Skip to content

Commit

Permalink
Moved some things to avoid shadowing variables
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph Toennis committed Aug 6, 2024
1 parent 908f381 commit 04f794a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
10 changes: 6 additions & 4 deletions src/ctapipe/io/interpolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

from .astropy_helpers import read_table

dimensionless_unit = u.Unit()


class StepFunction:

Expand Down Expand Up @@ -236,6 +238,8 @@ class FlatFieldInterpolator(Interpolator):
"""

telescope_data_group = "dl1/calibration/gain" # TBD
required_columns = frozenset(["time", "gain"]) # TBD
expected_units = {"gain": dimensionless_unit}

def __call__(self, tel_id, time):
"""
Expand Down Expand Up @@ -273,8 +277,6 @@ def add_table(self, tel_id, input_table):
for the flatfield data
"""

self.required_columns = frozenset(["time", "gain"]) # TBD

self._check_tables(input_table)

input_table.sort("time")
Expand All @@ -292,6 +294,8 @@ class PedestalInterpolator(Interpolator):
"""

telescope_data_group = "dl1/calibration/pedestal" # TBD
required_columns = frozenset(["time", "pedestal"]) # TBD
expected_units = {"pedestal": dimensionless_unit}

def __call__(self, tel_id, time):
"""
Expand Down Expand Up @@ -329,8 +333,6 @@ def add_table(self, tel_id, input_table):
for the pedestal data
"""

self.required_columns = frozenset(["time", "pedestal"]) # TBD

self._check_tables(input_table)

input_table.sort("time")
Expand Down
6 changes: 4 additions & 2 deletions src/ctapipe/io/tests/test_interpolator.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,16 @@ def test_bounds():
table_pedestal = Table(
{
"time": np.arange(0.0, 10.1, 2.0),
"pedestal": np.reshape(np.random.normal(4.0, 1.0, 1850 * 6), (6, 1850)),
"pedestal": np.reshape(np.random.normal(4.0, 1.0, 1850 * 6), (6, 1850))
* u.Unit(),
},
)

table_flatfield = Table(
{
"time": np.arange(0.0, 10.1, 2.0),
"gain": np.reshape(np.random.normal(1.0, 1.0, 1850 * 6), (6, 1850)),
"gain": np.reshape(np.random.normal(1.0, 1.0, 1850 * 6), (6, 1850))
* u.Unit(),
},
)

Expand Down

0 comments on commit 04f794a

Please sign in to comment.