示例#1
0
def compute_pointing(filename, channel="ch2"):

    with open(filename) as f:
        rawdata = cPickle.load(f)

    # UCSB
    lat = np.radians(34.41)
    lon = np.radians(-119.85)
    alt = 0

    observer = ephem.Observer()
    observer.lon = lon
    observer.lat = lat
    observer.elevation = alt

    def conv(azimuth, elevation, utc):
        observer.date = utc
        return observer.radec_of(azimuth, elevation)

    start_date = datetime(rawdata["sci_data"]["year"][0],
                          rawdata["sci_data"]["month"][0],
                          rawdata["sci_data"]["day"][0]) + timedelta(
                              hours=rawdata["sci_data"]["ut"][0])

    l.info("Start time: %s", str(start_date))

    az = np.radians(rawdata["az"])
    el = np.radians(rawdata["el"])

    ra = []
    dec = []
    for i in range(0, len(rawdata["sci_data"])):
        ra_i, dec_i = conv(
            az[i], el[i],
            start_date + timedelta(hours=rawdata["sci_data"]["localtime"][i] -
                                   rawdata["sci_data"]["localtime"][0]))
        ra.append(ra_i)
        dec.append(dec_i)

    ra = np.array(ra)
    dec = np.array(dec)
    ha = altaz2ha(el, az, lat)
    psi = compute_parallactic_angle(ha, lat, dec)

    h5data = pd.DataFrame({"THETA": np.pi / 2 - dec})
    h5data["PHI"] = ra
    h5data["TEMP"] = rawdata["sci_data"][channel]["T"]
    h5data["Q"] = rawdata["sci_data"][channel]["Q"]
    h5data["U"] = rawdata["sci_data"][channel]["U"]
    h5data["PSI"] = psi
    h5data["FLAG"] = 0
    return h5data
def compute_pointing(filename, channel="ch2"):

    with open(filename) as f:
        rawdata = cPickle.load(f)

    # UCSB
    lat = np.radians(34.41)
    lon = np.radians(-119.85)
    alt = 0

    observer = ephem.Observer()
    observer.lon = lon
    observer.lat = lat
    observer.elevation = alt

    def conv(azimuth, elevation, utc):
        observer.date = utc
        return observer.radec_of(azimuth, elevation)

    start_date = datetime(rawdata["sci_data"]["year"][0], rawdata["sci_data"]["month"][0], rawdata["sci_data"]["day"][0]) + timedelta(hours=rawdata["sci_data"]["ut"][0])

    l.info("Start time: %s", str(start_date))

    az = np.radians(rawdata["az"])
    el = np.radians(rawdata["el"])

    ra = []
    dec = []
    for i in range(0, len(rawdata["sci_data"])):
        ra_i, dec_i = conv(az[i], el[i], start_date+timedelta(hours=rawdata["sci_data"]["localtime"][i]-rawdata["sci_data"]["localtime"][0]))
        ra.append(ra_i)
        dec.append(dec_i)

    ra = np.array(ra)
    dec = np.array(dec)
    ha = altaz2ha(el, az, lat)
    psi = compute_parallactic_angle(ha, lat, dec)

    h5data=pd.DataFrame({"THETA" : np.pi/2 - dec })
    h5data["PHI"] = ra
    h5data["TEMP"] = rawdata["sci_data"][channel]["T"]
    h5data["Q"] = rawdata["sci_data"][channel]["Q"]
    h5data["U"] = rawdata["sci_data"][channel]["U"]
    h5data["PSI"] = psi
    h5data["FLAG"] = 0
    return h5data
示例#3
0
    observer.lat = lat[i]
    observer.elevation = alt[i]  
    observer.date = utc
    return observer.radec_of(azimuth, elevation)

START_DATE = datetime.datetime(2012, 8, 1)

rotation_speed = np.radians(-1 * 360/60)
ut = np.arange(0., 48., 1/(30.*3600.))
az = rotation_speed * (ut * 3600.) % (2*np.pi)

ra = []
dec = []
el = np.radians(45)
for i in range(0, len(ut)):
    ra_i, dec_i = conv(0, az[i], el, START_DATE+datetime.timedelta(ut[i]/24.))
    ra.append(ra_i)
    dec.append(dec_i)

ra = np.array(ra)
dec = np.array(dec)
ha = altaz2ha(el, az, lat)
psi = compute_parallactic_angle(ha, lat, dec)

pix = hp.ang2pix(NSIDE, np.pi/2-dec, ra, nest=False)

from mapmaking import pix2map
hit = hp.ma(pix2map(pix, NSIDE))
hit.mask = hit == 0
hp.mollview(np.log10(hit).filled(),min=0,max=3,unit='log10 hits',title='Hitmap 48hrs Alice Springs')
示例#4
0
out_filename = 'data/eq_pointing_%d.fits' % (freq)
if mag:
    out_filename = out_filename.replace('.fits','_mag.fits')
with fits.create(out_filename) as f:
    f.write_HDU("TIME", OrderedDict({'UT': ut}))
    for pnt_ch in channels:
        print("Channel %d" % pnt_ch)
        az = np.radians(pointing_file[0].read_column('az%d' % pnt_ch)[good])
        el = np.radians(pointing_file[0].read_column('el%d' % pnt_ch)[good])

        ra = []
        dec = []
        for i in range(0, len(ut)):
            if i % 100000 == 0:
                print("%.1d perc" % (i * 100./len(ut)))
            ra_i, dec_i = conv(i, az[i], el[i], START_DATE+datetime.timedelta(ut[i]/24.))
            ra.append(ra_i)
            dec.append(dec_i)

        ra = np.array(ra)
        dec = np.array(dec)
        ha = altaz2ha(el, az, lat)
        psi = compute_parallactic_angle(ha, lat, dec)

        pnt = OrderedDict()
        pnt['THETA'] = np.pi/2 - dec
        pnt['PHI'] = ra
        pnt['PSI'] = psi
        f.write_HDU("CHANNEL_%d" % pnt_ch, pnt)