Skip to content

Commit

Permalink
Rearrange plotting section and allow listobs only
Browse files Browse the repository at this point in the history
  • Loading branch information
Athanaseus committed Nov 18, 2023
1 parent 9378677 commit 59ffd60
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 33 deletions.
44 changes: 24 additions & 20 deletions rfinder/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,13 +426,15 @@ def go(self,cfg_par):
rfiFL.rfi_frequency(self.cfg_par,-1)
self.logger.warning("------ RFI saved to table ------\n")
self.logger.warning("------ End of RFI analysis ------\n")

else:
rfi.load_from_ms(self.cfg_par,0,0)
self.logger.warning("------ MSfile Loaded -----\n")

task = 'plots'

if self.cfg_par[task]['plot_summary']['enable']==True:
summary_results = {}
if not self.cfg_par['rfi']['rfi_enable']:
rfi.load_from_ms(self.cfg_par,0,0)

for axis in self.cfg_par[task]['plot_summary']['axis']:
flag_stats = rfiST.get_flags_summary_stats(self.cfg_par, axis)
Expand All @@ -448,7 +450,7 @@ def go(self,cfg_par):

rfiFL.write_html_summaryreport(self.cfg_par)

if self.cfg_par[task]['plot_enable']==True:
if self.cfg_par[task]['plot_details']['enable']==True:

if self.cfg_par['rfi']['chunks']['time_enable']==True:

Expand Down Expand Up @@ -483,39 +485,40 @@ def go(self,cfg_par):

rfiPL.plot_rfi_imshow(self.cfg_par,i)
self.logger.info("------ RFI in 2D plotted ------\n")
self.cfg_par['plots']['plot_noise'] = 'rfi'
self.cfg_par['plots']['long_short'] = False
self.cfg_par['plots']['plot_details']['plot_noise'] = 'rfi'
self.cfg_par['plots']['plot_details']['long_short'] = False
rfiPL.plot_noise_frequency(self.cfg_par,i)
self.cfg_par['plots']['long_short'] = True
self.cfg_par['plots']['plot_details']['long_short'] = True
rfiPL.plot_noise_frequency(self.cfg_par,i)
self.cfg_par['plots']['plot_noise'] = 'noise_factor'
self.cfg_par['plots']['plot_details']['plot_noise'] = 'noise_factor'
rfiPL.plot_noise_frequency(self.cfg_par,i)
self.cfg_par['plots']['plot_noise'] = 'noise'
self.cfg_par['plots']['plot_details']['plot_noise'] = 'noise'
rfiPL.plot_noise_frequency(self.cfg_par,i)
self.logger.warning("------ RFI in 1D plotted ------\n")

rfiPL.plot_altaz(self.cfg_par,68)
self.logger.warning("------ RFI in ALT/AZ plotted ------\n")

if (self.cfg_par['plots']['movies']['altaz_gif']==True or self.cfg_par['plots']['movies']['2d_gif']==True or
self.cfg_par['plots']['movies']['1d_gif']==True):
if (self.cfg_par['plots']['plot_details']['movies']['altaz_gif']==True or
self.cfg_par['plots']['plot_details']['movies']['2d_gif']==True or
self.cfg_par['plots']['plot_details']['movies']['1d_gif']==True):
self.logger.warning("------ Making movies ------\n")

if self.cfg_par['plots']['movies']['altaz_gif']==True:
if self.cfg_par['plots']['plot_details']['movies']['altaz_gif']==True:

out_animation = self.cfg_par['general']['moviedir']+'AltAz_movie.gif'
filenames = rfiFL.find_altaz_plots(self.cfg_par)
rfiPL.gif_me_up(self.cfg_par,filenames,out_animation)
self.logger.info("------ AltAz movie done ------\n")

if self.cfg_par['plots']['movies']['2d_gif']==True:
if self.cfg_par['plots']['plot_details']['movies']['2d_gif']==True:
out_animation = self.cfg_par['general']['moviedir']+'Time_2Dplot_movie.gif'
filenames = rfiFL.find_2d_plots(self.cfg_par)
rfiPL.gif_me_up(self.cfg_par,filenames,out_animation)

self.logger.info("------ 2D movie done ------\n")

if self.cfg_par['plots']['movies']['1d_gif']==True:
if self.cfg_par['plots']['plot_details']['movies']['1d_gif']==True:
out_animation = self.cfg_par['general']['moviedir']+'TimeChunks_1D_flags.gif'
root_name = 'flags'
filenames = rfiFL.find_1d_plots(self.cfg_par,root_name)
Expand All @@ -532,8 +535,9 @@ def go(self,cfg_par):
rfiPL.gif_me_up(self.cfg_par,filenames,out_animation)
self.logger.info("------ 1D movies done ------\n")

if (self.cfg_par['plots']['movies']['altaz_gif']==True or self.cfg_par['plots']['movies']['2d_gif']==True or
self.cfg_par['plots']['movies']['1d_gif']==True):
if (self.cfg_par['plots']['plot_details']['movies']['altaz_gif']==True or
self.cfg_par['plots']['plot_details']['movies']['2d_gif']==True or
self.cfg_par['plots']['plot_details']['movies']['1d_gif']==True):
self.logger.warning("------ Movies done ------\n")

rfiFL.write_html_timereport(self.cfg_par)
Expand All @@ -554,14 +558,14 @@ def go(self,cfg_par):
self.logger.warning("------ Alt/Az plotted ------\n")
rfiPL.plot_rfi_imshow(self.cfg_par,-1)
self.logger.warning("------ RFI in 2D plotted ------\n")
self.cfg_par['plots']['plot_noise'] = 'rfi'
self.cfg_par['plots']['long_short'] = False
self.cfg_par['plots']['plot_details']['plot_noise'] = 'rfi'
self.cfg_par['plots']['plot_details']['long_short'] = False
rfiPL.plot_noise_frequency(self.cfg_par,-1)
self.cfg_par['plots']['long_short'] = True
self.cfg_par['plots']['plot_details']['long_short'] = True
rfiPL.plot_noise_frequency(self.cfg_par,-1)
self.cfg_par['plots']['plot_noise'] = 'noise_factor'
self.cfg_par['plots']['plot_details']['plot_noise'] = 'noise_factor'
rfiPL.plot_noise_frequency(self.cfg_par,-1)
self.cfg_par['plots']['plot_noise'] = 'noise'
self.cfg_par['plots']['plot_details']['plot_noise'] = 'noise'
rfiPL.plot_noise_frequency(self.cfg_par,-1)
self.logger.warning("------ RFI in 1D plotted ------\n")

Expand Down
2 changes: 1 addition & 1 deletion rfinder/rfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class rfi:
def __init__(self):

self.logger = logging.getLogger('log-rfinder.log')
#self.logger.setLevel(logging.INFO)
self.logger.setLevel(logging.INFO)

#fh = logging.FileHandler('log-rfinder.log')
#fh.setLevel(logging.INFO)
Expand Down
24 changes: 13 additions & 11 deletions rfinder/rfinder_default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ general:

rfi:
__helpstr: Find RFI in msfile over threshold
rfi_enable: true #if True this module is enabled
rfi_enable: true #if True this module is enabled else only obs info will logged
polarization: 'q' #xx, yy, xy, yx, q (also in CAPS)
bad_antenna: '[]' #list of bad antennas: for no antennas try '[]'
RFInder_mode: 'use_flags' #uses RFI clip method or simply reads the FLAG column 'use_flags' / 'rms_clip'
Expand All @@ -34,17 +34,19 @@ rfi:

plots:
__helpstr: plot rfi over different axes
plot_enable: true
plot_noise: 'rfi' #choose to plot % of RFI, 'rfi', or noise, 'noise', or factor of noise increase, 'noise_factor' in 1D plots
plot_long_short: true #plot all baselines, or only the short and the long
plot_detail:
__helpstr: plot formats
enable: true
plot_noise: 'rfi' #choose to plot % of RFI, 'rfi', or noise, 'noise', or factor of noise increase, 'noise_factor' in 1D plots
plot_long_short: true #plot all baselines, or only the short and the long
movies:
__helpstr: make movies of output plots
2d_gif: true
1d_gif: true
altaz_gif: true
movies_in_report: true
plot_summary:
__helpstr: plot total % flagged visibilities
enable: true
axis: [ant, scan, corr] # Avalable choices [ant, corr, scan]
axis: [ant, scan, corr, freq] #avalable choices [ant, corr, scan, freq]
report: true
movies:
__helpstr: make movies of output plots
2d_gif: true
1d_gif: true
altaz_gif: true
movies_in_report: true
2 changes: 1 addition & 1 deletion rfinder/rfinder_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class rfi_stats:
def __init__(self):

self.logger = logging.getLogger('log-rfinder.log')
#self.logger.setLevel(logging.INFO)
self.logger.setLevel(logging.INFO)

#fh = logging.FileHandler('log-rfinder.log')
#fh.setLevel(logging.INFO)
Expand Down

0 comments on commit 59ffd60

Please sign in to comment.