Skip to content

Commit

Permalink
removes some print statements + update createh5Parm to remove error w…
Browse files Browse the repository at this point in the history
…ith shapes
  • Loading branch information
maaijke committed Nov 20, 2018
1 parent 01e8916 commit 6a3d09c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
4 changes: 2 additions & 2 deletions RMextract/LOFAR_TOOLS/createRMh5parm.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ def main(MSfiles, h5parmdb, solset_name = "sol000",all_stations=False,timestep=3

logging.info('Adding rotation measure values to: ' + solset_name + ' of ' + h5parmdb)
if all_stations:
rm_vals=np.array([rmdict["RM"][stat] for stat in station_names])[:,:,0]
rm_vals=np.array([rmdict["RM"][stat].flatten() for stat in station_names])
else:
rm_vals=np.ones((len(station_names),rmdict['RM']['st0'].shape[0]),dtype=float)
rm_vals+=rmdict['RM']['st0'][:,0][np.newaxis]
rm_vals+=rmdict['RM']['st0'].flatten()[np.newaxis]
new_soltab = solset.makeSoltab(soltype='rotationmeasure', soltabName='RMextract',
axesNames=['ant', 'time'], axesVals=[station_names, rmdict['times']],
vals=rm_vals,
Expand Down
6 changes: 3 additions & 3 deletions RMextract/PosTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ def radec2azel(ra,dec,time, pos):

p = me.position('ITRF',str(pos[0])+'m',str(pos[1])+'m',str(pos[2])+'m')
me.do_frame(p);
print ("input radec2azel",phasedir,ra,dec,p,t)
#print ("input radec2azel",phasedir,ra,dec,p,t)
azel = me.measure(phasedir,'azel');
return azel;

Expand Down Expand Up @@ -428,9 +428,9 @@ def getuvw(ra,dec,time, pos1,pos2):

p = me.position('ITRF',str(pos1[0])+'m',str(pos1[1])+'m',str(pos1[2])+'m')
bl = me.baseline('ITRF',str(pos2[0]-pos1[0])+'m',str(pos2[1]-pos1[1])+'m',str(pos2[2]-pos1[2])+'m')
print (bl)
#print (bl)
me.do_frame(p);
print (me.to_uvw(bl)['xyz'])
#print (me.to_uvw(bl)['xyz'])
#return uvw;

def getIONEXtimerange(timerange,timestep):
Expand Down
2 changes: 1 addition & 1 deletion RMextract/getIONEX.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ def getTECinterpol(time, lat, lon, tecinfo, apply_earth_rotation=0):
"""old function name for compatibility. Use compute_tec_interpol
instead"""

logging.warning("obsolete, use compute_tec_interpol instead")
#logging.warning("obsolete, use compute_tec_interpol instead")
if np.isscalar(time):
time = [time]
lat = [lat]
Expand Down
15 changes: 8 additions & 7 deletions RMextract/getRM.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ def getRM(MS=None,
Returns the (timegrid,timestep,TEC) where TEC is a dictionary containing 1 enumpyarray per station in stat_names.
If stat_names is not given, the station names will either be extracted from the MS or st1...stN '''

print ('earth_rot', earth_rot)
print ('timerange ', timerange)
print ('use_azel ', use_azel)
#print ('earth_rot', earth_rot)
#print ('timerange ', timerange)
#print ('use_azel ', use_azel)
stat_names=[]
useEMM=False
use_mean = False
Expand Down Expand Up @@ -95,7 +95,7 @@ def getRM(MS=None,
return

if useEMM:
print ("USING EMM for EarthMagnetic Field")
#print ("USING EMM for EarthMagnetic Field")
emm=EMM.EMM()
else:
emm=EMM.WMM()
Expand Down Expand Up @@ -145,7 +145,7 @@ def getRM(MS=None,
for time_array in times:
#get RM per timeslot
starttime=time_array[0]
print ("getting ionexfile for",starttime)
#print ("getting ionexfile for",starttime)
date_parms = PosTools.obtain_observation_year_month_day_fraction(starttime)
dayofyear = date(date_parms[0],date_parms[1],date_parms[2]).timetuple().tm_yday
emm.date=date_parms[0]+float(dayofyear)/365.
Expand All @@ -161,9 +161,9 @@ def getRM(MS=None,
stat_pos = []
stat_pos.append(stn_mean)
stat_pos_mean = True
print ('stat_pos.mean', stn_mean)
#print ('stat_pos.mean', stn_mean)
for station,position in zip(stat_names,stat_pos):
print ('generating data for station ', station)
#print ('generating data for station ', station)


for time in time_array:
Expand All @@ -190,6 +190,7 @@ def getRM(MS=None,
continue
flags[station].append(1)
latpp,lonpp,height,lon,lat,am1=PosTools.getlonlatheight(az,el,position)

if latpp==-1 and lonpp==-1 and height==-1:
return
#get VTEC from IONEX interpolation
Expand Down

0 comments on commit 6a3d09c

Please sign in to comment.