Averages images of the stack, deletes the stack and returns an average and its error image. More...
Public Member Functions | |
def | __init__ |
Make a Hermes component and initialize variables. | |
def | optionsAreValid |
User may give options. | |
def | __call__ |
component runs from here | |
Public Member Functions inherited from hermes.pipeline.core.pipelinecomponent.PipelineComponent | |
def | __init__ |
def | __call__ |
def | optionsAreValid |
def | getOptions |
def | setOptions |
def | checkExistShapeUnits |
def | isOption |
Public Attributes | |
imageStackTolerance | |
See if user gave a tolerance, else use default = 4. | |
isSimpleAverage | |
User can deactivate this feature and use a "clipped" average instead. | |
isQualityCheck | |
User can perform a quality check. | |
isInputStackKept | |
General options for program usage. | |
isDebug | |
isDebug can generate some intermediary files More... | |
results | |
Public Attributes inherited from hermes.pipeline.core.pipelinecomponent.PipelineComponent | |
options | |
logger | |
ConsoleLogSeverity | |
default value | |
canShowGraphics | |
when machine does not run matplotlib. More... | |
Averages images of the stack, deletes the stack and returns an average and its error image.
PURPOSE : This module produces either a straightforward or a clipped average (masking outlying values) of a stack of N single images. In both cases, the variance of the averaged image due to random noise (read-out and photon noise) is computed using the default model values for the read-out noise and the gain factor. COMMENTS : The clipping algorithm is based on the estimate of the random noise standard deviation of the considered pixel multiplied with a tolerance factor, using an iterative estimation of the intensity of that pixel. In order to check the assumption that the input images are "identical" except for random noise, the empirical variance of each pixel is computed from the scatter in the stack of input images. In the case of "identical" input images, the distribution of the empirical estimates should agree with the predictions from the default model values. No detailed analysis of the correctness of the assumption of "identical" input images is included (at present), since the most performant tests depend on the type of differences between input images (such as shifted spectral orders, varying intensity levels, etc.). Each type of difference requires (optimally) a test on a different sub-set of pixels. SYNTAX : self.results = averageImages(self.results, instrumentModel) INPUT CONSTANTS FROM INSTRUMENT MODEL : defaultPrescanBiasADU biasOffset defaultReadoutNoiseADU gain INPUT DATA FROM RESULTDICT : A stack of N images in "rawImageStack" self.results["stackVariance"] = (someValue) OPTIONS READ FROM OPTIONDICT : MANDATORY : OPTIONAL : "isSimpleAverage" - True (default) - False : will perform a "clipped" average (masking outlying values) any other value executes the option True while generating an info message. "isQualityCheck" - False (default) - True any other value executes the option False while generating an info message. "isInputStackKept" - False (default) - True the stack of images can usually be removed from memory. "isDebug" - False (default) - True switch to enable results to be written in fits files. "imageStackTolerance" default value is 4 #QUESTION: This is unclear to me. Shouldn't we write that "imageStackTolerance = the tolerance factor for the rejection of outliers expressed in units of the expected random noise, in this case set equal to 4", or where can this be found ? # LD : This is what the manual group should explain, somewhere in some part of some manual. OUTPUT : "self.results.rawImage" : array containing the average of the stack of images "self.results.rawImageVariance" : array containing the error estimate on "self.results.rawImage" "self.results.numberOfImagesInStack" : self.results["rawImageStack"].shape[-1] "self.results.averageImagesInputfilenames" : self.results["FITSFileNames"]) "self.results.isSimpleAverage" = self.isSimpleAverage (option read from optionDict) Information written to self.results.header includes averageImagesPixelsMaskedPerFrame, averageImagesStackTolerance, averageImagesAdd_nStack, averageImagesInputfilenames, isSimpleAverage If "isQualityCheck" = True then also write : An array containing the ratio of the actual variance of the averaged image (computed from the scatter of the individual frames around the mean) to the expected variance of the averaged image (computed using the predicted read-out and random photon noise), in "self.results.isQualityCheck"
hermes.pipeline.components.averageimages.averageImages.isDebug |
isDebug can generate some intermediary files
SHOULD NOT RUN IF 'rawImageStack' not in 'RESULTDICT' ( when a single image is read, it is in 'rawImage' )