Skip to content

Commit

Permalink
I moved the interpolator classes for flatfield events to to their pro…
Browse files Browse the repository at this point in the history
…per place
  • Loading branch information
Christoph Toennis committed Oct 1, 2024
1 parent cea1f21 commit c6d7245
Show file tree
Hide file tree
Showing 4 changed files with 200 additions and 615 deletions.
233 changes: 0 additions & 233 deletions src/ctapipe/calib/camera/extractor.py

This file was deleted.

26 changes: 13 additions & 13 deletions src/ctapipe/calib/camera/pointing.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from astroquery.vizier import Vizier # discuss this dependency with max etc.
from scipy.odr import ODR, RealData

from ctapipe.calib.camera.extractor import StatisticsExtractor
from ctapipe.containers import StarContainer
from ctapipe.coordinates import EngineeringCameraFrame
from ctapipe.core import TelescopeComponent
Expand All @@ -28,7 +27,8 @@
from ctapipe.image import tailcuts_clean
from ctapipe.image.psf_model import PSFModel
from ctapipe.instrument import CameraGeometry
from ctapipe.io import FlatFieldInterpolator, PointingInterpolator
from ctapipe.monitoring.aggregator import StatisticsAggregator
from ctapipe.monitoring.interpolation import FlatFieldInterpolator, PointingInterpolator

__all__ = ["PointingCalculator", "StarImageGenerator"]

Expand Down Expand Up @@ -359,16 +359,16 @@ class PointingCalculator(TelescopeComponent):
Attributes
----------
stats_extractor: str
The name of the StatisticsExtractor subclass to be used to calculate the statistics of an image set
stats_aggregator: str
The name of the StatisticsAggregator subclass to be used to calculate the statistics of an image set
telescope_location: dict
The location of the telescope for which the pointing correction is to be calculated
"""

stats_extractor = TelescopeParameter(
trait=ComponentName(StatisticsExtractor, default_value="Plain"),
default_value="Plain",
help="Name of the StatisticsExtractor Subclass to be used.",
stats_aggregator = TelescopeParameter(
trait=ComponentName(StatisticsAggregator, default_value="PlainAggregator"),
default_value="PlainAggregator",
help="Name of the StatisticsAggregator Subclass to be used.",
).tag(config=True)

telescope_location = Dict(
Expand Down Expand Up @@ -444,8 +444,8 @@ def __init__(
height=self.telescope_location["elevation"] * u.m,
)

self.stats_aggregator = StatisticsExtractor.from_name(
self.stats_extractor, subarray=self.subarray, parent=self
self.image_aggregator = StatisticsAggregator.from_name(
self.stats_aggregator, subarray=self.subarray, parent=self
)

self.set_camera(geometry)
Expand Down Expand Up @@ -662,14 +662,14 @@ def _get_accumulated_images(self, data_table):
np.square(relative_gains(data_table["time"][i]).median),
)

# then turn it into a table that the extractor can read
# then turn it into a table that the aggregator can read
variance_image_table = QTable(
[data_table["time"], variance_images], names=["time", "image"]
)

# get the cumulative variance images using the statistics extractor and return the value
# get the cumulative variance images using the statistics aggregator and return the value

variance_statistics = self.stats_aggregator(
variance_statistics = self.image_aggregator(
variance_image_table, col_name="image"
)

Expand Down
Loading

0 comments on commit c6d7245

Please sign in to comment.