Ejemplo n.º 1
0
def test_hessio_r1_calibrator(example_event):
    telid = 11

    calibrator = HESSIOR1Calibrator()
    calibrator.calibrate(example_event)
    r1 = example_event.r1.tel[telid].waveform
    assert_almost_equal(r1[0, 0, 0], -0.091, 3)
Ejemplo n.º 2
0
def test_check_r0_exists(example_event):
    telid = 11

    calibrator = HESSIOR1Calibrator()
    assert (calibrator.check_r0_exists(example_event, telid) is True)
    example_event.r0.tel[telid].waveform = None
    assert (calibrator.check_r0_exists(example_event, telid) is False)
Ejemplo n.º 3
0
def test_hessio_r1_calibrator(test_event):
    telid = 11
    event = deepcopy(test_event)
    calibrator = HESSIOR1Calibrator()
    calibrator.calibrate(event)
    r1 = event.r1.tel[telid].pe_samples
    assert_almost_equal(r1[0, 0, 0], -0.091, 3)
Ejemplo n.º 4
0
def test_check_r0_exists(test_event):
    telid = 11
    event = deepcopy(test_event)
    calibrator = HESSIOR1Calibrator()
    assert (calibrator.check_r0_exists(event, telid) is True)
    event.r0.tel[telid].adc_samples = None
    assert (calibrator.check_r0_exists(event, telid) is False)
Ejemplo n.º 5
0
def test_array_draw():
    filename = get_dataset("gamma_test.simtel.gz")
    cam_geom = {}

    source = hessio_event_source(filename, max_events=2)
    r1 = HESSIOR1Calibrator()
    dl0 = CameraDL0Reducer()

    calibrator = CameraDL1Calibrator()

    for event in source:
        array_pointing = SkyCoord(
            event.mcheader.run_array_direction[1] * u.rad,
            event.mcheader.run_array_direction[0] * u.rad,
            frame=AltAz)
        # array_view = ArrayPlotter(instrument=event.inst,
        #                          system=TiltedGroundFrame(
        # pointing_direction=array_pointing))

        hillas_dict = {}
        r1.calibrate(event)
        dl0.reduce(event)
        calibrator.calibrate(event)  # calibrate the events

        # store MC pointing direction for the array

        for tel_id in event.dl0.tels_with_data:

            pmt_signal = event.dl1.tel[tel_id].image[0]
            geom = deepcopy(event.inst.subarray.tel[tel_id].camera)
            fl = event.inst.subarray.tel[tel_id].optics.equivalent_focal_length

            # Transform the pixels positions into nominal coordinates
            camera_coord = CameraFrame(x=geom.pix_x,
                                       y=geom.pix_y,
                                       z=np.zeros(geom.pix_x.shape) * u.m,
                                       focal_length=fl,
                                       rotation=90 * u.deg - geom.cam_rotation)
            nom_coord = camera_coord.transform_to(
                NominalFrame(array_direction=array_pointing,
                             pointing_direction=array_pointing))

            geom.pix_x = nom_coord.x
            geom.pix_y = nom_coord.y

            mask = tailcuts_clean(geom,
                                  pmt_signal,
                                  picture_thresh=10.,
                                  boundary_thresh=5.)

            try:
                moments = hillas_parameters(geom, pmt_signal * mask)
                hillas_dict[tel_id] = moments
                nom_coord = NominalPlotter(hillas_parameters=hillas_dict,
                                           draw_axes=True)
                nom_coord.draw_array()

            except HillasParameterizationError as e:
                print(e)
                continue
    def setup(self):
        self.log_format = "%(levelname)s: %(message)s [%(name)s.%(funcName)s]"

        self.eventsource = SimTelEventSource(parent=self)

        extractor = ChargeExtractor.from_name(self.extractor_product,
                                              parent=self)

        self.r1 = HESSIOR1Calibrator(parent=self)

        self.dl0 = CameraDL0Reducer(parent=self)

        self.dl1 = CameraDL1Calibrator(extractor=extractor, parent=self)

        self.calculator = ChargeResolutionCalculator()
    def setup(self):
        self.log_format = "%(levelname)s: %(message)s [%(name)s.%(funcName)s]"
        kwargs = dict(config=self.config, tool=self)

        self.eventsource = SimTelEventSource(**kwargs)

        extractor = ChargeExtractorFactory.produce(**kwargs)

        self.r1 = HESSIOR1Calibrator(**kwargs)

        self.dl0 = CameraDL0Reducer(**kwargs)

        self.dl1 = CameraDL1Calibrator(extractor=extractor, **kwargs)

        self.calculator = ChargeResolutionCalculator(**kwargs)
Ejemplo n.º 8
0
    def setup(self):
        kwargs = dict(config=self.config, tool=self)
        self.r1 = HESSIOR1Calibrator(**kwargs)

        self.dl0 = CameraDL0Reducer(**kwargs)

        self.dl1 = CameraDL1Calibrator(**kwargs)

        self.cal = CameraCalibrator()

        self.cross = CrossCorrelation()

        self.glob_peak = GlobalPeakIntegrator()

        self.local_peak = LocalPeakIntegrator()

        self.neighbour = NeighbourPeakIntegrator()

        self.aver = AverageWfPeakIntegrator()
Ejemplo n.º 9
0
def previous_calibration(event):
    r1 = HESSIOR1Calibrator()
    r1.calibrate(event)
    dl0 = CameraDL0Reducer()
    dl0.reduce(event)
Ejemplo n.º 10
0
def previous_calibration(event):
    r1 = HESSIOR1Calibrator()
    r1.calibrate(event)
Ejemplo n.º 11
0
def test_hessio_r1_calibrator(example_event):
    telid = list(example_event.r0.tel)[0]

    calibrator = HESSIOR1Calibrator()
    calibrator.calibrate(example_event)
    assert example_event.r1.tel[telid].waveform is not None