MonitoringSource#
- class ctapipe.io.monitoringsource.MonitoringSource(*args: t.Any, **kwargs: t.Any)[source]#
Bases:
TelescopeComponentParent class for
MonitoringSource.MonitoringSourceread input files and fillSubarrayEventContainerinstances with corresponding monitoring data based on the event trigger time.A new
MonitoringSourceshould be created for each type of monitoring file read into ctapipe, e.g. HDF5 files are read by theHDF5MonitoringSource.MonitoringSourceprovides a common high-level interface for accessing monitoring information from different data sources. Creating anMonitoringSourcefor a new file format or other monitoring source ensures that data can be accessed in a common way, regardless of the file format or data origin.MonitoringSourceitself is an abstract class, but will create an appropriate subclass. AnMonitoringSourcecan also be created through the configuration system, by passingconfigorparentas appropriate. E.g. if usingMonitoringSourceinside of aTool, you would do:>>> self.monitoring_source = MonitoringSource(parent=self)
Attributes Summary
Returns the available monitoring types of this source.
Returns the available telescope monitoring types of this source.
Methods Summary
close()Close this event source.
fill_monitoring_container(event)Fill the monitoring container for a given event.
get_table(monitoring_type[, subtype])Get the monitoring table for a given monitoring type.
get_telescope_table(tel_id, monitoring_type)Get the monitoring table for a given telescope monitoring type.
get_telescope_values(tel_id, time, ...[, ...])Get monitoring values for specific timestamp(s).
get_values(time, monitoring_type[, subtype])Get monitoring values for specific timestamp(s).
Attributes Documentation
- available_data#
Returns the available monitoring types of this source.
- Returns:
- available_data
A tuple of (type, subtype) pairs of the available monitoring data.
- available_telescope_data#
Returns the available telescope monitoring types of this source.
- Returns:
- available_data
A dict mapping tel_id to a tuple of (type, subtype) pairs of the available monitoring data.
- plugin_entry_point = 'ctapipe_monitoring'#
Methods Documentation
- close()[source]#
Close this event source.
No-op by default. Should be overridden by sources needing a cleanup-step
- abstractmethod fill_monitoring_container(event: SubarrayEventContainer)[source]#
Fill the monitoring container for a given event.
Populates event.monitoring and event.tel[tel_id].monitoring with array-level and telescope-level monitoring data for the event’s trigger time.
For fields that contain a gain channel axis, it is expected that the monitoring source selects the correct channel depending on the pixel_status information in the event. If no r1/dl0/dl1 pixel status information is present, all available gain channels should be kept.
- Parameters:
- eventSubarrayEventContainer
The event to fill. Uses event.tel[tel_id].dl0.trigger.time for telescope-level data selection.
- abstractmethod get_table(monitoring_type: MonitoringType, subtype: str | None = None) Table[source]#
Get the monitoring table for a given monitoring type.
- Parameters:
- monitoring_typeMonitoringType
The type of monitoring data to retrieve.
- subtypestr | None
Optional subtype
- Returns:
- astropy.table.Table
The monitoring table.
- Raises:
- KeyError
If monitoring_type / subtype is not available.
- abstractmethod get_telescope_table(tel_id: int, monitoring_type: TelescopeMonitoringType, subtype: str | None = None)[source]#
Get the monitoring table for a given telescope monitoring type.
- Parameters:
- monitoring_typeMonitoringType
The type of monitoring data to retrieve.
- subtypestr | None
Optional subtype, e.g. for PIXEL_STATISTICS type
- Returns:
- astropy.table.Table
The monitoring table.
- Raises:
- KeyError
If monitoring_type is not available.
- TypeError
If tel_id scope doesn’t match monitoring_type requirements.
- abstractmethod get_telescope_values(tel_id: int, time: Time, monitoring_type: TelescopeMonitoringType, subtype: str | None = None) Any[source]#
Get monitoring values for specific timestamp(s).
Performs interpolation or nearest-neighbor lookup as appropriate.
- Parameters:
- timeastropy.time.Time
Target timestamp(s). Can be scalar or array.
- monitoring_typeMonitoringType
The type of monitoring data to retrieve.
- subtypestr | None
Optional subtype
- Returns:
- monitoring_data
Monitoring values at requested time(s). Return type depends on monitoring_type.
- Raises:
- KeyError
If monitoring_type unavailable
- ValueError
If time out of bounds.
- abstractmethod get_values(time: Time, monitoring_type: MonitoringType, subtype: str | None = None) Any[source]#
Get monitoring values for specific timestamp(s).
Performs interpolation or nearest-neighbor lookup as appropriate.
- Parameters:
- timeastropy.time.Time
Target timestamp(s). Can be scalar or array.
- monitoring_typeMonitoringType
The type of monitoring data to retrieve.
- subtypestr | None
Optional subtype
- Returns:
- monitoring_data
Monitoring values at requested time(s). Return type depends on monitoring_type.
- Raises:
- KeyError
If monitoring_type unavailable
- ValueError
If time out of bounds.