|
ERIS Pipeline Reference Manual 1.8.15
|
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 C array (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 *ev) |
| Delete a eris_ifu_vector. | |
| eris_ifu_vector * | eris_ifu_vector_duplicate (const eris_ifu_vector *ev) |
| This function duplicates an existing eris_ifu_vector and allocates memory. | |
| cpl_error_code | eris_ifu_vector_set (eris_ifu_vector *ev, int pos, double val) |
| Set an element of the eris_ifu_vector. | |
| double | eris_ifu_vector_get_rej (const eris_ifu_vector *ev, int pos, int *rej) |
| Get an element of the eris_ifu_vector. | |
| double | eris_ifu_vector_get (const eris_ifu_vector *ev, int pos) |
| Get an element of the eris_ifu_vector. | |
| cpl_vector * | eris_ifu_vector_get_mask (const eris_ifu_vector *ev) |
| Get a copy of the mask of eris_ifu_vector. | |
| cpl_vector * | eris_ifu_vector_get_data (const eris_ifu_vector *ev) |
| Get a copy of the data, rejected values are set to NaN. | |
| cpl_vector * | eris_ifu_vector_get_bpm (eris_ifu_vector *ev) |
| Get the pointer to the mask of the eris_ifu_vector. | |
| 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. | |
| int | eris_ifu_vector_count_rejected (const eris_ifu_vector *ev) |
| Count the number of rejected elements in a eris_ifu_vector. | |
| int | eris_ifu_vector_count_non_rejected (const eris_ifu_vector *ev) |
| Count the number of non-rejected elements in a eris_ifu_vector. | |
| int | eris_ifu_vector_is_rejected (const eris_ifu_vector *ev, int n) |
| Test if a value is good or bad. | |
| cpl_error_code | eris_ifu_vector_reject (eris_ifu_vector *ev, int n) |
| Set a value as rejected in a eris_ifu_vector. | |
| 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. | |
| 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. | |
| 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 *ev, double addend) |
| Elementwise addition of a scalar to a eris_ifu_vector. | |
| cpl_error_code | eris_ifu_vector_subtract_scalar (eris_ifu_vector *ev, double subtrahend) |
| Elementwise subtraction of a scalar from a eris_ifu_vector. | |
| cpl_error_code | eris_ifu_vector_multiply_scalar (eris_ifu_vector *ev, double factor) |
| Elementwise multiplication of a scalar to a eris_ifu_vector. | |
| cpl_error_code | eris_ifu_vector_divide_scalar (eris_ifu_vector *ev, double dividend) |
| Elementwise division of a eris_ifu_vector by a scalar. | |
| cpl_error_code | eris_ifu_vector_abs (eris_ifu_vector *ev) |
| Calculates the absolute value of a vector in-place. | |
| int | eris_ifu_vector_get_size (const eris_ifu_vector *ev) |
| Get the size of the eris_ifu_vector. | |
| double | eris_ifu_vector_get_mean (const eris_ifu_vector *ev) |
| Compute the mean value of non-rejected eris_ifu_vector elements. | |
| double | eris_ifu_vector_get_median (const eris_ifu_vector *ev, 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 *ev, double percentage) |
| Remove a certain percentage of brightest pixels. | |
| double | eris_ifu_vector_get_sum (const eris_ifu_vector *ev) |
| Compute the sum of non-rejected eris_ifu_vector elements. | |
| double | eris_ifu_vector_get_stdev (const eris_ifu_vector *ev) |
| Compute the bias-corrected standard deviation of a vector's elements. | |
| double | eris_ifu_vector_get_stdev_median (const eris_ifu_vector *ev) |
| Compute the bias-corrected standard deviation using median instead of mean. | |
| double | eris_ifu_vector_get_max (const eris_ifu_vector *ev, int *pos) |
| Get the maximum of the eris_ifu_vector and its position. | |
| double | eris_ifu_vector_get_min (const eris_ifu_vector *ev, int *pos) |
| Get the minimum of the eris_ifu_vector and its position. | |
| cpl_error_code | eris_ifu_vector_power (eris_ifu_vector *ev, double exponent) |
| Compute the elementwise power of the vector. | |
| cpl_error_code | eris_ifu_vector_fill (eris_ifu_vector *ev, double val) |
| Fill a eris_ifu_vector. | |
| cpl_error_code | eris_ifu_vector_flip (eris_ifu_vector *ev) |
| Flip the values of a vector. | |
| eris_ifu_vector * | eris_ifu_vector_histogram (const eris_ifu_vector *ev, 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 *ev, 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 *ev) |
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 | |
This module provides the eris_ifu_vector data type, which extends the standard cpl_vector with integrated bad pixel masking capabilities.
An eris_ifu_vector is a data structure that contains:
cpl_vector holding the actual data valuescpl_vector indicating which elements are validThis is similar to how HDRL images work but for 1D vectors.
All creation and arithmetic functions automatically detect and reject:
These values are marked as rejected in the mask but the data values themselves are preserved (not overwritten).
eris_ifu_vector_new(): Create empty vector (initialized to zero)eris_ifu_vector_create(): Create from cpl_vectoreris_ifu_vector_create2(): Create from data + mask vectorseris_ifu_vector_new_wrap(): Create from C arrayeris_ifu_vector_get(): Get value (regardless of mask)eris_ifu_vector_get_rej(): Get value and rejection statuseris_ifu_vector_set(): Set value (auto-rejects NaN/Inf)eris_ifu_vector_reject(): Manually reject an elementeris_ifu_vector_reject_from_mask(): Apply external maskeris_ifu_vector_adapt_rejected(): Synchronize masks between vectorseris_ifu_vector_count_rejected(): Count bad elementseris_ifu_vector_is_rejected(): Check if element is rejectederis_ifu_vector_create_non_rejected(): Get cpl_vector with only valid dataeris_ifu_vector_get_data(): Get cpl_vector (rejected → NaN)eris_ifu_vector_extract(): Extract subvectoreris_ifu_vector_load(): Load from FITS fileeris_ifu_vector_save(): Save to FITS file (optional: fill rejected with value)// Create vector with 100 elements eris_ifu_vector *ev = eris_ifu_vector_new(100);
// Fill with data for (int i = 0; i < 100; i++) { eris_ifu_vector_set(ev, i, some_data[i]); }
// Reject outliers manually eris_ifu_vector_reject(ev, 42);
// Compute statistics (ignores rejected elements) double mean = eris_ifu_vector_get_mean(ev); double stdev = eris_ifu_vector_get_stdev(ev);
// Cleanup eris_ifu_vector_delete(ev);
eris_ifu_vector *v1 = eris_ifu_vector_create(data1); eris_ifu_vector *v2 = eris_ifu_vector_create(data2);
// Divide v1 by v2 (division by zero → automatic rejection) eris_ifu_vector_divide(v1, v2); // v1 modified in-place
// If v2[i] was rejected or v2[i]==0, then v1[i] is now rejected
eris_ifu_vector *ev = eris_ifu_vector_load("data.fits", 0);
// Get CPL vector with only non-rejected values cpl_vector *valid = eris_ifu_vector_create_non_rejected(ev);
// valid is shorter than ev if some elements were rejected int n_valid = cpl_vector_get_size(valid);
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()))
| 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:
Definition at line 58 of file eris_ifu_vector.h.
| int eris_ifu_is_nan_or_inf | ( | double | A | ) |
Checks if a value is nan, inf or -inf.
| A | The value to check. |
Definition at line 2671 of file eris_ifu_vector.c.
Referenced by eris_compute_psf_qc(), eris_ifu_combine_build_mask_cube(), eris_ifu_load_deq_hdrl_imagelist(), eris_ifu_vector_add(), eris_ifu_vector_add_scalar(), eris_ifu_vector_create(), eris_ifu_vector_create2(), eris_ifu_vector_divide(), eris_ifu_vector_divide_scalar(), eris_ifu_vector_multiply(), eris_ifu_vector_multiply_scalar(), eris_ifu_vector_new_wrap(), eris_ifu_vector_power(), eris_ifu_vector_save(), eris_ifu_vector_set(), eris_ifu_vector_sqrt(), eris_ifu_vector_subtract(), and eris_ifu_vector_subtract_scalar().
| cpl_error_code eris_ifu_vector_abs | ( | eris_ifu_vector * | ev | ) |
Calculates the absolute value of a vector in-place.
| ev | The vector (modified in-place). |
The vector is checked elementwise: if the data is negative, its sign is changed. Only non-rejected elements are processed.
Possible cpl_error_code set in this function:
ev is NULL.Definition at line 1730 of file eris_ifu_vector.c.
References BRK_IF_NULL, CATCH, and TRY.
| 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.
| kv1 | 1st input eris_ifu_vector (modified in-place) |
| kv2 | 2nd input eris_ifu_vector (modified in-place) |
It is asserted that all rejected elements in kv1 are also rejected in kv2 and vice versa. Both masks are modified to ensure synchronization: if either vector has element i rejected, both will have it rejected.
Possible cpl_error_code set in this function:
Definition at line 1129 of file eris_ifu_vector.c.
References BRK_IF_NULL, CATCH, and TRY.
| cpl_error_code eris_ifu_vector_add | ( | eris_ifu_vector * | kv1, |
| const eris_ifu_vector * | kv2 | ||
| ) |
Add a eris_ifu_vector to another.
| kv1 | First eris_ifu_vector (modified in-place) |
| kv2 | Second eris_ifu_vector (not modified) |
The second vector is added to the first one: kv1 = kv1 + kv2. The input first vector is modified in-place.
The input vectors must have the same size.
Possible cpl_error_code set in this function:
Definition at line 1195 of file eris_ifu_vector.c.
References BRK_IF_NULL, CATCH, eris_ifu_is_nan_or_inf(), and TRY.
Referenced by eris_ifu_dist_calc_distortion().
| cpl_error_code eris_ifu_vector_add_scalar | ( | eris_ifu_vector * | ev, |
| double | addend | ||
| ) |
Elementwise addition of a scalar to a eris_ifu_vector.
| ev | eris_ifu_vector to modify (modified in-place) |
| addend | Number to add |
Add a number to each non-rejected element: ev[i] = ev[i] + addend. Rejected elements remain unchanged and rejected.
Possible cpl_error_code set in this function:
ev is NULLDefinition at line 1508 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().
| int eris_ifu_vector_count_non_rejected | ( | const eris_ifu_vector * | ev | ) |
Count the number of non-rejected elements in a eris_ifu_vector.
| ev | The input eris_ifu_vector |
Possible cpl_error_code set in this function:
ev is NULLDefinition at line 878 of file eris_ifu_vector.c.
References BRK_IF_NULL, CATCH, and TRY.
Referenced by eris_ifu_combine_calc_error(), eris_ifu_dist_calc_centers_fit(), and eris_ifu_vector_get_stdev_median().
| int eris_ifu_vector_count_rejected | ( | const eris_ifu_vector * | ev | ) |
Count the number of rejected elements in a eris_ifu_vector.
| ev | The input eris_ifu_vector |
Possible cpl_error_code set in this function:
ev is NULLDefinition at line 838 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 * eris_ifu_vector_create | ( | const cpl_vector * | data | ) |
Create a new eris_ifu_vector out of a data cpl_vector.
| data | The cpl_vector to wrap (will be duplicated). |
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 (not overwritten to NaN).
Possible cpl_error_code set in this function:
data is NULLDefinition at line 310 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_dist_calc_centers_fit(), eris_ifu_dist_calc_centers_profile(), eris_ifu_vector_cut_percentian(), and eris_ifu_vector_load().
| 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.
| data | The data cpl_vector to wrap (will be duplicated). |
| mask | The mask cpl_vector to wrap (will be duplicated). |
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.
Output mask is normalized to 1.0 (good) or 0.0 (bad).
Possible cpl_error_code set in this function:
data or mask is NULL data and mask isn't the same.Definition at line 390 of file eris_ifu_vector.c.
References BRK_IF_NULL, CATCH, eris_ifu_is_nan_or_inf(), and TRY.
| 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.
| ev | The input eris_ifu_vector |
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:
ev is NULLDefinition at line 1066 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 * eris_ifu_vector_cut_percentian | ( | const eris_ifu_vector * | ev, |
| double | percentage | ||
| ) |
Remove a certain percentage of brightest pixels.
| ev | Input Vector. |
| percentage | The percentage of brightest pixels to remove (between 0 and 1). |
Creates a new vector containing only the (1-percentage)*100% dimmest pixels. For example, percentage=0.1 removes the brightest 10% of pixels.
Only non-rejected elements are considered. Rejected elements are excluded.
Possible cpl_error_code set in this function:
ev is NULL. Definition at line 1921 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.
| void eris_ifu_vector_delete | ( | eris_ifu_vector * | ev | ) |
Delete a eris_ifu_vector.
| ev | eris_ifu_vector to delete. |
Deallocates both data and mask vectors, then frees the structure. If the eris_ifu_vector ev is NULL, nothing is done and no error is set.
Definition at line 457 of file eris_ifu_vector.c.
Referenced by eris_ifu_combine_coadd(), eris_ifu_combine_coadd_ks_clip(), eris_ifu_free_ifu_vector(), eris_ifu_vector_cut_percentian(), eris_ifu_vector_histogram(), eris_ifu_vector_load(), and eris_ifu_vector_save().
| cpl_error_code eris_ifu_vector_divide | ( | eris_ifu_vector * | kv1, |
| const eris_ifu_vector * | kv2 | ||
| ) |
Divide two eris_ifu_vectors element-wise.
| kv1 | First eris_ifu_vector (modified in-place) |
| kv2 | Second eris_ifu_vector (not modified) |
Elementwise division: kv1 = kv1 / kv2. In opposite to cpl_vector_divide(), a division by zero doesn't throw an error but results in a rejected element of the vector (NaN/Inf detection).
The input vectors must have the same size.
Possible cpl_error_code set in this function:
Definition at line 1437 of file eris_ifu_vector.c.
References BRK_IF_NULL, CATCH, eris_ifu_is_nan_or_inf(), and TRY.
| cpl_error_code eris_ifu_vector_divide_scalar | ( | eris_ifu_vector * | ev, |
| double | dividend | ||
| ) |
Elementwise division of a eris_ifu_vector by a scalar.
| ev | eris_ifu_vector to modify (modified in-place) |
| dividend | Number to divide by |
Divide each non-rejected element by a number: ev[i] = ev[i] / dividend. Rejected elements remain unchanged and rejected.
Possible cpl_error_code set in this function:
ev is NULLDefinition at line 1674 of file eris_ifu_vector.c.
References BRK_IF_NULL, CATCH, CHECK_ERROR_STATE, eris_ifu_is_nan_or_inf(), and TRY.
| cpl_error_code eris_ifu_vector_dump | ( | const eris_ifu_vector * | ev | ) |
All values contained in vec are printed for debugging purposes.
| ev | The vector to print. |
Definition at line 2619 of file eris_ifu_vector.c.
References BRK_IF_NULL, BRK_WITH_ERROR_MSG, CATCH, CHECK_ERROR_STATE, and TRY.
| eris_ifu_vector * eris_ifu_vector_duplicate | ( | const eris_ifu_vector * | ev | ) |
This function duplicates an existing eris_ifu_vector and allocates memory.
| ev | Input eris_ifu_vector |
The returned object must be deallocated using eris_ifu_vector_delete(). Both data and mask are duplicated (deep copy).
Possible cpl_error_code set in this function:
ev is NULLDefinition at line 489 of file eris_ifu_vector.c.
References BRK_IF_NULL, CATCH, CHECK_ERROR_STATE, and TRY.
Referenced by eris_ifu_dist_calc_distortion(), and eris_ifu_vector_save().
| 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.
| ev | The input eris_ifu_vector |
| istart | Start index (from 0 to number of elements - 1) |
| istop | Stop index (from 0 to number of elements - 1) |
Rejected elements are also extracted (mask is preserved).
Possible cpl_error_code set in this function:
ev is NULL Definition at line 1013 of file eris_ifu_vector.c.
References BRK_IF_NULL, CATCH, and TRY.
Referenced by eris_ifu_dist_calc_centers_fit().
| cpl_error_code eris_ifu_vector_fill | ( | eris_ifu_vector * | ev, |
| double | val | ||
| ) |
Fill a eris_ifu_vector.
| ev | The vector to be filled with the value val (modified in-place). |
| val | Value used to fill the eris_ifu_vector. |
All elements (rejected and non-rejected) are set to val. If val is NaN or Inf, all elements will be rejected. If val is finite, all elements will be non-rejected.
Possible cpl_error_code set in this function:
ev is NULL.Definition at line 2346 of file eris_ifu_vector.c.
References CATCH, eris_ifu_vector_get_size(), eris_ifu_vector_set(), and TRY.
| cpl_error_code eris_ifu_vector_flip | ( | eris_ifu_vector * | ev | ) |
Flip the values of a vector.
| ev | The vector (modified in-place). |
The vector is flipped elementwise from both sides: first element swaps with last, second with second-to-last, etc. Both data and mask are flipped.
Possible cpl_error_code set in this function:
ev is NULL.Definition at line 2386 of file eris_ifu_vector.c.
References BRK_IF_NULL, CATCH, and TRY.
| double eris_ifu_vector_get | ( | const eris_ifu_vector * | ev, |
| int | pos | ||
| ) |
Get an element of the eris_ifu_vector.
| ev | Input eris_ifu_vector |
| pos | The index of the element (0 to nelem-1) |
Convenience wrapper for eris_ifu_vector_get_rej() when rejection status is not needed. The value is returned regardless if it is rejected or not!
Possible cpl_error_code set in this function:
ev is NULL Definition at line 639 of file eris_ifu_vector.c.
References eris_ifu_vector_get_rej().
Referenced by eris_ifu_combine_calc_error(), and eris_ifu_dist_calc_centers_fit().
| cpl_vector * eris_ifu_vector_get_bpm | ( | eris_ifu_vector * | ev | ) |
Get the pointer to the mask of the eris_ifu_vector.
| ev | Input eris_ifu_vector |
The output vector contains 1.0 for non-rejected elements and 0.0 for rejected elements.
Possible cpl_error_code set in this function:
ev is NULLDefinition at line 742 of file eris_ifu_vector.c.
References BRK_IF_NULL, CATCH, and TRY.
| cpl_vector * eris_ifu_vector_get_data | ( | const eris_ifu_vector * | ev | ) |
Get a copy of the data, rejected values are set to NaN.
| ev | Input eris_ifu_vector |
The output vector contains NaN for rejected elements, allowing standard CPL operations to naturally ignore them.
Possible cpl_error_code set in this function:
ev is NULLDefinition at line 700 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.
| cpl_vector * eris_ifu_vector_get_mask | ( | const eris_ifu_vector * | ev | ) |
Get a copy of the mask of eris_ifu_vector.
| ev | Input eris_ifu_vector |
The output vector contains 1.0 for non-rejected elements and 0.0 for rejected elements.
Possible cpl_error_code set in this function:
ev is NULLDefinition at line 663 of file eris_ifu_vector.c.
References BRK_IF_NULL, CATCH, and TRY.
| double eris_ifu_vector_get_max | ( | const eris_ifu_vector * | ev, |
| int * | pos | ||
| ) |
Get the maximum of the eris_ifu_vector and its position.
| ev | Input 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. |
Only non-rejected elements are considered.
Possible cpl_error_code set in this function:
ev is NULLDefinition at line 2145 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().
| double eris_ifu_vector_get_mean | ( | const eris_ifu_vector * | ev | ) |
Compute the mean value of non-rejected eris_ifu_vector elements.
| ev | Input eris_ifu_vector |
Only non-rejected elements are included in the calculation.
Possible cpl_error_code set in this function:
ev is NULLDefinition at line 1813 of file eris_ifu_vector.c.
References CATCH, CHECK_ERROR_STATE, eris_ifu_vector_create_non_rejected(), and TRY.
Referenced by eris_ifu_dist_calc_centers_profile(), and eris_ifu_dist_calc_distortion().
| double eris_ifu_vector_get_median | ( | const eris_ifu_vector * | ev, |
| const enum medianType | type | ||
| ) |
Compute the median of the elements of a vector.
| ev | Input Vector. |
| type | The method to calculate the median with: 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. |
Unlike
Only non-rejected elements are included in the calculation.
Possible cpl_error_code set in this function:
ev is NULL.Definition at line 1864 of file eris_ifu_vector.c.
References CATCH, eris_ifu_vector_create_non_rejected(), and TRY.
Referenced by eris_ifu_dist_calc_centers_fit(), and eris_ifu_vector_get_stdev_median().
| double eris_ifu_vector_get_min | ( | const eris_ifu_vector * | ev, |
| int * | pos | ||
| ) |
Get the minimum of the eris_ifu_vector and its position.
| ev | Input 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. |
Only non-rejected elements are considered.
Possible cpl_error_code set in this function:
ev is NULLDefinition at line 2209 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().
| double eris_ifu_vector_get_rej | ( | const eris_ifu_vector * | ev, |
| int | pos, | ||
| int * | rej | ||
| ) |
Get an element of the eris_ifu_vector.
| ev | Input eris_ifu_vector |
| pos | The index of the element (0 to nelem-1) |
| rej | (Output) 1 if the pixel is bad, 0 if good, negative on error. Can be NULL if rejection status not needed. |
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:
ev is NULL Definition at line 587 of file eris_ifu_vector.c.
Referenced by eris_ifu_vector_get().
| int eris_ifu_vector_get_size | ( | const eris_ifu_vector * | ev | ) |
Get the size of the eris_ifu_vector.
| ev | Input eris_ifu_vector |
Returns the total number of elements (rejected + non-rejected).
Possible cpl_error_code set in this function:
ev is NULLDefinition at line 1776 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().
| double eris_ifu_vector_get_stdev | ( | const eris_ifu_vector * | ev | ) |
Compute the bias-corrected standard deviation of a vector's elements.
| ev | Input eris_ifu_vector |
Formula: S(n-1) = sqrt[sum((xi-mean)^2) / (n-1)] (i=1 -> n)
The length of ev must be at least 2. Only non-rejected elements are included in the calculation.
Possible cpl_error_code set in this function:
ev is NULL ev is less than 2Definition at line 2034 of file eris_ifu_vector.c.
References CATCH, CHECK_ERROR_STATE, eris_ifu_vector_create_non_rejected(), and TRY.
Referenced by eris_ifu_combine_calc_error().
| double eris_ifu_vector_get_stdev_median | ( | const eris_ifu_vector * | ev | ) |
Compute the bias-corrected standard deviation using median instead of mean.
| ev | Input eris_ifu_vector |
Formula: S(n-1) = sqrt[sum((xi-median)^2) / (n-1)] (i=1 -> n)
The length of ev must be at least 2. Only non-rejected elements are included in the calculation.
This is more robust to outliers than standard stdev.
Possible cpl_error_code set in this function:
ev is NULL ev is less than 2Definition at line 2083 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.
Referenced by eris_ifu_combine_calc_error(), and eris_ifu_dist_calc_centers_fit().
| double eris_ifu_vector_get_sum | ( | const eris_ifu_vector * | ev | ) |
Compute the sum of non-rejected eris_ifu_vector elements.
| ev | Input eris_ifu_vector |
Only non-rejected elements are included in the sum.
Possible cpl_error_code set in this function:
ev is NULLDefinition at line 1979 of file eris_ifu_vector.c.
References BRK_IF_NULL, CATCH, CHECK_ERROR_STATE, and TRY.
| eris_ifu_vector * eris_ifu_vector_histogram | ( | const eris_ifu_vector * | ev, |
| int | nbins | ||
| ) |
Calculates the histogram of a vector.
| ev | Input vector. |
| nbins | The number of bins to produce. |
nbins containing the histogram of input data, or NULL on error.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.
Only non-rejected elements are included in the histogram.
Possible cpl_error_code set in this function:
ev is NULL. nbins is <= 0.Definition at line 2450 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.
| int eris_ifu_vector_is_rejected | ( | const eris_ifu_vector * | ev, |
| int | n | ||
| ) |
Test if a value is good or bad.
| ev | The input eris_ifu_vector |
| n | The position of the value in the vector (first value is 0) |
Possible cpl_error_code set in this function:
ev is NULL Definition at line 925 of file eris_ifu_vector.c.
Referenced by eris_ifu_combine_calc_error(), eris_ifu_dist_calc_centers_fit(), and eris_ifu_vector_get_data().
| eris_ifu_vector * eris_ifu_vector_load | ( | const char * | filename, |
| int | position | ||
| ) |
Override for cpl_vector_load().
| filename | Name of the input file |
| position | Extension number in the file. |
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 2511 of file eris_ifu_vector.c.
References BRK_IF_NULL, CATCH, CHECK_ERROR_STATE, eris_ifu_vector_create(), eris_ifu_vector_delete(), and TRY.
| cpl_error_code eris_ifu_vector_multiply | ( | eris_ifu_vector * | kv1, |
| const eris_ifu_vector * | kv2 | ||
| ) |
Multiply two eris_ifu_vectors.
| kv1 | First eris_ifu_vector (modified in-place) |
| kv2 | Second eris_ifu_vector (not modified) |
Elementwise multiplication: kv1 = kv1 * kv2. The input first vector is modified in-place.
The input vectors must have the same size.
Possible cpl_error_code set in this function:
Definition at line 1354 of file eris_ifu_vector.c.
References BRK_IF_NULL, CATCH, eris_ifu_is_nan_or_inf(), and TRY.
| cpl_error_code eris_ifu_vector_multiply_scalar | ( | eris_ifu_vector * | ev, |
| double | factor | ||
| ) |
Elementwise multiplication of a scalar to a eris_ifu_vector.
| ev | eris_ifu_vector to modify (modified in-place) |
| factor | Number to multiply with |
Multiply each non-rejected element with a number: ev[i] = ev[i] * factor. Rejected elements remain unchanged and rejected.
Possible cpl_error_code set in this function:
ev is NULLDefinition at line 1619 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 * eris_ifu_vector_new | ( | int | n | ) |
Create a new eris_ifu_vector.
| n | Number of elements of the eris_ifu_vector |
The returned object must be deallocated using
Possible cpl_error_code set in this function:
Definition at line 184 of file eris_ifu_vector.c.
References BRK_IF_ERROR, BRK_IF_NULL, CATCH, and TRY.
Referenced by eris_ifu_combine_coadd(), eris_ifu_combine_coadd_ks_clip(), and eris_ifu_vector_histogram().
| eris_ifu_vector * eris_ifu_vector_new_wrap | ( | int | n, |
| const double * | data | ||
| ) |
Create a new eris_ifu_vector from a C array (duplicated).
| n | Number of elements of the eris_ifu_vector |
| data | Data array (will be duplicated) |
The returned object must be deallocated using
Possible cpl_error_code set in this function:
Definition at line 240 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_dist_calc_distortion().
| cpl_error_code eris_ifu_vector_power | ( | eris_ifu_vector * | ev, |
| double | exponent | ||
| ) |
Compute the elementwise power of the vector.
| ev | The vector to be modified in place. |
| exponent | The Exponent. |
Computes ev[i] = pow(ev[i], exponent) for non-rejected elements. Special case: exponent == 0 → ev[i] = 1.0 for all non-rejected elements.
With a vector-element being zero and negative exponent, this function produces Inf which is then rejected.
Possible cpl_error_code set in this function:
ev is NULL.Definition at line 2279 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.
| cpl_error_code eris_ifu_vector_reject | ( | eris_ifu_vector * | ev, |
| int | n | ||
| ) |
Set a value as rejected in a eris_ifu_vector.
| ev | The input eris_ifu_vector (modified in-place) |
| n | The position of the value in the vector (first value is 0) |
Marks the element at position n as rejected (mask[n] = 0.0). The data value itself is not modified.
Possible cpl_error_code set in this function:
ev is NULL Definition at line 970 of file eris_ifu_vector.c.
References CATCH, CHECK_ERROR_STATE, and TRY.
Referenced by eris_ifu_combine_coadd(), eris_ifu_combine_coadd_ks_clip(), and eris_ifu_dist_calc_centers_fit().
| 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.
| ev | Input eris_ifu_vector (modified in-place) |
| mask | The mask defining the bad elements (1.0=good, 0.0=bad). |
| keep | TRUE: keep already rejected values and just update the non-rejected ones. FALSE: apply the supplied mask completely. |
Applies a mask to the eris_ifu_vector. If keep=TRUE, only currently non-rejected elements can be updated; already rejected elements remain rejected.
Possible cpl_error_code set in this function:
ev or mask is NULL ev and mask don't have same lengthDefinition at line 783 of file eris_ifu_vector.c.
References BRK_IF_NULL, CATCH, CHECK_ERROR_STATE, and TRY.
| 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().
| ev | eris_ifu_vector to write to disk or NULL |
| filename | Name of the file to write |
| bpp | Bits per pixel |
| pl | Property list for the output header or NULL |
| mode | The desired output options |
| rej_val | The rejected values are filled with this value. If -1 is provided, the rejected values in the internal cpl-bad pixel mask are ignored. |
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 2561 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().
| cpl_error_code eris_ifu_vector_set | ( | eris_ifu_vector * | ev, |
| int | pos, | ||
| double | val | ||
| ) |
Set an element of the eris_ifu_vector.
| ev | Input eris_ifu_vector (modified in-place) |
| pos | The index of the element (0 to nelem-1) |
| val | The value to set in the vector |
If the value is NaN or Inf the element is automatically marked as rejected. If the value is finite, the element is marked as non-rejected.
Possible cpl_error_code set in this function:
ev is NULL Definition at line 540 of file eris_ifu_vector.c.
References CATCH, eris_ifu_is_nan_or_inf(), and TRY.
Referenced by eris_ifu_combine_coadd(), eris_ifu_combine_coadd_ks_clip(), and eris_ifu_vector_fill().
| cpl_error_code eris_ifu_vector_sqrt | ( | eris_ifu_vector * | ev | ) |
eris_ifu_vector_sqrt
| v |
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 2684 of file eris_ifu_vector.c.
References BRK_IF_NULL, CATCH, CHECK_ERROR_STATE, eris_ifu_is_nan_or_inf(), and TRY.
| cpl_error_code eris_ifu_vector_subtract | ( | eris_ifu_vector * | kv1, |
| const eris_ifu_vector * | kv2 | ||
| ) |
Subtract two eris_ifu_vectors.
| kv1 | First eris_ifu_vector (modified in-place) |
| kv2 | Second eris_ifu_vector (not modified) |
The second vector is subtracted from the first one: kv1 = kv1 - kv2. The input first vector is modified in-place.
The input vectors must have the same size.
Possible cpl_error_code set in this function:
Definition at line 1274 of file eris_ifu_vector.c.
References BRK_IF_NULL, CATCH, eris_ifu_is_nan_or_inf(), and TRY.
Referenced by eris_ifu_dist_calc_distortion().
| cpl_error_code eris_ifu_vector_subtract_scalar | ( | eris_ifu_vector * | ev, |
| double | subtrahend | ||
| ) |
Elementwise subtraction of a scalar from a eris_ifu_vector.
| ev | eris_ifu_vector to modify (modified in-place) |
| subtrahend | Number to subtract |
Subtract a number from each non-rejected element: ev[i] = ev[i] - subtrahend. Rejected elements remain unchanged and rejected.
Possible cpl_error_code set in this function:
ev is NULLDefinition at line 1563 of file eris_ifu_vector.c.
References BRK_IF_NULL, CATCH, CHECK_ERROR_STATE, eris_ifu_is_nan_or_inf(), and TRY.