Skip to content

Commit

Permalink
Merge pull request #1 from OpenCOMPES/sweep_scan
Browse files Browse the repository at this point in the history
Sweep scan
  • Loading branch information
rettigl authored Feb 28, 2024
2 parents a5ad8bf + b4e127f commit d52ecca
Show file tree
Hide file tree
Showing 9 changed files with 679 additions and 109 deletions.
55 changes: 38 additions & 17 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ license = "MIT"
[tool.poetry.dependencies]
python = ">=3.8, <3.12"
h5py = ">=3.6.0"
imutils = ">=0.5.4"
ipympl = ">=0.9.1"
ipywidgets = ">=8.1.1"
matplotlib = ">=3.5.1"
numpy = ">=1.21.6"
opencv-python = ">=4.8.1.78"
pynxtools = ">=0.0.9"
python-dateutil = ">=2.8.2"
pyyaml = ">=6.0"
Expand Down
17 changes: 11 additions & 6 deletions specsanalyzer/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from typing import Tuple
from typing import Union

import imutils
import ipywidgets as ipw
import matplotlib
import matplotlib.pyplot as plt
Expand Down Expand Up @@ -102,15 +103,14 @@ def convert_image(
Args:
raw_img (np.ndarray): Raw image data, numpy 2d matrix
lens_mode (str): analzser lens mode, check calib2d for a list
of modes Camelcase naming convention e.g. "WideAngleMode"
lens_mode (str): analzser lens mode, check calib2d for a list of modes CamelCase naming
convention e.g. "WideAngleMode"
kinetic_energy (float): set analyser kinetic energy
pass_energy (float): set analyser pass energy
work_function (float): set analyser work function
Returns:
xr.DataArray: xarray containg the corrected data and kinetic
and angle axis
xr.DataArray: xarray containg the corrected data and kinetic and angle axis
"""

apply_fft_filter = kwds.pop(
Expand All @@ -131,7 +131,11 @@ def convert_image(
else:
img = raw_img

# TODO add image rotation
rotation_angle = kwds.pop("rotation_angle", self._config.get("rotation_angle", 0))

if rotation_angle:
img_rotated = imutils.rotate(img, angle=rotation_angle)
img = img_rotated

# look for the lens mode in the dictionary
try:
Expand Down Expand Up @@ -434,7 +438,7 @@ def crop_tool(
value=vline_range,
min=data_array.Ekin[0],
max=data_array.Ekin[-1],
step=0.1,
step=0.01,
)
hline_slider = ipw.FloatRangeSlider(
description="Angle",
Expand Down Expand Up @@ -507,6 +511,7 @@ def cropit(val): # pylint: disable=unused-argument
- data_array.coords[data_array.dims[0]][0]
)
).item()
self._config["crop"] = True

ax.cla()
self._data_array.plot(ax=ax, add_colorbar=False)
Expand Down
Loading

0 comments on commit d52ecca

Please sign in to comment.