Self-Calibrating Flare Data

From EOVSA Wiki
Jump to navigation Jump to search

As EOVSA does not calibrate as often as other general-purpose radio interferometers (e.g., VLA and ALMA), self-calibration is often needed in bringing out details of the flare at multiple frequencies. An example script, run in SunCASA, for doing self-calibration of the 2017 Aug 21 flare at ~20:20 UT can be found at this Github link. Here are some explanations on steps taken in this script.

Step 1: Preparation

EOVSA observes the full solar disk, so we can in principle image the entire solar disk and perform self-calibration. However, as flares usually happen in an active region within a limited field of view and outshines everything else on the disk, self-calibrating the entire field of view is normally not needed (unless there are multiple bright sources on the Sun simultaneously, particularly if the flare of interest is relatively weak). The first step of selfcal is to make a clean image for a short duration of the flare, when the source structure is relatively simple and the signal-to-noise ratio is high across as many frequencies as possible. We use the full Sun view to find out the better phase center and appropriate field of view for later steps.

# ============ Prior definitions for spectral windows, antennas, pixel numbers =========
spws=[str(s+1) for s in range(30)] # Use all 30 spectral windows available for imaging (the case for pre-2019 data)
antennas='0~12' 
npix=512
# parameters specific to the event (found from step 1)
phasecenter='J2000 10h02m59 11d58m14'
xran=[280,480]
yran=[-50,150]

# =========== Step 1, doing a full-Sun image to find out phasecenter and appropriate field of view =========
if dofullsun:
    #initial mfs clean to find out the image phase center
    im_init='fullsun_init'
    os.system('rm -rf '+im_init+'*')
    clean(vis=slfcalms,
            antenna='0~12',
            imagename=im_init,
            spw='1~15',
            mode='mfs',
            timerange=trange,
            imagermode='csclean',
            psfmode='clark',
            imsize=[npix],
            cell=['5arcsec'],
            niter=1000,
            gain=0.05,
            stokes='I',
            restoringbeam=['30arcsec'],
            interactive=False,
            pbcor=True,
            usescratch=True)

    hf.imreg(vis=slfcalms,imagefile=im_init+'.image',fitsfile=im_init+'.fits',
             timerange=trange,usephacenter=False,verbose=True)
    clnjunks = ['.flux', '.mask', '.model', '.psf', '.residual']
    for clnjunk in clnjunks:
        if os.path.exists(im_init + clnjunk):
            shutil.rmtree(im_init + clnjunk)

    from sunpy import map as smap
    from matplotlib import pyplot as plt 
    eomap=smap.Map(im_init+'.fits')
    eomap.data=eomap.data.reshape((npix,npix))
    eomap.plot_settings['cmap'] = plt.get_cmap('jet')
    eomap.plot()
    eomap.draw_limb()
    eomap.draw_grid()
    plt.show()
    viewer(im_init+'.image')