ERIS Pipeline Reference Manual 1.8.14
Enumerations | Functions
wrapper to cpl_vector

Enumerations

enum  medianType
 The type of median behavior: For an odd number of samples the behaviour is the same for both methods. For an even number of samples: More...
 

Functions

eris_ifu_vector * eris_ifu_vector_new (int n)
 Create a new eris_ifu_vector.
 
eris_ifu_vector * eris_ifu_vector_new_wrap (int n, const double *data)
 Create a new eris_ifu_vector from a vector (duplicated).
 
eris_ifu_vector * eris_ifu_vector_create (const cpl_vector *data)
 Create a new eris_ifu_vector out of a data cpl_vector.
 
eris_ifu_vector * eris_ifu_vector_create2 (const cpl_vector *data, const cpl_vector *mask)
 Create a new eris_ifu_vector out of a data and mask cpl_vector.
 
void eris_ifu_vector_delete (eris_ifu_vector *kv)
 Delete a eris_ifu_vector.
 
eris_ifu_vector * eris_ifu_vector_duplicate (const eris_ifu_vector *kv)
 This function duplicates an existing eris_ifu_vector and allocates memory.
 
cpl_error_code eris_ifu_vector_set (eris_ifu_vector *kv, int pos, double val)
 Set an element of the eris_ifu_vector.
 
double eris_ifu_vector_get_rej (const eris_ifu_vector *kv, int pos, int *rej)
 Get an element of the eris_ifu_vector.
 
double eris_ifu_vector_get (const eris_ifu_vector *kv, int pos)
 Get an element of the eris_ifu_vector.
 
cpl_vector * eris_ifu_vector_get_mask (const eris_ifu_vector *kv)
 Get a copy of the mask of eris_ifu_vector.
 
cpl_vector * eris_ifu_vector_get_data (const eris_ifu_vector *kv)
 Get a copy of the data, rejected values are set to NaN.
 
cpl_vector * eris_ifu_vector_get_bpm (eris_ifu_vector *kv)
 Get the pointer to the mask of the eris_ifu_vector.
 
cpl_error_code eris_ifu_vector_reject_from_mask (eris_ifu_vector *kv, const cpl_vector *mask, int keep)
 Set the rejected elements in an eris_ifu_vector as defined in a mask.
 
int eris_ifu_vector_count_rejected (const eris_ifu_vector *kv)
 Count the number of rejected elements in a eris_ifu_vector.
 
int eris_ifu_vector_count_non_rejected (const eris_ifu_vector *kv)
 Count the number of non-rejected elements in a eris_ifu_vector.
 
int eris_ifu_vector_is_rejected (const eris_ifu_vector *kv, int n)
 Test if a value is good or bad.
 
cpl_error_code eris_ifu_vector_reject (eris_ifu_vector *kv, int n)
 Set a value as rejected in a eris_ifu_vector.
 
eris_ifu_vector * eris_ifu_vector_extract (const eris_ifu_vector *kv, int istart, int istop)
 Extract a sub_vector from a eris_ifu_vector.
 
cpl_vector * eris_ifu_vector_create_non_rejected (const eris_ifu_vector *kv)
 Creates a cpl_vector out of a eris_ifu_vector with non-rejected values.
 
cpl_error_code eris_ifu_vector_adapt_rejected (eris_ifu_vector *kv1, eris_ifu_vector *kv2)
 Assert that rejected values on both vectors are the same.
 
cpl_error_code eris_ifu_vector_add (eris_ifu_vector *kv1, const eris_ifu_vector *kv2)
 Add a eris_ifu_vector to another.
 
cpl_error_code eris_ifu_vector_subtract (eris_ifu_vector *kv1, const eris_ifu_vector *kv2)
 Subtract two eris_ifu_vectors.
 
cpl_error_code eris_ifu_vector_multiply (eris_ifu_vector *kv1, const eris_ifu_vector *kv2)
 Multiply two eris_ifu_vectors.
 
cpl_error_code eris_ifu_vector_divide (eris_ifu_vector *kv1, const eris_ifu_vector *kv2)
 Divide two eris_ifu_vectors element-wise.
 
cpl_error_code eris_ifu_vector_add_scalar (eris_ifu_vector *kv, double addend)
 Elementwise addition of a scalar to a eris_ifu_vector.
 
cpl_error_code eris_ifu_vector_subtract_scalar (eris_ifu_vector *kv, double subtrahend)
 Elementwise subtraction of a scalar from a eris_ifu_vector.
 
cpl_error_code eris_ifu_vector_multiply_scalar (eris_ifu_vector *kv, double factor)
 Elementwise multiplication of a scalar to a eris_ifu_vector.
 
cpl_error_code eris_ifu_vector_divide_scalar (eris_ifu_vector *kv, double factor)
 Elementwise division of a eris_ifu_vector and a scalar.
 
cpl_error_code eris_ifu_vector_abs (eris_ifu_vector *kv)
 Calculates the absolute of an vector inplace.
 
int eris_ifu_vector_get_size (const eris_ifu_vector *kv)
 Get the size of the eris_ifu_vector.
 
double eris_ifu_vector_get_mean (const eris_ifu_vector *kv)
 Compute the mean value of non-rejected eris_ifu_vector elements.
 
double eris_ifu_vector_get_median (const eris_ifu_vector *kv, const enum medianType type)
 Compute the median of the elements of a vector.
 
eris_ifu_vector * eris_ifu_vector_cut_percentian (const eris_ifu_vector *kv, double percentage)
 Remove a certain percentage of brightest pixels.
 
double eris_ifu_vector_get_sum (const eris_ifu_vector *kv)
 Compute the sum of non-rejected eris_ifu_vector elements.
 
double eris_ifu_vector_get_stdev (const eris_ifu_vector *kv)
 Compute the bias-corrected standard deviation of a vectors elements.
 
double eris_ifu_vector_get_stdev_median (const eris_ifu_vector *kv)
 Compute the bias-corrected standard deviation of a vectors elements using median.
 
double eris_ifu_vector_get_max (const eris_ifu_vector *kv, int *pos)
 Get the maximum of the eris_ifu_vector and its position.
 
double eris_ifu_vector_get_min (const eris_ifu_vector *kv, int *pos)
 Get the minimum of the eris_ifu_vector and its position.
 
cpl_error_code eris_ifu_vector_power (eris_ifu_vector *kv, double exponent)
 Compute the elementwise power of the vector.
 
cpl_error_code eris_ifu_vector_fill (eris_ifu_vector *kv, double val)
 Fill a eris_ifu_vector.
 
cpl_error_code eris_ifu_vector_flip (eris_ifu_vector *kv)
 Flip the values of a vector.
 
eris_ifu_vector * eris_ifu_vector_histogram (const eris_ifu_vector *kv, int nbins)
 Calculates the histogram of a vector.
 
eris_ifu_vector * eris_ifu_vector_load (const char *filename, int position)
 Override for cpl_vector_load().
 
cpl_error_code eris_ifu_vector_save (const eris_ifu_vector *kv, const char *filename, cpl_type_bpp bpp, const cpl_propertylist *pl, unsigned mode, double rej_val)
 Override for cpl_vector_save().
 
cpl_error_code eris_ifu_vector_dump (const eris_ifu_vector *kv)
 All values contained in vec are printed for debugging purposes.
 
int eris_ifu_is_nan_or_inf (double A)
 Checks if a value is nan, inf or -inf.
 
cpl_error_code eris_ifu_vector_sqrt (eris_ifu_vector *ev)
 eris_ifu_vector_sqrt
 

Detailed Description

eris_ifu_vector provides the functionality of rejected values like cpl_image does. It is a struct containing to vectors. The data vector can contain any value. If there are any infinite values in the data, these values will be masked already in eris_ifu_vector_create() and eris_ifu_vector_create2().

The mask vector can just contain the values 0 and 1. (this is asserted in eris_ifu_new() and eris_ifu_create() and eris_ifu_create2()))

Synopsis:
#include <eris_ifu_vector.h>

Enumeration Type Documentation

◆ medianType

enum medianType

The type of median behavior: For an odd number of samples the behaviour is the same for both methods. For an even number of samples:

  • ERIS_IFU_STATISTICAL:
    The returned value is the lower of the two center elements of the sorted input vector.
  • ERIS_IFU_ARITHMETIC
    The arithmetic mean of the two center elements of the sorted input vector is calculated

Definition at line 58 of file eris_ifu_vector.h.

Function Documentation

◆ eris_ifu_is_nan_or_inf()

int eris_ifu_is_nan_or_inf ( double  A)

◆ eris_ifu_vector_abs()

cpl_error_code eris_ifu_vector_abs ( eris_ifu_vector *  ev)

Calculates the absolute of an vector inplace.

Parameters
evThe vector.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.

The vector is checked elementwise if the data is negative. If so its sign is changed.

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if data is NULL.

Definition at line 1475 of file eris_ifu_vector.c.

References BRK_IF_NULL, CATCH, and TRY.

◆ eris_ifu_vector_adapt_rejected()

cpl_error_code eris_ifu_vector_adapt_rejected ( eris_ifu_vector *  kv1,
eris_ifu_vector *  kv2 
)

Assert that rejected values on both vectors are the same.

Parameters
kv11st input eris_ifu_vector
kv22nd input eris_ifu_vector
Returns
CPL_ERROR_NONE or error code.

It is asserted that all rejected elements in kv1 are also rejected in kv2 and vice versa.

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if any of the inputs is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the inputs don't have the same length

Definition at line 929 of file eris_ifu_vector.c.

References BRK_IF_NULL, CATCH, and TRY.

◆ eris_ifu_vector_add()

cpl_error_code eris_ifu_vector_add ( eris_ifu_vector *  kv1,
const eris_ifu_vector *  kv2 
)

Add a eris_ifu_vector to another.

Parameters
kv1First eris_ifu_vector (modified)
kv2Second eris_ifu_vector
Returns
CPL_ERROR_NONE or the relevant
  • cpl_error_code on error
The second vector is added to the first one. The input first vector is modified.

The input vectors must have the same size.

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if any input pointer is NULL
  • CPL_ERROR_INCOMPATIBLE_INPUT if kv1 and kv2 have different sizes

Definition at line 986 of file eris_ifu_vector.c.

References BRK_IF_NULL, CATCH, eris_ifu_is_nan_or_inf(), and TRY.

◆ eris_ifu_vector_add_scalar()

cpl_error_code eris_ifu_vector_add_scalar ( eris_ifu_vector *  ev,
double  addend 
)

Elementwise addition of a scalar to a eris_ifu_vector.

Parameters
everis_ifu_vector to modify
addendNumber to add
Returns
CPL_ERROR_NONE or the relevant
  • cpl_error_code on error
Add a number to each element of the eris_ifu_vector.

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if ev is NULL

Definition at line 1268 of file eris_ifu_vector.c.

References BRK_IF_NULL, CATCH, CHECK_ERROR_STATE, eris_ifu_is_nan_or_inf(), and TRY.

Referenced by eris_ifu_vector_power().

◆ eris_ifu_vector_count_non_rejected()

int eris_ifu_vector_count_non_rejected ( const eris_ifu_vector *  ev)

Count the number of non-rejected elements in a eris_ifu_vector.

Parameters
evThe input eris_ifu_vector
Returns
The number of rejected values or -1 if the input vector is NULL

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if ev is NULL

Definition at line 699 of file eris_ifu_vector.c.

References BRK_IF_NULL, CATCH, and TRY.

Referenced by eris_ifu_vector_get_stdev_median().

◆ eris_ifu_vector_count_rejected()

int eris_ifu_vector_count_rejected ( const eris_ifu_vector *  ev)

Count the number of rejected elements in a eris_ifu_vector.

Parameters
evThe input eris_ifu_vector
Returns
The number of rejected values or -1 if the input vector is NULL

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if ev is NULL

Definition at line 662 of file eris_ifu_vector.c.

References BRK_IF_NULL, CATCH, and TRY.

Referenced by eris_ifu_vector_create_non_rejected(), eris_ifu_vector_get_max(), and eris_ifu_vector_get_min().

◆ eris_ifu_vector_create()

eris_ifu_vector * eris_ifu_vector_create ( const cpl_vector *  data)

Create a new eris_ifu_vector out of a data cpl_vector.

Parameters
dataThe cpl_vector to wrap.
Returns
1 newly allocated eris_ifu_vector or NULL in case of an error

The returned object must be deallocated using

All NaNs and Infs in data will be marked as rejected. The rejected data value will remain unchanged.

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if data is NULL

Definition at line 175 of file eris_ifu_vector.c.

References BRK_IF_ERROR, BRK_IF_NULL, CATCH, eris_ifu_is_nan_or_inf(), and TRY.

Referenced by eris_ifu_vector_cut_percentian(), and eris_ifu_vector_load().

◆ eris_ifu_vector_create2()

eris_ifu_vector * eris_ifu_vector_create2 ( const cpl_vector *  data,
const cpl_vector *  mask 
)

Create a new eris_ifu_vector out of a data and mask cpl_vector.

Parameters
dataThe data cpl_vector to wrap.
maskThe mask cpl_vector to wrap.
Returns
1 newly allocated eris_ifu_vector or NULL in case of an error

The returned object must be deallocated using

All NaNs and Infs in data will be marked as rejected. The rejected data value will remain unchanged. All NaNs and Infs in mask are set rejected.

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if data or mask is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the size of data and mask isn't the same.

Definition at line 245 of file eris_ifu_vector.c.

References BRK_IF_NULL, CATCH, eris_ifu_is_nan_or_inf(), and TRY.

◆ eris_ifu_vector_create_non_rejected()

cpl_vector * eris_ifu_vector_create_non_rejected ( const eris_ifu_vector *  ev)

Creates a cpl_vector out of a eris_ifu_vector with non-rejected values.

Parameters
evThe input eris_ifu_vector
Returns
The extracted cpl_vector or NULL.

The length of the returned cpl_vector may be, depending on the number of rejected values shorter than the input eris_ifu_vector! If all values are rejected NULL is returned but no error is set.

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if ev is NULL

Definition at line 870 of file eris_ifu_vector.c.

References BRK_IF_NULL, CATCH, CHECK_ERROR_STATE, eris_ifu_vector_count_rejected(), and TRY.

Referenced by eris_ifu_vector_cut_percentian(), eris_ifu_vector_get_mean(), eris_ifu_vector_get_median(), and eris_ifu_vector_get_stdev().

◆ eris_ifu_vector_cut_percentian()

eris_ifu_vector * eris_ifu_vector_cut_percentian ( const eris_ifu_vector *  ev,
double  percentage 
)

Remove a certain percentage of brightest pixels.

Parameters
evInput Vector.
percentageThe percentage of brightest pixels to remove (between 0 and 1).
Returns
The cut vector.

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if vec is NULL.

Definition at line 1640 of file eris_ifu_vector.c.

References BRK_IF_NULL, CATCH, CHECK_ERROR_STATE, eris_ifu_vector_create(), eris_ifu_vector_create_non_rejected(), eris_ifu_vector_delete(), and TRY.

◆ eris_ifu_vector_delete()

void eris_ifu_vector_delete ( eris_ifu_vector *  ev)

Delete a eris_ifu_vector.

Parameters
everis_ifu_vector to delete.

If the eris_ifu_vector ev is NULL, nothing is done and no error is set.

Definition at line 310 of file eris_ifu_vector.c.

References CATCH, and TRY.

Referenced by eris_ifu_free_ifu_vector(), eris_ifu_vector_cut_percentian(), eris_ifu_vector_histogram(), eris_ifu_vector_load(), and eris_ifu_vector_save().

◆ eris_ifu_vector_divide()

cpl_error_code eris_ifu_vector_divide ( eris_ifu_vector *  kv1,
const eris_ifu_vector *  kv2 
)

Divide two eris_ifu_vectors element-wise.

Parameters
kv1First eris_ifu_vector (modified)
kv2Second eris_ifu_vector
Returns
CPL_ERROR_NONE or the relevant
  • cpl_error_code on error
The first vector is divided by the second one. In opposite to cpl_vector_divide(), a division by zero doesn't throw an error but results in a rejected element of the vector

The input vectors must have the same size.

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if any input pointer is NULL
  • CPL_ERROR_INCOMPATIBLE_INPUT if kv1 and kv2 have different sizes

Definition at line 1201 of file eris_ifu_vector.c.

References BRK_IF_NULL, CATCH, eris_ifu_is_nan_or_inf(), and TRY.

◆ eris_ifu_vector_divide_scalar()

cpl_error_code eris_ifu_vector_divide_scalar ( eris_ifu_vector *  ev,
double  dividend 
)

Elementwise division of a eris_ifu_vector and a scalar.

Parameters
everis_ifu_vector to modify
dividendNumber to divide with
Returns
CPL_ERROR_NONE or the relevant
  • cpl_error_code on error
Divide each element of the eris_ifu_vector by a number.

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if ev is NULL

Definition at line 1422 of file eris_ifu_vector.c.

References BRK_IF_NULL, CATCH, CHECK_ERROR_STATE, eris_ifu_is_nan_or_inf(), and TRY.

◆ eris_ifu_vector_dump()

cpl_error_code eris_ifu_vector_dump ( const eris_ifu_vector *  ev)

All values contained in vec are printed for debugging purposes.

Parameters
evThe vector to print.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.

Definition at line 2289 of file eris_ifu_vector.c.

References BRK_IF_NULL, BRK_WITH_ERROR_MSG, CATCH, CHECK_ERROR_STATE, and TRY.

◆ eris_ifu_vector_duplicate()

eris_ifu_vector * eris_ifu_vector_duplicate ( const eris_ifu_vector *  ev)

This function duplicates an existing eris_ifu_vector and allocates memory.

Parameters
evInput eris_ifu_vector
Returns
A newly allocated eris_ifu_vector or NULL in case of an error

The returned object must be deallocated using eris_ifu_vector_delete()

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if ev is NULL

Definition at line 339 of file eris_ifu_vector.c.

References BRK_IF_NULL, CATCH, CHECK_ERROR_STATE, and TRY.

Referenced by eris_ifu_vector_save().

◆ eris_ifu_vector_extract()

eris_ifu_vector * eris_ifu_vector_extract ( const eris_ifu_vector *  ev,
int  istart,
int  istop 
)

Extract a sub_vector from a eris_ifu_vector.

Parameters
evThe input eris_ifu_vector
istartStart index (from 0 to number of elements - 1)
istopStop index (from 0 to number of elements - 1)
Returns
A newly allocated eris_ifu_vector or NULL in case of an error

Rejected elements are also extracted.

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if ev is NULL
  • CPL_ERROR_ILLEGAL_INPUT if istop <= istart

Definition at line 822 of file eris_ifu_vector.c.

References BRK_IF_NULL, CATCH, and TRY.

◆ eris_ifu_vector_fill()

cpl_error_code eris_ifu_vector_fill ( eris_ifu_vector *  ev,
double  val 
)

Fill a eris_ifu_vector.

Parameters
evThe vector to be filled with the value val.
valValue used to fill the eris_ifu_vector.

If val is an invalid value all elements of ev will be rejected.

Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if vec is NULL.

Definition at line 2025 of file eris_ifu_vector.c.

References CATCH, eris_ifu_vector_get_size(), eris_ifu_vector_set(), and TRY.

◆ eris_ifu_vector_flip()

cpl_error_code eris_ifu_vector_flip ( eris_ifu_vector *  ev)

Flip the values of a vector.

Parameters
evThe vector.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.

The vector is flipped elementwise from both sides.

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if ev is NULL.

Definition at line 2061 of file eris_ifu_vector.c.

References BRK_IF_NULL, CATCH, and TRY.

◆ eris_ifu_vector_get()

double eris_ifu_vector_get ( const eris_ifu_vector *  ev,
int  pos 
)

Get an element of the eris_ifu_vector.

Parameters
evInput eris_ifu_vector
posThe index of the element (0 to nelem-1)
Returns
The element value

The value is returned regardless if it is rejected or not! By examining rej the status of the element can be examined.

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if ev is NULL
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if the specified position is out of the vector

Definition at line 478 of file eris_ifu_vector.c.

References eris_ifu_vector_get_rej().

◆ eris_ifu_vector_get_bpm()

cpl_vector * eris_ifu_vector_get_bpm ( eris_ifu_vector *  ev)

Get the pointer to the mask of the eris_ifu_vector.

Parameters
evInput eris_ifu_vector
Returns
Pointer to the mask of the input vector

The output vector contains 1 for non-rejected elements and 0 for rejected elements.

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if ev is NULL
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if the specified position is out of the vector

Definition at line 575 of file eris_ifu_vector.c.

References BRK_IF_NULL, CATCH, and TRY.

◆ eris_ifu_vector_get_data()

cpl_vector * eris_ifu_vector_get_data ( const eris_ifu_vector *  ev)

Get a copy of the data, rejected values are set to NaN.

Parameters
evInput eris_ifu_vector
Returns
A cpl_vector input vector

The output vector contains NaN for rejected elements.

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if ev is NULL
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if the specified position is out of the vector

Definition at line 535 of file eris_ifu_vector.c.

References BRK_IF_ERROR, BRK_IF_NULL, CATCH, eris_ifu_vector_get_size(), eris_ifu_vector_is_rejected(), and TRY.

◆ eris_ifu_vector_get_mask()

cpl_vector * eris_ifu_vector_get_mask ( const eris_ifu_vector *  ev)

Get a copy of the mask of eris_ifu_vector.

Parameters
evInput eris_ifu_vector
Returns
The mask of the input vector

The output vector contains 1 for non-rejected elements and 0 for rejected elements.

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if ev is NULL
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if the specified position is out of the vector

Definition at line 501 of file eris_ifu_vector.c.

References BRK_IF_NULL, CATCH, and TRY.

◆ eris_ifu_vector_get_max()

double eris_ifu_vector_get_max ( const eris_ifu_vector *  ev,
int *  pos 
)

Get the maximum of the eris_ifu_vector and its position.

Parameters
evInput eris_ifu_vector
pos(Output) The index of the max element (first value is 0), is set to -1 if all elements are rejected. If set to NULL it won't be returned.
Returns
The element value

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if ev is NULL

Definition at line 1842 of file eris_ifu_vector.c.

References BRK_IF_NULL, CATCH, CHECK_ERROR_STATE, eris_ifu_vector_count_rejected(), and TRY.

Referenced by eris_ifu_vector_histogram().

◆ eris_ifu_vector_get_mean()

double eris_ifu_vector_get_mean ( const eris_ifu_vector *  ev)

Compute the mean value of non-rejected eris_ifu_vector elements.

Parameters
evInput eris_ifu_vector
Returns
Mean value of vector elements or 0 on error or when all values are rejected.

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if ev is NULL

Definition at line 1548 of file eris_ifu_vector.c.

References CATCH, CHECK_ERROR_STATE, eris_ifu_vector_create_non_rejected(), and TRY.

◆ eris_ifu_vector_get_median()

double eris_ifu_vector_get_median ( const eris_ifu_vector *  ev,
const enum medianType  type 
)

Compute the median of the elements of a vector.

Parameters
evInput Vector.
typeThe method to calculate ther median with: KMCLIPM_STATISTICAL: The returned value is the lower of the two center elements of the sorted input vector. KMCLIPM_ARITHMETIC: The arithmetic mean of the two center elements of the sorted input vector is calculated.
Returns
Median value of the vector elements or 0 on error or when all values are rejected.

Unlike

  • cpl_vector_get_median this function doesn't modify the order of the elements of the input vector!

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if vec is NULL.

Definition at line 1593 of file eris_ifu_vector.c.

References CATCH, eris_ifu_vector_create_non_rejected(), and TRY.

Referenced by eris_ifu_vector_get_stdev_median().

◆ eris_ifu_vector_get_min()

double eris_ifu_vector_get_min ( const eris_ifu_vector *  ev,
int *  pos 
)

Get the minimum of the eris_ifu_vector and its position.

Parameters
evInput eris_ifu_vector
pos(Output) The index of the min element (first value is 0), is set to -1 if all elements are rejected. If set to NULL it won't be returned.
Returns
The element value

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if ev is NULL

Definition at line 1901 of file eris_ifu_vector.c.

References BRK_IF_NULL, CATCH, CHECK_ERROR_STATE, eris_ifu_vector_count_rejected(), and TRY.

Referenced by eris_ifu_vector_histogram().

◆ eris_ifu_vector_get_rej()

double eris_ifu_vector_get_rej ( const eris_ifu_vector *  ev,
int  pos,
int *  rej 
)

Get an element of the eris_ifu_vector.

Parameters
evInput eris_ifu_vector
posThe index of the element (0 to nelem-1)
rej1 if the pixel is bad, 0 if good, negative on error
Returns
The element value

The value is returned regardless if it is rejected or not! By examining rej the status of the element can be examined.

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if ev is NULL
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if the specified position is out of the vector

Definition at line 429 of file eris_ifu_vector.c.

References CATCH, and TRY.

Referenced by eris_ifu_vector_get().

◆ eris_ifu_vector_get_size()

int eris_ifu_vector_get_size ( const eris_ifu_vector *  ev)

Get the size of the eris_ifu_vector.

Parameters
evInput eris_ifu_vector
Returns
The size or -1 in case of an error

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if ev is NULL

Definition at line 1516 of file eris_ifu_vector.c.

References CATCH, CHECK_ERROR_STATE, and TRY.

Referenced by eris_ifu_vector_fill(), and eris_ifu_vector_get_data().

◆ eris_ifu_vector_get_stdev()

double eris_ifu_vector_get_stdev ( const eris_ifu_vector *  ev)

Compute the bias-corrected standard deviation of a vectors elements.

Parameters
evInput eris_ifu_vector
Returns
standard deviation of the elements or -1 on error.

S(n-1) = sqrt[sum((xi-mean)^2) / (n-1)] (i=1 -> n)

The length of ev must be at least 2.

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if ev is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the number of non-rejected values in ev is less than 2

Definition at line 1743 of file eris_ifu_vector.c.

References CATCH, CHECK_ERROR_STATE, eris_ifu_vector_create_non_rejected(), and TRY.

◆ eris_ifu_vector_get_stdev_median()

double eris_ifu_vector_get_stdev_median ( const eris_ifu_vector *  ev)

Compute the bias-corrected standard deviation of a vectors elements using median.

Parameters
evInput eris_ifu_vector
Returns
standard deviation using median of the elements or -1 on error.

S(n-1) = sqrt[sum((xi-median)^2) / (n-1)] (i=1 -> n)

The length of ev must be at least 2.

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if ev is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the number of non-rejected values in ev is less than 2

Definition at line 1785 of file eris_ifu_vector.c.

References BRK_IF_NULL, BRK_WITH_ERROR, CATCH, CHECK_ERROR_STATE, eris_ifu_vector_count_non_rejected(), eris_ifu_vector_get_median(), and TRY.

◆ eris_ifu_vector_get_sum()

double eris_ifu_vector_get_sum ( const eris_ifu_vector *  ev)

Compute the sum of non-rejected eris_ifu_vector elements.

Parameters
evInput eris_ifu_vector
Returns
Sum of vector elements or 0 on error or when all values are rejected.

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if ev is NULL

Definition at line 1693 of file eris_ifu_vector.c.

References BRK_IF_NULL, CATCH, CHECK_ERROR_STATE, and TRY.

◆ eris_ifu_vector_histogram()

eris_ifu_vector * eris_ifu_vector_histogram ( const eris_ifu_vector *  ev,
int  nbins 
)

Calculates the histogram of a vector.

This implementation follows the one used in IDL. This means that in the highest bin can only be found values corresponding to the maximum value in the input vector.

Parameters
evInput vector.
nbinsThe number of bins to produce.
Returns
A vector of size nbins containing the histogram of input data d .

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if d is NULL.
  • CPL_ERROR_ILLEGAL_INPUT if nbis is <= 0.

Definition at line 2120 of file eris_ifu_vector.c.

References BRK_IF_NULL, CATCH, CHECK_ERROR_STATE, eris_ifu_vector_delete(), eris_ifu_vector_get_max(), eris_ifu_vector_get_min(), eris_ifu_vector_new(), and TRY.

◆ eris_ifu_vector_is_rejected()

int eris_ifu_vector_is_rejected ( const eris_ifu_vector *  ev,
int  n 
)

Test if a value is good or bad.

Parameters
evThe input eris_ifu_vector
nThe position of the value in the vector (first value is 0)
Returns
1 if the value is rejected, 0 if it is good, -1 on error

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if ev is NULL
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if the specified position is out of the vector

Definition at line 744 of file eris_ifu_vector.c.

References CATCH, and TRY.

Referenced by eris_ifu_vector_get_data().

◆ eris_ifu_vector_load()

eris_ifu_vector * eris_ifu_vector_load ( const char *  filename,
int  position 
)

Override for cpl_vector_load().

Parameters
filenameName of the input file
positionExtension number in the file.
Returns
The function returns the newly created eris_ifu_vector or NULL if an error occurred.

This is an override for cpl_vector_load(), just giving a proper error message if the input file isn't found. The errors returned are the same as with cpl_vector_load

Definition at line 2181 of file eris_ifu_vector.c.

References BRK_IF_NULL, CATCH, CHECK_ERROR_STATE, eris_ifu_vector_create(), eris_ifu_vector_delete(), and TRY.

◆ eris_ifu_vector_multiply()

cpl_error_code eris_ifu_vector_multiply ( eris_ifu_vector *  kv1,
const eris_ifu_vector *  kv2 
)

Multiply two eris_ifu_vectors.

Parameters
kv1First eris_ifu_vector (modified)
kv2Second eris_ifu_vector
Returns
CPL_ERROR_NONE or the relevant
  • cpl_error_code on error
The input first vector is modified.

The input vectors must have the same size.

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if any input pointer is NULL
  • CPL_ERROR_INCOMPATIBLE_INPUT if kv1 and kv2 have different sizes

Definition at line 1128 of file eris_ifu_vector.c.

References BRK_IF_NULL, CATCH, eris_ifu_is_nan_or_inf(), and TRY.

◆ eris_ifu_vector_multiply_scalar()

cpl_error_code eris_ifu_vector_multiply_scalar ( eris_ifu_vector *  ev,
double  factor 
)

Elementwise multiplication of a scalar to a eris_ifu_vector.

Parameters
everis_ifu_vector to modify
factorNumber to multiply with
Returns
CPL_ERROR_NONE or the relevant
  • cpl_error_code on error
Multiply each element of the eris_ifu_vector with a number.

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if ev is NULL

Definition at line 1371 of file eris_ifu_vector.c.

References BRK_IF_NULL, CATCH, CHECK_ERROR_STATE, eris_ifu_is_nan_or_inf(), and TRY.

Referenced by eris_ifu_vector_power().

◆ eris_ifu_vector_new()

eris_ifu_vector * eris_ifu_vector_new ( int  n)

Create a new eris_ifu_vector.

Parameters
nNumber of elements of the eris_ifu_vector
Returns
1 newly allocated eris_ifu_vector or NULL in case of an error

The returned object must be deallocated using

  • eris_ifu_vector_delete(). In opposite to cpl_vector_new, the data values are initialised to zero, and all values are not marked as rejected

Possible cpl_error_code set in this function:

  • CPL_ERROR_ILLEGAL_INPUT if n is negative or zero

Definition at line 56 of file eris_ifu_vector.c.

References BRK_IF_ERROR, BRK_IF_NULL, CATCH, and TRY.

Referenced by eris_ifu_vector_histogram().

◆ eris_ifu_vector_new_wrap()

eris_ifu_vector * eris_ifu_vector_new_wrap ( int  n,
const double *  data 
)

Create a new eris_ifu_vector from a vector (duplicated).

Parameters
nNumber of elements of the eris_ifu_vector
datadata
Returns
1 newly allocated eris_ifu_vector or NULL in case of an error

The returned object must be deallocated using

  • eris_ifu_vector_delete(). In opposite to cpl_vector_new, the data values are initialised to zero, and all values are not marked as rejected

Possible cpl_error_code set in this function:

  • CPL_ERROR_ILLEGAL_INPUT if n is negative or zero

Definition at line 108 of file eris_ifu_vector.c.

References BRK_IF_ERROR, BRK_IF_NULL, CATCH, eris_ifu_is_nan_or_inf(), and TRY.

◆ eris_ifu_vector_power()

cpl_error_code eris_ifu_vector_power ( eris_ifu_vector *  ev,
double  exponent 
)

Compute the elementwise power of the vector.

Parameters
evThe vector to be modified in place.
exponentThe Exponent.
Returns
The function returns CPL_ERROR_NONE on success or a CPL error code otherwise.

With a vector-element being zero, this function returns also zero.

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if ev is NULL.

Definition at line 1963 of file eris_ifu_vector.c.

References BRK_IF_NULL, CATCH, CHECK_ERROR_STATE, eris_ifu_is_nan_or_inf(), eris_ifu_vector_add_scalar(), eris_ifu_vector_multiply_scalar(), and TRY.

◆ eris_ifu_vector_reject()

cpl_error_code eris_ifu_vector_reject ( eris_ifu_vector *  ev,
int  n 
)

Set a value as rejected in a eris_ifu_vector.

Parameters
evThe input eris_ifu_vector
nThe position of the value in the vector (first value is 0)
Returns
the
  • cpl_error_code or CPL_ERROR_NONE
Possible cpl_error_code set in this function:
  • CPL_ERROR_NULL_INPUT if ev is NULL
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if the specified position is out of the vector

Definition at line 783 of file eris_ifu_vector.c.

References CATCH, CHECK_ERROR_STATE, and TRY.

◆ eris_ifu_vector_reject_from_mask()

cpl_error_code eris_ifu_vector_reject_from_mask ( eris_ifu_vector *  ev,
const cpl_vector *  mask,
int  keep 
)

Set the rejected elements in an eris_ifu_vector as defined in a mask.

Parameters
evInput eris_ifu_vector
maskThe mask defining the bad elements.
keepTRUE: keep already rejected values and just update the non-rejected ones. FALSE: apply the supplied mask.
Returns
the
  • cpl_error_code or CPL_ERROR_NONE
Possible cpl_error_code set in this function:
  • CPL_ERROR_NULL_INPUT if ev or mask is NULL
  • CPL_ERROR_ILLEGAL_INPUT if ev and mask don't have same length

Definition at line 609 of file eris_ifu_vector.c.

References BRK_IF_NULL, CATCH, CHECK_ERROR_STATE, and TRY.

◆ eris_ifu_vector_save()

cpl_error_code eris_ifu_vector_save ( const eris_ifu_vector *  ev,
const char *  filename,
cpl_type_bpp  bpp,
const cpl_propertylist *  pl,
unsigned  mode,
double  rej_val 
)

Override for cpl_vector_save().

Parameters
everis_ifu_vector to write to disk or NULL
filenameName of the file to write
bppBits per pixel
plProperty list for the output header or NULL
modeThe desired output options
rej_valThe rejected values are filled with this value. If -1 is provided, the rejected values in the internal cpl-bad pixel mask are ignored.
Returns
CPL_ERROR_NONE or the relevant cpl_error_code on error

This is an override for cpl_vector_save(), just giving a proper error message if the input file isn't found and rejecting all infinite values (NaN, +/-Inf). The errors returned are the same as with cpl_vector_save

Definition at line 2231 of file eris_ifu_vector.c.

References BRK_IF_NULL, CATCH, CHECK_ERROR_STATE, eris_ifu_is_nan_or_inf(), eris_ifu_vector_delete(), eris_ifu_vector_duplicate(), and TRY.

Referenced by eris_ifu_save_ifu_vector_dbg().

◆ eris_ifu_vector_set()

cpl_error_code eris_ifu_vector_set ( eris_ifu_vector *  ev,
int  pos,
double  val 
)

Set an element of the eris_ifu_vector.

Parameters
evInput eris_ifu_vector
posThe index of the element (0 to nelem-1)
valThe value to set in the vector
Returns
A newly allocated eris_ifu_vector or NULL in case of an error

If the value is Nan or Inf the element is marked as rejected.

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if ev is NULL
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if the specified position is out of the vector

Definition at line 386 of file eris_ifu_vector.c.

References CATCH, eris_ifu_is_nan_or_inf(), and TRY.

Referenced by eris_ifu_vector_fill().

◆ eris_ifu_vector_sqrt()

cpl_error_code eris_ifu_vector_sqrt ( eris_ifu_vector *  ev)

eris_ifu_vector_sqrt

Parameters
v
Returns

Fixes a bug in cpl_vector_sqrt(): When a value is -nan, the function returns an ILLEGAL_INPUT error... sqrt() does return just the same nan value, so let's do so...

Definition at line 2354 of file eris_ifu_vector.c.

References BRK_IF_NULL, CATCH, CHECK_ERROR_STATE, eris_ifu_is_nan_or_inf(), and TRY.

◆ eris_ifu_vector_subtract()

cpl_error_code eris_ifu_vector_subtract ( eris_ifu_vector *  kv1,
const eris_ifu_vector *  kv2 
)

Subtract two eris_ifu_vectors.

Parameters
kv1First eris_ifu_vector (modified)
kv2Second eris_ifu_vector
Returns
CPL_ERROR_NONE or the relevant
  • cpl_error_code on error
The second vector is subtracted from the first one. The input first vector is modified.

The input vectors must have the same size.

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if any input pointer is NULL
  • CPL_ERROR_INCOMPATIBLE_INPUT if kv1 and kv2 have different sizes

Definition at line 1057 of file eris_ifu_vector.c.

References BRK_IF_NULL, CATCH, eris_ifu_is_nan_or_inf(), and TRY.

◆ eris_ifu_vector_subtract_scalar()

cpl_error_code eris_ifu_vector_subtract_scalar ( eris_ifu_vector *  ev,
double  subtrahend 
)

Elementwise subtraction of a scalar from a eris_ifu_vector.

Parameters
everis_ifu_vector to modify
subtrahendNumber to subtract
Returns
CPL_ERROR_NONE or the relevant
  • cpl_error_code on error
Subtract a number from each element of the eris_ifu_vector.

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if ev is NULL

Definition at line 1319 of file eris_ifu_vector.c.

References BRK_IF_NULL, CATCH, CHECK_ERROR_STATE, eris_ifu_is_nan_or_inf(), and TRY.