Return to directory of Todd's CASA extensions

Because measurement sets do not contain a column for the reason code for each flag, it is impossible to know how much data were flagged for which reason. This function writes an ASCII file of ALMA online (xml) flag commands for a measurement set, finds all the reason codes (using au.flagReasons), then applies them one at a time recording the statistics of data flagged by them using amc.getFlagdict.


au.flagReasonStats(vis, tbuff=0, useapplied=False, returnFullDictionary=False, verbose=True,
        copyvis=False, intent='')
  • vis: name of measurement set
  • tbuff: value in seconds to pass to flagdata
  • useapplied: Boolean to pass to the initial flagcmd to generate the flag list
  • returnFullDictionary: if True, return full dictionary; otherwise just the percent
  • verbose: if True, print progress reports
  • copyvis: if True, then copy dataset first to the working directory and work on the copy; otherwise, flagmanager is used to save/restore current flags. The copyvis parameter is useful if you do not have write permission on the measurement set or on its parent directory.
  • intent: passed to amc.getFlagdict to limit statistics to the specified intent

  • a dictionary of percentage values keyed by reason code string


CASA <8>: au.flagReasonStats('uid___A002_X74821d_Xfe0.ms',tbuff=3.0)
ACD_is_not_over_commanded_band_cartridge: 2.480997
ACD_motors_are_not_in_position.: 3.690666
FrontEnd_LO_Amps_not_optimized: 0.674380
Mount_is_off_source: 6.109103
Power_levels_are_being_optimized.: 0.727681
The_WCA_is_not_locked.: 7.839074
{'ACD_is_not_over_commanded_band_cartridge': 2.480997359790105,
 'ACD_motors_are_not_in_position.': 3.6906657545288915,
 'FrontEnd_LO_Amps_not_optimized': 0.6743803742733594,
 'Mount_is_off_source': 6.1091025258784875,
 'Power_levels_are_being_optimized.': 0.7276810747106018,
 'The_WCA_is_not_locked.': 7.839073937765359}

-- ToddHunter - 2014-11-15
Topic revision: r5 - 2015-09-25, ToddHunter
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding NRAO Public Wiki? Send feedback