From 8ab279975979142b65fb6239290fedadc319627b Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lenain Date: Wed, 31 Jul 2024 17:52:10 +0200 Subject: [PATCH 1/5] Pin scipy version to avoid https://github.com/cta-observatory/nectarchain/issues/124 --- environment.yml | 1 + pyproject.toml | 1 + 2 files changed, 2 insertions(+) diff --git a/environment.yml b/environment.yml index 6741943..8be5d60 100644 --- a/environment.yml +++ b/environment.yml @@ -13,5 +13,6 @@ dependencies: - pytest - pytest-runner - pyyaml + - scipy=1.11 - zeromq - zlib diff --git a/pyproject.toml b/pyproject.toml index 4c94c5f..d97aafe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,6 +23,7 @@ requires-python = ">=3.9" dependencies = [ "ctapipe~=0.19", "protozfits", + "scipy==1.11", ] # needed for setuptools_scm, we don't define a static version From be172c1f1974480fa62f597fbae27b548d97e05b Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lenain Date: Wed, 31 Jul 2024 17:54:38 +0200 Subject: [PATCH 2/5] Fix docstring, should solve https://github.com/cta-observatory/nectarchain/pull/141#issuecomment-2260554320 --- src/ctapipe_io_nectarcam/__init__.py | 33 +++++++++++----------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/src/ctapipe_io_nectarcam/__init__.py b/src/ctapipe_io_nectarcam/__init__.py index 5dbf042..75b1fc6 100644 --- a/src/ctapipe_io_nectarcam/__init__.py +++ b/src/ctapipe_io_nectarcam/__init__.py @@ -38,6 +38,7 @@ ) from ctapipe.io import DataLevel, EventSource from pkg_resources import resource_filename +from traitlets.config import Config from .anyarray_dtypes import CDTS_AFTER_37201_DTYPE, CDTS_BEFORE_37201_DTYPE, TIB_DTYPE from .calibration import NectarCAMR0Corrections @@ -48,9 +49,6 @@ NectarCAMEventContainer, NectarCAMServiceContainer, ) - -from traitlets.config import Config - from .version import __version__ __all__ = ["LightNectarCAMEventSource", "NectarCAMEventSource", "__version__"] @@ -475,8 +473,7 @@ class NectarCAMEventSource(EventSource): ).tag(config=True) load_feb_info = Bool( - default_value=True, - help="If False, skip the decoding of FEB info" + default_value=True, help="If False, skip the decoding of FEB info" ) def _correct_tel_id(self, tel_id, run): @@ -493,7 +490,8 @@ def _correct_tel_id(self, tel_id, run): def __init__(self, **kwargs): """ - Constructor + Constructor of the NectarCAMEventSource class. + Parameters ---------- config: traitlets.loader.Config @@ -952,7 +950,6 @@ def fill_nectarcam_event_container_from_zfile(self, array_event, event): event_container.ucts_num_in_bunch = unpacked_cdts[9] # new event_container.cdts_version = unpacked_cdts[10] # new - if not self.pre_v6_data: event_container.first_cell_id = np.full( (N_PIXELS,), -1, dtype=event.first_cell_id.dtype @@ -1085,7 +1082,9 @@ def unpack_feb_data(self, event_container, event, nectarcam_data): 3::n_fields ] # Unpack TS2 counters - ts2_decimal = lambda bits: bits - (1 << 8) if bits & 0x80 != 0 else bits + ts2_decimal = ( + lambda bits: bits - (1 << 8) if bits & 0x80 != 0 else bits + ) # noqa: E731 ts2_decimal_vec = np.vectorize(ts2_decimal) event_container.feb_ts2_trig[ self.nectarcam_service.module_ids @@ -1263,14 +1262,14 @@ def fill_mon_container_from_zfile(self, array_event, event): status_container.hardware_failing_pixels[:] = pixel_status == 0 - class LightNectarCAMEventSource(NectarCAMEventSource): """ EventSource for NectarCam r0 data. - Lighter version of the NectarCAMEventSource class but without FEB data nor gain selection. + Lighter version of the NectarCAMEventSource class but without FEB data nor gain + selection. """ - def __init__(self,**kwargs): + def __init__(self, **kwargs): if self.config is None: self.config = Config() self.config.NectarCAMEventSource.NectarCAMR0Corrections.calibration_path = None @@ -1281,14 +1280,13 @@ def __init__(self,**kwargs): @staticmethod def is_compatible(file_path): - ''' - This version should only be called directly so return False + """ + This version should only be called directly so return False such that it is not used when using EventSource - ''' + """ return False - class MultiFiles: """ This class open all the files in file_list and read the events following @@ -1421,8 +1419,3 @@ def get_empty_entries(self): # Compute the number of empty events. This is complete only once we've looped # on all events return sum(self._empty_per_file.values()) - - - - - From 16b2a54f49e9bd40950d379c9b0b89749a201dc0 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lenain Date: Wed, 31 Jul 2024 17:57:51 +0200 Subject: [PATCH 3/5] Solve the equivalent of https://github.com/cta-observatory/nectarchain/pull/140 for `ctapipe_io_nectarcam` --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2b6eb87..fd23ef9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,6 +21,8 @@ jobs: steps: - name: Check out source repository uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: Set up Python environment uses: actions/setup-python@v4 with: From 7411f690d0eb5974486050df412602ee122bb49e Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lenain Date: Wed, 31 Jul 2024 18:06:36 +0200 Subject: [PATCH 4/5] Migrate from provision-with-micromamba to setup-micromamba GitHub action (see also https://github.com/cta-observatory/nectarchain/pull/139) --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fd23ef9..69ddb0c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,7 +56,7 @@ jobs: sed -i -e "s/- python=.*/- python=$PYTHON_VERSION/g" environment.yml - name: Create and activate env - uses: mamba-org/provision-with-micromamba@v15 + uses: mamba-org/setup-micromamba@v1 with: environment-name: "ci" environment-file: environment.yml From 2e209048c01e17111001a19e3746ff8a5d944250 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lenain Date: Wed, 31 Jul 2024 18:19:20 +0200 Subject: [PATCH 5/5] Pin scipy version to 1.11.4, to avoid failures such as https://github.com/cta-observatory/ctapipe_io_nectarcam/actions/runs/10183584596/job/28168887272?pr=54 when building ctapipe_io_nectarcam --- environment.yml | 2 +- pyproject.toml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/environment.yml b/environment.yml index 8be5d60..562b62a 100644 --- a/environment.yml +++ b/environment.yml @@ -13,6 +13,6 @@ dependencies: - pytest - pytest-runner - pyyaml - - scipy=1.11 + - scipy=1.11.4 - zeromq - zlib diff --git a/pyproject.toml b/pyproject.toml index d97aafe..e5f6e53 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,7 +23,7 @@ requires-python = ">=3.9" dependencies = [ "ctapipe~=0.19", "protozfits", - "scipy==1.11", + "scipy==1.11.4", ] # needed for setuptools_scm, we don't define a static version @@ -37,6 +37,7 @@ dynamic = ["version"] test = [ "pytest", "pytest-cov", + "pytest-xdist", ] dev = [ "setuptools_scm",