Skip to content

Commit

Permalink
Start working on inverted container structure
Browse files Browse the repository at this point in the history
  • Loading branch information
maxnoe committed Jan 10, 2023
1 parent 9a83547 commit 1e8ad14
Show file tree
Hide file tree
Showing 14 changed files with 200 additions and 224 deletions.
4 changes: 2 additions & 2 deletions ctapipe/calib/camera/calibrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import numpy as np
from numba import float32, float64, guvectorize, int64

from ctapipe.containers import DL1CameraContainer
from ctapipe.containers import TelescopeDL1Container
from ctapipe.core import TelescopeComponent
from ctapipe.core.traits import (
BoolTelescopeParameter,
Expand Down Expand Up @@ -223,7 +223,7 @@ def _calibrate_dl1(self, event, tel_id):
# - Read into dl1 container directly?
# - Don't do anything if dl1 container already filled
# - Update on SST review decision
dl1 = DL1CameraContainer(
dl1 = TelescopeDL1Container(
image=waveforms[..., 0].astype(np.float32),
peak_time=np.zeros(n_pixels, dtype=np.float32),
is_valid=True,
Expand Down
8 changes: 4 additions & 4 deletions ctapipe/calib/camera/flatfield.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import numpy as np
from astropy import units as u

from ctapipe.containers import DL1CameraContainer
from ctapipe.containers import TelescopeDL1Container
from ctapipe.core import Component
from ctapipe.core.traits import Int, List, Unicode
from ctapipe.image.extractor import ImageExtractor
Expand Down Expand Up @@ -169,7 +169,7 @@ def __init__(self, **kwargs):
self.arrival_times = None # arrival time per event in sample
self.sample_masked_pixels = None # masked pixels per event in sample

def _extract_charge(self, event) -> DL1CameraContainer:
def _extract_charge(self, event) -> TelescopeDL1Container:
"""
Extract the charge and the time from a calibration event
Expand All @@ -195,7 +195,7 @@ def _extract_charge(self, event) -> DL1CameraContainer:
waveforms, self.tel_id, selected_gain_channel, broken_pixels
)
else:
return DL1CameraContainer(image=0, peak_pos=0, is_valid=False)
return TelescopeDL1Container(image=0, peak_pos=0, is_valid=False)

def calculate_relative_gain(self, event):
"""
Expand Down Expand Up @@ -237,7 +237,7 @@ def calculate_relative_gain(self, event):

# extract the charge of the event and
# the peak position (assumed as time for the moment)
dl1: DL1CameraContainer = self._extract_charge(event)
dl1: TelescopeDL1Container = self._extract_charge(event)

if not dl1.is_valid:
return False
Expand Down
8 changes: 4 additions & 4 deletions ctapipe/calib/camera/pedestals.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import numpy as np
from astropy import units as u

from ctapipe.containers import DL1CameraContainer
from ctapipe.containers import TelescopeDL1Container
from ctapipe.core import Component
from ctapipe.core.traits import Int, List, Unicode
from ctapipe.image.extractor import ImageExtractor
Expand Down Expand Up @@ -197,7 +197,7 @@ def __init__(self, **kwargs):
self.charges = None # charge per event in sample
self.sample_masked_pixels = None # pixels tp be masked per event in sample

def _extract_charge(self, event) -> DL1CameraContainer:
def _extract_charge(self, event) -> TelescopeDL1Container:
"""
Extract the charge and the time from a pedestal event
Expand All @@ -224,7 +224,7 @@ def _extract_charge(self, event) -> DL1CameraContainer:
waveforms, self.tel_id, selected_gain_channel, broken_pixels
)
else:
return DL1CameraContainer(image=0, peak_pos=0, is_valid=False)
return TelescopeDL1Container(image=0, peak_pos=0, is_valid=False)

def calculate_pedestals(self, event):
"""
Expand Down Expand Up @@ -258,7 +258,7 @@ def calculate_pedestals(self, event):

# extract the charge of the event and
# the peak position (assumed as time for the moment)
dl1: DL1CameraContainer = self._extract_charge(event)
dl1: TelescopeDL1Container = self._extract_charge(event)

if not dl1.is_valid:
return False
Expand Down
Loading

0 comments on commit 1e8ad14

Please sign in to comment.