Skip to content

Commit 7ef4f79

Browse files
committed
Skeleton of a report routine.
1 parent c6d1a95 commit 7ef4f79

1 file changed

Lines changed: 27 additions & 6 deletions

File tree

src/astrohack/core/beamcut.py

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77

88
from astrohack import get_proper_telescope
99
from astrohack.utils.file import load_holog_file
10-
from astrohack.utils import create_dataset_label, data_statistics, statistics_to_text, convert_unit, sig_2_fwhm, \
11-
format_frequency, format_value_unit, to_db, fontsize
10+
from astrohack.utils import create_dataset_label, convert_unit, sig_2_fwhm, \
11+
format_frequency, format_value_unit, to_db
1212
from astrohack.visualization import create_figure_and_axes, scatter_plot, close_figure
1313
from astrohack.visualization.plot_tools import set_y_axis_lims_from_default
14-
import matplotlib.ticker as mticker
14+
15+
lnbr = '\n'
1516

1617

1718
def process_beamcut_chunk(beamcut_chunk_params):
@@ -57,6 +58,7 @@ def process_beamcut_chunk(beamcut_chunk_params):
5758

5859
plot_cuts_in_amplitude(cut_list, summary, beamcut_chunk_params)
5960
plot_cuts_in_attenuation(cut_list, summary, beamcut_chunk_params)
61+
create_report_chunk(cut_list, summary, beamcut_chunk_params)
6062

6163
def time_scan_selection(scan_time_ranges, time_axis):
6264
time_selections = []
@@ -207,13 +209,13 @@ def add_lobe_identification_to_plot(ax, centers, peaks, y_off, attenunation_plot
207209
ax.text(centers[i_peak], peak+y_off, f'{i_peak+1})', ha='center', va='bottom')
208210

209211

210-
def make_parallel_hand_subplot_title(direction, time_string):
212+
def make_parallel_hand_sub_title(direction, time_string):
211213
return f'{direction}, {time_string} UTC'
212214

213215

214216
def plot_single_cut_amp_parallel_corrs(cut_dict, axes, par_dict):
215217
# Init
216-
sub_title = make_parallel_hand_subplot_title(cut_dict["direction"], cut_dict["time_string"])
218+
sub_title = make_parallel_hand_sub_title(cut_dict["direction"], cut_dict["time_string"])
217219
max_amp = cut_dict['max_amp']
218220
y_off = 0.05*max_amp
219221
lm_unit = par_dict['lm_unit']
@@ -277,6 +279,7 @@ def create_beamcut_header(summary, par_dict):
277279
title += f'El ~ {format_value_unit(mean_azel[1], 'deg', decimal_places=0)}'
278280
return title
279281

282+
280283
def plot_cuts_in_amplitude(cut_list, summary, par_dict):
281284
# Init
282285
n_cuts = len(cut_list)
@@ -355,7 +358,7 @@ def beamcut_fit(cut_list, telescope, summary):
355358

356359

357360
def plot_single_cut_attenuation_parallel_corrs(cut_dict, ax, par_dict):
358-
sub_title = make_parallel_hand_subplot_title(cut_dict["direction"], cut_dict["time_string"])
361+
sub_title = make_parallel_hand_sub_title(cut_dict["direction"], cut_dict["time_string"])
359362
lm_unit = par_dict['lm_unit']
360363
lm_fac = convert_unit('rad', lm_unit, 'trigonometric')
361364
corr_colors = ['blue', 'red']
@@ -425,4 +428,22 @@ def plot_cuts_in_attenuation(cut_list, summary, par_dict):
425428
close_figure(fig, title, filename, par_dict['dpi'], par_dict['display'])
426429

427430

431+
def create_report_chunk(cut_list, summary, par_dict):
432+
outstr = ''
433+
434+
outstr += create_beamcut_header(summary, par_dict)+2*lnbr
435+
for icut, cut_dict in enumerate(cut_list):
436+
sub_title = make_parallel_hand_sub_title(cut_dict["direction"], cut_dict["time_string"])
437+
for i_corr, parallel_hand in enumerate(cut_dict['available_corrs']):
438+
outstr += f'{parallel_hand} {sub_title}{lnbr}'
439+
440+
outstr += lnbr
441+
442+
outstr += lnbr
443+
444+
print(outstr)
445+
446+
447+
448+
428449

0 commit comments

Comments
 (0)