Skip to content

Commit

Permalink
Merge pull request #54 from jlenain/env
Browse files Browse the repository at this point in the history
Pin scipy version
  • Loading branch information
jlenain authored Jul 31, 2024
2 parents 320ca12 + 2e20904 commit f447c72
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 21 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -54,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
Expand Down
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ dependencies:
- pytest
- pytest-runner
- pyyaml
- scipy=1.11.4
- zeromq
- zlib
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ requires-python = ">=3.9"
dependencies = [
"ctapipe~=0.19",
"protozfits",
"scipy==1.11.4",
]

# needed for setuptools_scm, we don't define a static version
Expand All @@ -36,6 +37,7 @@ dynamic = ["version"]
test = [
"pytest",
"pytest-cov",
"pytest-xdist",
]
dev = [
"setuptools_scm",
Expand Down
33 changes: 13 additions & 20 deletions src/ctapipe_io_nectarcam/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -48,9 +49,6 @@
NectarCAMEventContainer,
NectarCAMServiceContainer,
)

from traitlets.config import Config

from .version import __version__

__all__ = ["LightNectarCAMEventSource", "NectarCAMEventSource", "__version__"]
Expand Down Expand Up @@ -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):
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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())





0 comments on commit f447c72

Please sign in to comment.