Skip to content

Commit

Permalink
fix detector distance endpoint (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
fhernandezvivanco authored Jul 19, 2024
1 parent c039265 commit 7de8f43
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions ansto_simplon_api/routes/detector/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,19 @@ async def get_description():

@router.get("/detector_distance")
async def get_detector_distance():
return {"value": zmq_start_message.detector_translation}
return {"value": zmq_start_message.detector_translation[2]}


@router.put("/detector_distance")
async def put_detector_distance(
input: SimplonRequestFloat,
):
detector_translation = (0, 0, input.value)
zmq_start_message.detector_translation = detector_translation
return {"value": zmq_start_message.detector_translation}
zmq_start_message.detector_translation = [
zmq_start_message.detector_translation[0],
zmq_start_message.detector_translation[1],
input.value,
]
return {"value": zmq_start_message.detector_translation[2]}


@router.put("/detector_number")
Expand Down
2 changes: 1 addition & 1 deletion ansto_simplon_api/simulate_zmq_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def create_list_of_compressed_frames(
self.compression = compression
self.number_of_data_files = number_of_datafiles

with h5py.File(hdf5_file_path) as hdf5_file:
with h5py.File(hdf5_file_path, mode="r") as hdf5_file:
keys = list(hdf5_file["entry"]["data"].keys())

if number_of_datafiles is None:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "ansto-simplon-api"
version = "0.2.5"
version = "0.2.6"
description = "Simulated simplon api"
authors = ["Francisco Hernandez Vivanco <hernandf@ansto.gov.au>",
"Daniel Eriksson <daniele@ansto.gov.au>"]
Expand Down

0 comments on commit 7de8f43

Please sign in to comment.