@@ -277,7 +277,7 @@ def __init__(self,d,freqs=1822,freq_index=0,elevation=None,ra=None,dec=None ,sur
277
277
for val_el ,ra ,dec ,el in zip (sort_ind ,self .ra ,self .dec ,self .elevation ):
278
278
self .T_sky .append ( T_sky (ra ,dec ))
279
279
self .Tsys_sky [pol ].append (tipping_mu [val_el ]- T_sky (ra ,dec ))
280
- TmpSky = scape . fitting .PiecewisePolynomial1DFit ()
280
+ TmpSky = fit .PiecewisePolynomial1DFit ()
281
281
TmpSky .fit (self .elevation , self .T_sky )
282
282
self .Tsky = TmpSky
283
283
@@ -307,16 +307,16 @@ def remove_rfi(d,width=3,sigma=5,axis=1):
307
307
def load_cal (filename , baseline , nd_models , freq_channel = None ,channel_bw = 10.0 ,channel_mask = '' ,n_chan = 4096 ,channel_range = None ,band_input = None ):
308
308
""" Load the dataset into memory """
309
309
print ('Loading noise diode models' )
310
-
310
+
311
311
try :
312
312
d = scape .DataSet (filename , baseline = baseline , nd_models = nd_models ,band = band_input )
313
313
except IOError :
314
314
nd = scape .gaincal .NoiseDiodeModel (freq = [800 ,2000 ],temp = [20 ,20 ])
315
315
warnings .warn ('Warning: Failed to load/find Noise Diode Models, setting models to 20K ' )
316
316
print ('Warning: Failed to load/find Noise Diode Models, setting models to 20K ' )
317
317
d = scape .DataSet (filename , baseline = baseline , nd_h_model = nd , nd_v_model = nd ,band = band_input )
318
-
319
-
318
+
319
+
320
320
if not channel_range is None :
321
321
start_freq_channel = int (channel_range .split (',' )[0 ])
322
322
end_freq_channel = int (channel_range .split (',' )[1 ])
@@ -438,7 +438,7 @@ def fit_tipping(T_sys,SpillOver,pol,freqs,T_rx,fixopacity=False):
438
438
else :
439
439
tau = 0.01078
440
440
print ("atmospheric_opacity = %f at %f MHz" % (tau ,freqs ))
441
- tip = scape . fitting .NonLinearLeastSquaresFit (None , [0 , 0.00 ]) # nonsense Vars
441
+ tip = fit .NonLinearLeastSquaresFit (None , [0 , 0.00 ]) # nonsense Vars
442
442
def know_quant (x ):
443
443
rx = T_rx .rec [pol ](freqs )
444
444
sky = T_sys .Tsky (x )
@@ -480,7 +480,7 @@ def plot_data_el(Tsys,Tant,title='',units='K',line=42,aperture_efficiency=None,f
480
480
for error_margin in [0.9 ,1.1 ]:
481
481
plt .hlines (recLim_apEffH * error_margin ,elevation .min (), elevation .max (), lw = 1.1 ,colors = 'g' ,linestyle = '--' )
482
482
plt .hlines (recLim_apEffV * error_margin ,elevation .min (), elevation .max (), lw = 1.1 ,colors = 'g' ,linestyle = '--' )
483
-
483
+
484
484
plt .grid ()
485
485
plt .ylabel ('$T_{sys}/\eta_{ap}$ (K)' )
486
486
return fig
@@ -524,7 +524,7 @@ def plot_data_freq(frequency,Tsys,Tant,title='',aperture_efficiency=None):
524
524
plt .plot (frequency ,recLim_apEffV ,lw = 1.1 ,color = 'limegreen' ,linestyle = '-' )
525
525
for error_margin in [0.9 ,1.1 ]:
526
526
plt .plot (frequency ,recLim_apEffH * error_margin , lw = 1.1 ,color = 'g' ,linestyle = '--' )
527
- plt .plot (frequency ,recLim_apEffV * error_margin , lw = 1.1 ,color = 'g' ,linestyle = '--' )
527
+ plt .plot (frequency ,recLim_apEffV * error_margin , lw = 1.1 ,color = 'g' ,linestyle = '--' )
528
528
529
529
low_lim = (r_lim (Tsys [:,0 :2 ]),r_lim (Tant [:,0 :2 ]) )
530
530
low_lim = np .min (low_lim )
@@ -536,7 +536,7 @@ def tmp(x):
536
536
high_lim = np .max ((high_lim , 46 * 1.3 ))
537
537
plt .ylim (low_lim ,high_lim )
538
538
plt .vlines (900 ,low_lim ,high_lim ,lw = 1.1 ,color = 'darkviolet' ,linestyle = '--' )
539
- plt .vlines (1680 ,low_lim ,high_lim ,lw = 1.1 ,color = 'darkviolet' ,linestyle = '--' )
539
+ plt .vlines (1680 ,low_lim ,high_lim ,lw = 1.1 ,color = 'darkviolet' ,linestyle = '--' )
540
540
if np .min (frequency ) <= 1420 :
541
541
plt .hlines (42 , np .min ((frequency .min (),1420 )), 1420 , colors = 'k' )
542
542
if np .max (frequency ) >= 1420 :
@@ -569,7 +569,7 @@ def tmp(x):
569
569
570
570
parser .add_option ( "--fix-opacity" ,action = "store_true" , default = False ,
571
571
help = "The opacity is fixed to 0.01078 (Van Zee et al.,1997) or it is calculated according to ITU-R P.676-9." )
572
- parser .add_option ("-c" , "--channel-mask" , default = '/var/kat/katsdpscripts/RTS/rfi_mask.pickle' ,
572
+ parser .add_option ("-c" , "--channel-mask" , default = '/var/kat/katsdpscripts/RTS/rfi_mask.pickle' ,
573
573
help = "Optional pickle file with boolean array specifying channels to mask (default is no mask)" )
574
574
575
575
(opts , args ) = parser .parse_args ()
@@ -610,9 +610,9 @@ def find_nearest(array,value):
610
610
Band ,SN = h5 .receivers .get (ant .name ,'l.4' ).split ('.' ) # A safe Default
611
611
else :
612
612
Band = 'L'
613
- SN = h5 .sensor ['Antennas/' + ant .name + '/rsc_rxl_serial_number' ][0 ] # Try get the serial no. only used for noise&recever model
614
-
615
-
613
+ SN = h5 .sensor ['Antennas/' + ant .name + '/rsc_rxl_serial_number' ][0 ] # Try get the serial no. only used for noise&recever model
614
+
615
+
616
616
receiver_model_H = str ("{}/Rx{}_SN{:0>4d}_calculated_noise_H_chan.dat" .format (opts .receiver_models ,str .upper (Band ),int (SN )))
617
617
receiver_model_V = str ("{}/Rx{}_SN{:0>4d}_calculated_noise_V_chan.dat" .format (opts .receiver_models ,str .upper (Band ),int (SN )))
618
618
aperture_efficiency_h = "%s/ant_eff_%s_H_AsBuilt.csv" % (opts .aperture_efficiency ,str .upper (Band ))
@@ -625,8 +625,8 @@ def find_nearest(array,value):
625
625
freq_list = np .zeros ((len (chunks )))
626
626
for j ,chunk in enumerate (chunks ):freq_list [j ] = h5 .channel_freqs [chunk ].mean ()/ 1e6
627
627
print ("Selecting channel data to form %f MHz Channels" % (channel_bw ) )
628
- d = load_cal (filename , "%s" % (ant .name ,), nd_models , chunks ,channel_mask = channel_mask ,n_chan = n_chans ,channel_range = freq_chans ,band_input = Band .lower ())
629
-
628
+ d = load_cal (filename , "%s" % (ant .name ,), nd_models , chunks ,channel_mask = channel_mask ,n_chan = n_chans ,channel_range = freq_chans ,band_input = Band .lower ())
629
+
630
630
for j in xrange (len (d .freqs )):freq_list [j ] = d .freqs [j ]
631
631
632
632
tsys = np .zeros ((len (d .scans ),len (freq_list ),5 ))#*np.NaN
@@ -659,7 +659,7 @@ def find_nearest(array,value):
659
659
#print ('Chi square for HH at %s MHz is: %6f ' % (np.mean(d.freqs),fit_H['chisq'],))
660
660
#print ('Chi square for VV at %s MHz is: %6f ' % (np.mean(d.freqs),fit_V['chisq'],))
661
661
length = len (T_SysTemp .elevation )
662
- Tsky_spec = 2.725 + 1.6 * (d .freqs [i ]/ 1e3 )** - 2.75 # T_SysTemp.Tsys_sky is Tsys-(Tsky-cmb) . We then add the spec sky aproxx (T_gal+Tcmb)
662
+ Tsky_spec = 2.725 + 1.6 * (d .freqs [i ]/ 1e3 )** - 2.75 # T_SysTemp.Tsys_sky is Tsys-(Tsky-cmb) . We then add the spec sky aproxx (T_gal+Tcmb)
663
663
tsys [0 :length ,i ,0 ] = (np .array (T_SysTemp .Tsys_sky ['HH' ])+ Tsky_spec )/ aperture_efficiency .eff ['HH' ](d .freqs [i ])
664
664
tsys [0 :length ,i ,1 ] = (np .array (T_SysTemp .Tsys_sky ['VV' ])+ Tsky_spec )/ aperture_efficiency .eff ['VV' ](d .freqs [i ])
665
665
tsys [0 :length ,i ,2 ] = T_SysTemp .elevation
@@ -695,26 +695,26 @@ def find_nearest(array,value):
695
695
#break
696
696
697
697
fig = plt .figure (None ,figsize = (8 ,8 ))
698
- text = r"""The 'tipping curve' is calculated according to the expression below, with the parameters
699
- of $T_{\mathrm{ant}}$ and $\tau_{0}$, the Antenna temperature and the atmospheric opacity respectively. All the
698
+ text = r"""The 'tipping curve' is calculated according to the expression below, with the parameters
699
+ of $T_{\mathrm{ant}}$ and $\tau_{0}$, the Antenna temperature and the atmospheric opacity respectively. All the
700
700
variables are also functions of frequency.
701
701
702
702
$T_{\mathrm{sys}}(\mathrm{el}) = T_{\mathrm{cmb}}(\mathrm{ra,dec}) + T_{\mathrm{gal}}(\mathrm{ra,dec}) + T_{\mathrm{atm}}*(1-\exp\left(\frac{-\tau_{0}}{\sin(\mathrm{el})}\right)) + T_{\mathrm{spill}}(\mathrm{el}) + T_{\mathrm{ant}} + T_{\mathrm{rx}}$
703
703
704
704
$T_{\mathrm{sys}}(\mathrm{el})$ is determined from the noise diode calibration so it is $\frac{T_{\mathrm{sys}}(\mathrm{el})}{\eta_{_{\mathrm{illum}}}}$
705
705
706
- We assume the opacity and $T_{\mathrm{ant}}$ is the residual after the tipping curve function is calculated.
706
+ We assume the opacity and $T_{\mathrm{ant}}$ is the residual after the tipping curve function is calculated.
707
707
$T_{\mathrm{cmb}}$ + $T_{\mathrm{gal}}$ is obtained from the Sky model. """
708
708
if fix_opacity :
709
- text += r"""$\tau_{0}$, the zenith opacity, is set to 0.01078
710
- (Van Zee et al., 1997). $T_{\mathrm{ant}}$ is the excess temperature since the other components are
709
+ text += r"""$\tau_{0}$, the zenith opacity, is set to 0.01078
710
+ (Van Zee et al., 1997). $T_{\mathrm{ant}}$ is the excess temperature since the other components are
711
711
known. """
712
712
else :
713
- text += r"""$\tau_{0}$, the zenith opacity, is the calculated opacity
714
- according to ITU-R P.676-9. $T_{\mathrm{ant}}$ is the excess temperature since the other components are
713
+ text += r"""$\tau_{0}$, the zenith opacity, is the calculated opacity
714
+ according to ITU-R P.676-9. $T_{\mathrm{ant}}$ is the excess temperature since the other components are
715
715
known. """
716
716
717
- text += r"""The green solid lines in the figures reflect the modelled $T_{\mathrm{sys}}(\mathrm{el})$ or $T_{\mathrm{sys}}(\mathrm{freq})$, with the
717
+ text += r"""The green solid lines in the figures reflect the modelled $T_{\mathrm{sys}}(\mathrm{el})$ or $T_{\mathrm{sys}}(\mathrm{freq})$, with the
718
718
broken green lines indicating a $\pm10\%$ margin."""
719
719
720
720
params = {'font.size' : 10 }
0 commit comments