Ejemplo n.º 1
0
    def CreatePFrame(self, nside, pixel):
        dec, ra = healpy.pix2ang(nside, pixel)
        dec = dec - numpy.pi / 2.
        zenith, azimuth = astro.equa_to_dir(ra, dec, self.event_mjd)
        zenith = float(zenith)
        azimuth = float(azimuth)
        direction = dataclasses.I3Direction(zenith, azimuth)

        position = self.seed_position
        time = self.seed_time
        energy = self.seed_energy

        variationDistance = 20. * I3Units.m
        posVariations = [
            dataclasses.I3Position(0., 0., 0.),
            dataclasses.I3Position(-variationDistance, 0., 0.),
            dataclasses.I3Position(variationDistance, 0., 0.),
            dataclasses.I3Position(0., -variationDistance, 0.),
            dataclasses.I3Position(0., variationDistance, 0.),
            dataclasses.I3Position(0., 0., -variationDistance),
            dataclasses.I3Position(0., 0., variationDistance)
        ]

        for i in range(0, len(posVariations)):
            posVariation = posVariations[i]
            p_frame = icetray.I3Frame(icetray.I3Frame.Physics)
            thisPosition = dataclasses.I3Position(position.x + posVariation.x,
                                                  position.y + posVariation.y,
                                                  position.z + posVariation.z)

            # generate the particle from scratch
            particle = dataclasses.I3Particle()
            particle.shape = dataclasses.I3Particle.ParticleShape.InfiniteTrack
            particle.fit_status = dataclasses.I3Particle.FitStatus.OK
            particle.pos = thisPosition
            particle.dir = direction
            particle.time = time
            particle.energy = energy
            p_frame[self.output_particle_name] = particle

            # generate a new event header
            eventHeader = dataclasses.I3EventHeader(self.event_header)
            eventHeader.sub_event_stream = "SCAN_nside%04u_pixel%04u_posvar%04u" % (
                nside, pixel, i)
            eventHeader.sub_event_id = pixel
            p_frame["I3EventHeader"] = eventHeader
            p_frame["SCAN_HealpixPixel"] = icetray.I3Int(int(pixel))
            p_frame["SCAN_HealpixNSide"] = icetray.I3Int(int(nside))
            p_frame["SCAN_PositionVariationIndex"] = icetray.I3Int(int(i))

            for frame in self.GCDQpFrames[0:-1]:
                self.PushFrame(frame)
            self.PushFrame(p_frame)
Ejemplo n.º 2
0
    def CreatePFrame(self, nside, pixel, pixel_index):
        dec, ra = healpy.pix2ang(nside, pixel)
        dec = numpy.pi/2. - dec
        zenith, azimuth = astro.equa_to_dir(ra, dec, self.event_mjd)
        zenith = float(zenith)
        azimuth = float(azimuth)
        direction = dataclasses.I3Direction(zenith,azimuth)

        position = self.seed_position
        time = self.seed_time
        energy = self.seed_energy

        for i in range(0,len(self.posVariations)):
            posVariation = self.posVariations[i]
            p_frame = icetray.I3Frame(icetray.I3Frame.Physics)

            thisPosition = dataclasses.I3Position(position.x + posVariation.x, position.y + posVariation.y, position.z + posVariation.z)

            # generate the particle from scratch
            particle = dataclasses.I3Particle()
            particle.shape = dataclasses.I3Particle.ParticleShape.InfiniteTrack
            particle.fit_status = dataclasses.I3Particle.FitStatus.OK
            particle.pos = thisPosition
            particle.dir = direction
            particle.time = time
            particle.energy = energy
            p_frame[self.output_particle_name] = particle

            # generate a new event header
            eventHeader = dataclasses.I3EventHeader(self.event_header)
            eventHeader.sub_event_stream = "SCAN_nside%04u_pixel%04u_posvar%04u" % (nside, pixel, i)
            eventHeader.sub_event_id = pixel
            p_frame["I3EventHeader"] = eventHeader
            p_frame["SCAN_HealpixPixel"] = icetray.I3Int(int(pixel))
            p_frame["SCAN_HealpixNSide"] = icetray.I3Int(int(nside))
            p_frame["SCAN_PositionVariationIndex"] = icetray.I3Int(int(i))

            # an overall sequence index, 0-based, in case we need to re-start
            p_frame["SCAN_EventOverallIndex"] = icetray.I3Int( int(i) + pixel_index*len(self.posVariations))
            if self.inject_event_name is not None:
                p_frame["SCAN_EventName"] = dataclasses.I3String(self.inject_event_name)

            self.PushFrame(p_frame)
    for row in reader:
        bg_src['FRB'].append(row[0])
        bg_src['t'].append(
            datetime.strptime(row[1] + '000', '%Y/%m/%d %H:%M:%S.%f'))
        bg_src['telescope'].append(row[2])
        bg_src['beam_semimajor_minutes'].append(float_else_neg(row[3]))
        bg_src['RA'].append(right_ascension(row[4]))
        bg_src['Dec'].append(declination(row[5]))
        bg_src['DM_mwlimit'].append(rm_plusminus(row[6]))
        bg_src['DM'].append(rm_plusminus(row[7]))
        bg_src['duration_ms'].append(float(row[8]))
        bg_src['flux'].append(float(row[9]))

for i in range(len(bg_src['FRB'])):
    zenith, azimuth = astro.equa_to_dir(
        bg_src['RA'][i], bg_src['Dec'][i],
        Time(bg_src['t'][i], format='datetime').mjd)
    bg_src['zenith'].append(zenith)
    bg_src['azimuth'].append(azimuth)
    bg_src['sigma'].append(bg_src['beam_semimajor_minutes'][i] * (1. / 60) *
                           (np.pi / 180.))

# Making a list of FRBs after May 30th, 2010 (when we have data) and NOT the repeater (for separate stacking test)
isdata = np.array(bg_src['t']) > datetime(2010, 05, 30, 0, 0, 0)
notrep = np.array(bg_src['FRB']) != 'FRB121102'
mask = isdata * notrep

savedict = {
    'FRB': np.array(bg_src['FRB'])[mask],
    'telescope': np.array(bg_src['telescope'])[mask],
    't': np.array(bg_src['t'])[mask],
Ejemplo n.º 4
0
ap_altaz = ap_coords.transform_to(AltAz(obstime=ap_times,location=south_pole))
ap2_altaz = ap2_coords.transform_to(AltAz(obstime=ap_times,location=south_pole))
ap3_altaz = ap3_coords.transform_to(AltAz(obstime=ap_times,location=south_pole))
ap_zenith=(90*u.degree - ap_altaz.alt).degree
ap2_zenith=(90*u.degree - ap2_altaz.alt).degree
ap3_zenith=(90*u.degree - ap3_altaz.alt).degree
ap_azimuth=(90*u.degree - ap_altaz.az - south_pole.lon).wrap_at(360*u.degree).degree
ap2_azimuth=(90*u.degree - ap2_altaz.az - south_pole.lon).wrap_at(360*u.degree).degree
ap3_azimuth=(90*u.degree - ap3_altaz.az - south_pole.lon).wrap_at(360*u.degree).degree

from icecube import astro
from icecube.icetray import I3Units

mjds =  mjd + np.linspace(0,1,1000)
i3zenith,i3azimuth = astro.equa_to_dir(
    src_ra*I3Units.degree,
    src_dec*I3Units.degree,
    mjds)

i3zenith_2,i3azimuth_2 = astro.equa_to_dir(
    src2_ra*I3Units.degree,
    src2_dec*I3Units.degree,
    mjds)

i3zenith_3,i3azimuth_3 = astro.equa_to_dir(
    src3_ra*I3Units.degree,
    src3_dec*I3Units.degree,
    mjds)

f, ([ax1, ax2], [ax3, ax4]) = plt.subplots( 2,2,sharex=True)
ax1.plot(ap_zenith)
ax1.plot(i3zenith/I3Units.degree)