CASA Contributed Script: flag reason stats
From CASA Guides
List Flag Statistics for each "Reason"
\Flag_reason_stats.py is a script that can list the statistics of flags in categories of "reason".
- Download Script: File:Flag reason stats.py
Here is an example, on a small MS where spw=8 is filled with exact zeros, spw='9' has RFI, and I want to clip zeros and run tfcrop, and count zeros and RFI separately.
execfile('flag_reason_stats.py'); CASA <17>: countlist = task_reason_stats(msname='Four_ants_3C286.ms',spw='8,9'); Summary 0 ( Zeros ) : Flagged : 274944.0 out of 549888.0 Summary 1 ( TFCrop ) : Flagged : 18633.0 out of 549888.0 CASA <18>: countlist = task_reason_stats(msname='Four_ants_3C286.ms',spw='9'); Summary 0 ( Zeros ) : Flagged : 0.0 out of 274944.0 Summary 1 ( TFCrop ) : Flagged : 18633.0 out of 274944.0 CASA <19>: countlist = task_reason_stats(msname='Four_ants_3C286.ms',spw='8'); Summary 0 ( Zeros ) : Flagged : 274944.0 out of 274944.0 Summary 1 ( TFCrop ) : Flagged : 0.0 out of 274944.0