Skip to content
This repository was archived by the owner on May 7, 2026. It is now read-only.

Added get operations for UB/Constraints#2

Merged
rosesyrett merged 3 commits into
masterfrom
getUbAndConstraints
Jul 13, 2022
Merged

Added get operations for UB/Constraints#2
rosesyrett merged 3 commits into
masterfrom
getUbAndConstraints

Conversation

@rosesyrett
Copy link
Copy Markdown
Contributor

added get operations to return the current state of the UB and Constraint objects in HklCalculation object. Modified tests for this, and also moved the UB calculation operation to hklCalc routes as it made most sense. Modified tests to reflect these changes.

…aint objects in HklCalculation object. Modified tests for this, and also moved the UB calculation operation to hklCalc routes as it made most sense. Modified tests to reflect these changes.
Comment thread src/diffcalc_API/routes/Constraints.py Outdated
Comment thread src/diffcalc_API/routes/Constraints.py Outdated
name: str, hklCalc: HklCalculation = Depends(unpickleHkl)
):
return Response(
content=hklCalc.constraints.__str__(), media_type="application/text"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it appropriate to return a string? Would we be better of serialising to JSON?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, so the reason this is returning a string is because I want the terminal to print a lovely long message with newlines when this route is called. And I discovered that if it was inside a JSON object, this would not be the case. Effectively, the response content looks something like:

'<>

h k l tag
0 0 1 orient1
0 0 0.5 orient2

<< UB Matrix >>
....
'

and so on.

@rosesyrett rosesyrett merged commit dac9961 into master Jul 13, 2022
@rosesyrett rosesyrett deleted the getUbAndConstraints branch July 13, 2022 15:08
rosesyrett pushed a commit that referenced this pull request Aug 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants