cheta.fix_bad_values#

Fix bad values that are in the engineering archive.

Typically this is needed because of bad telemetry that is not marked as such in the CXC archive. This code will mark a single value or range of values as bad (via the quality flag) and re-run the statistics computations. The database (HDF5 file) values are updated in place.

Usage:

cheta_fix_bad_values [-h] [--msid MSID] [--start START] [--stop STOP]
                         [--run] [--data-root DATA_ROOT]

Fix bad values in eng archive

optional arguments:
  -h, --help            show this help message and exit
  --msid MSID           MSID name
  --start START         Start time of bad values
  --stop STOP           Stop time of bad values (default is start + 1 msec)
  --run                 Actually modify files (dry run is the default)
  --data-root DATA_ROOT
                        Engineering archive root directory for MSID and arch
                        files

Example:

# First dry run
% cheta_fix_bad_values --msid aorate3 --start=2013:146:16:12:44.600                         --data-root=/proj/sot/ska/data/eng_archive

# Now the real thing
% cheta_fix_bad_values --msid aorate3 --start=2013:146:16:12:44.600                         --data-root=/proj/sot/ska/data/eng_archive --run

% emacs NOTES.fix_bad_values  # copy the above into NOTES for the record

Functions#

_set_msid_files_basedir(datestart)

If datestart is before 2000:001:00:00:00 then use the 1999 archive files.

get_opt()

calc_stats_vals(msid, rows, indexes, interval)

fix_stats_h5(msid, tstart, tstop, interval)

fix_msid_h5(msid, tstart, tstop)

Fix the msid full-resolution HDF5 data file

main()