コード例 #1
0
    def test_I3Calibration_equality(self):
        cal1 = dataclasses.I3Calibration()        
        cal1.dom_cal = dataclasses.I3DOMCalibrationMap()
        cal1.vem_cal = dataclasses.I3VEMCalibrationMap()
        cal1.start_time = dataclasses.I3Time()
        cal1.end_time = dataclasses.I3Time()

        cal2 = dataclasses.I3Calibration()        
        cal2.dom_cal = dataclasses.I3DOMCalibrationMap()
        cal2.vem_cal = dataclasses.I3VEMCalibrationMap()
        cal2.start_time = dataclasses.I3Time()
        cal2.end_time = dataclasses.I3Time()

        self.assertEqual(cal1, cal2, "these should be the same.")
コード例 #2
0
ファイル: benchmark.py プロジェクト: recepkandemir/clsim
    def DAQ(self, frame):
        # only inject it once
        if self.has_been_injected:
            self.PushFrame(frame)
            return
        self.has_been_injected = True

        geometry = dataclasses.I3Geometry()
        calibration = dataclasses.I3Calibration()
        detectorStatus = dataclasses.I3DetectorStatus()

        # fill the geometry map
        omgeomap = geometry.omgeo
        domcalmap = calibration.dom_cal
        domstatusmap = detectorStatus.dom_status

        for i, pos in enumerate(omPositions):
            shiftedPos = pos
            shiftedPos[0] += self.xCoord * I3Units.m
            shiftedPos[1] += self.yCoord * I3Units.m
            shiftedPos[2] += self.zCoord * I3Units.m

            omkey = omKeys[i]

            newomgeo = dataclasses.I3OMGeo()
            newomgeo.omtype = dataclasses.I3OMGeo.OMType.IceCube
            newomgeo.orientation = dataclasses.I3Orientation(
                dataclasses.I3Direction(0., 0., -1.))
            newomgeo.position = dataclasses.I3Position(shiftedPos[0],
                                                       shiftedPos[1],
                                                       shiftedPos[2])
            omgeomap[omkey] = newomgeo

            newdomcal = dataclasses.I3DOMCalibration()
            newdomcal.relative_dom_eff = 1.0
            domcalmap[omkey] = newdomcal

            newdomstatus = dataclasses.I3DOMStatus()
            newdomstatus.pmt_hv = 1345. * I3Units.V  # some arbitrary setting: >0 and not NaN
            domstatusmap[omkey] = newdomstatus

        # make GCD frames and fill them with objects
        Gframe = icetray.I3Frame(icetray.I3Frame.Geometry)
        Cframe = icetray.I3Frame(icetray.I3Frame.Calibration)
        Dframe = icetray.I3Frame(icetray.I3Frame.DetectorStatus)

        Gframe["I3Geometry"] = geometry
        Cframe["I3Calibration"] = calibration
        Dframe["I3DetectorStatus"] = detectorStatus

        # push the new GCD frames
        self.PushFrame(Gframe)
        self.PushFrame(Cframe)
        self.PushFrame(Dframe)

        # push the original Q-frame
        self.PushFrame(frame)
コード例 #3
0
    def test_PulseChargeShifting(self):
        frame = icetray.I3Frame()
        omkey = icetray.OMKey(1, 1)

        # create a calibration object
        calibration = dataclasses.I3Calibration()
        calibration.dom_cal[omkey] = dataclasses.I3DOMCalibration()
        calibration.dom_cal[omkey].mean_atwd_charge = 1.2
        calibration.dom_cal[omkey].mean_fadc_charge = 1.8
        frame["I3Calibration"] = calibration

        # create some pulses on our fake DOM
        pulse1 = dataclasses.I3RecoPulse()
        pulse1.flags = dataclasses.I3RecoPulse.PulseFlags.ATWD
        pulse1.time = 1. * I3Units.nanosecond
        pulse1.charge = 10.
        pulse1.width = 1.

        pulse2 = dataclasses.I3RecoPulse()
        pulse2.flags = dataclasses.I3RecoPulse.PulseFlags.FADC
        pulse2.time = 10. * I3Units.nanosecond
        pulse2.charge = 5.
        pulse2.width = 1.

        pulse_series = dataclasses.I3RecoPulseSeriesMap()
        pulse_series[omkey] = dataclasses.I3RecoPulseSeries()
        pulse_series[omkey].append(pulse1)
        pulse_series[omkey].append(pulse2)

        # add these pulses to our new frame
        frame["UnshiftedPulses"] = pulse_series

        # create a shifter object
        frame[
            "ShiftedPulses"] = dataclasses.I3RecoPulseSeriesMapApplySPECorrection(
                pulses_key="UnshiftedPulses", calibration_key="I3Calibration")

        # retrieve the shifted pulses
        shifted_pulses = dataclasses.I3RecoPulseSeriesMap.from_frame(
            frame, "ShiftedPulses")

        # make sure everything is as expected
        self.assertEqual(pulse_series[omkey][0].time,
                         shifted_pulses[omkey][0].time,
                         "these should be the same.")
        self.assertEqual(pulse_series[omkey][0].width,
                         shifted_pulses[omkey][0].width,
                         "these should be the same.")
        self.assertEqual(pulse_series[omkey][0].flags,
                         shifted_pulses[omkey][0].flags,
                         "these should be the same.")
        self.assertAlmostEqual(pulse_series[omkey][0].charge /
                               calibration.dom_cal[omkey].mean_atwd_charge,
                               shifted_pulses[omkey][0].charge,
                               places=4,
                               msg="these should be the same.")

        self.assertEqual(pulse_series[omkey][1].time,
                         shifted_pulses[omkey][1].time,
                         "these should be the same.")
        self.assertEqual(pulse_series[omkey][1].width,
                         shifted_pulses[omkey][1].width,
                         "these should be the same.")
        self.assertEqual(pulse_series[omkey][1].flags,
                         shifted_pulses[omkey][1].flags,
                         "these should be the same.")
        self.assertAlmostEqual(pulse_series[omkey][1].charge /
                               calibration.dom_cal[omkey].mean_fadc_charge,
                               shifted_pulses[omkey][1].charge,
                               places=4,
                               msg="these should be the same.")
コード例 #4
0
    def Finish(self):
        self.assertEquals(phys_frames, max_phys_frames)


# Manufacture a file.
fname = os.environ["I3_BUILD"] + "/daq_frame_test.i3.gz"
if os.path.exists(fname):
    os.unlink(fname)
the_time = dataclasses.I3Time()
the_time.set_utc_cal_date(1919, 1, 15, 0, 0, 0, 0)
f = dataio.I3File(fname, "w")
geo = dataclasses.I3Geometry()
geo.start_time = the_time - 100
geo.end_time = the_time + 100
calib = dataclasses.I3Calibration()
calib.start_time = the_time - 100
calib.end_time = the_time + 100
status = dataclasses.I3DetectorStatus()
status.start_time = the_time - 100
status.end_time = the_time + 100
frame = icetray.I3Frame(icetray.I3Frame.Geometry)
frame['I3Geometry'] = geo
f.push(frame)
frame = icetray.I3Frame(icetray.I3Frame.Calibration)
frame['I3Calibration'] = calib
f.push(frame)
frame = icetray.I3Frame(icetray.I3Frame.DetectorStatus)
frame['I3DetectorStatus'] = status
f.push(frame)
frame = icetray.I3Frame(icetray.I3Frame.DAQ)
コード例 #5
0
newDOMStatus.mpe_threshold = sum([
    domstat.mpe_threshold
    for domstat in allI3DOMStatuses if not is_nan(domstat.mpe_threshold)
]) / len(allI3DOMStatuses)
newDOMStatus.status_atwd_a = dataclasses.I3DOMStatus.OnOff.On  # allow awtd a readings
newDOMStatus.status_atwd_b = dataclasses.I3DOMStatus.OnOff.On  # allow awtd b readings
newDOMStatus.status_fadc = dataclasses.I3DOMStatus.OnOff.On  # allow fadc readings (off in input file???)
newDOMStatus.delta_compress = dataclasses.I3DOMStatus.OnOff.On  # allow delta compression
newDOMStatus.dom_gain_type = dataclasses.I3DOMStatus.DOMGain.High  # set gain to high
newDOMStatus.slc_active = True  # activate SLC readouts
newDOMStatus.fe_pedestal = 2130  # value shared across all doms in input file

dummyOMKey = icetray.OMKey(0, 0, 0)
start_time = dataclasses.I3Time(2019, 0)
end_time = dataclasses.I3Time(2039, 0)
newI3Calibration = dataclasses.I3Calibration()
newI3DetectorStatus = dataclasses.I3DetectorStatus()
newSPEScalingFactors = dataclasses.I3MapKeyDouble()
newSPEAbove = dataclasses.I3MapKeyDouble()
newI3Calibration.dom_cal = dataclasses.Map_OMKey_I3DOMCalibration()
newI3DetectorStatus.dom_status = dataclasses.Map_OMKey_I3DOMStatus()

newI3Calibration.dom_cal[dummyOMKey] = newDOMCalib
newI3Calibration.start_time = start_time
newI3Calibration.end_time = end_time
newI3Calibration.vem_cal = dataclasses.I3VEMCalibrationMap()

newI3DetectorStatus.daq_configuration_name = "P-ONE_Estimate"
newI3DetectorStatus.dom_status[dummyOMKey] = newDOMStatus
newI3DetectorStatus.start_time = start_time
newI3DetectorStatus.end_time = end_time