Determines the positions of the spectral orders, absolute or differentially, relative to a template frame. More...
Public Member Functions | |
def | __init__ |
Make a Hermes component and initialize variables. | |
def | optionsAreValid |
check user's options, or set default values | |
def | __call__ |
run starts here | |
def | checkIfItIsWorthToMeasureOrderPosition |
rapidly estimates order shift over a small part of the CCD | |
def | getShiftEstimateOrderModel |
return an array that contains the shift values of the order for each cross cut | |
def | getOrderCorrelationCoefficients |
knowing the shift interval, this method cross correlates the image with a template. More... | |
def | getShiftedFrame |
shift a 2D frame in the crossAxis direction inputs are the frame and the shift in pixels | |
def | getShiftedMask |
shift a 2D frame in the crossAxis direction inputs are the frame and the shift in pixels | |
def | getOrderMask |
given the shape of an order and its widths (assumed to be constant) this methods prepares a frame that will mask all the other orders. More... | |
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 | |
isShiftEstimateOrderModel | |
is shiftEstimateOrderModel already measured ? | |
shiftStep | |
The correlation step will always be equal to 1. | |
isOrderShiftPrinted | |
TEMPORARY? - Do we need to plot print the order shifts. | |
isShiftEstimateOrderModelMeasured | |
Do we need to check the shift beforehand on a smaller region ? Value is False if we have to ... More... | |
isItWorthToMeasureOrderPosition | |
if estimate order position provides a shift that is too large then it is not worth to measure order position | |
midOrder | |
midRow | |
orderHalfWidth | |
give the half width | |
tolFastClean | |
tolerance | |
maxShift | |
maximal shift allowed | |
minShift | |
minimal shift allowed | |
crossAxis | |
select direction | |
isPolynomeBivariate | |
default computation More... | |
isFerosData | |
Is it FEROS data == only for testing purposes. | |
isDifferential | |
isEstimatedAbsoluteOrderPositionsNeeded | |
if at this stage absolute order positions are needed | |
areVirtualEdgeOrdersAdded | |
border management | |
isDebug | |
Set debug flag according to users needs. | |
results | |
xStart | |
if it is needed then we have to check that the right additional input is provided More... | |
xEnd | |
default x end | |
yStart | |
default y start | |
yEnd | |
default y end | |
optionsdict | |
a global pointer needed to pass the options to estimateOrderPosition | |
Public Attributes inherited from hermes.pipeline.core.pipelinecomponent.PipelineComponent | |
options | |
logger | |
ConsoleLogSeverity | |
default value | |
canShowGraphics | |
when machine does not run matplotlib. More... | |
Determines the positions of the spectral orders, absolute or differentially, relative to a template frame.
PURPOSE : This module determines the positions of the spectral orders, either in an absolute way or differentially, relative to a template frame. The template should have in each spectral order, in cross-order direction, profiles as close as possible to the profiles in the input frame (inclusive the presence or absence of a background). Measurement errors caused by a different discretisation of the data are minimized by the use of an algorithm developed by David & Verschueren (1995, A&A, 111, 183). The larger the number of (trustworthy) cross-cuts used, the higher the precision obtainable in the modelBackground module. A useful indicator of how trustworthy the result is (in other words, to what extent the input and template data are similar in cross-order shape) can be obtained from the correlation coefficient between input and template cross-order profile as compared to the signal-to-noise ratio (and the difference in discretisation of the cross-order profile). Only trustworthy data will be passed to modelOrderPosition. Suspects cross-cuts (known hot or dark pixels, radiation events detected through a too low correlation coefficient, cross-cuts well outside the useful zone of the spectral orders) are marked. COMMENTS : (1) Auto-correlation of the (shifted) template with itself (for each constant-wavelength bin in each spectral order) should be computed when choosing the instrument model. Any moment that the template or the mask vector defining the extraction slit for each order, or the shift range is changed (the shift range should never be changed, unless the basic measurement method for estimating the centre of the cross-correlation peak is modified), this auto-correlation has to be re-computed. The auto-correlation for the image with itself is computed out of the loop over the different shifts. SYNTAX : measureOrderPositions(self, instrumentModel) INPUT CONSTANTS FROM INSTRUMENT MODEL : referenceFrame Is the modelFlatField image. The path and name of the file could be written in the InstrumentConfig.xml file. In that case we should decide if the modelFlatField is loaded once for all in the begining of the chain, or if it has to be loaded each time we need it in a component. May be we could foresee a Model.xml file. It could be loaded at the beginning by a component named e.g. modelLoader that would prepare the InputDict in a way depending on the chain composition or the options. templateorderpositionscoefficients Are the polynomial coefficients that define the shape of orders of the modelFlatField image. Since we are using FEROS data it is loaded for the moment by a Ferosinitchain component saved in the utilities package. INPUT DATA FROM RESULTDICT : MANDATORY : imageFrame Input image frame. It is supposed to be a single file. OPTIONS READ FROM OPTIONDICT : MANDATORY : maxShiftEstimateOrderModel Is the upper boundary of the allowed template shifts. Could be written in the InstrumentConfig. minShiftEstimateOrderModel Is the lower boundary of the allowed template shifts. Could be written in the InstrumentConfig. crossAxis Is the cross order axis. Its value is 1 or 0. Could be written in the InstrumentConfig. orderHalfWidth Half Width of the orders in pixel units. This something that should be related to the modelFlatField image. OPTIONAL : For the moment, when self.isShiftEstimateOrderModelMeasured = False the component first launches the estimateOrderPosition component. In that case, the following options should also be set. isDebug (boolean) default is True When debug information is needed than this parameter should be True. When the parameter is set to True you will find in the self.results["DebugPath"] the following fits files: ... isFerosData (boolean) default is False Tells whether we are using FEROS data. tolFastClean Is the tolerance for the fast cleaning of the frame subregion we want to cross-correlate. All pixels having an intensity higher than tolFastClean are masked. xStart Definition of the frame subregion. It is the X lower edge of the subregion. Definition of X and Y depends for the moment on the crossAxis value. May be this is stupid ? Could be set in the InstrumentConfig file or Model.xml file. xEnd Definition of the frame subregion. It is the X upper edge of the subregion. Definition of X and Y depends for the moment on the crossAxis value. May be this is stupid ? Could be set in the InstrumentConfig file or Model.xml file. yStart Definition of the frame subregion. It is the Y lower edge of the subregion. Definition of X and Y depends for the moment on the crossAxis value. May be this is stupid ? Could be set in the InstrumentConfig file or Model.xml file. yEnd Definition of the frame subregion. It is the Y upper edge of the subregion. Definition of X and Y depends for the moment on the crossAxis value. May be this is stupid ? Could be set in the InstrumentConfig file or Model.xml file. areVirtualEdgeOrdersAdded default : True Do we have to foresee additional edge orders ? OUTPUT written to the InputDict : MeasuredRelativeOrderPositions Is an array of NxM order shifts. M is the number of orders and N is the number of rows/columns. AbsoluteOrderPositionsInTemplate Is a NxM frame, where M is the order index and N the row/column index, that contains the column/row index of the center of the orders. NOTE : If you have the following error: finin = (image * image * mask).sum(axis = 1) TypeError: sum() got an unexpected keyword argument 'axis' It probably means that you are using an older version of pyfits.
def hermes.pipeline.components.measureorderpositions.measureOrderPositions.getOrderCorrelationCoefficients | ( | self, | |
image, | |||
template, | |||
mask | |||
) |
knowing the shift interval, this method cross correlates the image with a template.
A mask is used to only cross-correlate a given order.
def hermes.pipeline.components.measureorderpositions.measureOrderPositions.getOrderMask | ( | self, | |
frame, | |||
orderCoefficients, | |||
orderHalfWidth, | |||
order, | |||
bivarianceDegree | |||
) |
given the shape of an order and its widths (assumed to be constant) this methods prepares a frame that will mask all the other orders.
orderCoefficients: polynomial coefficients array that describes the order shape orderHalfWidth (in pixels)
hermes.pipeline.components.measureorderpositions.measureOrderPositions.isPolynomeBivariate |
default computation
computation model
hermes.pipeline.components.measureorderpositions.measureOrderPositions.isShiftEstimateOrderModelMeasured |
Do we need to check the shift beforehand on a smaller region ? Value is False if we have to ...
hermes.pipeline.components.measureorderpositions.measureOrderPositions.xStart |
if it is needed then we have to check that the right additional input is provided
default x start