suncasa.eovsa.eovsa_flare_pipeline

Attributes

timer_start

ia

ms

msmd

tb

Classes

FlareSelfCalib

FlareSelfCalib provides a pipeline for self-calibration and imaging of EOVSA solar flare data.

Functions

run_command(command[, use_sudo])

Helper function to run a command with or without sudo privileges.

get_user_confirmation(prompt)

Prompt the user to enter 'yes' or 'no' and return the response.

Module Contents

suncasa.eovsa.eovsa_flare_pipeline.timer_start[source]
suncasa.eovsa.eovsa_flare_pipeline.ia[source]
suncasa.eovsa.eovsa_flare_pipeline.ms[source]
suncasa.eovsa.eovsa_flare_pipeline.msmd[source]
suncasa.eovsa.eovsa_flare_pipeline.tb[source]
suncasa.eovsa.eovsa_flare_pipeline.run_command(command, use_sudo=False)[source]

Helper function to run a command with or without sudo privileges.

suncasa.eovsa.eovsa_flare_pipeline.get_user_confirmation(prompt)[source]

Prompt the user to enter ‘yes’ or ‘no’ and return the response.

Parameters:

prompt (str) – The message to display to the user.

Returns:

True if the user enters ‘yes’, False if the user enters ‘no’.

Return type:

bool

class suncasa.eovsa.eovsa_flare_pipeline.FlareSelfCalib(vis=None, workpath='./', logfile=None)[source]

FlareSelfCalib provides a pipeline for self-calibration and imaging of EOVSA solar flare data.

This class handles the detection of flare times and locations, self-calibration of visibility data, and final imaging steps for flare events, as well as renaming and moving the output files to designated web directories.

Parameters:
  • vis (str or object, optional) – Full path for the input visibility data or a pre-processed flare-calibrated dataset, defaults to None

  • workpath (str, optional) – Working directory path for pipeline outputs, defaults to ‘./’

  • logfile (str, optional) – Path to the logfile. If not provided, a default log file is generated based on the current time, defaults to None

Raises:

ValueError – If the input visibility (when provided as a string) does not exist.

Example

from suncasa.eovsa import eovsa_flare_pipeline from eovsapy.util import Time

trange_str = [‘2023-12-14T16:54:00’, ‘2023-12-14T17:10:00’] flare_id = ‘20231214170000’

# Initialize the pipeline with a given time range trange = Time(trange_str) fp = eovsa_flare_pipeline.FlareSelfCalib(vis=trange)

# Run the self-calibration and imaging pipeline fp.slfcal_pipeline(doselfcal=True, doimaging=True)

# Rename and move the output files to the designated web directories fp.rename_move_files(

flare_id=flare_id, fitsdir_web_tp=’/data1/eovsa/fits/flares/’, movdir_web_tp=’/common/webplots/SynopticImg/eovsamedia/eovsa-browser/’, msdir_web_tp=’/data1/eovsa/fits/flares/’, dorename_fits=True, domove_fits=True, dorename_mov=True, domove_mov=True, domove_ms=True, dormworkdir=True, docopy=True

)

Returns:

None

Return type:

None

workpath = './'[source]
property vis[source]

Getting the input visibility for self-calibration

num_spws = 50[source]
logfile = None[source]
identify_data_gap = True[source]
property slfcal_spws[source]

Rteurn the spws chosen for selfcal

maximum_spw[source]
minimum_spw[source]
slfcal_spwstr = ''[source]
selfcal_spw = '0~'[source]
imaging_spw = [][source]
min_DR_threshold = 12.0[source]
total_duration = 480.0[source]
final_image_cadence = 12[source]
final_image_int = 12[source]
min_restoring_beam = 6.0[source]
beam_1GHz = '89.7arcsec'[source]
cell_size = 2.0[source]
final_imsize = 512[source]
imaging_start = None[source]
imaging_end = None[source]
slfcaldir = './slfcal/'[source]
imagedir = './slfcal/images/'[source]
caltbdir = './slfcal/caltables/'[source]
maskdir = './slfcal/masks/'[source]
imagedir_slfcaled = './slfcal/images_slfcal'[source]
redo_selfcal = True[source]
refantenna = '0'[source]
calc_cell = True[source]
cell = [10][source]
calc_imsize = True[source]
max_frac_freq_avg = 0.5[source]
maxiter = 10[source]
uvlim = 25[source]
avg_spw_max = 5[source]
flag_antennas = ''[source]
phasecenter = ''[source]
flare_time_available = False[source]
flare_loc_available = False[source]
flare_location = None[source]
flare_peaktime = ''[source]
flare_peak_intensity = [][source]
outfits_list = [][source]
outmovie = ''[source]
vis_info()[source]
static get_img_center_heliocoords(images)[source]

Provide a set of images in helioprojective coordinates (at different frequencies), find the peak location :param images: :type images: list of fits image files

Returns:

xycen

Return type:

solar x and y coordinates, in arcsec

static get_img_peak_intensity(images)[source]

Provide a set of images in helioprojective coordinates (at different frequencies), find the peak intensity for each spw :param images: :type images: list of fits image files

Returns:

peak_intensity

Return type:

in the unit same as one from image (eg. in K)

static find_sidelobe_level(image)[source]
static check_shift(image, shift, cell)[source]
static grow_mask(image, mask, thres)[source]
static get_spw_num(visibility)[source]
static get_descids(visibility)[source]

Retrieve actual descids from the DATA_DESCRIPTION table. Unusually, the DATA_DESCRIPTION table may contain duplicated rows featuring the same SPECTRAL_WINDOW_ID, yet pointing to null or dummy data. This can cause a KeyError: ‘axis_info’ when attempting to read the ‘data’ variable in calc_cellsize, as the loop iterating over ‘i’ in ms.selectinit(datadescid=i) within calc_cellsize fails to locate the corresponding data due to its non-existence.

Parameters:

visibility

Returns:

static calc_cellsize(visibility)[source]
static get_ref_freqlist(visibility)[source]
static read_bandpass(bptable, nant=16)[source]
static combine_groups(group, pos)[source]
static gen_fof_groups(data3, thres)[source]
gen_mask(image1, image2, mask1, mask2, threshold, imsize, s, make_shifted_mask=False, grow_threshold=0.5)[source]

We will allow for small shifts and small change of size ere

confirm_maximum_pixel(imagename, mask, spwran, msname, uvrange, imsize, cell, s)[source]
static restore_previous_condition(imagename)[source]
static flag_data_gap(visibility, sp)[source]
get_img_stat(imagename)[source]
flare_finder()[source]

Provide input visibility, find out the flare peak time, flare duration, and suitable time ranges for performing self-calibration

produce_required_inputs_from_flare_time(num_spws)[source]
find_previous_image(spw)[source]
gen_blank_cal(spw)[source]
find_phasecenter()[source]

The purpose of this module is to find a new phasecenter at the flare location for imaging :rtype: Updates self.phasecenter (in J2000 RA and DEC) to be the flare location

do_selfcal(slfcalms, sp, spwran, uvrange='', cell_val='2arcsec', imsize=2048, ref_image='', make_shifted_mask=False, combine_spws=False)[source]
calling_do_selfcal(slfcalms, s, uvrange='', cell_val='2arcsec')[source]
slfcal_init()[source]
flare_ms_calib(value)[source]
slfcal_pipeline(doselfcal=True, doimaging=False)[source]
rename_move_files(flare_id, fitsdir_web_tp, movdir_web_tp, msdir_web_tp=None, dorename_fits=False, domove_fits=False, dorename_mov=False, domove_mov=False, domove_ms=False, dormworkdir=False, docopy=False)[source]

Rename EOVSA FITS/movie/ms/slfcal_ms files and move them to the web folder ‘eovsa.lev1_mbd_12s.2022-11-12T180524Z.image.fits’ ‘eovsa.lev1_mbd_12s.flare_id_20221112180200.mp4’ ‘IDB20221112_1801-1811.ms’ to ‘20221112180200.calibrated.ms.tar.gz’ ‘IDB20221112_1801-1811_selfcaled.ms’ to ‘20221112180200.selfcalibrated.ms.tar.gz’

fitsdir_web_tp = ‘/data1/eovsa/fits/flares/’ #’YYYY/MM/DD/flare_id/’ movdir_web_tp = ‘/common/webplots/SynopticImg/eovsamedia/eovsa-browser/’ #’YYYY/MM/DD/’ msdir_web_tp = ‘/data1/eovsa/fits/flares/’ #’YYYY/MM/DD/flare_id/’