# import everything we need
import numpy as np
import matplotlib.pyplot as plt
from lofarSun.lofarData import LofarDataBF, LofarDataCleaned
lofar_bf = LofarDataBF()
# load data
lofar_bf.load_fits("demo_bf.fits")
# 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()
bf_res,bf_err = lofar_bf.bf_fit_gauss_source_by_idx(30,100)
print(bf_res)
print(bf_err)
# write the bfcube into fits:
lofar_bf.write_fits_full('.','test2.fits')
# process interferometry data
lofar_cleaned = LofarDataCleaned()
lofar_cleaned.load_fits('demo_cleaned.fits')
lofar_cleaned.plot_image()
# show information
lofar_cleaned.header