In [1]:
# import everything we need
import numpy as np
import matplotlib.pyplot as plt
from lofarSun.lofarData import LofarDataBF, LofarDataCleaned
In [2]:
lofar_bf = LofarDataBF()
# load data
lofar_bf.load_fits("demo_bf.fits")
In [3]:
# interpolate X,Y to get a beamform image
[X,Y,data_bf,x,y,Ibeam] = lofar_bf.bf_image_by_idx(30,100)

# plot
plt.imshow(data_bf, cmap='gist_heat',origin='lower',
                 extent=[np.min(X),np.max(X),np.min(Y),np.max(Y)])
plt.show()
In [4]:
bf_res,bf_err = lofar_bf.bf_fit_gauss_source_by_idx(30,100)
print(bf_res)
print(bf_err)
{'s0': 65.43724000434034, 'x_cent': -171.49582346710602, 'y_cent': -721.4920517421299, 'tile': 2.325420767575146, 'x_sig': 592.5638058223651, 'y_sig': 474.99511642396857}
{'s0': 2.552679929598186, 'x_cent': 180.7383260074285, 'y_cent': 275.21219676780805, 'tile': 0.022081139397659447, 'x_sig': 915.2896965231499, 'y_sig': 792.6006649079086}
In [5]:
# write the bfcube into fits:
lofar_bf.write_fits_full('.','test2.fits')
Data shape:
(58, 800, 215)
In [6]:
# process interferometry data
lofar_cleaned = LofarDataCleaned()
lofar_cleaned.load_fits('demo_cleaned.fits')
lofar_cleaned.plot_image()
117.19383027428259
In [7]:
# show information
lofar_cleaned.header
Out[7]:
SIMPLE  =                    T / file does conform to FITS standard             
BITPIX  =                  -32 / number of bits per data pixel                  
NAXIS   =                    4 / number of data axes                            
NAXIS1  =                 2048 / length of data axis 1                          
NAXIS2  =                 2048 / length of data axis 2                          
NAXIS3  =                    1 / length of data axis 3                          
NAXIS4  =                    1 / length of data axis 4                          
EXTEND  =                    T / FITS dataset may contain extensions            
COMMENT   FITS (Flexible Image Transport System) format is defined in 'Astronomy
COMMENT   and Astrophysics', volume 376, page 359; bibcode: 2001A&A...376..359H 
BSCALE  =                   1.                                                  
BZERO   =                   0.                                                  
BUNIT   = 'JY/BEAM '           / Units are in Jansky per beam                   
BMAJ    =   0.0762222758136721                                                  
BMIN    =   0.0177380617022592                                                  
BPA     =     143.313028413745                                                  
EQUINOX =                2000. / J2000                                          
BTYPE   = 'Intensity'                                                           
TELESCOP= 'LOFAR   '                                                            
OBSERVER= 'unknown '                                                            
OBJECT  = 'BEAM_0  '                                                            
ORIGIN  = 'WSClean '           / W-stacking imager written by Andre Offringa    
CTYPE1  = 'RA---SIN'           / Right ascension angle cosine                   
CRPIX1  =                1025.                                                  
CRVAL1  =        21.3308208333                                                  
CDELT1  = -0.000833333333333333                                                 
CUNIT1  = 'deg     '                                                            
CTYPE2  = 'DEC--SIN'           / Declination angle cosine                       
CRPIX2  =                1025.                                                  
CRVAL2  =             8.959625                                                  
CDELT2  = 0.000833333333333333                                                  
CUNIT2  = 'deg     '                                                            
CTYPE3  = 'FREQ    '           / Central frequency                              
CRPIX3  =                   1.                                                  
CRVAL3  =      26556396.484375                                                  
CDELT3  =             195312.5                                                  
CUNIT3  = 'Hz      '                                                            
CTYPE4  = 'STOKES  '                                                            
CRPIX4  =                   1.                                                  
CRVAL4  =                   1.                                                  
CDELT4  =                   1.                                                  
CUNIT4  = '        '                                                            
SPECSYS = 'TOPOCENT'                                                            
DATE-OBS= '2019-04-13T12:01:45.3'                                               
WSCDATAC= 'CORRECTED_DATA'                                                      
WSCVDATE= '2018-11-23'                                                          
WSCVERSI= '2.6.3   '                                                            
WSCWEIGH= 'Briggs''(0.2)'                                                       
WSCENVIS=     364.312750702007                                                  
WSCFIELD=                   0.                                                  
WSCGAIN =                  0.1                                                  
WSCGKRNL=                   7.                                                  
WSCIMGWG= 0.000318930100078365                                                  
WSCMAJOR=                   7.                                                  
WSCMGAIN=                  0.7                                                  
WSCMINOR=                1100.                                                  
WSCNEGCM=                   1.                                                  
WSCNEGST=                   0.                                                  
WSCNITER=                2000.                                                  
WSCNORMF= 0.000318930100078365                                                  
WSCNVIS =                8925.                                                  
WSCNWLAY=                  40.                                                  
WSCTHRES=                   0.                                                  
WSCTIMEE=                7080.                                                  
WSCTIMES=                6995.                                                  
WSCVWSUM=  0.00150515504766302                                                  
HISTORY wsclean -j 40 -mem 80 -no-reorder -no-update-model-required -mgain 0.7 -
HISTORY weight briggs 0.2 -size 2048 2048 -scale 3asec -pol I -auto-mask 5 -mult
HISTORY iscale -auto-threshold 1 -data-column CORRECTED_DATA -niter 2000 -interv
HISTORY als-out 85 -interval 6995 7080 -fit-beam -make-psf -name /data/scratch/z
HISTORY hang/fits_20190413_weak/SB008 /data/scratch/zhang/MS/L701913_SAP000_SB00
HISTORY 8_autow_uv.MS                                                           
In [ ]: