Skip to content

Commit

Permalink
Merge pull request #16 from lsammut/ls_nano_error_catching
Browse files Browse the repository at this point in the history
Add check around omega start value
  • Loading branch information
lsammut authored Feb 13, 2025
2 parents b1a6fe5 + daf305a commit a455a7f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion ansto_simplon_api/parse_master_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,14 @@ def header(self) -> dict:
"Setting saturation value to 33000"
)
saturation_value = 33000
try:
start_value = float(self.hf.get("/entry/sample/goniometer/omega")[0])
except Exception as e:
start_value = 0.0
logging.warning(
f"Error when trying to get the start value for omega: {e}. Setting start value to 0.0"
)

start_message = {
"type": "start",
"arm_date": self.parse("data_collection_date"),
Expand All @@ -134,7 +142,7 @@ def header(self) -> dict:
"omega": {
"increment": self.parse("omega_range_average"),
# Needs to get the first item of a list, so can't use parse
"start": float(self.hf.get("/entry/sample/goniometer/omega")[0]),
"start": start_value,
},
"otherAxis": {
"increment": 1.0,
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.3.4"
version = "0.3.5"
description = "Simulated simplon api"
authors = [
"Francisco Hernandez Vivanco <hernandf@ansto.gov.au>",
Expand Down

0 comments on commit a455a7f

Please sign in to comment.