Ejemplo n.º 1
0
    def test_I3Geometry_equality(self):
        geo1 = dataclasses.I3Geometry()
        geo1.omgeo = dataclasses.I3OMGeoMap()
        geo1.stationgeo = dataclasses.I3StationGeoMap()
        geo1.start_time = dataclasses.I3Time()
        geo1.end_time = dataclasses.I3Time()

        geo2 = dataclasses.I3Geometry()
        geo2.omgeo = dataclasses.I3OMGeoMap()
        geo2.stationgeo = dataclasses.I3StationGeoMap()
        geo2.start_time = dataclasses.I3Time()
        geo2.end_time = dataclasses.I3Time()

        self.assertEqual(geo1, geo2, "these should be the same.")
Ejemplo n.º 2
0
    def Process(self):
        if not self.geometry:
            self.geometry = True
            geometry = dc.I3Geometry()
            for string in self.strings:
                for dom in self.doms:
                    omkey= icetray.OMKey(string,dom)
                    geometry.omgeo[omkey] = dc.I3OMGeo()
                    x=random.uniform(-500,500)
                    y=random.uniform(-500,500)
                    z=random.uniform(-300,300)
                    geometry.omgeo[omkey].position = dc.I3Position(x,y,z)

            frame = icetray.I3Frame(icetray.I3Frame.Geometry);
            frame.Put('I3Geometry',geometry)
            self.PushFrame(frame)

        pulsesmap= dc.I3RecoPulseSeriesMap()
        for string in self.strings:
            for dom in self.doms:
                omkey= icetray.OMKey(string,dom)
                pulse= dc.I3RecoPulse()
                pulse.charge= random.uniform(0.3,6.)#pulses are not used in the algorithm of this module, 
                                                    #just put a single pulse with any value of the charge
                pulsesmap[omkey]= dc.I3RecoPulseSeries([pulse])
    
        frame = icetray.I3Frame(icetray.I3Frame.Physics);
        frame.Put("TestPulseSeriesMap",pulsesmap)
        self.PushFrame(frame)
Ejemplo n.º 3
0
    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)
Ejemplo n.º 4
0
def make_geometry():
    geo = dataclasses.I3Geometry()
    for omkey in doms:
        geo.omgeo[omkey] = dataclasses.I3OMGeo()
    geo.omgeo[icetray.OMKey(1, 1)].position = dataclasses.I3Position(0, 0, 0)
    geo.omgeo[icetray.OMKey(1, 2)].position = dataclasses.I3Position(0, 0, 50)
    geo.omgeo[icetray.OMKey(1, 3)].position = dataclasses.I3Position(0, 0, 100)
    geo.omgeo[icetray.OMKey(1, 4)].position = dataclasses.I3Position(0, 0, 500)
    geo.omgeo[icetray.OMKey(2,
                            4)].position = dataclasses.I3Position(0, 50, 500)
    return geo
Ejemplo n.º 5
0
def makePartialGeometry(denseGeometry, domsUsed):
    newGeo = dataclasses.I3Geometry()
    newGeo.start_time = start_time
    newGeo.end_time = end_time

    newGeoMap = dataclasses.I3OMGeoMap()
    denseGeoMap = denseGeometry.omgeo
    for omkey in domsUsed:
        if omkey not in denseGeoMap:
            raise ValueError(str(omkey) + "is not in the dense geometry")
        newGeoMap[omkey] = denseGeoMap[omkey]

    newGeo.omgeo = newGeoMap

    return newGeo
Ejemplo n.º 6
0
def MakeGeometryFrame(antFile):
    antFile = np.genfromtxt(args.input,
                            delimiter=',',
                            names=True,
                            dtype=None,
                            encoding='ASCII')
    print("Reading in deployed locations from: ", args.input)

    frame = icetray.I3Frame(icetray.I3Frame.Geometry)
    antGeometry = dataclasses.I3Geometry()

    num_ants = len(antFile['StationID'])

    for iAnt in range(num_ants):
        stationID = int(antFile['StationID'][iAnt])
        antennaID = int(antFile['AntennaID'][iAnt])
        antkey = dataclasses.IceAntennaKey(stationID, antennaID)
        antennaGeo = MakeAntennaGeo(antFile, iAnt)
        antGeometry.iceantennageo[antkey] = antennaGeo

    # print(antGeometry.iceantennageo)
    frame['I3IceAntennaGeometry'] = antGeometry
    return frame
Ejemplo n.º 7
0
        self.assertEquals(self.frame["I3EventHeader"].run_id,
                          frame["I3EventHeader"].run_id)
        phys_frames += 1

    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)
adom = dataclasses.I3DOMStatus()
adom.pmt_hv = 1500 * icetray.I3Units.V
dmstat[icetray.OMKey(1, 1)] = adom
mykey = icetray.OMKey(1, 1)
ENSURE(mykey in dmstat, 'Can not find my new dom status')

#Also...see Fix_Trigger_In_GCD.py test

# I3Geometry example? (olivas have one?)
print("Testing I3Geometry")
omg = dataclasses.I3OMGeo()
omg.position.x = 100.0
omg.position.y = 101.0
omg.position.z = 102.0
print(type(omg.position), omg.position)
i3g = dataclasses.I3Geometry()
i3g.omgeo[icetray.OMKey(1, 1)] = omg
ENSURE(icetray.OMKey(1, 1) in i3g.omgeo, 'can not find my omkey in i3geo')
ENSURE((icetray.OMKey(1, 2) not in i3g.omgeo), 'found a bad omkey in i3geo')
newom = i3g.omgeo[icetray.OMKey(1, 1)]
print(type(newom.position), vars(newom.position), newom.position)
ENSURE(newom.position.x > 99.0, 'Failed to get the right OMGeo position back')

# I3Calibratoim example? (olivas have one?)
## See the Fix_Cals_in_GCD.py script for full example

#I3DOMLaunch
print('Testing I3DOMLaunch')
dl = dataclasses.I3DOMLaunch()
fadc = icetray.vector_int()
for i in range(10):