Skip to content

Commit

Permalink
Handle missing plots in report
Browse files Browse the repository at this point in the history
  • Loading branch information
Athanaseus committed Nov 23, 2023
1 parent 6cc4cf7 commit 8a867e5
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions rfinder/rfinder_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,9 +468,17 @@ def write_html_summaryreport(cfg_par):
image_encoded4 = None

if cfg_par['plots']['plot_summary']['report'] == True:
image_tags = {}
if image_encoded1:
image_tags['video_tag1'] = '<img class="h" src="data:image/png;base64,{0}">'.format(image_encoded1.decode())
if image_encoded2:
image_tags['video_tag2'] = '<img class="a" src="data:image/png;base64,{0}">'.format(image_encoded2.decode())
if image_encoded3:
image_tags['video_tag3'] = '<img class="c" src="data:image/png;base64,{0}">'.format(image_encoded3.decode())
if image_encoded4:
image_tags['video_tag4'] = '<img class="g" src="data:image/png;base64,{0}">'.format(image_encoded4.decode())

with open(cfg_par['general']['rfidir']+'summary_report.html', "w") as f:
# lenghts = np.array([cfg_par['rfi']['baseline_lenghts']])+0.
f.write(template.render(
title=title,
fieldname=cfg_par['general']['fieldname'],
Expand All @@ -483,16 +491,10 @@ def write_html_summaryreport(cfg_par):
enddate = ('{0:%y}{0:%b}{0:%d} {0:%X}'.format(cfg_par['rfi']['enddate'].datetime)),
nant = cfg_par['rfi']['nant'],
ant_names = cfg_par['rfi']['ant_names'],
# maxbase = str(np.round(lenghts[0][-1],0)),
# minbase = str(np.round(lenghts[0][0],0)),
# totbase = cfg_par['rfi']['number_baseline'],
exptime = np.round(cfg_par['rfi']['exptime']*60.,2),
polnum = cfg_par['rfi']['polnum'],
noise = np.round(cfg_par['rfi']['theo_rms'][0]*1e3,5),
video_tag1 = '<img class="h" src="data:image/png;base64,{0}">'.format(image_encoded1.decode()),
video_tag2 = '<img class="a" src="data:image/png;base64,{0}">'.format(image_encoded2.decode()),
video_tag3 = '<img class="c" src="data:image/png;base64,{0}">'.format(image_encoded3.decode()),
video_tag4 = '<img class="g" src="data:image/png;base64,{0}">'.format(image_encoded4.decode())
**image_tags
))


Expand Down

0 comments on commit 8a867e5

Please sign in to comment.