Skip to content
This repository was archived by the owner on May 7, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/diffcalc_api/routes/ub.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,9 +410,9 @@ async def set_ub(
store: accessor to the hkl object.
collection: collection within which the hkl object resides.
"""
await service.set_u(name, ub_matrix, store, collection)
await service.set_ub(name, ub_matrix, store, collection)
return InfoResponse(
payload=f"UB matrix set for crystal {name} of collection {collection}"
message=f"UB matrix set for crystal {name} of collection {collection}"
)


Expand All @@ -435,7 +435,7 @@ async def set_u(
"""
await service.set_u(name, u_matrix, store, collection)
return InfoResponse(
payload=f"U matrix set for crystal {name} of collection {collection}"
message=f"U matrix set for crystal {name} of collection {collection}"
)


Expand Down
14 changes: 11 additions & 3 deletions tests/test_ubcalc.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,13 @@ def test_set_u():
client = Client(hkl).client

u_matrix = np.identity(3)
client.put("/ub/test/u?collection=B07", json=u_matrix.tolist())
response = client.put("/ub/test/u?collection=B07", json=u_matrix.tolist())

assert np.all(ubcalc.U == u_matrix)
assert (
literal_eval(response.content.decode())["message"]
== "U matrix set for crystal test of collection B07"
)


def test_set_ub():
Expand All @@ -392,9 +396,13 @@ def test_set_ub():
client = Client(hkl).client

ub_matrix = np.identity(3)
client.put("/ub/test/ub?collection=B07", json=ub_matrix.tolist())
response = client.put("/ub/test/ub?collection=B07", json=ub_matrix.tolist())

assert np.all(ubcalc.U == ub_matrix)
assert np.all(ubcalc.UB == ub_matrix)
assert (
literal_eval(response.content.decode())["message"]
== "UB matrix set for crystal test of collection B07"
)


def test_modify_property():
Expand Down