예제 #1
0
 def testopenfile(self):
     f = pfits.FITS('tst0001.fits')
     self.assertRaises(ValueError, pfits.FITS, 'new.fits')
     self.assertRaises(ValueError, pfits.FITS, 'new.fits', 'w')
     self.assertRaises(ValueError, pfits.FITS, 'tst0001.fits', 'x')
     f = pfits.FITS('new.fits', 'c')
     del (f)
     os.remove('new.fits')
예제 #2
0
def get_gb_weather_channel(t, thing):
    import glob, numpy as n, pfits, aipy as a, ephem
    weather_dir = '/data1/paper/gb/weather/'
    tstring = str(ephem.Date(
        a.phs.juldate2ephem(t)).datetime().date()).replace('-', '_')
    tstring = tstring + '_' + str(
        ephem.Date(a.phs.juldate2ephem(t)).datetime().time())[:3]
    tfile = glob.glob(weather_dir + tstring + '*')[0]
    fitsfile = pfits.FITS(tfile)
    hdus = fitsfile.get_hdus()
    ttimes = hdus[1].get_data()['DMJD'] + 2400000.5
    things_data = hdus[1].get_data()[thing]
    thing = things_data[n.argwhere(
        n.abs(ttimes - t) == n.min(n.abs(ttimes - t)))[0]]
    return thing
예제 #3
0
파일: plot_temps.py 프로젝트: nkern/capo
o = optparse.OptionParser()
a.scripting.add_standard_options(o, cal=True)
o.add_option(
    '-j',
    '--jdbin',
    dest='jdbin',
    type='float',
    default=600,
    help='Time interval for averaging temperatures (seconds).  Default 600')
opts, args = o.parse_args(sys.argv[1:])

# Collect temperature data
jds, temps = [], []
for f in args:
    print f
    hdu = pfits.FITS(f).get_hdus()[1]
    dat = hdu.get_data()
    jds.append(dat['DMJD'] + 2400000.5)
    temps.append(dat['TEMPERATURE'])

jds = n.concatenate(jds)
temps = n.concatenate(temps)
JDBIN = ephem.second * opts.jdbin
nbins = int((jds[-1] - jds[0]) / JDBIN)
jwgts, bins = n.histogram(jds, bins=nbins)
jtemps, bins = n.histogram(jds, weights=temps, bins=nbins)
jd_bins = .5 * (bins[1:] + bins[:-1])
temp_prof = jtemps / jwgts

if not opts.cal is None:
    aa = a.cal.get_aa(opts.cal, .1, .1, 1)
예제 #4
0
 def setUp(self):
     f = pfits.FITS('tst0001.fits')
     self.hdus = f.get_hdus()
     self.h = self.hdus[0]
예제 #5
0
 def setUp(self):
     f = pfits.FITS('test64bit1.fits')
     self.hdus = f.get_hdus()
예제 #6
0
 def setUp(self):
     f = pfits.FITS('varitab.fits')
     self.hdus = f.get_hdus()