Ejemplo n.º 1
0
    def test_radec_single(self):
        day_str = testTime[0].split(' ')[0]

        hour0 = Time(day_str + ' 00:00:00', format='iso')
        dHr = TimeDelta(1. * u.hour)

        time_strs = [str(hour0 + dHr * t) for t in range(24)]

        self.lofar_map = rm.IonoMap(lofarLocStrings[0],
                                    lofarLocStrings[1],
                                    time_strs,
                                    height=0)
        self.lofar_map.calc_radec_rm([testRA], [testDec])

        RMs = np.array([self.lofar_map.RMs[t] for t in time_strs])
        dRMs = np.array([self.lofar_map.dRMs[t] for t in time_strs])

        # XXX this no longer makes sense
        # assert(self.lofar_map.RMs.shape == (1,24,1)) #npix = 1
        # assert(self.lofar_map.dRMs.shape == (1,24,1))

        #Plot the comparison plot for Sotomayor Beltran et al. 2013 Fig.4b
        plt.errorbar(range(24),
                     np.abs(RMs[:, 0]),
                     yerr=dRMs[:, 0],
                     fmt='ro',
                     ecolor='r')
        plt.xlim(0, 23)
        plt.ylim(0, 2.5)
        plt.xlabel(r'UT Time [Hours]')
        plt.ylabel(r'$|\phi_{\rm ion}|$ [rad m$^{-2}$]')
        plt.savefig('testFig_compare_SB_Fig4b.png')
        plt.suptitle(r'%s' %
                     ('/'.join(map(str, [test_day, test_month, test_yr]))))
        plt.close()
Ejemplo n.º 2
0
 def setUp(self):
     self.rm_map = rm.IonoMap(paperLocStrings[0],
                              paperLocStrings[1],
                              testTime,
                              height=testHeight,
                              ionex_dir=testIonexDir,
                              rm_dir=testRmDir)
Ejemplo n.º 3
0
 def test_radec_single(self):
     self.lofar_map = rm.IonoMap(lofarLocStrings[0],
                                 lofarLocStrings[1], [testTime],
                                 height=0)
     self.lofar_map.calc_radec_rm([testRA], [testDec])
     assert (self.lofar_map.RMs.shape == (1, 24, 1))  #npix = 1
     assert (self.lofar_map.dRMs.shape == (1, 24, 1))
     #Plot the comparison plot for Sotomayor Beltran et al. 2013 Fig.4b
     plt.errorbar(range(24),
                  np.abs(self.lofar_map.RMs[0, :, 0]),
                  yerr=self.lofar_map.dRMs[0, :, 0],
                  fmt='ro',
                  ecolor='r')
     plt.xlim(0, 23)
     plt.ylim(0, 2.5)
     plt.xlabel(r'UT Time [Hours]')
     plt.ylabel(r'$|\phi_{\rm ion}|$ [rad m$^{-2}$]')
     plt.savefig('testFig_compare_SB_Fig4b.png')
     plt.suptitle(r'%s' %
                  ('/'.join(map(str, [test_day, test_month, test_yr]))))
     plt.close()
Ejemplo n.º 4
0
    '2012-01-25', '2012-01-26', '2012-01-27', '2012-01-28', '2012-01-29',
    '2012-01-30', '2012-01-31', '2012-02-01', '2012-02-02', '2012-02-03',
    '2012-02-04', '2012-02-05', '2012-02-06', '2012-02-07', '2012-02-08',
    '2012-02-09', '2012-02-10', '2012-02-11', '2012-02-12', '2012-02-13',
    '2012-02-14', '2012-02-15', '2012-02-16', '2012-02-17', '2012-02-18',
    '2012-02-19', '2012-02-20', '2012-02-21', '2012-02-22', '2012-02-23',
    '2012-02-24', '2012-02-25', '2012-02-26', '2012-02-27', '2012-02-28'
]

import pickle
import numpy as np
from radiono import rm
from radiono import utils as ut

lat, lon = '30d43m17.5ss', '21d25m41.9se'
IM = rm.IonoMap(lat, lon, dates)
ras, decs = ut.nsideToRaDec(16)

print 'Calculating...'
IM.calc_radec_RM(ras, decs)

print 'Saving to dict structure'
datadict = {}
datadict['lat'] = lat
datadict['lon'] = lon
datadict['lsts'] = IM.lst

for dayindex, day in enumerate(dates):
    datadict[day] = {}
    for ut in range(24):
        datadict[day][ut] = IM.RMs[dayindex, ut, :]
Ejemplo n.º 5
0
	
Plat=-30.-(43./60.)-(17.5/3600.)
Plon=21.+(25./60.)+(41.9/3600.)

ipix = range(hp.nside2npix(NSIDE))
ras,decs = [],[]
for p in ipix:
    dec,ra = IndexToDeclRa(p)
    ras.append(ra)
    decs.append(dec)
###### 

#dates = ['2012-02-10', '2012-02-11', '2012-02-13', '2012-02-14', '2012-02-15', '2012-02-16', '2012-02-17','2012-02-18', '2012-02-19', '2012-02-20', '2012-02-21',  '2012-02-22']
dates = ['2011-12-06', '2011-12-07', '2011-12-08', '2011-12-09', '2011-12-10', '2011-12-11', '2011-12-12', '2011-12-13', '2011-12-14', '2011-12-15', '2011-12-16', '2011-12-17', '2011-12-18', '2011-12-19', '2011-12-20', '2011-12-21', '2011-12-22', '2011-12-23', '2011-12-24', '2011-12-25', '2011-12-26', '2011-12-27', '2011-12-28', '2011-12-29', '2011-12-30', '2011-12-31', '2012-01-01', '2012-01-02', '2012-01-03', '2012-01-04', '2012-01-05', '2012-01-06', '2012-01-07', '2012-01-08', '2012-01-09', '2012-01-10', '2012-01-11', '2012-01-12', '2012-01-13', '2012-01-14', '2012-01-15', '2012-01-16', '2012-01-17', '2012-01-18', '2012-01-19', '2012-01-20', '2012-01-21', '2012-01-22', '2012-01-23', '2012-01-24', '2012-01-25', '2012-01-26', '2012-01-27', '2012-01-28', '2012-01-29', '2012-01-30', '2012-01-31', '2012-02-01', '2012-02-02', '2012-02-03', '2012-02-04', '2012-02-05', '2012-02-06', '2012-02-07', '2012-02-08', '2012-02-09', '2012-02-10', '2012-02-11', '2012-02-12', '2012-02-13', '2012-02-14', '2012-02-15', '2012-02-16', '2012-02-17', '2012-02-18', '2012-02-19', '2012-02-20', '2012-02-21', '2012-02-22', '2012-02-23', '2012-02-24', '2012-02-25', '2012-02-26', '2012-02-27', '2012-02-28']
if not os.path.exists('%s_to_%s.pkl'%(dates[0],dates[-1])):
    IM = rm.IonoMap('30d43m17.5ss','21d25m41.9se',dates)
    IM.calc_radec_rm(ras,decs)

    datadict = {}
    bm = beamPAPER(150.,nside=16)
    bm_map = np.ma.masked_invalid(hp.orthview(bm,return_projected_map=True))[:,:400]
    plt.close() #negate orthview launching xwindow
    datadict['bm'] = bm_map

    for dayindex in range(IM.RMs.shape[0]):
        datadict[dates[dayindex]] = {}
        #TODO convert keys to JDs? would be neater for everything to be numeric
        for ut in range(IM.RMs.shape[1]):
            map = hp.orthview(IM.RMs[dayindex,ut,:],rot=[0,90],return_projected_map=True)
            map = np.ma.masked_invalid(map)[:,:400] #only get above horizon, mask elsewhere
            datadict[dates[dayindex]][ut] = map
Ejemplo n.º 6
0
# Moore et al.: 7 Dec 2011 to 27 Feb 2012
#dates = (('2011-12', range(6, 32)),('2012-01', range(1, 32)),('2012-02', range(1, 29)))

dates = []
for d in range(6, 32):
    dates.append('-'.join(['2011-12', ut.std_hour(d)]))
for d in range(1, 32):
    dates.append('-'.join(['2012-01', ut.std_hour(d)]))
for d in range(1, 29):
    dates.append('-'.join(['2012-02', ut.std_hour(d)]))

# PAPER INFO
lat_str = '30d43m17.5ss'
lon_str = '21d25m41.9se'

IM = rm.IonoMap(lat_str, lon_str, dates)
ras = [
    np.radians(15. * 2.),
    np.radians(15. * 4.),
    np.radians(15. * 6.),
    np.radians(15. * 8.)
]  #2,4,6,8 hrs
dec = np.radians(-30. - (43. / 60.) - (17.5 / 3600.))
#decs = [dec,dec,dec] #zenith
decs = [dec, dec, dec, dec]

#if not os.path.exists('./1h4h8h.npz'):
if not os.path.exists('./2h4h6h8h.npz'):
    print 'getting RMs'
    IM.calc_radec_rm(ras, decs, verbose=True)
    np.savez('./2h4h6h8h.npz', RM=IM.RMs, dRM=IM.dRMs, dates=dates)
Ejemplo n.º 7
0
MM='04'
DD='11'
"""
YYYY='2012'
MM='02'
DD='13'
"""
def IndexToDeclRa(index,deg=False):
    theta,phi=hp.pixelfunc.pix2ang(NSIDE,index)
    if deg: return -np.degrees(theta-np.pi/2.),np.degrees(np.pi*2.-phi)
    else: return theta-np.pi/2., 2.*np.pi-phi
def DeclRaToIndex(decl,RA):
    return hp.pixelfunc.ang2pix(NSIDE,np.radians(-decl+90.),np.radians(360.-RA))


IM = rm.IonoMap('30d43m17.5ss','21d25m41.9se',['%s-%s-%s'%(YYYY,MM,DD)])
Plat=-30.-(43./60.)-(17.5/3600.)
Plon=21.+(25./60.)+(41.9/3600.)

ipix = range(hp.nside2npix(NSIDE))
ras,decs = [],[]
for p in ipix:
    dec,ra = IndexToDeclRa(p)
    ras.append(ra)
    decs.append(dec)

tec,rmstec,ionh = IM.ionex_data(YYYY,MM,DD)
IM.calc_radec_rm(ras,decs)

mc = Basemap(projection='cyl', resolution='c')
mo = Basemap(projection='ortho',lon_0=Plon,lat_0=Plat,resolution='c')
Ejemplo n.º 8
0
lng='6d00m00.00se' 

year='2011'
month='04'
day='11'

ionexfile = 'CODG1010.11I'

time = year+'-'+month+'-'+day+'T00:00:00'

ionFRMcommand = 'ionFRM.py '+RA+Dec+' '+lat+' '+lng+' '+time+' '+'IONEX/Data/'+ionexfile
ionfrfile = '2011-04-1123h23m27.9s+58d48m42.4sIonRM.txt'
if not os.path.exists(ionfrfile): os.system(ionFRMcommand)
ut,tec,absB,RM,dRM = np.loadtxt(ionfrfile,unpack=True)

RA_d = 23.+(23./60.)+(27.9/3600.)
RA_d *= 15.
Dec_d = 58.+(48./60.)+(42.4/3600.)

IM = rm.IonoMap(lat,lng,['%s-%s-%s'%(year,month,day)])
IM.calc_radec_rm([np.radians(RA_d)],[np.radians(Dec_d)])

plt.errorbar(ut,RM,yerr=dRM,fmt='ro',label=r'${\tt ionFR}$')
plt.errorbar(range(24),IM.RMs[0,:],yerr=IM.dRMs[0,:],fmt='bo',label=r'${\tt radionopy}$')
plt.suptitle('2011-04-11')
plt.xlabel('UT [hours]')
plt.ylabel(r'$\rm\phi_{iono}\,[rad\,m^{-2}]$')
plt.legend(loc=4)
plt.xlim(0,23)
plt.ylim(0,2.5)
plt.show()