HOW-TO Subwindow statistics

To make it easier to do automatic quality control, statistics in sub-windows are derived for calibration files (including raw frames). On the basis of these statistics various tests can be derived in order to disqualify bad data.

How to work with subwindows

Statistics in subwindows are stored in the form of the SubWinStat class. This class has a “frame” dependency pointing to the frame the statistics were derived from. The class hierarchy here may be somewhat counter-intuitive: there is no link from e.g. a RawBiasFrame to a SubWinStat object, instead there is one from the SubWinStat object to the RawBiasFrame. Therefore, to get the subwindow statistics for a particular frame, the following queries should be done:

awe> raw = (RawDarkFrame.filename == 'WFI.2001-03-27T21:24:07.546_7.fits')[0]
awe> subwin = (SubWinStat.frame == raw)[0]

The SubWinStat class also has a dependency “windows”, which contains a list of Imstat objects, which in turn house the statistics such as “mean”, “median”, “stdev” etc. The Imstat class also contains attributes “x_lower”, “x_upper”, “y_lower”, and “y_upper” defining the region the statistics were derived from. Example:

awe> for w in subwin.windows: print w.x_lower, w.y_lower, w.x_upper, w.y_upper
...
49 1 559 512
49 513 559 1024
49 1025 559 1536
49 1537 559 2048
49 2049 559 2560
49 2561 559 3072
49 3073 559 3584
49 3585 559 4096
560 1 1070 512
560 513 1070 1024
560 1025 1070 1536
560 1537 1070 2048
560 2049 1070 2560
560 2561 1070 3072
560 3073 1070 3584
560 3585 1070 4096
1071 1 1581 512
1071 513 1581 1024
1071 1025 1581 1536
1071 1537 1581 2048
1071 2049 1581 2560
1071 2561 1581 3072
1071 3073 1581 3584
1071 3585 1581 4096
1582 1 2092 512
1582 513 2092 1024
1582 1025 2092 1536
1582 1537 2092 2048
1582 2049 2092 2560
1582 2561 2092 3072
1582 3073 2092 3584
1582 3585 2092 4096

There are 4 groups of 8 subwindows here for a total of 32 subwindows, the default.

Verify

A number of verify methods are implemented that use subwindows. The actual checks are TBD or improved by experience.

Deriving SubWinStat yourself

For RegriddedFrames and CoaddedRegriddedFrames subwindow statistics are not derived by default. It is possible to create subwindow statistics for these images if you want to, however. Example:

awe> query = CoaddedRegriddedFrame.filename == 'Sci-GVERDOES-WFI-------#844---C
oadd---Sci-53814.4484972.fits'
awe> frame = query[0]
awe> sub = SubWinStat()
awe> sub.frame = frame
awe> sub.process_params.NUMBER_OF_WINDOWS_X = 10
awe> sub.process_params.NUMBER_OF_WINDOWS_Y = 15
awe> sub.make()
awe> sub.commit()