Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix matplotlib warnings #71

Open
wants to merge 4 commits into
base: elab_metadata_integration
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ dependencies = [
"imutils>=0.5.4",
"ipympl>=0.9.1",
"ipywidgets>=7.7.1",
"matplotlib>=3.5.1,<3.10.0",
"matplotlib>=3.5.1",
"numpy>=1.21.6",
"opencv-python>=4.8.1.78",
"pynxtools-mpes>=0.2.1",
Expand Down
3 changes: 1 addition & 2 deletions src/specsanalyzer/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -753,8 +753,7 @@ def update(v_vals, pos_x, pos_y, sigma_x, sigma_y, amplitude):
fft_filt.set_data(np.abs(fft_filtered_new.T))

nonlocal cont
for i in range(len(cont.collections)):
cont.collections[i].remove()
cont.remove()
cont = ax.contour(msk.T)

edc.set_ydata(np.sum(filtered_new, 0))
Expand Down
3 changes: 1 addition & 2 deletions src/specsscan/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import os
import pathlib
from importlib.util import find_spec
from logging import warn
from pathlib import Path
from typing import Any
from typing import Sequence
Expand Down Expand Up @@ -671,7 +670,7 @@ def process_sweep_scan(
"""
ekin_step = kinetic_energy[1] - kinetic_energy[0]
if not (np.diff(kinetic_energy) == ekin_step).all():
warn(
logger.warning(
"Conversion of sweep scans with non-equidistant energy steps "
"might produce wrong results!",
)
Expand Down
8 changes: 2 additions & 6 deletions src/specsscan/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,12 +423,8 @@ def handle_meta(
ts_from = dt.datetime.timestamp(datetime_list[0]) # POSIX timestamp
ts_to = dt.datetime.timestamp(datetime_list[-1]) # POSIX timestamp
metadata["timing"] = {
"acquisition_start": dt.datetime.utcfromtimestamp(ts_from)
.replace(tzinfo=dt.timezone.utc)
.isoformat(),
"acquisition_stop": dt.datetime.utcfromtimestamp(ts_to)
.replace(tzinfo=dt.timezone.utc)
.isoformat(),
"acquisition_start": dt.datetime.fromtimestamp(ts_from, dt.timezone.utc).isoformat(),
"acquisition_stop": dt.datetime.fromtimestamp(ts_to, dt.timezone.utc).isoformat(),
"acquisition_duration": int(ts_to - ts_from),
"collection_time": float(ts_to - ts_from),
}
Expand Down
14 changes: 11 additions & 3 deletions src/specsscan/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def fetch_epics_metadata(self, ts_from: float, ts_to: float, metadata: dict) ->
Returns:
dict: Updated metadata dictionary.
"""
start = datetime.datetime.utcfromtimestamp(ts_from)
start = datetime.datetime.fromtimestamp(ts_from, datetime.timezone.utc).isoformat()

# replace metadata names by epics channels
try:
Expand Down Expand Up @@ -315,8 +315,16 @@ def get_archiver_data(
Returns:
tuple[np.ndarray, np.ndarray]: The extracted time stamps and corresponding data
"""
iso_from = datetime.datetime.utcfromtimestamp(ts_from).isoformat()
iso_to = datetime.datetime.utcfromtimestamp(ts_to).isoformat()
iso_from = (
datetime.datetime.fromtimestamp(ts_from, datetime.timezone.utc)
.replace(tzinfo=None)
.isoformat()
)
iso_to = (
datetime.datetime.fromtimestamp(ts_to, datetime.timezone.utc)
.replace(tzinfo=None)
.isoformat()
)
req_str = archiver_url + archiver_channel + "&from=" + iso_from + "Z&to=" + iso_to + "Z"
with urlopen(req_str) as req:
data = json.load(req)
Expand Down