reads one or more images More...
Public Member Functions | |
def | __init__ |
Make it a component. | |
def | optionsAreValid |
Check options. | |
def | __call__ |
run (name point is 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 | |
add | |
add = the number of consecutive input files to add asked by Alain Jorissen on june 4, 2010 | |
isDebug | |
isDebug added to trace the "sum files" function needed for computeVR. More... | |
results | |
Public Attributes inherited from hermes.pipeline.core.pipelinecomponent.PipelineComponent | |
options | |
logger | |
ConsoleLogSeverity | |
default value | |
canShowGraphics | |
when machine does not run matplotlib. More... | |
reads one or more images
PURPOSE : read one or more FITS files, and store the images as well as the headers in the result dictionary. SYNTAX : self.results = readFITSImage(instrumentModel) INPUT : resultDict["FITSFileNames"] : list of strings containing the names of the FITS files, possibly only one FITS file. optiondict["add"] : integer, number of consecutive files to add (compute a real sum) OUTPUT : - In case only one FITS file was read: . resultDict["rawImage"] : 2D numpy array of double precision float64 reals containing the image . resultDict["FITSheader"] : the header of the FITS file - In case more than one FITS file was read: . resultDict["rawImageStack"] : 3D numpy array of double precision float64 reals containing the images shape: (# of images, # of rows. # of cols) . resultDict["FITSheader"] : the header of the first FITS file - Looking at the first file, depending on the "mode" found in the header, this module also reads a bunch of fifteen models, choosen in four different possible modes : HRF, LRF, WRF or LRF_WRF. The paths to those models are found in the instrumentModel. They are also dependent on the image date, as several different configs can be found. The models are written in the resultDict with the following names : - crossOrderProfile - offsetExtractionSlit - fluxCorExtractionSlit - orderPositionTemplate - orderPositionTemplateHeader - firstUsefulPixel - lastUsefulPixel - reddestOrderOnDetector - bluestOrderOnDetector - path2mslit - masterBlaze - ImageWCFtemplate - selectedLampLinesAbs - selectedLampLinesDiff - middleCcdRowOrderPositionsAfterCut resultDict.update(crossOrderProfile = readArray(fibr.crossOrderProfile, resultDict).data) resultDict.update(offsetExtractionSlit = readArray(fibr.offsetExtractionSlit, resultDict).data) resultDict.update(fluxCorExtractionSlit = readArray(fibr.fluxCorExtractionSlit, resultDict).data) resultDict.update(orderPositionTemplate = readArray(fibr.orderPositionTemplate, resultDict).data) resultDict.update(ImageWCFtemplate = transpose(readArray(fibr.templateWavelengthCalibration, resultDict).data)) resultDict.update(selectedLampLinesAbs = wctools.getTblAbsLinePos(fibr.selectedLampLinesAbs, resultDict).data) resultDict.update(selectedLampLinesDiff = wctools.getTblAbsLinePos(fibr.selectedLampLinesAbs, resultDict).data) resultDict.update(orderPositionTemplateHeader = readArray(fibr.orderPositionTemplate, resultDict).header) resultDict.update(firstUsefulPixel = readArray(fibr.firstUsefulPixel, resultDict).data) resultDict.update(lastUsefulPixel = readArray(fibr.lastUsefulPixel, resultDict).data) resultDict.update(reddestOrderOnDetector = fibr.reddestOrderOnDetector) resultDict.update(bluestOrderOnDetector = fibr.bluestOrderOnDetector) resultDict.update(path2mslit = readArray(fibr.path2mslit, resultDict).data) resultDict.update(masterBlaze = readArray(fibr.masterBlaze, resultDict).data) resultDict.update(middleCcdRowOrderPositionsAfterCut = ac) EXAMPLES: How to use the output of this component: . rawImage = resultDict["rawImage"] # reference to Numpy array . rawImageStack = resultDict["rawImageStack"] # reference to 3D Numpy array . nImages = rawImageStack.shape[0] # number of stacked images . for image in rawImageStack: # looping over image stack . header = resultDict["FITSheader"] # reference to header dict . header ["observer"] # contents of header line . header ["temp"] = 25.0 # modify value . header ["TARGET"] = "HD12345" # add or modify . header.add_history("What you did") # append a history line . header.add_comment("Some comment") # append a comment line . headerList = resultDict["FITSheaderList"] # list of header dicts . for header in headerList: # looping over header list REMARKS: The image(s) and the header(s) are read from the primary HDU(s). IO errors are catched, reported to the logger, and raised again Stacking errors (e.g. due to dtype or shape mismatch) are catched, reported to the logger, and raised again.
hermes.pipeline.components.readFITSimage.readFITSImage.isDebug |
isDebug added to trace the "sum files" function needed for computeVR.