Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rettigl committed Jan 15, 2025
1 parent ef688e9 commit 071b7e1
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 20 deletions.
16 changes: 12 additions & 4 deletions src/specsanalyzer/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,10 +411,18 @@ def crop_tool(
linev2 = ax.axvline(x=data_array.Ekin[-1])

try:
ang_range_min = kwds.get("ang_range_min", self._config["ang_range_min"])
ang_range_max = kwds.get("ang_range_max", self._config["ang_range_max"])
ek_range_min = kwds.get("ek_range_min", self._config["ek_range_min"])
ek_range_max = kwds.get("ek_range_max", self._config["ek_range_max"])
ang_range_min = (
kwds["ang_range_min"] if "ang_range_min" in kwds else self._config["ang_range_min"]
)
ang_range_max = (
kwds["ang_range_max"] if "ang_range_max" in kwds else self._config["ang_range_max"]
)
ek_range_min = (
kwds["ek_range_min"] if "ek_range_min" in kwds else self._config["ek_range_min"]
)
ek_range_max = (
kwds["ek_range_max"] if "ek_range_max" in kwds else self._config["ek_range_max"]
)
ang_min = (
ang_range_min
* (
Expand Down
29 changes: 16 additions & 13 deletions src/specsscan/config/example_config_FHI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,22 @@ units:
spatial0: "mm"
voltage: "V"

# URL of the epics archiver request engine
archiver_url: "http://__epicsarchiver_host__:17668/retrieval/data/getData.json?pv="
# dictionary containing axis names with Epics channels to request from the EPICS archiver
epics_channels:
tempa: "trARPES:Carving:TEMP_RBV"
x: "trARPES:Carving:TRX.RBV"
y: "trARPES:Carving:TRY.RBV"
z: "trARPES:Carving:TRZ.RBV"
polar: "trARPES:Carving:THT.RBV"
tilt: "trARPES:Carving:PHI.RBV"
azimuth: "trARPES:Carving:OMG.RBV"
drain_current: "trARPES:Sample:Measure"
pressure: "trARPES:XGS600:PressureAC:P_RD"
metadata:
# URL of the elabFTW instance API interface
elab_url: "https://__elabftw_host__/api/v2"
# URL of the epics archiver request engine
archiver_url: "http://__epicsarchiver_host__:17668/retrieval/data/getData.json?pv="
# dictionary containing axis names with Epics channels to request from the EPICS archiver
epics_channels:
tempa: "trARPES:Carving:TEMP_RBV"
x: "trARPES:Carving:TRX.RBV"
y: "trARPES:Carving:TRY.RBV"
z: "trARPES:Carving:TRZ.RBV"
polar: "trARPES:Carving:THT.RBV"
tilt: "trARPES:Carving:PHI.RBV"
azimuth: "trARPES:Carving:OMG.RBV"
drain_current: "trARPES:Sample:Measure"
pressure: "trARPES:XGS600:PressureAC:P_RD"

# parameters for NeXus conversion
nexus:
Expand Down
4 changes: 2 additions & 2 deletions src/specsscan/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ def load_scan(
**handle_meta(
df_lut=df_lut,
scan_info=self._scan_info,
config=self.config["metadata"],
config=self.config.get("metadata", {}),
scan=scan,
fast_axes=list(fast_axes), # type: ignore
slow_axes=list(slow_axes),
Expand Down Expand Up @@ -535,7 +535,7 @@ def check_scan(
**handle_meta(
df_lut=df_lut,
scan_info=self._scan_info,
config=self.config["metadata"],
config=self.config.get("metadata", {}),
scan=scan,
fast_axes=list(fast_axes), # type: ignore
slow_axes=list(slow_axes),
Expand Down
4 changes: 4 additions & 0 deletions src/specsscan/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import elabapi_python
import numpy as np
from urllib3.exceptions import MaxRetryError

from specsanalyzer.config import read_env_var
from specsanalyzer.config import save_env_var
Expand Down Expand Up @@ -153,6 +154,9 @@ def fetch_elab_metadata(self, scan: int, metadata: dict) -> dict:
except IndexError:
logger.warning(f"No elabFTW entry found for run {scan}")
return metadata
except MaxRetryError:
logger.warning("Connection to elabFTW could not be established. Check accessibility")
return metadata

if "elabFTW" not in metadata:
metadata["elabFTW"] = {}
Expand Down
2 changes: 1 addition & 1 deletion tests/data
Submodule data updated from e921fe to bbede1

0 comments on commit 071b7e1

Please sign in to comment.