High-Level Data Reduction Library: Bad Pixel Mask via fitting

High-Level Data Reduction Library 1.6.0 High-Level data reduction routines for ESO pipelines

Loading...
Searching...
No Matches
Functions
Bad Pixel Mask via fitting
Bad Pixel Detection

Algorithms to detect bad-pixels on a sequence of images like e.g. domeflats. More...

Collaboration diagram for Bad Pixel Mask via fitting:

## Functions
hdrl_parameter * | hdrl_bpm_fit_parameter_create_pval (int degree, double pval)
| create bpm_fit parameter with p-value bpm treshold
hdrl_parameter * | hdrl_bpm_fit_parameter_create_rel_chi (int degree, double rel_chi_low, double rel_chi_high)
| create bpm_fit parameter with relative chi bpm treshold
hdrl_parameter * | hdrl_bpm_fit_parameter_create_rel_coef (int degree, double rel_coef_low, double rel_coef_high)
| create bpm_fit parameter with relative coefficient bpm treshold
cpl_boolean | hdrl_bpm_fit_parameter_check (const hdrl_parameter *self)
| Check that the parameter is a bpm_fit parameter.
cpl_error_code | hdrl_bpm_fit_parameter_verify (const hdrl_parameter *p)
| verify that the parameter is a valid bpm_fit_parameter
int | hdrl_bpm_fit_parameter_get_degree (const hdrl_parameter *p)
| get degree of polynomial fit of parameter
double | hdrl_bpm_fit_parameter_get_pval (const hdrl_parameter *p)
| get p-value bpm treshold
double | hdrl_bpm_fit_parameter_get_rel_chi_low (const hdrl_parameter *p)
| get relative chi distribution lower threshold
double | hdrl_bpm_fit_parameter_get_rel_chi_high (const hdrl_parameter *p)
| get relative chi distribution upper threshold
double | hdrl_bpm_fit_parameter_get_rel_coef_low (const hdrl_parameter *p)
| get relative fit coefficient distribution lower threshold
double | hdrl_bpm_fit_parameter_get_rel_coef_high (const hdrl_parameter *p)
| get relative fit coefficient distribution upper threshold
cpl_parameterlist * | hdrl_bpm_fit_parameter_create_parlist (const char *base_context, const char *prefix, const hdrl_parameter *defaults)
| Create a parameter list for the BPM_FIT computation.
hdrl_parameter * | hdrl_bpm_fit_parameter_parse_parlist (const cpl_parameterlist *parlist, const char *prefix)
| Parse a parameterlist to create input parameters for the BPM_FIT.
cpl_error_code | hdrl_bpm_fit_compute (const hdrl_parameter *par, const hdrl_imagelist *data, const cpl_vector *sample_pos, cpl_image **out_mask)
| compute bad pixel map based on fitting a stack of images

## Detailed Description

Algorithms to detect bad-pixels on a sequence of images like e.g. domeflats.

The routine in this module derives bad pixels on a sequence of images (e.g. domeflats with differend exposure time). The algorithm fits a polynomial to each pixel-sequence and determinates bad pixels based on this fit and various thresholding methods.

The calculation is performed by calling the top-level function hdrl_bpm_fit_compute() and the parameters passed to this function can be created by calling hdrl_bpm_fit_parameter_create_rel_chi(), or hdrl_bpm_fit_parameter_create_rel_coef(), or hdrl_bpm_fit_parameter_create_pval(), depending on the method one would like to use.

## Function Documentation

## ◆ hdrl_bpm_fit_compute()

cpl_error_code hdrl_bpm_fit_compute | ( | const hdrl_parameter * | par,
|  | const hdrl_imagelist * | data,
|  | const cpl_vector * | sample_pos,
|  | cpl_image ** | out_mask
| ) |  |

compute bad pixel map based on fitting a stack of images

Parameters

  par | input bpm_fit_parameter
  data | hdrl_imagelist to fit
  sample_pos | cpl_vector of sampling position of the images in data, e.g. exposure time
  out_mask | output bad pixel mask as integer image

Returns
  CPL_ERROR_NONE if everything is ok, an error code otherwise

The function fits a polynomial of degree degree to the imagelist at the sampling positions defined in sample_pos.

Three methods are available to convert the information from the fit into a bad pixel map:

- `Relative` cutoff on the chi distribution of all fits. Pixels with chi values strictly outside the interval and are considered bad. The corresponding hdrl parameter is created by hdrl_bpm_fit_parameter_create_rel_chi()

- `Relative` cutoff on the distribution of the fit coefficients. Pixels with fit coefficients strictly outside the interval and are considered bad. The coefficient numbers that caused the pixel to be marked as bad are encoded as powers of two of their degree (starting from 0). The corresponding hdrl parameter is created by hdrl_bpm_fit_parameter_create_rel_coef()

- `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. The corresponding hdrl parameter is created by hdrl_bpm_fit_parameter_create_pval()

## ◆ hdrl_bpm_fit_parameter_check()

cpl_boolean hdrl_bpm_fit_parameter_check | ( | const hdrl_parameter * | self | ) |

Check that the parameter is a bpm_fit parameter.

Parameters

  self | The parameter to check

Returns
  True or False

## ◆ hdrl_bpm_fit_parameter_create_parlist()

cpl_parameterlist * hdrl_bpm_fit_parameter_create_parlist | ( | const char * | base_context,
|  | const char * | prefix,
|  | const hdrl_parameter * | defaults
| ) |  |

Create a parameter list for the BPM_FIT computation.

Parameters

  base_context | base context of parameter (e.g. recipe name)
  prefix | prefix of parameter, may be empty string
  defaults | default values

Creates a parameterlist with the BPM_FIT parameters:

- base_context.prefix.degree
- base_context.prefix.pval
- base_context.prefix.rel-chi-low
- base_context.prefix.rel-chi-high
- base_context.prefix.rel-coef-low
- base_context.prefix.rel-coef-high The CLI aliases omit the base_context.

## ◆ hdrl_bpm_fit_parameter_create_pval()

hdrl_parameter * hdrl_bpm_fit_parameter_create_pval | ( | int | degree,
|  | double | pval
| ) |  |

create bpm_fit parameter with p-value bpm treshold

Parameters

  degree | degree of fit
  pval | p-value of bpm threshold

Returns
  hdrl_parameter or NULL on error

See also
  hdrl_bpm_fit_compute()

## ◆ hdrl_bpm_fit_parameter_create_rel_chi()

hdrl_parameter * hdrl_bpm_fit_parameter_create_rel_chi | ( | int | degree,
|  | double | rel_chi_low,
|  | double | rel_chi_high
| ) |  |

create bpm_fit parameter with relative chi bpm treshold

Parameters

  degree | degree of fit
  rel_chi_low | relative chi distribution bpm lower threshold
  rel_chi_high | relative chi distribution bpm upper threshold

Returns
  hdrl_parameter or NULL on error

See also
  hdrl_bpm_fit_compute()

## ◆ hdrl_bpm_fit_parameter_create_rel_coef()

hdrl_parameter * hdrl_bpm_fit_parameter_create_rel_coef | ( | int | degree,
|  | double | rel_coef_low,
|  | double | rel_coef_high
| ) |  |

create bpm_fit parameter with relative coefficient bpm treshold

Parameters

  degree | degree of fit
  rel_coef_low | relative fit coefficient distribution bpm lower threshold
  rel_coef_high | relative fit coefficient distribution bpm upper threshold

Returns
  hdrl_parameter or NULL on error

See also
  hdrl_bpm_fit_compute()

## ◆ hdrl_bpm_fit_parameter_get_degree()

int hdrl_bpm_fit_parameter_get_degree | ( | const hdrl_parameter * | p | ) |

get degree of polynomial fit of parameter

Parameters

  p | parameter

Returns
  degree of polynomial fit

## ◆ hdrl_bpm_fit_parameter_get_pval()

double hdrl_bpm_fit_parameter_get_pval | ( | const hdrl_parameter * | p | ) |

get p-value bpm treshold

Parameters

  p | parameter

Returns
  p-value

## ◆ hdrl_bpm_fit_parameter_get_rel_chi_high()

double hdrl_bpm_fit_parameter_get_rel_chi_high | ( | const hdrl_parameter * | p | ) |

get relative chi distribution upper threshold

Parameters

  p | parameter

Returns
  relative chi distribution upper threshold

## ◆ hdrl_bpm_fit_parameter_get_rel_chi_low()

double hdrl_bpm_fit_parameter_get_rel_chi_low | ( | const hdrl_parameter * | p | ) |

get relative chi distribution lower threshold

Parameters

  p | parameter

Returns
  relative chi distribution lower threshold

## ◆ hdrl_bpm_fit_parameter_get_rel_coef_high()

double hdrl_bpm_fit_parameter_get_rel_coef_high | ( | const hdrl_parameter * | p | ) |

get relative fit coefficient distribution upper threshold

Parameters

  p | parameter

Returns
  relative fit coefficient distribution upper threshold

## ◆ hdrl_bpm_fit_parameter_get_rel_coef_low()

double hdrl_bpm_fit_parameter_get_rel_coef_low | ( | const hdrl_parameter * | p | ) |

get relative fit coefficient distribution lower threshold

Parameters

  p | parameter

Returns
  relative fit coefficient distribution lower threshold

## ◆ hdrl_bpm_fit_parameter_parse_parlist()

hdrl_parameter * hdrl_bpm_fit_parameter_parse_parlist | ( | const cpl_parameterlist * | parlist,
|  | const char * | prefix
| ) |  |

Parse a parameterlist to create input parameters for the BPM_FIT.

Parameters

  parlist | parameter list to parse
  prefix | prefix of parameter name

Returns
  Input parameter for the BPM_FIT computation

Reads a parameterlist in order to create BPM image parameters. Expects a parameterlist containing:

- prefix.degree
- prefix.pval
- prefix.rel-chi-low
- prefix.rel-chi-high
- prefix.rel-coef-low
- prefix.rel-coef-high

## ◆ hdrl_bpm_fit_parameter_verify()

cpl_error_code hdrl_bpm_fit_parameter_verify | ( | const hdrl_parameter * | p | ) |

verify that the parameter is a valid bpm_fit_parameter

Parameters

  p | parameter

Returns
  error code