hdrl.func¶
High-level HDRL algorithms. The order below matches the High-level algorithms so the user guide and this API stay aligned.
Most algorithms use a class with factory constructors and compute().
Fixed-pattern noise is the exception: call the module function
hdrl.func.fpn_compute() (there is no Fpn class).
Bias and dark reductions reuse hdrl.func.Collapse (and optionally
hdrl.func.Overscan); they have no dedicated classes.
Overscan, collapse, flat¶
- class hdrl.func.Overscan¶
Bases:
pybind11_objectThe hdrl.func.Overscan class provides an interface to overscan calculations. This module contains functionality to compute and correct the overscan level of CCD image.
- compute(self: hdrl.func.Overscan, image: hdrl.core.Image) None¶
Compute the overscan correction model from an HDRL Image.
- Parameters:
image (hdrl.core.Image) – The image to compute the overscan model from.
- correct(self: hdrl.func.Overscan, input_image: hdrl.core.Image, region: tuple | None = None) object¶
Apply overscan correction to an HDRL Image.
- Parameters:
input_image (hdrl.core.Image) – Image to correct.
region (tuple[int, int, int, int], optional) – Region to apply correction.
- Returns:
- Namedtuple with:
corrected: corrected image (hdrl.core.Image)
badmask: corresponding bad pixel mask (cpl.core.Image)
- Return type:
- property box_hsize¶
- property ccd_ron¶
- property chi2¶
Chi^2 image from the last compute() call.
- property contribution¶
Contribution image from the last compute() call.
- property correction¶
Correction image from the last compute() call.
- property direction¶
- property minmax_reject_high¶
Min/max high rejection map from the last compute() call.
- property minmax_reject_low¶
Min/max low rejection map from the last compute() call.
- property overscan_region¶
Returns the overscan region as a Window object.
- property red_chi2¶
Reduced chi^2 image from the last compute() call.
- property sigclip_reject_high¶
Sigma-clip high rejection map from the last compute() call.
- property sigclip_reject_low¶
Sigma-clip low rejection map from the last compute() call.
Overscan.correct returns an OverscanCorrectResult namedtuple with
fields corrected (hdrl.core.Image) and badmask (cpl.core.Image).
- class hdrl.func.OverscanCorrectResult(corrected, badmask)¶
Bases:
tuple- badmask¶
Alias for field number 1
- corrected¶
Alias for field number 0
- class hdrl.func.Window¶
Bases:
pybind11_object- property llx¶
- property lly¶
- property urx¶
- property ury¶
- class hdrl.func.Collapse¶
Bases:
pybind11_objectA hdrl.func.Collapse is a collapse-strategy object for reducing an hdrl.core.ImageList to one image. Collapse() cannot be called directly; create an instance via one of the following factory constructors: - hdrl.func.Collapse.Mean: Mean Collapse operation on HDRL ImageList. - hdrl.func.Collapse.WeightedMean: Weighted Mean Collapse operation on HDRL ImageList. - hdrl.func.Collapse.Median: Median Collapse operation on HDRL ImageList. - hdrl.func.Collapse.Sigclip: Sigma Clipped Collapse operation on HDRL ImageList. - hdrl.func.Collapse.MinMax: Min-Max Clipped Collapse operation on HDRL ImageList. - hdrl.func.Collapse.Mode: Mode Collapse operation on HDRL ImageList.
Once the factory has created a Collapse instance, call hdrl.func.Collapse.compute() or pass the instance to a function that accepts Collapse (e.g. hdrl.func.Flat.compute).
Notes
Sigma Clipping or Median Collapse methods are recommended for robust application against outliers (e.g. cosmic ray hits). However, Median has a low statistical efficiency, so will display higher uncertainty than images collapsed using sigma clipping with few outliers.
- class Method¶
Bases:
pybind11_objectMethod to use for the mode computation.
Members:
- Median :
This method is the most robust method and can/should be used for very asymmetric point distributions.
- Fit :
This method gives accurate results for symmetric distributions but is also more likely to fail.
- Weighted :
This method can/should be used with asymmetric distributions.
- Fit = <Method.Fit: 2>¶
- Median = <Method.Median: 0>¶
- Weighted = <Method.Weighted: 1>¶
- Collapse.Method.name -> str
- property value¶
- static Mean() hdrl.func.Collapse¶
Creates an instance of hdrl.func.Collapse class with Mean parameters.
Mean and associated error are computed with standard formulae.
- Returns:
The namedtuple has two components- one hdrl.core.Image (out), containing the collapsed image and one cpl.core.Image (contrib), which is the output mask containing an integer map that counts how many pixels contributed to each pixel image.
- Return type:
namedtuple
See also
hdrl.core.ImageList.collapsePerform Collapse operation on HDRL ImageList.
hdrl.core.ImageList.collapse_meanPerform Mean Collapse operation on HDRL ImageList.
- static Median() hdrl.func.Collapse¶
The median collapse of an ImageList to a single image.
Median and associated error are computed with standard formulae.
- Returns:
The namedtuple has two components- one hdrl.core.Image (out), containing the collapsed image, one cpl.core.Image (contrib), which is the output mask containing an integer map that counts how many pixels contributed to each pixel image.
- Return type:
namedtuple
See also
hdrl.core.ImageList.collapse_medianPerform Median Collapse operation on HDRL ImageList.
hdrl.func.Collapse.computePerform Collapse function on an HDRL ImageList to create one HDRL Image.
- static MinMax(nlow: SupportsFloat | SupportsIndex, nhigh: SupportsFloat | SupportsIndex) hdrl.func.Collapse¶
Creates an instance of hdrl.func.Collapse class with Min-Max clipped parameters.
Minmax-clipped mean and associated error, computed similarly as for mean but without taking the clipped values into account
- Returns:
The namedtuple has four components- one hdrl.core.Image (out), containing the collapsed image, one cpl.core.Image (contrib), which is the output mask containing an integer map that counts how many pixels contributed to each pixel image, one cpl.core.Image (reject_low) containing low rejection threshold, one cpl.core.Image (reject_high) containing high rejection threshold.
- Return type:
namedtuple
See also
hdrl.core.ImageList.collapsePerform Collapse operation on HDRL ImageList.
hdrl.core.ImageList.collapse_minmaxPerform MinMax Collapse operation on HDRL ImageList.
- static Mode(histo_min: SupportsFloat | SupportsIndex, histo_max: SupportsFloat | SupportsIndex, bin_size: SupportsFloat | SupportsIndex, mode_method: hdrl.func.Collapse.Method, error_niter: SupportsInt | SupportsIndex) hdrl.func.Collapse¶
Creates an instance of hdrl.func.Collapse class with Mode parameters.
- Parameters:
histo_min (float) – minimum value of low pixels to use
histo_max (float) – maximum value of high pixels to be use
bin_size (float) – size of the histogram bin
mode_method (hdrl.func.Collapse.Mode) – mode_method to use for the mode computation
error_niter (int) – size of the histogram bin
- Returns:
The namedtuple has two components- one hdrl.core.Image (out), containing the collapsed image and one cpl.core.Image (contrib), which is the output mask containing an integer map that counts how many pixels contributed to each pixel image.
- Return type:
namedtuple
See also
hdrl.core.ImageList.collapsePerform Collapse operation on HDRL ImageList.
hdrl.core.ImageList.collapse_modePerform Mode Collapse operation on HDRL ImageList.
- static Sigclip(kappa_low: SupportsFloat | SupportsIndex, kappa_high: SupportsFloat | SupportsIndex, niter: SupportsInt | SupportsIndex) hdrl.func.Collapse¶
The sigma clipped collapse of an ImageList to a single image.
Sigma-clipped mean and associated error, computed similarly as for mean but without taking the clipped values into account.
- Parameters:
kappa_low (float) – low sigma bound
kappa_high (float) – high sigma bound
niter (int) – number of clipping iterators
- Returns:
The namedtuple has four components- one hdrl.core.Image (out), containing the collapsed image, one cpl.core.Image (contrib), which is the output mask containing an integer map that counts how many pixels contributed to each pixel image, one cpl.core.Image (reject_low) containing low rejection threshold, one cpl.core.Image (reject_high) containing high rejection threshold.
- Return type:
namedtuple
See also
hdrl.core.ImageList.collapse_sigclipPerform Sigma Clipped Collapse operation on HDRL ImageList.
hdrl.func.Collapse.computePerform Collapse function on an HDRL ImageList to create one HDRL Image.
- static WeightedMean() hdrl.func.Collapse¶
Creates an instance of hdrl.func.Collapse class with Weighted Mean parameters.
Weighted mean and associated error are computed with standard formulae
- Returns:
The namedtuple has two components- one hdrl.core.Image (out), containing the collapsed image and one cpl.core.Image (contrib), which is the output mask containing an integer map that counts how many pixels contributed to each pixel image.
- Return type:
namedtuple
See also
hdrl.core.ImageList.collapsePerform Collapse operation on HDRL ImageList.
hdrl.core.ImageList.collapse_weighted_meanPerform Weighted Mean Collapse operation on HDRL ImageList.
- compute(self: hdrl.func.Collapse, himlist: hdrl.core.ImageList) object¶
Implement the Collapse operations for an HDRL ImageList to a single image.
- Parameters:
himlist (hdrl.core.ImageList) – ImageList to collapse using the operation defined in self.
- Returns:
Namedtuple with hdrl.core.Image
out(collapsed image) and cpl.core.Imagecontrib(integer map of how many pixels contributed to each output pixel).- Return type:
Notes
These operations can also be accessed directly by the hdrl.core.ImageList objects. The generic compute method returns only out and contrib. Use hdrl.core.ImageList.collapse_sigclip or collapse_minmax when the reject_low and reject_high maps are required.
See also
hdrl.core.ImageList.collapsePerform Collapse operation on HDRL ImageList.
hdrl.core.ImageList.collapse_meanPerform Mean Collapse operation on HDRL ImageList.
hdrl.core.ImageList.collapse_weighted_meanPerform Weighted Mean Collapse operation on HDRL ImageList.
hdrl.core.ImageList.collapse_sigclipPerform Sigma Clipped Collapse operation on HDRL ImageList.
hdrl.core.ImageList.collapse_minmaxPerform Min-max clipped Collapse operation on HDRL ImageList.
hdrl.core.ImageList.collapse_modePerform Mode Collapse operation on HDRL ImageList.
- property bin_size¶
- property error_niter¶
- property histo_max¶
- property histo_min¶
- property kappa_high¶
- property kappa_low¶
- property method¶
- property nhigh¶
- property niter¶
- property nlow¶
Collapse.compute returns a CollapseResult namedtuple with fields
out (hdrl.core.Image) and contrib (cpl.core.Image). This is
distinct from hdrl.core.CollapseResult (used for spectrum collapse).
The generic compute method does not return rejection maps. Use
ImageList.collapse_sigclip or ImageList.collapse_minmax when the
additional reject_low and reject_high images are required; those
shortcuts return method-specific namedtuples.
- class hdrl.func.CollapseResult(out, contrib)¶
Bases:
tuple- contrib¶
Alias for field number 1
- out¶
Alias for field number 0
- class hdrl.func.Flat¶
Bases:
pybind11_objectThe hdrl.func.Flat class provides an interface to combining single flatfields into a master flatfield with increased signal-to-noise ratio.
Once the class has been instantiated with the desired parameters, the master flat can be created using the member function hdrl.func.Flat.compute().
- Parameters:
filter_size_x (int) – The dimension of the smoothing kernel (median filter) in the x-direction in pixel units.
filter_size_y (int) – The dimension of the smoothing kernel (median filter) in the y-direction in pixel units.
method (hdrl.func.Flat.Mode) – The flat combination algorithm mode, either hdrl.func.Flat.FreqLow or hdrl.func.Flat.FreqHigh.
- Return type:
Notes
See hdrl.func.Flat.Mode for descriptions of each algorithm.
Examples
# Example 1: with a stat_mask # choose a collapse method collapse = hdrl.func.Collapse.Mean() # dx and dy are image dimensions stat_mask = cpl.core.Mask(dx,dy) # set the mask for a window defined by (r1_llx, r1_lly, r1_urx, r1_ury) for j in range(r1_lly, r1_ury): for i in range(r1_llx, r1_urx): stat_mask[j - 1][i - 1] = True # create the hdrl.func.Flat instance flat = hdrl.func.Flat(filter_size_x, filter_size_y, hdrl.func.Flat.Mode.FreqLow) # compute the master flat with imglist being an hdrl.core.ImageList # holding the images to combine into the master flat results = flat.compute(imglist, collapse, stat_mask) mflat = results.master cmap = results.contrib_map # Example 2: without a stat_mask collapse = hdrl.func.Collapse.Median() stat_mask = None # create the hdrl.func.Flat instance flat = hdrl.func.Flat(filter_size_x, filter_size_y, hdrl.func.Flat.Mode.FreqLow) # compute the master flat with imglist being an hdrl.core.ImageList # holding the images to combine into the master flat results = flat.compute(imglist, collapse, stat_mask)
- class Mode¶
Bases:
pybind11_objectThe flat combination algorithm mode.
Members:
- FreqLow :
This algorithm derives the low frequency part of the master flatfield – often also denoted as the shape of the flatfield.
The algorithm multiplicatively normalizes the input images by the median (considered to be noiseless) of the image to unity. An optional static mask stat_mask can be provided to the algorithm in order to define the pixels that should be taken into account when computing the normalisation factor. This allows the user to normalize the flatfield e.g. only by the illuminated section. In the next step, all normalized images are collapsed into a single master flatfield. The collapsing can be done with all methods currently implemented in HDRL (see hdrl.func.Collapse or Sect. 3.2.2 of the HDRL manual for an overview). Finally, the master flatfield is smoothed by a median filter controlled by filter_size_x and filter_size_y. The associated error of the final master frame is the error derived via error propagation of the previous steps, i.e. the smoothing itself is considered noiseless. Please note that, if the smoothing kernel is set to unity, i.e. filter_size_x = 1 and filter_size_y = 1, no final smoothing will take place but the resulting masterframe is simply the collapsed normalized flatfield.
- FreqHigh :
This algorithm derives the high frequency part of the master flatfield – often also denoted as the pixel-to-pixel variation of the flatfield.
The algorithm first divides each input image by the smooth image obtained with a median filter (the latter is controlled by the parameters filter_size_x and filter_size_y). Concerning the error propagation, the smoothed image is considered to be noiseless, i.e. the relative error associated to the normalised images is the same as the one of the input images. Then all residual images are collapsed into a single master flatfield. The collapsing can be done with all methods currently implemented in HDRL (see hdrl.func.Collapse or Sect. 3.2.2 of the HDRL manual for an overview).
To distinguish between illuminated and not illuminated regions/pixels (i.e. orders in an echelle flat image), the user may provide an optional static mask stat_mask to the algorithm. In this case the smoothing procedure is done twice, once for the illuminated region and once for the blanked region. This ensures that the information of one region does not influence the other regions during the smoothing process.
- FreqHigh = <Mode.FreqHigh: 1>¶
- FreqLow = <Mode.FreqLow: 0>¶
- Flat.Mode.name -> str
- property value¶
- compute(self: hdrl.func.Flat, hdrl_data: hdrl.core.ImageList, collapse: hdrl.func.Collapse, stat_mask: cpl.core.Mask) object¶
Compute the master flat image and a contribution map image.
- Parameters:
hdrl_data (hdrl.core.ImageList) – The imagelist of images to combine into the master flat. This input is consumed: HDRL overwrites its images to reduce memory use, and its contents are undefined after the call.
collapse (hdrl.func.Collapse) – Specifies the collapsing algorithm to apply to hdrl_data.
stat_mask (cpl.core.Mask) – A static mask to distinguish between illuminated and dark regions. If no static mask is needed, this can be set to None.
- Returns:
Namedtuple with a master flat image (
master, hdrl.core.Image) and a contribution map (contrib_map, cpl.core.Image). Convert to a dictionary with._asdict()if needed.- Return type:
Notes
See hdrl.func.Flat.Mode for descriptions of each algorithm. Duplicate
hdrl_databefore calling compute if it is needed later.
- property method¶
flat combination algorithm mode.
- Type:
- property sizex¶
dimension of the smoothing kernel (median filter) in the x-direction in pixel units.
- Type:
int
- property sizey¶
dimension of the smoothing kernel (median filter) in the y-direction in pixel units.
- Type:
int
Flat.compute returns a FlatResult namedtuple with fields master
(hdrl.core.Image) and contrib_map (cpl.core.Image).
To match the HDRL C memory-saving contract, it consumes the input
hdrl.core.ImageList and leaves that list’s contents undefined.
Bad pixels, Strehl, fringe, catalogue¶
- class hdrl.func.BPM¶
Bases:
pybind11_objectThe hdrl.func.BPM class provides an interface to various Bad Pixel Mask algorithms. This module contains static functions to detect bad pixels on single images, on a stack of identical images, and on a sequence of images.
- static filter(input_mask: cpl.core.Mask, kernel_nx: SupportsInt | SupportsIndex, kernel_ny: SupportsInt | SupportsIndex, filter: cpl.core.Filter) cpl.core.Mask¶
Sets pixels to bad if the pixel is surrounded by other bad pixels. Allows the growing and shrinking of bad pixel masks.
The algorithm assumes that all pixels outside the mask are good, i.e. it enlarges the mask by the kernel size and marks this border as good. It applies on the enlarged mask during the operation and extracts the original-size mask at the very end.
- Parameters:
input_mask (cpl.core.Mask) – Input mask
kernel_nx (int) – Size in x-direction of the filtering kernel
kernel_ny (int) – Size in y-direction of the filtering kernel
filter (cpl.core.Filter mode) – Filter modes as defined in PyCPL. Supported modes: cpl.core.Filter.EROSION, cpl.core.Filter.DILATION, cpl.core.Filter.OPENING, cpl.core.Filter.CLOSING, cpl.core.Filter.LINEAR
- Returns:
mask of a defined size.
- Return type:
cpl.core.Mask
See also
hdrl.func.BPM.filter_listWrapper around hdrl.func.BPM.filter() to filter list of images.
- static filter_list(inlist: cpl.core.ImageList, kernel_nx: SupportsInt | SupportsIndex, kernel_ny: SupportsInt | SupportsIndex, filter: cpl.core.Filter) cpl.core.ImageList¶
Wrapper around hdrl.func.BPM.filter() to filter list of images
- Parameters:
inlist (cpl.core.ImageList) – Input image list
kernel_nx (int) – Size in x-direction of the filtering kernel
kernel_ny (int) – Size in y-direction of the filtering kernel
filter (cpl.core.Filter mode) – Filter modes as defined in PyCPL. Supported modes: cpl.core.Filter.EROSION, cpl.core.Filter.DILATION, cpl.core.Filter.OPENING, cpl.core.Filter.CLOSING, cpl.core.Filter.LINEAR
- Returns:
the filtered image list.
- Return type:
cpl.core.ImageList
See also
hdrl.func.BPM.filterSets pixels to bad if the pixel is surrounded by other bad pixels.
- class hdrl.func.BPM2D¶
Bases:
pybind11_objectThe hdrl.func.BPM2D class provides an interface to the bad pixel mask 2D algorithm. Bad pixels on single images, on a stack of identical images, and on a sequence of images can be detected.
The algorithm first smoothes the image by applying different methods. Then it subtracts the smoothed image and derives bad pixels by thresholding the residual image, i.e. all pixels exceeding the threshold are considered bad.
In order to create instances of the hdrl.func.BPM2D class, two methods are available depending on the smoothing algorithm used, namely hdrl.func.BPM2D.Method.Filter and hdrl.func.BPM2D.Method.Legendre.
- class Method¶
Bases:
pybind11_objectThe method to be used when creating an instance of the hdrl.func.BPM2D class.
Members:
- Legendre :
This algorithm will use Legendre smoothing techniques to detect bad pixels. Fitting a Legendre polynomial to the image of order order_x in x and order_y in y direction. This method allows you to define steps_x \(\times\) steps_y sampling points (the latter are computed as the median within a box of filter_size_x and filter_size_y) where the polynomial is fitted. This substantially decreases the fitting time for the Legendre polynomial.
- Filter :
This algorithm will use Filter smoothing techniques to detect bad pixels. Applying a filter like a median filter to the image. The filtering can be done by all modes currently supported by PyCPL and is controlled by the cpl.core.Filter type filter, the cpl.core.Border type border, and by the kernel size in x and y, i.e. smooth_x, and smooth_y.
- Filter = <Method.Filter: 1>¶
- Legendre = <Method.Legendre: 0>¶
- BPM2D.Method.name -> str
- property value¶
- static Filter(kappa_low: SupportsFloat | SupportsIndex, kappa_high: SupportsFloat | SupportsIndex, maxiter: SupportsInt | SupportsIndex, filter: cpl.core.Filter, border: cpl.core.Border, smooth_x: SupportsInt | SupportsIndex, smooth_y: SupportsInt | SupportsIndex) hdrl.func.BPM2D¶
Creates an instance of hdrl.func.BPM2D class for the method hdrl.func.BPM2D.Method.Filter
- Parameters:
kappa_low (float) – Low kappa factor for thresholding algorithm
kappa_high (float) – High kappa factor for thresholding algorithm
maxiter (int) – Maximum number of iterations
filter (cpl.core.Filter mode) – Filter mode as defined in PyCPL. Supported modes: cpl.core.Filter.EROSION, cpl.core.Filter.DILATION, cpl.core.Filter.OPENING, cpl.core.Filter.CLOSING, cpl.core.Filter.LINEAR
border (cpl.core.Border mode) – Border mode as defined in PyCPL. Supported modes: cpl.core.Border.FILTER. cpl.core.Border.ZERO, cpl.core.Border.CROP, cpl.core.Border.NOP, cpl.core.Border.COPY
smooth_x (int) – Smoothing kernel size in the x-direction
smooth_y (int) – Smoothing kernel size in the y-direction
- Returns:
An instance of the hdrl.func.BPM2D class for the method hdrl.func.BPM2D.Method.Filter.
- Return type:
The hdrl.func.BPM2D
Example
fs = hdrl.func.BPM2D.Filter(4.0, 5.0, 6, cpl.core.Filter.MEDIAN, cpl.core.Border.NOP, 7, 9)
Notes
Filter smooth algorithm: This instance applies a filter like e.g. a median filter to the image. The filtering can be done by all modes currently supported by CPL and is controlled by the filter type, the border type and the kernel size in x and y.
See also
hdrl.func.BPM2D.LegendreCreates an instance of hdrl.func.BPM2D class for the method hdrl.func.BPM2D.Method.Legendre.
hdrl.func.BPM2D.computeDetect bad pixels on a single image with an iterative process.
- static Legendre(kappa_low: SupportsFloat | SupportsIndex, kappa_high: SupportsFloat | SupportsIndex, maxiter: SupportsInt | SupportsIndex, steps_x: SupportsInt | SupportsIndex, steps_y: SupportsInt | SupportsIndex, filter_size_x: SupportsInt | SupportsIndex, filter_size_y: SupportsInt | SupportsIndex, order_x: SupportsInt | SupportsIndex, order_y: SupportsInt | SupportsIndex) hdrl.func.BPM2D¶
Creates an instance of hdrl.func.BPM2D class for the method hdrl.func.BPM2D.Method.Legendre.
- Parameters:
kappa_low (float) – Low kappa factor for the thresholding algorithm
kappa_high (float) – High kappa factor for the thresholding algorithm
maxiter (int) – Maximum number of iterations
steps_x (int) – Number of sampling points in the x-direction
steps_y (int) – Number of sampling points in the y-direction
filter_size_x (int) – Size of the median box in the x-direction
filter_size_y (int) – Size of the median box in the y-direction
order_x (int) – Order of polynomial in the x-direction
order_y (int) – Order of polynomial in the y-direction
- Returns:
An instance of the hdrl.func.BPM2D class for the method hdrl.func.BPM2D.Method.Legendre.
- Return type:
The hdrl.func.BPM2D
Example
ls = hdrl.func.BPM2D.Legendre(4, 5, 6, 20, 21, 11, 12, 2, 10)
Notes
This instance of a hdrl.func.BPM2D class fits a Legendre polynomial to the image of order order_x, in x and order_y in y direction. This method allows you to define steps_x and steps_y sampling points (the latter are computed as the median within a box of filter_size_x and filter_size_y) where the polynomial is fitted. This substantially decreases the fitting time for the Legendre polynomial.
See also
hdrl.func.BPM2D.computeDetect bad pixels on a single image with an iterative process.
hdrl.func.BPM2D.FilterCreates an instance of hdrl.func.BPM2D for the method hdrl.func.BPM2D.Method.Filter.
- compute(self: hdrl.func.BPM2D, img_in: hdrl.core.Image) cpl.core.Mask¶
Detects bad pixels on a single image with an iterative process
- Parameters:
img_in (hdrl.core.Image) – Input image
- Returns:
Bad pixel mask with the newly found bad pixels.
- Return type:
cpl.core.Mask
Notes
The algorithm first smoothes the image by applying the methods described under hdrl.func.BPM2D.Filter or hdrl.func.BPM2D.Legendre. Then it subtracts the smoothed image and derives bad pixels by thresholding the residual image, i.e. all pixels exceeding the threshold are considered bad. To compute the upper and lower thresholds, it measures a robust rms (a properly scaled Median Absolute Deviation), which is then scaled by the parameters kappa_low and kappa_high. Furthermore, the algorithm is applied iteratively controlled by maxiter. During each iteration, the newly found bad pixels are ignored. Please note that the thresholding values are applied as median (residual-image) \(\pm\) thresholds. This makes the algorithm more robust in the case that the methods are not able to completely remove the background level, e.g due to an exceeding number of bad pixels in the first iteration.
See also
hdrl.func.BPM2D.FilterCreates an instance of hdrl.func.BPM2D class for the method hdrl.func.BPM2D.Method.Filter.
hdrl.func.BPM2D.LegendreCreates an instance of hdrl.func.BPM2D class for the method hdrl.func.BPM2D.Method.Legendre.
- property border¶
border mode
- Type:
cpl.core.Border
- property filter¶
filter mode
- Type:
cpl.core.Filter
- property filter_size_x¶
Size of the median box in the x-direction
- Type:
int
- property filter_size_y¶
Size of the median box in the y-direction
- Type:
int
- property kappa_high¶
High kappa factor for thresholding algorithm
- Type:
float
- property kappa_low¶
Low kappa factor for thresholding algorithm
- Type:
float
- property maxiter¶
Maximum number of iterations
- Type:
int
- property method¶
Selected algorithm method
- Type:
- property order_x¶
Order of polynomial in the x-direction
- Type:
int
- property order_y¶
Order of polynomial in the y-direction
- Type:
int
- property smooth_x¶
Smoothing kernel size in the x-direction
- Type:
int
- property smooth_y¶
Smoothing kernel size in the y-direction
- Type:
int
- property steps_x¶
Number of sampling points in the x-direction
- Type:
int
- property steps_y¶
Number of sampling points in the y-direction
- Type:
int
- class hdrl.func.BPM3D¶
Bases:
pybind11_objectThe hdrl.func.BPM3D class provides an interface to the bad pixel mask 3D algorithm. This algorithm detects bad pixels on a stack of identical images in an imagelist. Once the class is instantiated with the desired parameters, the compute function may be called to run the algorithm.
- Parameters:
kappa_low (float) – Low kappa factor for thresholding algorithm
kappa_high (float) – High kappa factor for thresholding algorithm
method (hdrl.func.BPM3D.Method) – Selected algorithm method
- Return type:
Notes
There are three algorithm methods to be selected from:
hdrl.func.BPM3D.Method.Absolute: It uses kappa_low and kappa_high as absolute threshold.
hdrl.func.BPM3D.Method.Relative: It scales the measured rms on the residual-image with kappa_low and kappa_high and uses it as threshold. For the rms a properly scaled Median Absolute Deviation (MAD) is used.
hdrl.func.BPM3D.Method.Error: It scales the propagated error of each individual pixel with kappa_low and kappa_high and uses it as threshold.
Example
bpm_3d = hdrl.func.BPM3D(4, 5, hdrl.func.BPM3D.Method.Absolute) bpm_3d = hdrl.func.BPM3D(4, 5, hdrl.func.BPM3D.Method.Relative) bpm_3d = hdrl.func.BPM3D(4, 5, hdrl.func.BPM3D.Method.Error)
See also
hdrl.func.BPM3D.computeDetect bad pixels on a stack of identical images.
- class Method¶
Bases:
pybind11_objectThe method to be used when creating an instance of the hdrl.func.BPM3D class.
Members:
- Absolute :
Uses kappa_low and kappa_high as absolute thresholds.
- Relative :
Scales the measured RMS on the residual image with kappa_low and kappa_high and uses it as thresholds. For the rms a properly scaled Median Absolute Deviation (MAD) is used.
- Error :
Scales the propagated error of each individual pixel with kappa_low and kappa_high and uses it as a threshold.
- Absolute = <Method.Absolute: 0>¶
- Error = <Method.Error: 2>¶
- Relative = <Method.Relative: 1>¶
- BPM3D.Method.name -> str
- property value¶
- compute(self: hdrl.func.BPM3D, imglist_in: hdrl.core.ImageList) cpl.core.ImageList¶
Detects bad pixels on a stack of identical images.
- Parameters:
imglist (hdrl.core.ImageList) – input imagelist.
- Returns:
imagelist containing the newly found bad pixels for each input image with the same pixel coding as for a cpl.core.Mask bad pixel mask, i.e. 0 for good pixels and 1 for bad pixels. Please note that already known bad pixels given to the routine will not be included in the output mask.
- Return type:
cpl.core.ImageList
Notes
The algorithm first collapses the stack of images by using the median in order to generate a master image. Then it subtracts the master image from each individual image and derives the bad pixels on the residual images by thresholding, i.e. all pixels exceeding the threshold are considered bad.
Please note that the algorithm assumes that the mean level of the different images is the same. If this is not the case, then the master image as described above will be biased.
See also
hdrl.func.BPM3DCreates an instance of the hdrl.func.BPM3D class for the imagelist method.
- property kappa_high¶
High kappa factor for thresholding algorithm
- Type:
float
- property kappa_low¶
Low kappa factor for thresholding algorithm
- Type:
float
- property method¶
Selected algorithm method
- Type:
- class hdrl.func.BPMFit¶
Bases:
pybind11_objectThe hdrl.func.BPMFit module provides an interface to various bad pixel mask fit algorithms to detect bad pixels on a sequence of images e.g. domeflats.
The algorithm fits a polynomial to each pixel sequence and determines bad pixels based on this fit and various thresholding methods.
Three thresholding methods are available to convert the information from the fit into a bad pixel map:
PVal: Pixels with p-values below the mentioned threshold are considered as bad pixels.
RelChi: Pixels with a chi value below the mentioned threshold are considered as bad pixels.
RelCoef: Pixels with a fit coefficient below the mentioned threshold are considered as bad pixels.
In order to create an instance of the hdrl.func.BPMFit class, three constructors corresponding to the above methods are available.
- static PVal(degree: SupportsInt | SupportsIndex, pval: SupportsFloat | SupportsIndex) hdrl.func.BPMFit¶
Creates an instance of hdrl.func.BPMFit class for the p-value method.
- Parameters:
degree (int) – The degree of the fit
pval (float) – The p-value bpm cutoff
Notes
Pixels with low p-value. When the errors of the pixels are correct the p-value can be interpreted as the probability with which the pixel response fits the chosen model.
See also
hdrl.func.BPMFit.computeDerives bad pixels on a sequence of images by fitting a polynomial along each pixel sequence of the images.
hdrl.func.BPMFit.RelChiCreates an instance of hdrl.func.BPMFit class with relative chi bpm threshold.
hdrl.func.BPMFit.RelCoefCreates an instance of hdrl.func.BPMFit class with relative coefficient bpm threshold.
- static RelChi(degree: SupportsInt | SupportsIndex, low: SupportsFloat | SupportsIndex, high: SupportsFloat | SupportsIndex) hdrl.func.BPMFit¶
Creates an instance of hdrl.func.BPMFit class with a relative chi bpm threshold.
- Parameters:
degree (int) – The degree of the fit
low (float) – Relative chi distribution bpm lower threshold
high (float) – Relative chi distribution bpm upper threshold
- Return type:
Notes
Relative cutoff on the chi distribution of all fits. Pixels with chi values which exceed mean \(\pm\) cutoff \(\times\) standard deviation are considered bad.
See also
hdrl.func.BPMFit.computeDerives bad pixels on a sequence of images by fitting a polynomial along each pixel sequence of the images.
hdrl.func.BPMFit.PValCreates an instance of hdrl.func.BPMFit class with p-value bpm threshold.
hdrl.func.BPMFit.RelCoefCreates an instance of hdrl.func.BPMFit class with relative coefficient bpm threshold.
- static RelCoef(degree: SupportsInt | SupportsIndex, low: SupportsFloat | SupportsIndex, high: SupportsFloat | SupportsIndex) hdrl.func.BPMFit¶
Creates an instance of hdrl.func.BPMFit class with relative coefficient bpm threshold.
- Parameters:
degree (int) – The degree of the fit
low (float) – Relative fit coefficient distribution bpm lower threshold
high (float) – Relative fit coefficient distribution bpm upper threshold
- Return type:
Notes
Relative cutoff on the distribution of the fit coefficients. Pixels with fit coefficients which exceed mean \(\pm\) cutoff \(\times\) standard deviation are considered bad.
See also
hdrl.func.BPMFit.computeDerives bad pixels on a sequence of images by fitting a polynomial along each pixel sequence of the images.
hdrl.func.BPMFit.PValCreates an instance of hdrl.func.BPMFit class with p-value bpm threshold.
hdrl.func.BPMFit.RelChiCreates an instance of hdrl.func.BPMFit class with relative chi bpm threshold.
- compute(self: hdrl.func.BPMFit, imglist_in: hdrl.core.ImageList, sample_position: cpl.core.Vector) cpl.core.Image¶
Derives bad pixels on a sequence of images by fitting a polynomial along each pixel sequence of the images.
- Parameters:
imglist_in (hdrl.core.ImageList) – imagelist to fit
sample_position (cpl.core.Vector) – vector of sampling position of the images in data, e.g. exposure time
- Returns:
image with cpl.core.Type.INT pixels containing the newly found bad pixels for each input image
- Return type:
cpl.core.Image
Notes
When using hdrl.func.BPMFit.RelCoef the value of the returned image encodes the coefficient that was outside the relative threshold as a power of two. e.g. if coefficient 0 and 3 of the fit were not within the threshold for a pixel, it will have the value \(2^0 + 2^3 = 9\). The other hdrl.func.BPMFit algorithms return an image with non-zero values marking pixels outside the selection thresholds.
Please note that already known bad pixels given to the routine will not be included in the output mask.
See also
hdrl.func.BPMFit.PValCreates an instance of hdrl.func.BPMFit class with p-value bpm threshold.
hdrl.func.BPMFit.RelChiCreates an instance of hdrl.func.BPMFit class with relative chi bpm threshold.
hdrl.func.BPMFit.RelCoefCreates an instance of hdrl.func.BPMFit class with relative coefficient bpm threshold.
- property chi_high¶
Relative chi distribution bpm upper threshold
- Type:
float
- property chi_low¶
Relative chi distribution bpm lower threshold
- Type:
float
- property coef_high¶
Relative fit coefficient distribution bpm upper threshold
- Type:
float
- property coef_low¶
Relative fit coefficient distribution bpm lower threshold
- Type:
float
- property degree¶
The degree of the fit
- Type:
int
- property pval¶
The p-value bpm cutoff
- Type:
float
- class hdrl.func.LaCosmic¶
Bases:
pybind11_objectThe hdrl.func.LaCosmic class provides an interface to the LA-Cosmic algorithm described in van Dokkum et al. 2001, PASP, 113, 1420 to detect bad-pixels and cosmic-rays hits on a single image.
After creating an instance of the class using hdrl.func.LaCosmic() with the desired parameters, the detection is executed using the member function edgedetect().
- Parameters:
sigma_lim (float) – Limiting sigma for detection on the sampling image.
f_lim (float) – Limiting f factor for detection on the modified Laplacian image.
max_iter (int) – Maximum number of iterations.
- Return type:
See also
hdrl.func.LaCosmic.edgedetectDetect bad-pixels or cosmic-rays on a single image.
Notes
For the algorithm see the paper of van Dokkum et al. 2001, PASP, 113, 1420.
- edgedetect(self: hdrl.func.LaCosmic, img_in: hdrl.core.Image) cpl.core.Mask¶
Detect bad-pixels or cosmic-rays on a single image.
This routine determines bad-pixels on a single image via edge detection following the LA-Cosmic algorithm described in van Dokkum et al. 2001, PASP, 113, 1420. It was originally developed to detect cosmic ray hits, but it can also be used in the more general context to detect bad pixels. The HDRL implementation does not use the error model as described in the paper, but instead uses the error image passed to the function. Moreover, several iterations are performed until no new bad pixels are found or the number of iterations reaches max_iter. In each iteration the detected cosmic ray hits are replaced by the median of the surrounding 5x5 pixels taking into account the pixel quality information. The input parameters sigma_lim and f_lim refer to \(\sigma_{lim}\) and \(f_{lim}\) as described in the paper mentioned above.
- Parameters:
ima_in (hdrl.core.Image) – The input image
- Returns:
A mask with all detected bad pixels or cosmics-rays marked as bad or None on error
- Return type:
cpl.core.Mask
See also
hdrl.func.LaCosmicCreates an LaCosmic instance.
Notes
Be aware that the implementation only detects positive bad pixels or cosmic ray hits, i.e. no “holes” in the image are detected, but in such a case the pixels surrounding the hole are marked as bad. Holes in the image can be introduced if e.g. one subtracts a not cosmic-ray-cleaned image from another image.
- property f_lim¶
Limiting f factor for detection on the modified Laplacian image.
- Type:
float
- property max_iter¶
Maximum number of iterations.
- Type:
int
- property sigma_lim¶
Limiting sigma for detection on the sampling image.
- Type:
float
- class hdrl.func.Strehl¶
Bases:
pybind11_object- compute(self: hdrl.func.Strehl, himage: hdrl.core.Image) hdrl.func.StrehlResult¶
Compute the Strehl ratio on an image.
The raw image is assumed to be pre-processed to remove the instrument signatures (bad pixels, etc.) and the natural noise sources (sky background, etc.). Nethertheless this function allows also the user to correct a residual background by setting the parameters bkg_radius_low, bkg_radius_high. The PSF is identified and its integrated flux (controlled by the parameter flux_radius) is normalized to 1. The PSF baricenter is computed and used to generate the ideal PSF (with integrated flux normalized to 1) which takes into account the telescope pupil characteristics (radius m1, central obstruction, m2, …), the wavelength wavelength, at which the image has been obtained and the related pixel scale (pixel_scale_x, pixel_scale_y,). Finally the Strehl ratio is computed dividing the maximum intensity of the image PSF by the maximum intensity of the ideal PSF and the associated error is also computed.
- Parameters:
himage (hdrl.core.Image) – The image to process
- Returns:
The Strehl value object
- Return type:
- property bkg_radius_high¶
Background radius high
- property bkg_radius_low¶
Background radius low
- property flux_radius¶
Flux radius
- property m1¶
M1
- property m2¶
M2
- property pixel_scale_x¶
Pixel scale x
- property pixel_scale_y¶
Pixel scale y
- property wavelength¶
Wavelength
- class hdrl.func.StrehlResult¶
Bases:
pybind11_objectThe hdrl.func.StrehlResult class provides an interface to the results of the Strehl ratio computation.
StrehlResult contains the computed Strehl value and its error.
- property computed_background_error¶
- property nbackground_pixels¶
- property star_background¶
- property star_background_error¶
- property star_flux¶
- property star_flux_error¶
- property star_peak¶
- property star_peak_error¶
- property star_x¶
- property star_y¶
- property strehl_error¶
- property strehl_value¶
- class hdrl.func.Fringe¶
Bases:
pybind11_objectThe hdrl.func.Fringe class provides an interface to fringe pattern detection and correction in astronomical images.
The class provides two main methods: - compute(): Creates a master fringe pattern from a list of fringe images - correct(): Applies fringe correction to images using a master fringe pattern
- Parameters:
None – The Fringe class does not require any parameters for initialization.
- Return type:
Notes
The fringe functions work with HDRL image lists and can handle optional object masks and static masks for improved fringe detection and correction.
Examples
# Example 1: Compute master fringe pattern # Create fringe object fringe = hdrl.func.Fringe() # Create collapse method for combining images collapse = hdrl.func.Collapse.Mean() # Optional: Create static mask for fringe regions stat_mask = cpl.core.Mask(dx, dy) # Set mask for fringe-affected regions # Compute master fringe pattern # ilist_fringe is an hdrl.core.ImageList with fringe images # ilist_obj is optional cpl.core.ImageList with object masks (can be None) fringe.compute(ilist_fringe, ilist_obj, stat_mask, collapse) master_fringe = fringe.master contrib_map = fringe.contrib_map qctable = fringe.qctable # Example 2: Apply fringe correction # Apply correction to images using master fringe # ilist_fringe is an hdrl.core.ImageList with images to correct # masterfringe is the master fringe pattern from compute() result = fringe.correct(ilist_fringe, ilist_obj, stat_mask, masterfringe) qctable = result.qctable
- compute(self: hdrl.func.Fringe, ilist_fringe: hdrl.core.ImageList, ilist_obj: cpl.core.ImageList = None, stat_mask: cpl.core.Mask = None, collapse_params: hdrl.func.Collapse) None¶
Compute a master fringe pattern from a list of fringe images.
This method combines multiple fringe images to create a master fringe pattern with improved signal-to-noise ratio. The method uses the specified collapse algorithm to combine the images.
- Parameters:
ilist_fringe (hdrl.core.ImageList) – List of fringe images to combine into master fringe pattern.
ilist_obj (cpl.core.ImageList or None, optional) – Optional list of object masks. If provided, must have same size and dimensions as ilist_fringe. Default is None.
stat_mask (cpl.core.Mask or None, optional) – Optional static mask for fringe regions. If provided, must have same dimensions as fringe images. Default is None.
collapse_params (hdrl.func.Collapse) – Collapse method for combining fringe images.
- Return type:
None
- Raises:
hdrl.core.NullInputError – If ilist_fringe is None or empty, or if collapse_params is None.
hdrl.core.IncompatibleInputError – If ilist_obj dimensions don’t match ilist_fringe, or if stat_mask dimensions don’t match fringe images.
- correct(self: hdrl.func.Fringe, ilist_fringe: hdrl.core.ImageList, ilist_obj: cpl.core.ImageList = None, stat_mask: cpl.core.Mask = None, masterfringe: hdrl.core.Image = None) hdrl.func.FringeCorrectResult¶
Apply fringe correction to images using a master fringe pattern.
This method corrects fringe patterns in images by subtracting a scaled version of the master fringe pattern. The scaling is determined by fitting the fringe amplitude for each image.
- Parameters:
ilist_fringe (hdrl.core.ImageList) – List of images to correct for fringe patterns.
ilist_obj (cpl.core.ImageList or None, optional) – Optional list of object masks. If provided, must have same size and dimensions as ilist_fringe. Default is None.
stat_mask (cpl.core.Mask or None, optional) – Optional static mask for fringe regions. If provided, must have same dimensions as fringe images. Default is None.
masterfringe (hdrl.core.Image) – Master fringe pattern to use for correction. If None, uses the master computed by compute().
- Returns:
Result object containing a cpl.core.Table, the quality control table with background levels and fringe amplitudes for each image
- Return type:
- Raises:
hdrl.core.NullInputError – If ilist_fringe is None or empty, or if masterfringe is None.
hdrl.core.IncompatibleInputError – If ilist_obj dimensions don’t match ilist_fringe, if stat_mask dimensions don’t match fringe images, or if masterfringe dimensions don’t match fringe images.
Notes
The correction is applied in-place to the images in ilist_fringe. The method modifies the input images directly.
- property contrib_map¶
Contribution map from the last compute() call.
- property master¶
Master fringe pattern from the last compute() call.
- property qctable¶
QC table from the last compute() call.
- class hdrl.func.FringeCorrectResult¶
Bases:
pybind11_objectA hdrl.func.FringeCorrectResult class is a container for the results of hdrl.func.Fringe.correct(). The results consist of a quality control table with background levels and fringe amplitudes.
These can be accessed via the qctable attribute of the object.
Example
result = fringe.correct(ilist_fringe, ilist_obj, stat_mask, masterfringe) qctable = result.qctable
- property qctable¶
Quality control table with background levels and fringe amplitudes
- Type:
cpl.core.Table
- class hdrl.func.Catalogue¶
Bases:
pybind11_objectA hdrl.func.Catalogue class provides an interface to object detection and catalogue generation from astronomical images.
- compute(self: hdrl.func.Catalogue, image: cpl.core.Image, confidence_map: cpl.core.Image = None, wcs: cpl.drs.WCS = None) hdrl.func.CatalogueResult¶
Compute object catalogue from an astronomical image.
This function builds an object catalogue from the input image. The algorithm performs local sky background estimation and removal, detects objects and blends, assigns image pixels to each object, and performs astrometry, photometry and shape analysis on the detected objects.
- Parameters:
image (cpl.core.Image) – Input image for catalogue computation. The image should be in units of ADU (Analog-to-Digital Units).
confidence_map (cpl.core.Image, optional) – Optional confidence map providing uncertainty information for each pixel. If None, no confidence map is used. Must contain only positive numbers if provided.
wcs (cpl.core.WCS, optional) – Optional WCS information for astrometric measurements. If None, no WCS information is used and astrometry will not be performed.
- Returns:
A result object containing: - catalogue: cpl.core.Table with the object catalogue including positions, fluxes, and shape parameters - segmentation_map: cpl.core.Image with the segmentation map showing object assignments - background: cpl.core.Image with the estimated background - qclist: cpl.core.PropertyList with quality control information
- Return type:
Example
# Load image and WCS image = cpl.core.Image.load("science_image.fits") wcs = cpl.drs.WCS(cpl.core.PropertyList.load("science_image.fits")) # Create catalogue object cat = hdrl.func.Catalogue( obj_min_pixels=10, obj_threshold=3.0, obj_deblending=True, obj_core_radius=2.0, bkg_estimate=True, bkg_mesh_size=64, bkg_smooth_fwhm=2.0, det_eff_gain=1.0, det_saturation=65535.0, resulttype=7 ) # Compute catalogue result = cat.compute(image, wcs=wcs) # Access results catalogue = result.catalogue segmap = result.segmentation_map background = result.background qc_info = result.qclist
Notes
The confidence_map must contain only positive numbers if provided.
The function automatically handles image type conversion to double precision if needed.
- Raises:
hdrlcore.NullInputError – If image is None.
hdrlcore.IllegalInputError – If parameter validation fails (e.g., invalid parameter values).
hdrlcore.IncompatibleInputError – If confidence_map contains negative values or other incompatible inputs.
- property bkg_estimate¶
Estimate background from input
- Type:
bool
- property bkg_mesh_size¶
Background smoothing box size
- Type:
int
- property bkg_smooth_fwhm¶
FWHM of Gaussian kernel for object detection
- Type:
float
- property det_eff_gain¶
Detector gain value
- Type:
float
- property det_saturation¶
Detector saturation value
- Type:
float
- property obj_core_radius¶
Value of Rcore in pixels
- Type:
float
- property obj_deblending¶
Use deblending algorithm
- Type:
bool
- property obj_min_pixels¶
Minimum pixel area for each detected object
- Type:
int
- property obj_threshold¶
Detection threshold in sigma above sky
- Type:
float
- property resulttype¶
Requested output type
- Type:
int
- class hdrl.func.CatalogueResult¶
Bases:
pybind11_objectA hdrl.func.CatalogueResult class is a container for the results of hdrl.func.Catalogue.compute(). The results consist of a catalogue table, segmentation map, background image, and quality control information.
These can be accessed via the catalogue, segmentation_map, background, and qclist attributes of the object.
Example
result = hdrl.func.Catalogue.compute(image, wcs=wcs) catalogue = result.catalogue segmap = result.segmentation_map background = result.background qc_info = result.qclist
- property background¶
Estimated background image
- Type:
cpl.core.Image
- property catalogue¶
Object catalogue with positions, fluxes, and shape parameters
- Type:
cpl.core.Table
- property qclist¶
Quality control information
- Type:
cpl.core.PropertyList
- property segmentation_map¶
Segmentation map showing object assignments
- Type:
cpl.core.Image
Efficiency and response¶
Efficiency.compute_response_core uses an experimental HDRL interface whose
C API is not guaranteed to be stable. It is provided for the raw response
calculation and should not be confused with the complete
hdrl.func.Response workflow.
- class hdrl.func.Efficiency¶
Bases:
pybind11_objectA hdrl.func.Efficiency class provides an interface to the HDRL efficiency computation. The efficiency of the instrument (including telescope and detector) is estimated as a 1D function of wavelength by comparing an observed flux-standard-star spectrum with a reference spectrum as it would be observed outside the Earth’s atmosphere. It is used to monitor instrument performance and health. Wavelengths are in nm. Observations should be taken in photometric conditions. The observed and reference fluxes must be expressed in the same units (the reference is typically in erg/s/cm2/Angstrom).
hdrl.func.Efficiency.compute() evaluates \(\epsilon(\lambda) = I_{std}(\lambda)\, 10^{[-0.4(A_p-A_m)E_x(\lambda)]}\, G\, E_{ph}(\lambda) / [T_{ex}\, A_{tel}\, I_{std-ref}(\lambda)]\), where \(E_{ph}\) is the energy of one photon. The reference spectrum and the extinction curve are resampled with Akima interpolation onto the observed wavelength grid; the efficiency is defined only where those inputs overlap.
The class cannot be instantiated. Use hdrl.func.Efficiency.create_parameter() to build the parameter object, then call hdrl.func.Efficiency.compute() to obtain the efficiency spectrum. The related hdrl.func.Efficiency.compute_response_core() method evaluates the raw response equation without telluric correction, velocity compensation, or the final spline interpolation. It wraps an experimental HDRL interface whose C API is not guaranteed to be stable.
- static compute(I_std_arg: hdrl.core.Spectrum1D, I_std_ref: hdrl.core.Spectrum1D, E_x: hdrl.core.Spectrum1D, pars: hdrl.func.EfficiencyParameter) hdrl.core.Spectrum1D¶
Compute HDRL efficiency.
- Parameters:
I_std_arg (hdrl.core.Spectrum1D) – Std star observed spectrum, wavelength in [nm].
I_std_ref (hdrl.core.Spectrum1D) – Std start model spectrum, wavelength in [nm].
E_x (hdrl.core.Spectrum1D) – Atm. extinction model spectrum, wavelength in [nm].
pars (hdrl.func.EfficiencyParameter) – Parameters.
- Returns:
Efficiency.
- Return type:
- static compute_response_core(I_std_arg: hdrl.core.Spectrum1D, I_std_ref: hdrl.core.Spectrum1D, E_x: hdrl.core.Spectrum1D, pars: hdrl.func.EfficiencyResponseParameter) hdrl.core.Spectrum1D¶
Compute HDRL response core.
- Parameters:
I_std_arg (hdrl.core.Spectrum1D) – Std star observed spectrum, wavelength in [nm].
I_std_ref (hdrl.core.Spectrum1D) – Std start model spectrum, wavelength in [nm].
E_x (hdrl.core.Spectrum1D) – Atm. extinction model spectrum, wavelength in [nm].
pars (hdrl.func.EfficiencyParameter) – Parameters.
- Returns:
Response.
- Return type:
- static create_parameter(Ap: SupportsFloat | SupportsIndex, Am: SupportsFloat | SupportsIndex, G: SupportsFloat | SupportsIndex, Tex: SupportsFloat | SupportsIndex, Atel: SupportsFloat | SupportsIndex) hdrl.func.EfficiencyParameter¶
Create an HDRL efficiency parameter.
- Parameters:
Ap (float) – Parameter to indicate if the efficiency is computed at airmass = 0, or at a given non zero value.
Am (float) – Airmass at which the std star was observed.
G (float) – Gain [e/ADU].
Tex (float) – Exposure time [s].
Atel (float) – Collecting area of the telescope [cm2].
- Returns:
A newly alocated parameter.
- Return type:
- static create_response_parameter(Ap: SupportsFloat | SupportsIndex, Am: SupportsFloat | SupportsIndex, G: SupportsFloat | SupportsIndex, Tex: SupportsFloat | SupportsIndex) hdrl.func.EfficiencyResponseParameter¶
Create an HDRL response parameter.
- Parameters:
Ap (float) – Parameter to indicate if the efficiency is computed at airmass = 0, or at a given non zero value.
Am (float) – Airmass at which the std star was observed.
G (float) – Gain [ADU/e].
Tex (float) – Exposure time [s].
- Returns:
A newly alocated parameter.
- Return type:
- class hdrl.func.EfficiencyParameter¶
Bases:
pybind11_objectParameters for the HDRL efficiency computation.
These quantities enter the efficiency equation \(\epsilon(\lambda) = I_{std}(\lambda)\, 10^{[-0.4(A_p-A_m)E_x(\lambda)]}\, G\, E_{ph}(\lambda) / [T_{ex}\, A_{tel}\, I_{std-ref}(\lambda)]\):
Am : airmass of the observed standard-star spectrum
Ap : airmass at which the efficiency is computed (0 for above the atmosphere, or typically the tabulated airmass of the reference spectrum)
G : detector gain [e/ADU]
Tex : exposure time [s]
Atel : telescope collecting area [cm2]
PyHDRL accepts these quantities as floats and fixes their uncertainties to zero. The HDRL C API’s propagation of parameter uncertainties is not exposed.
Create an instance with hdrl.func.Efficiency.create_parameter() or by calling the constructor directly.
- class hdrl.func.EfficiencyResponseParameter¶
Bases:
pybind11_objectParameters for the core response calculation used by hdrl.func.Efficiency.compute_response_core().
These are the subset of efficiency parameters that enter the response equation: airmass terms (Ap, Am), detector gain G [ADU/e], and exposure time Tex [s]. Unlike hdrl.func.EfficiencyParameter they do not include the telescope collecting area.
Create an instance with hdrl.func.Efficiency.create_response_parameter() or by calling the constructor directly.
- class hdrl.func.Response¶
Bases:
pybind11_objectA hdrl.func.Response class provides an interface to the HDRL response computation. The spectroscopic response of the instrument (including telescope and detector) is estimated as a 1D function of wavelength from an observed spectrophotometric standard-star spectrum, a reference standard-star spectrum, and an atmospheric extinction curve. Wavelengths are in nm. Observations should be taken in photometric conditions and in the same optical setup as the science data. The observed and reference fluxes must be expressed in the same units.
The computation has two stages. Telluric correction (optional) selects the best telluric model from a provided list by cross-correlation, shifts and convolves it to the observation’s resolution, and divides it out of the observed spectrum. Response calculation then optionally compensates the stellar model for radial velocity, evaluates the raw response \(R(\lambda) = I_{std-ref}(\lambda)\, 10^{[0.4(A_p-A_m)E_x(\lambda)]}\, G\, T_{ex} / I_{std}(\lambda)\), and interpolates it at selected continuum points. The reference spectrum and the extinction curve are resampled with Akima interpolation onto the observed wavelength grid; the response is defined only where those inputs overlap. If the reference spectrum already contains telluric lines, telluric correction of the observation should be skipped and the response interpolated across those regions.
The class cannot be instantiated. Use the static factory methods to build the parameter objects, then call hdrl.func.Response.compute() to obtain a hdrl.func.ResponseResult. Telluric correction and velocity compensation can each be disabled by passing a default-constructed hdrl.func.ResponseTelluricParameter() or hdrl.func.ResponseVelocityParameter().
- static calc_parameter_create(Ap: SupportsFloat | SupportsIndex, Am: SupportsFloat | SupportsIndex, G: SupportsFloat | SupportsIndex, Tex: SupportsFloat | SupportsIndex) hdrl.func.ResponseCalcParameter¶
Constructor for Response Calc parameter.
- Parameters:
Ap (float) – Airmass at which the response is computed (0 for above the atmosphere, or a tabulated airmass).
Am (float) – Airmass at which the std star was observed.
G (float) – Gain [ADU/e].
Tex (float) – Exposure time [s].
- Return type:
- static compute(obs_s: hdrl.core.Spectrum1D, ref_s: hdrl.core.Spectrum1D, E_x: hdrl.core.Spectrum1D, telluric_par: hdrl.func.ResponseTelluricParameter, velocity_par: hdrl.func.ResponseVelocityParameter, calc_par: hdrl.func.ResponseCalcParameter, fit_par: hdrl.func.ResponseFitParameter) hdrl.func.ResponseResult¶
Computation of the response.
- Parameters:
obs_s (hdrl.core.Spectrum1D) – Observed spectrum.
ref_s (hdrl.core.Spectrum1D) – Reference std star spectrum
E_x (hdrl.core.Spectrum1D) – Atmospheric Extinction
telluric_par (hdrl.func.ResponseTelluricParameter) – Telluric correction parameter. Pass hdrl.func.ResponseTelluricParameter() if telluric correction is skipped.
velocity_par (hdrl.func.ResponseVelocityParameter) – Doppler shift estimation and compensation. Pass hdrl.func.ResponseVelocityParameter() if compensation is skipped.
calc_par (hdrl.func.ResponseCalcParameter) – Parameter for the core computation of the response, e.g. exposure time.
fit_par (hdrl.func.ResponseFitParameter) – Parameter for the final interpolation of the response.
- Returns:
Response result
- Return type:
- static evaluate_telluric_models(obs_s: hdrl.core.Spectrum1D, telluric_par: hdrl.func.ResponseTelluricParameter) tuple[hdrl.core.Spectrum1D, float, float, float, int]¶
This function evaluates all the telluric models and picks the best model.
- Parameters:
obs_s (hdrl.core.Spectrum1D) – Observed spectrum.
telluric_par (hdrl.func.ResponseTelluricParameter) – Telluric correction parameter.
- Returns:
The duplicated spectrum with the best telluric shift, mean, standard devation, best model index.
- Return type:
tuple (hdrl.core.Spectrum1D, float, float, float, int)
- static fit_parameter_create(radius: SupportsInt | SupportsIndex, fit_points: numpy.ndarray, wrange: SupportsFloat | SupportsIndex, high_abs_regions: object = None) hdrl.func.ResponseFitParameter¶
Constructor for the hdrl_parameter for the final interpolation of the response.
- Parameters:
radius (int) – Radius of the median filter used to smooth the response before the final interpolation
fit_points (array) – Median points where the fit will be calculated.
wrange (float) – Range around the median point where the median is calculated.
high_abs_regions (tuple (array of float, array of float) or None) – High absorption regions that should be skipped when calculating the fit. None if no skipping is done.
- Return type:
- static telluric_evaluation_parameter_create(telluric_models: hdrl.core.Spectrum1DList, w_step: SupportsFloat | SupportsIndex, half_win: SupportsInt | SupportsIndex, normalize: bool, shift_in_log_scale: bool, quality_areas: tuple, fit_areas: tuple, lmin: SupportsFloat | SupportsIndex, lmax: SupportsFloat | SupportsIndex) hdrl.func.ResponseTelluricParameter¶
Constructor for Response Telluric parameter.
- Parameters:
telluric_models (hdrl.core.Spectrum1DList) – The available telluric models.
w_step (float) – Sampling step to use when upsampling model and observed spectrum to calculate the cross correlations.
half_win (int) – Half the search window to be used to find the peak of the cross correlation.
normalize (boolean) – True if the cross correlation should be normalized, False otherwise.
shift_in_log_scale (boolean) – True if the cross correlation has to be calculated in logarithmic scale, False otherwise.
quality_areas (tuple (array of float, array of float)) – Areas where the quality of the fit of the telluric model has to be evaluated.
fit_areas (tuple (array of float, array of float)) – Areas where the median points are extracted from, in order to generate the final quality parameters of the telluric model.
lmin (float) – Minimum wavelength used to calculate the cross-correlation (in log scale if shift_in_log_scale = TRUE).
lmax (float) – Maximum wavelength used to calculate the cross-correlation (in log scale if shift_in_log_scale = TRUE).
- Return type:
- static velocity_parameter_create(wguess: SupportsFloat | SupportsIndex, range_wmin: SupportsFloat | SupportsIndex, range_wmax: SupportsFloat | SupportsIndex, fit_wmin: SupportsFloat | SupportsIndex, fit_wmax: SupportsFloat | SupportsIndex, fit_half_win: SupportsInt | SupportsIndex) hdrl.func.ResponseVelocityParameter¶
Constructor for Response Velocity parameter.
- Parameters:
wguess (float) – Reference line wavelength position.
range_wmin (float) – Minimum of wavelength box for line fit.
range_wmax (float) – Maximum of wavelength box for line fit.
fit_wmin (float) – Minimum wavelength value used to fit line slope.
fit_wmax (float) – Maximum wavelength value used to fit line slope.
fit_half_win (int) – Half box where polynomial fit is performed.
- Return type:
- class hdrl.func.ResponseCalcParameter¶
Bases:
pybind11_objectParameters for the core response calculation.
These quantities enter the response equation \(R(\lambda) = I_{std-ref}(\lambda)\, 10^{[0.4(A_p-A_m)E_x(\lambda)]}\, G\, T_{ex} / I_{std}(\lambda)\):
Am : airmass of the observed standard-star spectrum
Ap : airmass at which the response is computed (0 for above the atmosphere, or typically the tabulated airmass of the reference spectrum)
G : detector gain [ADU/e]
Tex : exposure time [s]
Create an instance with hdrl.func.Response.calc_parameter_create() or by calling the constructor directly.
- class hdrl.func.ResponseFitParameter¶
Bases:
pybind11_objectParameters for the final interpolation of the computed raw response.
After the raw response is evaluated, the median flux is taken in a window of half-width wrange around each continuum wavelength in fit_points, skipping high-absorption regions and stellar line cores. A spline is then fitted through those median points to produce the smoothed final response. A median filter of radius radius is applied to the raw response before this interpolation.
Create an instance with hdrl.func.Response.fit_parameter_create() or by calling the constructor directly.
- class hdrl.func.ResponseTelluricParameter¶
Bases:
pybind11_objectParameters for the optional telluric-correction stage of the response computation.
Each provided telluric model is cross-correlated with the observed spectrum (typically on a water-vapour feature) to measure the wavelength shift and the difference in resolution. The model is shifted, convolved with a Gaussian of the measured FWHM, resampled onto the observed wavelengths, and divided into the observation. The model with the lowest quality indicator \(q = |m_r - 1|\) is selected, where \(m_r\) is the mean of the continuum-normalised corrected spectrum.
The parameters cover both the cross-correlation (sampling step, search window, normalisation, logarithmic shift, wavelength limits) and the subsequent quality evaluation (quality and fit wavelength areas). A logarithmic wavelength scale should be used when \(\lambda\)/FWHM is constant; the sampling of that scale must be fine enough for the cross-correlation.
Create an instance with hdrl.func.Response.telluric_evaluation_parameter_create() or by calling the constructor directly. Telluric correction can be skipped by passing a default-constructed hdrl.func.ResponseTelluricParameter() to hdrl.func.Response.compute().
- class hdrl.func.ResponseVelocityParameter¶
Bases:
pybind11_objectParameters for the optional radial-velocity compensation applied during response computation.
A Gaussian is fitted to a known stellar absorption line in the observed (possibly telluric-corrected) spectrum. The derived radial velocity is then applied to the reference standard-star spectrum as \(\lambda = \lambda_0 (1 + RV/c)\). This aligns model and observation when they differ in radial velocity, or when a slit-positioning offset shifts the observed wavelength scale.
Create an instance with hdrl.func.Response.velocity_parameter_create() or by calling the constructor directly. Velocity compensation can be skipped by passing a default-constructed hdrl.func.ResponseVelocityParameter() to hdrl.func.Response.compute().
- class hdrl.func.ResponseResult¶
Bases:
pybind11_objectResult of a hdrl.func.Response.compute() call.
Contains the response spectra produced by the computation together with the telluric-corrected observed spectrum and quality-control quantities:
the raw response \(I_{std-ref}\, 10^{[0.4(A_p-A_m)E_x]}\, G\, T_{ex} / I_{std}\)
the selected response (raw response sampled at the fit points)
the final interpolated response
the observed spectrum after telluric correction (undefined if telluric correction was skipped)
the index of the best telluric model, the telluric and Doppler shifts, and the fit-quality indicators avg_diff_from_1 (\(|m_r - 1|\)) and stddev
- get_avg_diff_from_1(self: hdrl.func.ResponseResult) float¶
Get the absolute value of mean minus 1, where mean is the average of the ratio between the corrected observed spectrum and its smoothed fit. This value can be used to assess the quality of the match of the telluric model with the provided observed spectrum.
- Returns:
The mean value.
- Return type:
float
- get_best_telluric_model_idx(self: hdrl.func.ResponseResult) int¶
Get the index of the telluric model used for telluric correction.
- Returns:
The index.
- Return type:
int
- get_corrected_obs_spectrum(self: hdrl.func.ResponseResult) hdrl.core.Spectrum1D¶
Get the the corrected observed spectrum.
- Returns:
The observed spectrum corrected by the telluric model.
- Return type:
- get_doppler_shift(self: hdrl.func.ResponseResult) float¶
Get the doppler shift used to correct the model.
- Returns:
The value of doppler shift.
- Return type:
float
- get_final_response(self: hdrl.func.ResponseResult) hdrl.core.Spectrum1D¶
Get the final product of response calculations.
- Returns:
Copy of the response spectrum.
- Return type:
- get_raw_response(self: hdrl.func.ResponseResult) hdrl.core.Spectrum1D¶
Get the raw response. The raw response is the reference standard-star spectrum divided by the observed spectrum, corrected for gain, exposure time and atmospheric extinction.
- Returns:
Copy of the raw response.
- Return type:
- get_selected_response(self: hdrl.func.ResponseResult) hdrl.core.Spectrum1D¶
Get the selected response. The selected response is the raw response sampled in the fit points. This response is going then to be interpolated, creating the final response.
- Returns:
Copy of the selected response.
- Return type:
- get_stddev(self: hdrl.func.ResponseResult) float¶
Get the standard deviation of the ratio between the corrected observed spectrum and its smoothed fit. This value can be used to assess the quality of the match of the telluric model with the provided observed spectrum.
- Returns:
The standard deviation value.
- Return type:
float
- get_telluric_shift(self: hdrl.func.ResponseResult) float¶
Get the shift applied to the telluric model. This value can be used to assess the quality of the match of the telluric model with the provided observed spectrum.
- Returns:
The value of shift.
- Return type:
float
DAR, airmass, FPN, resample, maglim, barycorr¶
- class hdrl.func.Dar¶
Bases:
pybind11_object- compute(self: hdrl.func.Dar, lambdaRef: tuple, lambdaIn: cpl.core.Vector) hdrl.func.DarResult¶
Compute differential atmospheric refraction corrections.
This function computes shifts for correcting an image for differential atmospheric refraction (DAR). The algorithm computes the DAR offset for the wavelength difference with respect to the reference wavelength, and stores the shift in the coordinates, taking into account the instrument rotation angle on the sky and the parallactic angle at the time of the observations.
- Parameters:
lambdaRef (tuple or None) – Reference wavelength in Angstroms with error (data, error) or None for (0, 0).
lambdaIn (cpl.core.Vector) – One lambda for each plane (in Angstroms).
- Returns:
A result object containing: - xShift: cpl.core.Vector, correction for each plane in x-axis (pixels) - yShift: cpl.core.Vector, correction for each plane in y-axis (pixels) - xShiftErr: cpl.core.Vector, error in correction for each plane in x-axis (pixels) - yShiftErr: cpl.core.Vector, error in correction for each plane in y-axis (pixels)
- Return type:
Notes
The resulting correction can be directly applied to the image.
The algorithm is based on Filippenko (1982, PASP, 94, 715) and uses the formula from Owens which converts relative humidity to water vapor pressure.
The calculation is performed by calling the top-level function hdrl_dar_compute() and the parameters passed to this function can be created by calling the constructor.
- Raises:
hdrlcore.NullInputError – If any required parameter is None.
hdrlcore.IllegalInputError – If parameter validation fails (e.g., invalid parameter values).
hdrlcore.IncompatibleInputError – If inputs are incompatible.
- property airmass¶
- property parang¶
- property posang¶
- property pres¶
- property rhum¶
- property temp¶
- property wcs¶
- class hdrl.func.DarResult¶
Bases:
pybind11_object- property xShift¶
- property xShiftErr¶
- property yShift¶
- property yShiftErr¶
- class hdrl.func.Airmass¶
Bases:
pybind11_object- compute(self: hdrl.func.Airmass) tuple¶
Compute the effective air mass.
This function calculates the effective air mass using the specified approximation method. The air mass is computed from the astronomical coordinates (RA, Dec), local sidereal time, exposure time, and observatory latitude.
- Returns:
A tuple containing (airmass_data, airmass_error) where: - airmass_data: The computed air mass value - airmass_error: The error in the air mass calculation
- Return type:
tuple
Notes
The function uses different approximation methods: - Hardie (1962): Most commonly used method - Young & Irvine (1967): Alternative approximation - Young (1994): More recent approximation
The calculation takes into account the Earth’s atmospheric refraction and the geometric path length through the atmosphere.
- Raises:
hdrlcore.IllegalInputError – If any input parameter is invalid (e.g., RA outside [0, 360], Dec outside [-90, 90], latitude outside [-90, 90], etc.).
- property dec¶
- property exptime¶
- property latitude¶
- property lst¶
- property ra¶
- property type¶
- class hdrl.func.AirmassApprox¶
Bases:
pybind11_objectMembers:
Hardie
YoungIrvine
Young
- Hardie = <AirmassApprox.Hardie: 1>¶
- Young = <AirmassApprox.Young: 3>¶
- YoungIrvine = <AirmassApprox.YoungIrvine: 2>¶
- AirmassApprox.name -> str
- property value¶
- hdrl.func.fpn_compute(image: cpl.core.Image, mask: cpl.core.Mask = None, dc_mask_x: SupportsInt | SupportsIndex = 1, dc_mask_y: SupportsInt | SupportsIndex = 1) hdrl.func.FpnResult¶
Compute fixed pattern noise on a single image.
This function detects fixed pattern noise on the input image. The algorithm first computes the power spectrum of the image using the Fast Fourier Transform (FFT), then computes the standard deviation and MAD-based standard deviation of the power spectrum excluding the masked region.
- Parameters:
image (cpl.core.Image) – Input image (bad pixels are not allowed).
mask (cpl.core.Mask, optional) – Optional input mask applied to the power spectrum. If None, no mask is used.
dc_mask_x (int, optional) – X-pixel window (>= 1) to discard the DC component starting from C/FITS pixel (1, 1), which is Python index [0, 0]. Default is 1.
dc_mask_y (int, optional) – Y-pixel window (>= 1) to discard the DC component starting from C/FITS pixel (1, 1), which is Python index [0, 0]. Default is 1.
- Returns:
A result object containing: - power_spectrum: cpl.core.Image with the computed power spectrum - std: float, the standard deviation of the power spectrum - std_mad: float, the MAD-based standard deviation of the power spectrum
- Return type:
Notes
The power spectrum contains the DC component (the DC term is the 0 Hz term and is equivalent to the average of all the samples in the window) in C/FITS pixel (1, 1), corresponding to [0, 0] with Python’s 0-based (y, x) indexing.
The mask created on the fly by setting dc_mask_x and dc_mask_y and the optional mask are combined and are both taken into account when calculating std and std_mad.
The final mask used to derive std and std_mad is attached to the power_spectrum image as a normal cpl mask and can be retrieved using power_spectrum.bpm.
- Raises:
hdrlcore.NullInputError – If image is None.
hdrlcore.IllegalInputError – If dc_mask_x < 1 or dc_mask_y < 1, or if image contains bad pixels.
hdrlcore.IncompatibleInputError – If mask is not None and its size doesn’t match the image size.
- class hdrl.func.FpnResult¶
Bases:
pybind11_object- property power_spectrum¶
- property std¶
- property std_mad¶
- class hdrl.func.Resample¶
Bases:
pybind11_objectA hdrl.func.Resample class provides an interface to static functions required to resample images and cubes.
- static compute(restable: cpl.core.Table, method: hdrl.func.ResampleMethod, outputgrid: hdrl.func.ResampleOutgrid, wcs: cpl.drs.WCS) hdrl.func.ResampleResult¶
This routine does not work directly on an image or cube but on a table (restable).
For 2D images, the table is created by the function hdrl.func.Resample.image_to_table(), whereas for a 3D data cube the function hdrl.func.Resample.imagelist_to_table() is used.
In the case that many images or cubes have to be combined into a single mosaic, the two functions can be called multiple times and the returned tables should be merged into a single table using cpl.core.Table.insert().
- Parameters:
restable (cpl.core.Table) –
A PyCPL table with information on the data to be resampled.
It can be created either via hdrl.func.Resample.image_to_table() for a 2D image or via hdrl.func.Resample.imagelist_to_table() for a 3D data cube. These functions require either an hdrl.core.Image (2D image) or hdrl.core.ImageList (3D data cube), plus a valid cpl.drs.WCS object that encodes the world coordinate system of the given image or cube.
Alternatively, in case the above mentioned functions can not be used to create the table, e.g. the pixel to sky mapping is very complex and can not be encoded by the cpl.drs.WCS object, the pipeline developer has to create and fill the table. A template of this table can be generated using the function hdrl.func.Resample.restable_template().
method (hdrl.func.ResampleMethod) – The interpolation method to apply as specified via an instance of the hdrl.func.ResampleMethod class, which can be instantiated via one of the following constructors: - hdrl.func.ResampleMethod.Nearest: Nearest neighbour resampling. - hdrl.func.ResampleMethod.Linear: Weighted resampling using an inverse distance weighting function. - hdrl.func.ResampleMethod.Quadratic: Weighted resampling using a quadratic inverse distance weighting function. - hdrl.func.ResampleMethod.Renka: Weighted resampling using a Renka weighting function. - hdrl.func.ResampleMethod.Drizzle: Weighted resampling using a drizzle-like weighting scheme. - hdrl.func.ResampleMethod.Lanczos: Weighted resampling using a Lanczos-like restricted sinc as weighting function.
outputgrid (hdrl.func.ResampleOutgrid) – Defines basic properties of the resampled image or cube. Depending on the input data (image or cube), outputgrid should be an instance of the hdrl.func.ResampleOutgrid class, which can be instantiated via one of the following constructors: - hdrl.func.ResampleOutgrid.User2D : User specified function for 2D images. - hdrl.func.ResampleOutgrid.User3D : User specified function for 3D data cubes. - hdrl.func.ResampleOutgrid.Auto2D : Convenience function for 2D images. - hdrl.func.ResampleOutgrid.Auto3D : Convenience function for 3D data cubes. In the case of the Auto2D and Auto3D constructors, only the step sizes in right ascension, declination and wavelength of the output image or cube are required. All the rest are automatically derived from the data by hdrl.func.Resample.compute().
wcs (cpl.drs.WCS) – The World Coordinate System representative of the images to be resampled. The resampling functions use the wcs input (CD matrix) mostly to determine the scales between the input and output grid. Please note, that in case the user would like to combine images or cubes with substantially different pixel sizes into a single output image or cube, the single tables have to be properly scaled to the same scales before merging them into the final table.
- Returns:
res – An object containing the results consisting of a cpl.core.PropertyList, representing the image or cube header, and an hdrl.core.ImageList. These can be accessed via the hdr and imlist attributes of the object.
- Return type:
Example
# plist is a cpl.core.PropertyList containing the WCS keywords from the header wcs = cpl.drs.WCS(plist) # himg is a hdrl.core.Image to be resampled table = hdrl.func.Resample.image_to_table(himg, wcs) rmethod = hdrl.func.ResampleMethod.Lanczos(1,False,2) outgrid = hdrl.func.ResampleOutgrid.Auto2D(0.01,0.01) result = hdrl.func.Resample.compute(table,rmethod,outgrid,wcs) first_img = result.imlist[0].image first_err = result.imlist[0].error hdr = result.hdr
- static image_to_table(hima: hdrl.core.Image, wcs: cpl.drs.WCS) cpl.core.Table¶
Creates the restable input table needed by hdrl.func.Resample.compute() for 2D images.
- Parameters:
himg (hdrl.core.Image) – The image to be resampled.
wcs (cpl.drs.WCS) – The World Coordinate System representative of the images to be resampled.
- Returns:
restable – The table that is used by hdrl.func.Resample.compute()
- Return type:
cpl.core.Table
See also
hdrl.func.Resample.imagelist_to_tableCreates the restable input table needed by hdrl.func.Resample.compute() for 3D data cubes.
hdrl.func.Resample.restable_templateCreates a table template as per Sect. 4.14.3 of the HDRL manual.
- static imagelist_to_table(himlist: hdrl.core.ImageList, wcs: cpl.drs.WCS) cpl.core.Table¶
Creates the restable input table needed by hdrl.func.Resample.compute() for 3D data cubes.
- Parameters:
himlist (hdrl.core.ImageList) – The imagelist containing the images, i.e. the data cube, to be resampled.
wcs (cpl.drs.WCS) – The World Coordinate System representative of the images to be resampled.
- Returns:
restable – The table that is used by hdrl.func.Resample.compute()
- Return type:
cpl.core.Table
See also
hdrl.func.Resample.image_to_tableCreates the restable input table needed by hdrl.func.Resample.compute() for 2D images.
hdrl.func.Resample.restable_templateCreates a table template as per Sect. 4.14.3 of the HDRL manual.
- static restable_template(nrows: SupportsInt | SupportsIndex) cpl.core.Table¶
Creates a table template as per Sect. 4.14.3 of the HDRL manual. Useful for instances where the pixel to sky mapping is very complex and can not be encoded in a cpl.drs.WCS object. This template can then be filled by the pipeline developer as required.
- Parameters:
nrows (int) – The number of rows to create.
- Returns:
restable – The table template with nrows rows.
- Return type:
cpl.core.Table
See also
hdrl.func.Resample.image_to_tableCreates the restable input table needed by hdrl.func.Resample.compute() for 2D images.
hdrl.func.Resample.imagelist_to_tableCreates the restable input table needed by hdrl.func.Resample.compute() for 3D data cubes.
- class hdrl.func.ResampleMethod¶
Bases:
pybind11_objectA hdrl.func.ResampleMethod class represents an interpolation algorithm to be applied using hdrl.func.Resample.compute().
The implemented interpolation algorithms are based on the MUSE pipeline and work for 2D images and 3D cubes. The 2D and 3D interpolation is done in 2-dimensional and 3-dimensional spaces, respectively.
Currently there are six different interpolation methods implemented: - Nearest: Nearest neighbour resampling - Linear: Weighted resampling using an inverse distance weighting function - Quadratic: Weighted resampling using a quadratic inverse distance weighting function - Renka: Weighted resampling using a Renka weighting function - Drizzle: Weighted resampling using a drizzle-like weighting scheme - Lanczos: Weighted resampling using a Lanczos-like restricted sinc as weighting function
Each method has its own separate constructor (e.g. hdrl.func.ResampleMethod.Nearest(), hdrl.func.ResampleMethod.Linear()).
- static Drizzle(loop_distance: SupportsInt | SupportsIndex, use_errorweights: bool, pix_frac_x: SupportsFloat | SupportsIndex, pix_frac_y: SupportsFloat | SupportsIndex, pix_frac_lambda: SupportsFloat | SupportsIndex) hdrl.func.ResampleMethod¶
Creates an instance of hdrl.func.ResampleMethod for the Drizzle method. This method performs weighted resampling using a drizzle-like weighting scheme.
- Parameters:
loop_distance (int) – Controls the number of surrounding pixels that are taken into account on the final grid.
use_errorweights (bool) – Apply an additional weight of 1/variance.
pix_frac_x (float) – Fraction of flux of the original pixel/voxel that drizzles into target pixel/voxel in the x-direction.
pix_frac_y (float) – Fraction of flux of the original pixel/voxel that drizzles into target pixel/voxel in the y-direction.
pix_frac_lambda (float) – Fraction of flux of the original pixel/voxel that drizzles into target pixel/voxel in the lambda-direction.
- Returns:
hdrl.func.ResampleMethod for the Drizzle method.
- Return type:
Example
loop_distance = 2 use_errorweights = True pix_frac_drizzle_x = 0.8 pix_frac_drizzle_y = 0.8 pix_frac_drizzle_lambda = 1 rmethod = hdrl.func.ResampleMethod.Drizzle(loop_distance, use_errorweights, pix_frac_drizzle_x, pix_frac_drizzle_y, pix_frac_drizzle_lambda)
Notes
The algorithm uses a drizzle-like distance weighting function for the interpolation. The down-scaling factors pix_frac_x, pix_frac_y, and pix_frac_lambda, for x, y, and wavelength direction control the percentage of flux of the original pixel/voxel that drizzles into the target pixel/voxel. The parameter loop_distance controls the number of surrounding pixels that are taken into account on the final grid, e.g. a loop_distance of 1 uses 3 pixels \((x - 1, x, x + 1)\) in each dimension, i.e. 9 in total for a 2D image and 27 in total for a 3D cube. Moreover, if the parameter use_errorweights is set to True, an additional weight, defined as 1/variance, is taken into account. This additional weight is only applied if the variance of a pixel is greater than 0.
See also
hdrl.func.ResampleMethod.NearestCreates an instance of hdrl.func.ResampleMethod for the Nearest method.
hdrl.func.ResampleMethod.LinearCreates an instance of hdrl.func.ResampleMethod for the Linear method.
hdrl.func.ResampleMethod.QuadraticCreates an instance of hdrl.func.ResampleMethod for the Quadratic method.
hdrl.func.ResampleMethod.RenkaCreates an instance of hdrl.func.ResampleMethod for the Renka method.
hdrl.func.ResampleMethod.LanczosCreates an instance of hdrl.func.ResampleMethod for the Lanczos method.
- static Lanczos(loop_distance: SupportsInt | SupportsIndex, use_errorweights: bool, kernel_size: SupportsInt | SupportsIndex) hdrl.func.ResampleMethod¶
Creates an instance of hdrl.func.ResampleMethod for the Lanczos method. This method performs weighted resampling using a Lanczos-like restricted sinc as weighting function.
- Parameters:
loop_distance (int) – Controls the number of surrounding pixels that are taken into account on the final grid.
use_errorweights (bool) – Apply an additional weight of 1/variance.
kernel_size (int) – The kernel size in pixel units for the sinc distance weighting function.
- Returns:
hdrl.func.ResampleMethod for the Lanczos method.
- Return type:
Example
loop_distance = 2 use_errorweights = True kernel_size = 2 rmethod = hdrl.func.ResampleMethod.Lanczos(loop_distance, use_errorweights, kernel_size)
Notes
The algorithm uses a restricted sinc distance weighting function sinc(r)/sinc(r/kernel_size), with the kernel size given by the parameter kernel_size for the interpolation. The parameter loop_distance controls the number of surrounding pixels that are taken into account on the final grid, e.g. a loop_distance of 1 uses 3 pixels \((x - 1, x, x + 1)\) in each dimension, i.e. 9 in total for a 2D image and 27 in total for a 3D cube. Moreover, if the parameter use_errorweights is set to True, an additional weight, defined as 1/variance, is taken into account. This additional weight is only applied if the variance of a pixel is greater than 0.
See also
hdrl.func.ResampleMethod.NearestCreates an instance of hdrl.func.ResampleMethod for the Nearest method.
hdrl.func.ResampleMethod.LinearCreates an instance of hdrl.func.ResampleMethod for the Linear method.
hdrl.func.ResampleMethod.QuadraticCreates an instance of hdrl.func.ResampleMethod for the Quadratic method.
hdrl.func.ResampleMethod.RenkaCreates an instance of hdrl.func.ResampleMethod for the Renka method.
hdrl.func.ResampleMethod.DrizzleCreates an instance of hdrl.func.ResampleMethod for the Drizzle method.
- static Linear(loop_distance: SupportsInt | SupportsIndex, use_errorweights: bool) hdrl.func.ResampleMethod¶
Creates an instance of hdrl.func.ResampleMethod for the Linear method. This method performs weighted resampling using an inverse distance weighting function.
- Parameters:
loop_distance (int) – Controls the number of surrounding pixels that are taken into account on the final grid.
use_errorweights (bool) – Apply an additional weight of 1/variance.
- Returns:
Instance of hdrl.func.ResampleMethod for the Linear method.
- Return type:
Example
loop_distance = 2 use_errorweights = True rmethod = hdrl.func.ResampleMethod.Linear(loop_distance, use_errorweights)
Notes
The algorithm uses a linear inverse distance weighting function \((1/r)\) for the interpolation. The parameter loop_distance controls the number of surrounding pixels that are taken into account on the final grid, e.g. a loop_distance of 1 uses 3 pixels \((x - 1, x, x + 1)\) in each dimension, i.e. 9 in total for a 2D image and 27 in total for a 3D cube. Moreover, if the parameter use_errorweights is set to True, an additional weight, defined as 1/variance, is taken into account. This additional weight is only applied if the variance of a pixel is greater than 0.
See also
hdrl.func.ResampleMethod.NearestCreates an instance of hdrl.func.ResampleMethod for the Nearest method.
hdrl.func.ResampleMethod.QuadraticCreates an instance of hdrl.func.ResampleMethod for the Quadratic method.
hdrl.func.ResampleMethod.RenkaCreates an instance of hdrl.func.ResampleMethod for the Renka method.
hdrl.func.ResampleMethod.DrizzleCreates an instance of hdrl.func.ResampleMethod for the Drizzle method.
hdrl.func.ResampleMethod.LanczosCreates an instance of hdrl.func.ResampleMethod for the Lanczos method.
- static Nearest() hdrl.func.ResampleMethod¶
Creates an instance of hdrl.func.ResampleMethod for the Nearest method. This method performs nearest neighbour resampling.
- Returns:
Instance of hdrl.func.ResampleMethod for Nearest method
- Return type:
Example
rmethod = hdrl.func.ResampleMethod.Nearest()
Notes
The algorithm does not use any weighting function, but simply uses the value of the nearest neighbour inside an output voxel [1] centre as the final output value. If there is no nearest neighbour inside the voxel (but e.g. only outside), the voxel is marked as bad. This speeds up the algorithm considerably. There are no control parameters for this method.
See also
hdrl.func.ResampleMethod.LinearCreates an instance of hdrl.func.ResampleMethod for the Linear method.
hdrl.func.ResampleMethod.QuadraticCreates an instance of hdrl.func.ResampleMethod for the Quadratic method.
hdrl.func.ResampleMethod.RenkaCreates an instance of hdrl.func.ResampleMethod for the Renka method.
hdrl.func.ResampleMethod.DrizzleCreates an instance of hdrl.func.ResampleMethod for the Drizzle method.
hdrl.func.ResampleMethod.LanczosCreates an instance of hdrl.func.ResampleMethod for the Lanczos method.
- static Quadratic(loop_distance: SupportsInt | SupportsIndex, use_errorweights: bool) hdrl.func.ResampleMethod¶
Creates an instance of hdrl.func.ResampleMethod for the Quadratic method. This method performs weighted resampling using a quadratic inverse distance weighting function.
- Parameters:
loop_distance (int) – Controls the number of surrounding pixels that are taken into account on the final grid.
use_errorweights (bool) – Apply an additional weight of 1/variance.
- Returns:
Instance of hdrl.func.ResampleMethod for the Quadratic method.
- Return type:
Example
loop_distance = 2 use_errorweights = True rmethod = hdrl.func.ResampleMethod.Quadratic(loop_distance, use_errorweights)
Notes
The algorithm uses a quadratic inverse distance weighting function \((1/r^2)\) for the interpolation. The parameter loop_distance controls the number of surrounding pixels that are taken into account on the final grid, e.g. a loop_distance of 1 uses 3 pixels \((x - 1, x, x + 1)\) in each dimension, i.e. 9 in total for a 2D image and 27 in total for a 3D cube. Moreover, if the parameter use_errorweights is set to True, an additional weight, defined as 1/variance, is taken into account. This additional weight is only applied if the variance of a pixel is greater than 0.
See also
hdrl.func.ResampleMethod.NearestCreates an instance of hdrl.func.ResampleMethod for the Nearest method.
hdrl.func.ResampleMethod.LinearCreates an instance of hdrl.func.ResampleMethod for the Linear method.
hdrl.func.ResampleMethod.RenkaCreates an instance of hdrl.func.ResampleMethod for the Renka method.
hdrl.func.ResampleMethod.DrizzleCreates an instance of hdrl.func.ResampleMethod for the Drizzle method.
hdrl.func.ResampleMethod.LanczosCreates an instance of hdrl.func.ResampleMethod for the Lanczos method.
- static Renka(loop_distance: SupportsInt | SupportsIndex, use_errorweights: bool, critical_radius: SupportsFloat | SupportsIndex) hdrl.func.ResampleMethod¶
Creates an instance of hdrl.func.ResampleMethod for the Renka method. This method performs weighted resampling using a Renka weighting function.
- Parameters:
loop_distance (int) – Controls the number of surrounding pixels that are taken into account on the final grid.
use_errorweights (bool) – Apply an additional weight of 1/variance.
critical_radius (float) – The distance beyond which the weights are set to 0.
- Returns:
Instance of hdrl.func.ResampleMethod for the Renka method.
- Return type:
Example
loop_distance = 2 use_errorweights = True critical_radius = 3 rmethod = hdrl.func.ResampleMethod.Renka(loop_distance, use_errorweights, critical_radius)
Notes
The algorithm uses a modified Shepard-like distance weighting function following Renka for the interpolation. The parameter critical_radius defines the distance beyond which the weights are set to 0 and the pixels are therefore not taken into account. The parameter loop_distance controls the number of surrounding pixels that are taken into account on the final grid, e.g. a loop_distance of 1 uses 3 pixels \((x - 1, x, x + 1)\) in each dimension, i.e. 9 in total for a 2D image and 27 in total for a 3D cube. Moreover, if the parameter use_errorweights is set to True, an additional weight, defined as 1/variance, is taken into account. This additional weight is only applied if the variance of a pixel is greater than 0.
See also
hdrl.func.ResampleMethod.NearestCreates an instance of hdrl.func.ResampleMethod for the Nearest method.
hdrl.func.ResampleMethod.LinearCreates an instance of hdrl.func.ResampleMethod for the Linear method.
hdrl.func.ResampleMethod.QuadraticCreates an instance of hdrl.func.ResampleMethod for the Quadratic method.
hdrl.func.ResampleMethod.DrizzleCreates an instance of hdrl.func.ResampleMethod for the Drizzle method.
hdrl.func.ResampleMethod.LanczosCreates an instance of hdrl.func.ResampleMethod for the Lanczos method.
- class hdrl.func.ResampleOutgrid¶
Bases:
pybind11_objectA hdrl.func.ResampleOutgrid class defines the basic properties of the resampled image or cube that are to be considered by hdrl.func.Resample.compute().
It can be instantiated via one of the following constructors: - hdrl.func.ResampleOutgrid.User2D : User specified function for 2D images. - hdrl.func.ResampleOutgrid.User3D : User specified function for 3D data cubes. - hdrl.func.ResampleOutgrid.Auto2D : Convenience function for 2D images. - hdrl.func.ResampleOutgrid.Auto3D : Convenience function for 3D data cubes. In the case of the Auto2D and Auto3D constructors, only the step sizes in right ascension, declination and wavelength of the output image or cube are required. All the rest are automatically derived from the data by hdrl.func.Resample.compute().
- static Auto2D(delta_ra: SupportsFloat | SupportsIndex, delta_dec: SupportsFloat | SupportsIndex) hdrl.func.ResampleOutgrid¶
Creates an instance of hdrl.func.ResampleOutgrid for 2D images.
- Parameters:
delta_ra (float) – Output grid step in right ascension
delta_dec (float) – Output grid step in declination
- Returns:
Instance of hdrl.func.ResampleOutgrid for 2D images.
- Return type:
Example
outputgrid = hdrl.func.ResampleOutgrid.Auto2D(0.1,0.2)
See also
hdrl.func.ResampleOutgrid.User2DCreates an instance of hdrl.func.ResampleOutgrid for 2D images.
- static Auto3D(delta_ra: SupportsFloat | SupportsIndex, delta_dec: SupportsFloat | SupportsIndex, delta_lambda: SupportsFloat | SupportsIndex) hdrl.func.ResampleOutgrid¶
Creates an instance of hdrl.func.ResampleOutgrid for 3D data cubes.
- Parameters:
delta_ra (float) – Output grid step in right ascension
delta_dec (float) – Output grid step in declination
delta_lambda (float) – Output grid step in wavelength
- Returns:
Instance of hdrl.func.ResampleOutgrid for 3D data cubes.
- Return type:
Example
outputgrid = hdrl.func.ResampleOutgrid.Auto3D(0.1,0.2,0.001)
See also
hdrl.func.ResampleOutgrid.User3DCreates an instance of hdrl.func.ResampleOutgrid for 3D data cubes.
- static User2D(delta_ra: SupportsFloat | SupportsIndex, delta_dec: SupportsFloat | SupportsIndex, ra_min: SupportsFloat | SupportsIndex, ra_max: SupportsFloat | SupportsIndex, dec_min: SupportsFloat | SupportsIndex, dec_max: SupportsFloat | SupportsIndex, fieldmargin: SupportsFloat | SupportsIndex) hdrl.func.ResampleOutgrid¶
Creates an instance of hdrl.func.ResampleOutgrid for 2D images.
- Parameters:
delta_ra (float) – Output grid step in right ascension
delta_dec (float) – Output grid step in declination
ra_min (float) – Minimum boundary of the image in right ascension
ra_max (float) – Maximum boundary of the image in right ascension
dec_min (float) – Minimum boundary of the image in declination
dec_max (float) – Maximum boundary of the image in declination
fieldmargin (float) – Percentage of how much margin to add to the output image in all spatial directions. A value of 0 adds no margin.
- Returns:
instance of hdrl.func.ResampleOutgrid for 2D images.
- Return type:
Example
delta_ra = 0.1 delta_dec = 0.2 ra_min = 48.069416667 ra_max = 48.0718125 dec_min = -20.6229925 dec_max = -20.620708611 field_margin = 5 outputgrid = hdrl.func.ResampleOutgrid.User2D(delta_ra, delta_dec, ra_min, ra_max, dec_min, dec_max, field_margin)
See also
hdrl.func.ResampleOutgrid.Auto2DCreates an instance of hdrl.func.ResampleOutgrid for 2D images.
- static User3D(delta_ra: SupportsFloat | SupportsIndex, delta_dec: SupportsFloat | SupportsIndex, delta_lambda: SupportsFloat | SupportsIndex, ra_min: SupportsFloat | SupportsIndex, ra_max: SupportsFloat | SupportsIndex, dec_min: SupportsFloat | SupportsIndex, dec_max: SupportsFloat | SupportsIndex, lambda_min: SupportsFloat | SupportsIndex, lambda_max: SupportsFloat | SupportsIndex, fieldmargin: SupportsFloat | SupportsIndex) hdrl.func.ResampleOutgrid¶
Creates an instance of hdrl.func.ResampleOutgrid for 3D data cubes.
- Parameters:
delta_ra (float) – Output grid step in right ascension
delta_dec (float) – Output grid step in declination
delta_lambda (float) – Output grid step in wavelength
ra_min (float) – Minimum boundary of the image in right ascension
ra_max (float) – Maximum boundary of the image in right ascension
dec_min (float) – Minimum boundary of the image in declination
dec_max (float) – Maximum boundary of the image in declination
lambda_min (float) – Minimum boundary of the image in wavelength
lambda_max (float) – Maximum boundary of the image in wavelength
fieldmargin (float) – Percentage of how much margin to add to the output image in all spatial directions. A value of 0 adds no margin.
- Returns:
instance of hdrl.func.ResampleOutgrid for 3D data cubes.
- Return type:
Example
delta_ra = 0.1 delta_dec = 0.2 delta_lambda = 0.001 ra_min = 48.069416667 ra_max = 48.0718125 dec_min = -20.6229925 dec_max = -20.620708611 lambda_min = 1.9283e-06 lambda_max = 2.47146e-06 field_margin = 5 outputgrid = hdrl.func.ResampleOutgrid.User3D(delta_ra, delta_dec, delta_lambda, ra_min, ra_max, dec_min, dec_max, lambda_min, lambda_max, field_margin)
See also
hdrl.func.ResampleOutgrid.Auto3DCreates an instance of hdrl.func.ResampleOutgrid for 3D data cubes.
- class hdrl.func.ResampleResult¶
Bases:
pybind11_objectA hdrl.func.ResampleResult class is a container for the results of hdrl.func.Resample.compute(). The results consist of a cpl.core.PropertyList, representing the image or cube header, and an hdrl.core.ImageList.
These can be accessed via the hdr and imlist attributes of the object.
Example
result = hdrl.func.Resample.compute(table,rmethod,outgrid,wcs) hdr = result.hdr himlist = result.imlist first_img = himlist[0].image first_err = himlist[0].error
- property hdr¶
image or cube header
- Type:
cpl.core.PropertyList
- property imlist¶
imagelist containing the resampled images
- Type:
- class hdrl.func.Maglim¶
Bases:
pybind11_objectA hdrl.func.Maglim is a helper class for computing limiting magnitudes.
- Parameters:
zeropoint (float) – Zeropoint for magnitude calculation.
fwhm (float) – Full width at half maximum for the PSF.
kernel_size_x (int) – Kernel size in x direction.
kernel_size_y (int) – Kernel size in y direction.
extend_method (hdrl.func.Maglim.ImageExtendMethod) – Image extension method (Nearest or Mirror).
mode_param (hdrl.func.Collapse or hdrl.core.Parameter) – Mode parameter for the computation.
- class ImageExtendMethod¶
Bases:
pybind11_objectImage extension method for maglim computation.
Members:
Nearest : Extend using nearest value.
Mirror : Extend using mirror value.
- Mirror = <ImageExtendMethod.Mirror: 1>¶
- Nearest = <ImageExtendMethod.Nearest: 0>¶
- Maglim.ImageExtendMethod.name -> str
- property value¶
- compute(self: hdrl.func.Maglim, image: cpl.core.Image) float¶
Compute the limiting magnitude for the given image.
- Parameters:
image (hdrl.core.Image) – The input image.
- Returns:
The computed limiting magnitude.
- Return type:
float
- property extend_method¶
Image extension method.
- property fwhm¶
Full width at half maximum for the PSF.
- property kernel_size_x¶
Kernel size in x direction.
- property kernel_size_y¶
Kernel size in y direction.
- property mode_param¶
Mode parameter for the computation.
- property zeropoint¶
Zeropoint for magnitude calculation.
- class hdrl.func.Barycorr¶
Bases:
pybind11_object- static compute(target: tuple[SupportsFloat | SupportsIndex, SupportsFloat | SupportsIndex], observer: tuple[SupportsFloat | SupportsIndex, SupportsFloat | SupportsIndex, SupportsFloat | SupportsIndex], eop_table: cpl.core.Table, mjd_obs: SupportsFloat | SupportsIndex, time_to_mid_exposure: SupportsFloat | SupportsIndex, pressure: SupportsFloat | SupportsIndex = 0.0, temperature: SupportsFloat | SupportsIndex = 0.0, humidity: SupportsFloat | SupportsIndex = 0.0, wavelength: SupportsFloat | SupportsIndex = 0.0) float¶
Compute the barycentric correction for an observation, using the ERFA function eraApco13().
- Parameters:
target (tuple) – A tuple (ra, dec) in degrees.
observer (tuple) – A tuple (lat, lon, height) where latitude and longitude are in degrees, and height is in meters.
eop_table (cpl.core.Table) – The Earth Orientation Parameter (EOP) table.
mjd_obs (float) – Modified Julian Date of the observation.
time_to_mid_exposure (float) – Time to mid exposure in seconds.
pressure (float, optional) – Atmospheric pressure in hPa (default: 0.0).
temperature (float, optional) – Ambient temperature in degrees Celsius (default: 0.0).
humidity (float, optional) – Relative humidity (0 to 1, default: 0.0).
wavelength (float, optional) – Observing wavelength in micrometers (default: 0.0).
- Returns:
Computed barycentric correction in m/s.
- Return type:
float