diff --git a/flint/summary.py b/flint/summary.py index 777292f9..325efe3c 100644 --- a/flint/summary.py +++ b/flint/summary.py @@ -1,5 +1,6 @@ """Summary containers intended to hold general information obtained throughout a processing run. """ + from __future__ import ( # Used for mypy/pylance to like the return type of MS.with_options annotations, ) diff --git a/flint/validation.py b/flint/validation.py index 0ab749e7..19176586 100644 --- a/flint/validation.py +++ b/flint/validation.py @@ -451,21 +451,29 @@ def plot_flag_summary( ms_summaries = sorted( [mss for mss in field_summary.ms_summaries], key=lambda x: x.beam ) + accumulated_flags = 0 + accumulated_samples = 0 for ms_summary in ms_summaries: flag_spectrum = ms_summary.flag_spectrum + accumulated_flags += np.sum(np.nan_to_num(flag_spectrum)) + accumulated_samples += len(flag_spectrum) ax.plot( np.arange(len(flag_spectrum)), flag_spectrum, label=f"{ms_summary.beam:02d}", lw=0.5, ) + + percent_sbid_flagged = accumulated_flags / accumulated_samples * 100.0 ax.legend(ncols=18, title="Beam Number", loc="lower left") + ax.grid() + ax.axhline(0.0, color="black") ax.set( xlabel="Channel", ylabel="Flagged fraction", - ylim=(0, 1.1), + ylim=(-0.3, 1.1), aspect="auto", - title="Flagging summary", + title=f"Flagging summary - {percent_sbid_flagged:.2f}% of {field_summary.sbid} flagged", ) return ax @@ -1059,7 +1067,8 @@ def plot_field_info( f"- Galactic l / b : {rms_info.centre.galactic.to_string(style='decimal')}", f"- SBID : {field_summary.sbid}", f"- CAL_SBID : {field_summary.cal_sbid}", - f"- Holorgraphy file : {field_summary.holography_path.name if field_summary.holography_path else 'N/A'}", + "- Holorgraphy file : ", + f" {field_summary.holography_path.name if field_summary.holography_path else 'N/A'}", f"- Start time : {field_summary.ms_times[0].utc.fits}", f"- Integration time : {field_summary.integration_time * u.second:latex_inline}", f"- Hour angle range : {hour_angles.min().to_string(precision=2, format='latex_inline')} - {hour_angles.max().to_string(precision=2, format='latex_inline')}",