コード例 #1
0
def test_null_data_volume_reducer(subarray_lst):
    subarray, _, _, _, _ = subarray_lst
    waveforms = np.random.uniform(0, 1, (2048, 96))
    reducer = NullDataVolumeReducer(subarray=subarray)
    reduced_waveforms_mask = reducer(waveforms)
    reduced_waveforms = waveforms.copy()
    reduced_waveforms[~reduced_waveforms_mask] = 0
    assert_array_equal(waveforms, reduced_waveforms)
コード例 #2
0
    def __init__(
        self,
        subarray,
        config=None,
        parent=None,
        data_volume_reducer=None,
        image_extractor=None,
        **kwargs,
    ):
        """
        Parameters
        ----------
        subarray: ctapipe.instrument.SubarrayDescription
            Description of the subarray. Provides information about the
            camera which are useful in calibration. Also required for
            configuring the TelescopeParameter traitlets.
        config : traitlets.loader.Config
            Configuration specified by config file or cmdline arguments.
            Used to set traitlet values.
            Set to None if no configuration to pass.
        tool : ctapipe.core.Tool or None
            Tool executable that is calling this component.
            Passes the correct logger to the component.
            Set to None if no Tool to pass.
        data_volume_reducer : ctapipe.image.reducer.DataVolumeReducer
            The DataVolumeReducer to use. If None, then
            NullDataVolumeReducer will be used by default, and waveforms
            will not be reduced.
        image_extractor : ctapipe.image.extractor.ImageExtractor
            The ImageExtractor to use. If None, then NeighborPeakWindowSum
            will be used by default.
        subarray: ctapipe.instrument.SubarrayDescription
            Description of the subarray
        kwargs
        """
        super().__init__(config=config, parent=parent, **kwargs)
        self.subarray = subarray

        self._r1_empty_warn = False
        self._dl0_empty_warn = False

        if image_extractor is None:
            image_extractor = NeighborPeakWindowSum(parent=self, subarray=subarray)
        self.image_extractor = image_extractor

        if data_volume_reducer is None:
            data_volume_reducer = NullDataVolumeReducer(
                parent=self, image_extractor=self.image_extractor
            )
        self.data_volume_reducer = data_volume_reducer
コード例 #3
0
    def __init__(self,
                 config=None,
                 parent=None,
                 gain_selector=None,
                 data_volume_reducer=None,
                 image_extractor=None,
                 **kwargs):
        """
        Parameters
        ----------
        config : traitlets.loader.Config
            Configuration specified by config file or cmdline arguments.
            Used to set traitlet values.
            Set to None if no configuration to pass.
        tool : ctapipe.core.Tool or None
            Tool executable that is calling this component.
            Passes the correct logger to the component.
            Set to None if no Tool to pass.
        gain_selector : ctapipe.calib.camera.gainselection.GainSelector
            The GainSelector to use. If None, then ManualGainSelector will be
            used, which by default selects the high/first gain channel.
        data_volume_reducer : ctapipe.image.reducer.DataVolumeReducer
            The DataVolumeReducer to use. If None, then
            NullDataVolumeReducer will be used by default, and waveforms
            will not be reduced.
        image_extractor : ctapipe.image.extractor.ImageExtractor
            The ImageExtractor to use. If None, then NeighborPeakWindowSum
            will be used by default.
        kwargs
        """
        super().__init__(config=config, parent=parent, **kwargs)

        self._r1_empty_warn = False
        self._dl0_empty_warn = False

        if gain_selector is None:
            gain_selector = ManualGainSelector(parent=self)
        self.gain_selector = gain_selector

        if data_volume_reducer is None:
            data_volume_reducer = NullDataVolumeReducer(parent=self)
        self.data_volume_reducer = data_volume_reducer

        if image_extractor is None:
            image_extractor = NeighborPeakWindowSum(parent=self)
        self.image_extractor = image_extractor
コード例 #4
0
ファイル: test_reducer.py プロジェクト: yutonogami/ctapipe
def test_null_data_volume_reducer():
    waveforms = np.random.uniform(0, 1, (2048, 96))
    reducer = NullDataVolumeReducer()
    reduced_waveforms = reducer(waveforms)
    assert_array_equal(waveforms, reduced_waveforms)