MUSE Pipeline Reference Manual
2.1.1
|
Data Structures | |
struct | muse_cpltable_def |
Definition of a cpl table structure. More... | |
Typedefs | |
typedef int(* | muse_cplmatrix_element_compare_func) (double aValue1, double aValue2) |
Matrix element comparison function type definition. | |
Enumerations |
Functions | |
cpl_error_code | muse_cplimage_or (cpl_image *aTarget, const cpl_image *aImage, unsigned int mask) |
Provide an 'OR' operation of two integer images. More... | |
cpl_image * | muse_cplimage_concat_y (const cpl_image *aImage1, const cpl_image *aImage2) |
Concatenate two images in y direction. More... | |
cpl_image * | muse_cplimage_concat_x (const cpl_image *aImage1, const cpl_image *aImage2) |
Concatenate two images in x direction. More... | |
cpl_image * | muse_cplimage_filter_median_subtract (cpl_image *aImage, unsigned int aNX, unsigned int aNY) |
Subtract a median-filtered version of the input image from itself. More... | |
cpl_vector * | muse_cplimage_slope_window (const cpl_image *aImage, const cpl_size *aWindow) |
Compute slopes of an image, both horizontally and vertically. More... | |
double | muse_cplimage_get_percentile (const cpl_image *aImage, double aFraction) |
Get the percentile of an image. More... | |
cpl_image * | muse_cplimagelist_collapse_or_create (const cpl_imagelist *imlist) |
Compute the OR of an image list to a single image. More... | |
cpl_mask * | muse_cplmask_adapt_to_image (const cpl_mask *aMask, const cpl_image *aImage) |
Adapt mask with masked region in one quadrant to size of an image. More... | |
cpl_matrix * | muse_cplmatrix_multiply_create (const cpl_matrix *aMatrix1, const cpl_matrix *aMatrix2) |
Compute the element-wise product of two matrices. More... | |
cpl_array * | muse_cplmatrix_where (const cpl_matrix *aMatrix, double aValue, muse_cplmatrix_element_compare_func aCondition) |
Select matrix elements according to a condition. More... | |
cpl_matrix * | muse_cplmatrix_extract_selected (const cpl_matrix *aMatrix, const cpl_array *aIndices) |
Extract the elements given by the index array. More... | |
double | muse_cplvector_get_adev_const (const cpl_vector *aVector, double aCenter) |
Compute the average absolute deviation of a (constant) vector. More... | |
double | muse_cplvector_get_median_dev (cpl_vector *aVector, double *aMedian) |
Compute the median and average absolute deviation against the median of a vector. More... | |
double | muse_cplvector_get_semiquartile (cpl_vector *aVector) |
compute the semi-quartile range of a vector of elements More... | |
cpl_error_code | muse_cplvector_threshold (cpl_vector *aVec, double aLoCut, double aHiCut, double aLoVal, double aHiVal) |
Threshold a vector to a given interval. More... | |
cpl_error_code | muse_cplvector_erase_element (cpl_vector *aVector, int aElement) |
delete the given element from the input vector More... | |
cpl_size | muse_cplvector_count_unique (const cpl_vector *aVector) |
Count the number of unique entries in a given vector. More... | |
cpl_vector * | muse_cplvector_get_unique (const cpl_vector *aVector) |
Separate out all unique entries in a given vector into a new one. More... | |
cpl_table * | muse_cpltable_new (const muse_cpltable_def *aDef, cpl_size aLength) |
Create an empty table according to the specified definition. More... | |
cpl_table * | muse_cpltable_load (const char *aFile, const char *aExtension, const muse_cpltable_def aDefinition[]) |
Load a table from disk (and check against definition). More... | |
cpl_error_code | muse_cpltable_append_file (const cpl_table *aTable, const char *aFile, const char *aExtension, const muse_cpltable_def aDefinition[]) |
Save a table to disk (into a FITS extension) More... | |
cpl_error_code | muse_cpltable_check (const cpl_table *aTable, const muse_cpltable_def *aDef) |
Check whether the table contains the fields of the definition. More... | |
cpl_array * | muse_cpltable_extract_column (cpl_table *aTable, const char *aColumn) |
Create an array from a section of a column. More... | |
cpl_error_code | muse_cpltable_copy_array (cpl_table *aTable, const char *aColumn, const cpl_array *aArray) |
Copy an array into a table. More... | |
cpl_array * | muse_cpltable_get_array_copy (cpl_table *aTable, const char *aColumn, cpl_size aRow) |
Return the copy of an array of a table cell. More... | |
cpl_size | muse_cpltable_find_sorted (const cpl_table *aTable, const char *aColumn, double aValue) |
Find a row in a table. More... | |
cpl_array * | muse_cplarray_new_from_image (const cpl_image *aImage) |
Copy the image data into an array. More... | |
cpl_error_code | muse_cplarray_poly1d (cpl_array *aArray, const cpl_array *aCoeff) |
Apply a polynomial to an array. More... | |
double | muse_cplarray_poly1d_double (double aDouble, const cpl_array *aCoeff) |
Apply a polynomial to a double value. More... | |
cpl_error_code | muse_cplarray_dump_name (const cpl_array *aArray, const char *aName) |
Dump a numerical array to stdout with a name prefixed to each line. More... | |
cpl_error_code | muse_cplarray_erase_invalid (cpl_array *aArray) |
Erase all invalid values from an array. More... | |
cpl_size | muse_cplarray_erase_outliers (cpl_array *aArray, const cpl_bivector *aHistogram, cpl_size aGap, double aLimit) |
Erase outliers from an array using histogram information. More... | |
cpl_error_code | muse_cplarray_sort (cpl_array *aArray, cpl_boolean aOrder) |
Sort float, int or double array by quicksort. More... | |
cpl_bivector * | muse_cplarray_histogram (const cpl_array *aArray, double aWidth, double aMin, double aMax) |
Create a histogram for a numerical array. More... | |
cpl_size | muse_cplarray_find_sorted (const cpl_array *aArray, double aValue) |
Find a row in an array. More... | |
cpl_boolean | muse_cplarray_has_duplicate (const cpl_array *aArray) |
Check, if an array contains duplicate values. More... | |
cpl_array * | muse_cplarray_extract (cpl_array *aArray, cpl_size aStart, cpl_size aCount) |
Create an array from a section of another array. More... | |
cpl_error_code | muse_cplarray_add_window (cpl_array *aDest, cpl_size aStart, const cpl_array *aArray) |
Add the value of an array to a window of a table column. More... | |
cpl_array * | muse_cplarray_diff (const cpl_array *aArray, int aOffset) |
Build the difference of any element and one of the next elements. More... | |
cpl_error_code | muse_cplarray_erf (cpl_array *aArray) |
Compute the error function of array elements. More... | |
cpl_error_code | muse_cplarray_exp (cpl_array *aArray) |
Compute the exponential function of array elements. More... | |
cpl_array * | muse_cplarray_interpolate_linear (const cpl_array *aTargetAbscissa, const cpl_array *aSourceAbscissa, const cpl_array *aSourceOrdinate) |
Linear interpolation of a 1d array. More... | |
cpl_array * | muse_cplarray_interpolate_table_linear (const cpl_array *aTargetAbscissa, const cpl_table *aSrcTable, const char *aSrcAbscissa, const char *aSrcOrdinate) |
Linear interpolation of a 1d column. More... | |
cpl_array * | muse_cplarray_new_from_delimited_string (const char *aString, const char *aDelim) |
Convert a delimited string into an array of strings. More... | |
cpl_array * | muse_cplarray_string_to_double (const cpl_array *aArray) |
Convert a string array into an array of type double. More... | |
cpl_parameter * | muse_cplparamerterlist_find_prefix (cpl_parameterlist *aParameters, const char *aPrefix, const char *aName) |
Return the full recipe parameter belonging to prefix and shortname. More... | |
cpl_parameterlist * | muse_cplparameterlist_from_propertylist (const cpl_propertylist *aHeader, int aRecNum) |
Recreate a cpl_parameterlist from the RECi headers of an output MUSE product. More... | |
cpl_parameterlist * | muse_cplparameterlist_duplicate (const cpl_parameterlist *aPList) |
Duplicate a CPL parameter list. More... | |
cpl_error_code | muse_cplpropertylist_update_long_long (cpl_propertylist *aHeader, const char *aKeyword, cpl_size aValue) |
Update an integer-like property irrespective of the real type. More... | |
cpl_error_code | muse_cplframeset_erase_all (cpl_frameset *aFrames) |
Erase all frames in a frameset. More... | |
cpl_error_code | muse_cplframeset_erase_duplicate (cpl_frameset *aFrames) |
Erase all duplicate frames from a frameset. More... | |
void | muse_cplerrorstate_dump_some (unsigned aCurrent, unsigned aFirst, unsigned aLast) |
Dump some CPL errors. More... | |
muse_cplframework_type | muse_cplframework (void) |
Return the CPL framework the recipe is run under. More... | |
This group handles several utility functions that are convenient wrappers of CPL functions or functions that could extend CPL.
Currently there are functions that work on cpl_image, cpl_imagelist, cpl_vector, cpl_table, and cpl_array objects.
Type for the framework that called the recipe.
Definition at line 73 of file muse_cplwrappers.h.
cpl_error_code muse_cplarray_add_window | ( | cpl_array * | aDest, |
cpl_size | aStart, | ||
const cpl_array * | aArray | ||
) |
Add the value of an array to a window of a table column.
aDest | Pointer to destination array. |
aStart | First row to be added. |
aArray | Array to be added. |
CPL_ERROR_NONE | Everything went OK |
CPL_ERROR_NULL_INPUT | (aDest && aArray) not fulfilled |
The columns are summed element by element, and the result of the sum is stored in the target column. Only arrays of types CPL_TYPE_DOUBLE
, CPL_TYPE_FLOAT
, and CPL_TYPE_INT
are supported. The validity of cells is ignored here.
Definition at line 1766 of file muse_cplwrappers.c.
References muse_cplarray_extract().
Referenced by muse_lsf_params_spectrum(), and muse_sky_lines_spectrum().
cpl_array* muse_cplarray_diff | ( | const cpl_array * | aArray, |
int | aOffset | ||
) |
Build the difference of any element and one of the next elements.
aArray | Input array |
aOffset | number of rows to step ahead. |
set CPL_ERROR_NULL_INPUT, return NULL | (aArray) not fulfilled |
set CPL_ERROR_ILLEGAL_INPUT, return NULL | (aOffset > 0) not fulfilled |
Definition at line 1793 of file muse_cplwrappers.c.
cpl_error_code muse_cplarray_dump_name | ( | const cpl_array * | aArray, |
const char * | aName | ||
) |
Dump a numerical array to stdout with a name prefixed to each line.
aArray | Pointer to the array. |
aName | Name of the array. |
return CPL_ERROR_NULL_INPUT | one of the input arguments is NULL |
Definition at line 1296 of file muse_cplwrappers.c.
cpl_error_code muse_cplarray_erase_invalid | ( | cpl_array * | aArray | ) |
Erase all invalid values from an array.
aArray | Pointer to the array. |
CPL_ERROR_NULL_INPUT | (aArray != NULL) not fulfilled |
Definition at line 1315 of file muse_cplwrappers.c.
Referenced by muse_cplarray_erase_outliers(), muse_cplimage_get_percentile(), muse_find_stars(), muse_geo_compute_pinhole_local_distance(), and muse_geo_refine_horizontal().
cpl_size muse_cplarray_erase_outliers | ( | cpl_array * | aArray, |
const cpl_bivector * | aHistogram, | ||
cpl_size | aGap, | ||
double | aLimit | ||
) |
Erase outliers from an array using histogram information.
aArray | the input array |
aHistogram | histogram to use |
aGap | size of the gap in the histogram to separate outliers |
aLimit | the limit below which values count as gap |
return CPL_ERROR_NULL_INPUT, return -1 | aArray or aHistogram are NULL |
return CPL_ERROR_INVALID_TYPE, return -2 | aArray is not of numerical type (element zero cannot be read with cpl_array_get()) |
Definition at line 1359 of file muse_cplwrappers.c.
References muse_cplarray_erase_invalid().
Referenced by muse_geo_compute_pinhole_global_distance(), and muse_geo_refine_horizontal().
cpl_error_code muse_cplarray_erf | ( | cpl_array * | aArray | ) |
Compute the error function of array elements.
aArray | Pointer to array. |
CPL_ERROR_NONE | Everything went OK |
CPL_ERROR_NULL_INPUT | (aArray) not fulfilled |
CPL_ERROR_ILLEGAL_INPUT | (Supported data type) not fulfilled |
Each column element is replaced by its error function. This function only works with CPL_TYPE_DOUBLE
and CPL_TYPE_FLOAT
arrays. The validity of cells is ignored.
Definition at line 1826 of file muse_cplwrappers.c.
Referenced by muse_lsf_G().
cpl_error_code muse_cplarray_exp | ( | cpl_array * | aArray | ) |
Compute the exponential function of array elements.
aArray | Pointer to array. |
CPL_ERROR_NONE | Everything went OK |
CPL_ERROR_NULL_INPUT | (aArray) not fulfilled |
CPL_ERROR_ILLEGAL_INPUT | (Supported data type) not fulfilled |
Each column element is replaced by its exponential function. This function only works with CPL_TYPE_DOUBLE
and CPL_TYPE_FLOAT
arrays. The validity of cells is ignored.
Definition at line 1865 of file muse_cplwrappers.c.
Referenced by muse_lsf_G().
cpl_array* muse_cplarray_extract | ( | cpl_array * | aArray, |
cpl_size | aStart, | ||
cpl_size | aCount | ||
) |
Create an array from a section of another array.
aArray | Input array |
aStart | First element. |
aCount | Number of elements |
CPL_ERROR_NONE | Everything went OK |
This function is like cpl_array_extract and differs in that it uses the same data vector as the original one. So, changing values in the new array will also change these values in the original array. The new array should not be deleted, but unwrapped.
Definition at line 1729 of file muse_cplwrappers.c.
Referenced by muse_cplarray_add_window().
cpl_size muse_cplarray_find_sorted | ( | const cpl_array * | aArray, |
double | aValue | ||
) |
Find a row in an array.
aArray | Pointer to the array. |
aValue | Value to search. |
set CPL_ERROR_NULL_INPUT, return 0 | (aArray != NULL) not fulfilled |
set CPL_ERROR_ILLEGAL_INPUT, return 0 | (Supported data type) not fulfilled |
This function assumes that the array is sorted. It then searches the last index where the value value is smaller than the specified value. The validity is ignored here.
Definition at line 1613 of file muse_cplwrappers.c.
Referenced by muse_cplarray_interpolate_linear(), muse_cpltable_find_sorted(), muse_lsf_params_spectrum(), and muse_sky_lines_spectrum().
cpl_boolean muse_cplarray_has_duplicate | ( | const cpl_array * | aArray | ) |
Check, if an array contains duplicate values.
aArray | Pointer to the array. |
This is a very simple (and slow!) routine that just compares all values against all others, and stops when it detected a duplicate.
set CPL_ERROR_NULL_INPUT, return CPL_FALSE | NULL input array |
set CPL_ERROR_UNSUPPORTED_MODE, return CPL_FALSE | array is of non-integer type |
Definition at line 1674 of file muse_cplwrappers.c.
Referenced by muse_wcs_solve().
cpl_bivector* muse_cplarray_histogram | ( | const cpl_array * | aArray, |
double | aWidth, | ||
double | aMin, | ||
double | aMax | ||
) |
Create a histogram for a numerical array.
aArray | the input array |
aWidth | the bin width |
aMin | lower histogram limit, can be NAN |
aMax | upper histogram limit, can be NAN |
return CPL_ERROR_NULL_INPUT, return NULL | aArray is NULL |
return CPL_ERROR_INVALID_TYPE, return NULL | aArray is not of numerical type (element zero cannot be read with cpl_array_get()) |
return CPL_ERROR_ILLEGAL_INPUT, return NULL | aMin is not less than aMax |
Definition at line 1544 of file muse_cplwrappers.c.
Referenced by muse_geo_compute_pinhole_global_distance(), and muse_geo_refine_horizontal().
cpl_array* muse_cplarray_interpolate_linear | ( | const cpl_array * | aTargetAbscissa, |
const cpl_array * | aSourceAbscissa, | ||
const cpl_array * | aSourceOrdinate | ||
) |
Linear interpolation of a 1d array.
aTargetAbscissa | Target abscissa (x) array |
aSourceAbscissa | Source abscissa (x) array |
aSourceOrdinate | Source ordinate (y) array @return Target ordinate (y) array |
CPL_ERROR_NULL_INPUT | (aTargetAbscissa) not fulfilled |
CPL_ERROR_NULL_INPUT | (aSourceAbscissa) not fulfilled |
CPL_ERROR_NULL_INPUT | (aSourceOrdinate) not fulfilled |
CPL_ERROR_ILLEGAL_INPUT | (any data column is not double) not fulfilled |
The linear interpolation will be done from the values in the source table to the abscissa points in the target table.
The abscissa points of both source and target tables must be growing.
The abscissa points of the target must be in range of those of the source (i.e. extrapolation is not allowed).
The source table must be of at least length 2.
Definition at line 1914 of file muse_cplwrappers.c.
References muse_cplarray_find_sorted().
Referenced by muse_cplarray_interpolate_table_linear(), muse_lsf_apply(), muse_pixtable_spectrum_apply(), and muse_sky_continuum_create().
cpl_array* muse_cplarray_interpolate_table_linear | ( | const cpl_array * | aTargetAbscissa, |
const cpl_table * | aSrcTable, | ||
const char * | aSrcAbscissa, | ||
const char * | aSrcOrdinate | ||
) |
Linear interpolation of a 1d column.
aTargetAbscissa | Target abscissa (x) array |
aSrcTable | Source table |
aSrcAbscissa | Target abscissa (x) column |
aSrcOrdinate | Target ordinate (y) column @return Target ordinate (y) column |
The linear interpolation will be done from the values in the source table to the abscissa points in the target table.
The abscissa points of both source and target tables must be growing.
The abscissa points of the target must be in range of those of the source (i.e. extrapolation is not allowed).
The source table must be of at least length 2.
Definition at line 1983 of file muse_cplwrappers.c.
References muse_cplarray_interpolate_linear(), and muse_cpltable_extract_column().
Referenced by muse_pixtable_load_merge_channels().
cpl_array* muse_cplarray_new_from_delimited_string | ( | const char * | aString, |
const char * | aDelim | ||
) |
Convert a delimited string into an array of strings.
aString | the input string |
aDelim | the delimiting string |
This function acts a bit like strtok(), just that it finds all tokens in one go, and takes the aDelim as a single delimiter. It is hopefully threadsafe, unlike strtok(). Consecutive occurrences of aDelim are ignored, i.e. the output array does not contain empty strings.
return CPL_ERROR_NULL_INPUT, return NULL | aString or aDelim are NULL |
Definition at line 2014 of file muse_cplwrappers.c.
Referenced by muse_geo_refine_horizontal(), muse_postproc_check_save_param(), muse_postproc_cube_resample_and_collapse(), muse_resampling_params_delete(), and muse_resampling_params_set_pixfrac().
cpl_array* muse_cplarray_new_from_image | ( | const cpl_image * | aImage | ) |
Copy the image data into an array.
aImage | Source image |
The validity of values will be copied, too.
Definition at line 1196 of file muse_cplwrappers.c.
Referenced by muse_cplimage_get_percentile().
cpl_error_code muse_cplarray_poly1d | ( | cpl_array * | aArray, |
const cpl_array * | aCoeff | ||
) |
Apply a polynomial to an array.
aArray | Pointer to array |
aCoeff | Polynomial coefficients. First coefficient is lowest order (constant). |
CPL_ERROR_NONE | Everything went OK. |
If the length of the coefficient array is zero, all values of the value are are set to zero. No error is set in this case.
return CPL_ERROR_NULL_INPUT | one of the input arguments is NULL |
Definition at line 1231 of file muse_cplwrappers.c.
Referenced by muse_lsf_G().
double muse_cplarray_poly1d_double | ( | double | aDouble, |
const cpl_array * | aCoeff | ||
) |
Apply a polynomial to a double value.
aDouble | Argument. |
aCoeff | Polynomial coefficients. First coefficient is lowest order (constant). |
set CPL_ERROR_NULL_INPUT, return NAN | (aCoeff) not fulfilled |
If the length of the coefficient array is zero, 0.0 is returned. No error is set in this case.
Definition at line 1269 of file muse_cplwrappers.c.
Referenced by muse_lsf_params_apply().
cpl_error_code muse_cplarray_sort | ( | cpl_array * | aArray, |
cpl_boolean | aOrder | ||
) |
Sort float, int or double array by quicksort.
aArray | Pointer to the array. |
aOrder | Sort order of the array, ascending if true |
CPL_ERROR_NULL_INPUT | (aArray != NULL) not fulfilled |
CPL_ERROR_NULL_INPUT | (!cpl_array_has_invalid(aArray)) not fulfilled |
This function currently only works with arrays that have no invalid values.
Definition at line 1492 of file muse_cplwrappers.c.
Referenced by muse_cplimage_get_percentile().
cpl_array* muse_cplarray_string_to_double | ( | const cpl_array * | aArray | ) |
Convert a string array into an array of type double.
aArray | the input string array |
This function assumes that every element of the string array contains a number and does element-wise conversions using atof().
The returned array has to be deallocated using cpl_array_delete() after use.
return CPL_ERROR_NULL_INPUT, return NULL | aArray is NULL |
return CPL_ERROR_ILLEGAL_INPUT, return NULL | aArray is not of type CPL_TYPE_STRING |
Definition at line 2063 of file muse_cplwrappers.c.
void muse_cplerrorstate_dump_some | ( | unsigned | aCurrent, |
unsigned | aFirst, | ||
unsigned | aLast | ||
) |
Dump some CPL errors.
aCurrent | The number of the current error to be dumped |
aFirst | The number of the first error to be dumped |
aLast | The number of the last error to be dumped |
By default, the last 20 error messages are dumped. This can be changed by setting the environment variable MUSE_CPL_ERRORSTATE_NDUMP to a positive value.
Definition at line 2420 of file muse_cplwrappers.c.
Referenced by muse_postproc_process_exposure().
cpl_error_code muse_cplframeset_erase_all | ( | cpl_frameset * | aFrames | ) |
Erase all frames in a frameset.
aFrames | the frame set to clean out |
set and return CPL_ERROR_NULL_INPUT | aFrames is NULL |
propagate return code | cpl_frameset_erase_frame() fails |
Definition at line 2308 of file muse_cplwrappers.c.
cpl_error_code muse_cplframeset_erase_duplicate | ( | cpl_frameset * | aFrames | ) |
Erase all duplicate frames from a frameset.
aFrames | the frame set to clean up |
This function loops through all frames except the last one in the input frameset and compares this "reference" frame to all following frames. If it finds a frame for which all properties match, it uses the reference frame to erase one. (If it erased one frame in this way, it stays are the same position, because CPL always erases the first frame that it finds.)
set and return CPL_ERROR_NULL_INPUT | aFrames is NULL |
propagate return code | cpl_frameset_erase_frame() fails |
Definition at line 2339 of file muse_cplwrappers.c.
muse_cplframework_type muse_cplframework | ( | void | ) |
Return the CPL framework the recipe is run under.
MUSE_CPLFRAMEWORK_ESOREX | The recipe was called from EsoRex. |
MUSE_CPLFRAMEWORK_PYTHONCPL | The recipe was called from python-cpl, or another Python-based framework. |
MUSE_CPLFRAMEWORK_GASGANO | The recipe was called from Gasgano, or another Java-based framework. |
MUSE_CPLFRAMEWORK_UNKNOWN | The framework is unknown. |
This function currently works properly only under Linux. Under MacOSX, it will always return MUSE_CPLFRAMEWORK_UNKNOWN.
Definition at line 2467 of file muse_cplwrappers.c.
References MUSE_CPLFRAMEWORK_ESOREX, MUSE_CPLFRAMEWORK_GASGANO, MUSE_CPLFRAMEWORK_PYTHONCPL, and MUSE_CPLFRAMEWORK_UNKNOWN.
cpl_image* muse_cplimage_concat_x | ( | const cpl_image * | aImage1, |
const cpl_image * | aImage2 | ||
) |
Concatenate two images in x direction.
aImage1 | First image |
aImage2 | Second image |
set CPL_ERROR_NULL_INPUT, return NULL | (aImage1 || aImage2) not fulfilled |
set CPL_ERROR_ILLEGAL_INPUT, return NULL | (cpl_image_get_type(aImage1) == cpl_image_get_type(aImage2)) not fulfilled |
set CPL_ERROR_ILLEGAL_INPUT, return NULL | (cpl_image_get_size_y(aImage1) == cpl_image_get_size_y(aImage2)) not fulfilled |
If one of the pointers is NULL, just return a copy of the other image. If both input images are NULL, fail. The returned image has to be deallocated using cpl_image_delete().
Definition at line 159 of file muse_cplwrappers.c.
Referenced by muse_resampling_image().
cpl_image* muse_cplimage_concat_y | ( | const cpl_image * | aImage1, |
const cpl_image * | aImage2 | ||
) |
Concatenate two images in y direction.
aImage1 | First image |
aImage2 | Second image |
set CPL_ERROR_NULL_INPUT, return NULL | (aImage1 || aImage2) not fulfilled |
set CPL_ERROR_ILLEGAL_INPUT, return NULL | (cpl_image_get_type(aImage1) == cpl_image_get_type(aImage2)) not fulfilled |
set CPL_ERROR_ILLEGAL_INPUT, return NULL | (cpl_image_get_size_x(aImage1) == cpl_image_get_size_x(aImage2)) not fulfilled |
If one of the pointers is NULL, just return a copy of the other image. If both input images are NULL, fail. The returned image has to be deallocated using cpl_image_delete().
Definition at line 115 of file muse_cplwrappers.c.
cpl_image* muse_cplimage_filter_median_subtract | ( | cpl_image * | aImage, |
unsigned int | aNX, | ||
unsigned int | aNY | ||
) |
Subtract a median-filtered version of the input image from itself.
aImage | Image to be filtered and subtracted from |
aNX | Median filter width, has to be odd |
aNY | Median filter height, has to be odd |
set CPL_ERROR_NULL_INPUT, return NULL | input image is NULL |
set CPL_ERROR_ILLEGAL_INPUT, return NULL | aNX or aNY are even |
Definition at line 203 of file muse_cplwrappers.c.
double muse_cplimage_get_percentile | ( | const cpl_image * | aImage, |
double | aFraction | ||
) |
Get the percentile of an image.
aImage | input image |
aFraction | Fraction of the total number of pixels |
set CPL_ERROR_NULL_INPUT, return 0.0 | (aImage != NULL) not fulfilled |
Definition at line 347 of file muse_cplwrappers.c.
References muse_cplarray_erase_invalid(), muse_cplarray_new_from_image(), and muse_cplarray_sort().
Referenced by muse_sky_create_skymask().
cpl_error_code muse_cplimage_or | ( | cpl_image * | aTarget, |
const cpl_image * | aImage, | ||
unsigned int | mask | ||
) |
Provide an 'OR' operation of two integer images.
aTarget | the first operand that will be the target image |
aImage | the image that shall be appplied to the first |
mask | additional mask to apply to each pixel. |
return CPL_ERROR_NULL_INPUT | NULL input target or image |
return CPL_ERROR_TYPE_MISMATCH | the passed image type is not CPL_TYPE_INT |
return CPL_ERROR_ILLEGAL_INPUT | the input images have different sizes |
Definition at line 77 of file muse_cplwrappers.c.
Referenced by muse_cplimagelist_collapse_or_create().
cpl_vector* muse_cplimage_slope_window | ( | const cpl_image * | aImage, |
const cpl_size * | aWindow | ||
) |
Compute slopes of an image, both horizontally and vertically.
aImage | Image to be investigated |
aWindow | Image window to use (integer array with 4 elements: xmin, xmax, ymin, ymax, see muse_quadrants_get_window()) |
Collapse the given image window along rows and columns, then fit a 1st-order polynomial to the values of both images to derive the slope in both directions.
set CPL_ERROR_NULL_INPUT, return NULL | aImage or aWindow are NULL |
propagate error from cpl_image_collapse_window_create(), return NULL | positions given through aWindow are outside image |
propagate error from cpl_polynomial_fit(), return NULL | polynomial fit fails |
Definition at line 258 of file muse_cplwrappers.c.
cpl_image* muse_cplimagelist_collapse_or_create | ( | const cpl_imagelist * | imlist | ) |
Compute the OR of an image list to a single image.
imlist | the input images list |
The returned image has to be deallocated with cpl_image_delete(). The input image list must be of type CPL_TYPE_INT.
set CPL_ERROR_NULL_INPUT | any input pointer is NULL |
set CPL_ERROR_ILLEGAL_INPUT | the input images have different sizes |
set CPL_ERROR_INVALID_TYPE | an image type is not CPL_TYPE_INT |
Definition at line 379 of file muse_cplwrappers.c.
References muse_cplimage_or().
cpl_mask* muse_cplmask_adapt_to_image | ( | const cpl_mask * | aMask, |
const cpl_image * | aImage | ||
) |
Adapt mask with masked region in one quadrant to size of an image.
aMask | mask to adapt |
aImage | reference imgae |
If the input mask has a quadrant with many masked pixels (like a masked corner), this quadrant is extracted and copied into a new mask, so that its outer corner again comes to lie in the new corner.
set CPL_ERROR_NULL_INPUT, return NULL | aMask and/or aImage are NULL |
set CPL_ERROR_DATA_NOT_FOUND, return NULL | aMask does not contain a quadrant with masked pixels |
propagate CPL error, return NULL | relevant quadrant could not be copied into output mask of aImage-size |
Definition at line 416 of file muse_cplwrappers.c.
cpl_matrix* muse_cplmatrix_extract_selected | ( | const cpl_matrix * | aMatrix, |
const cpl_array * | aIndices | ||
) |
Extract the elements given by the index array.
aMatrix | A matrix object. |
aIndices | Array containing the matrix element offsets to extract. |
NULL
in case of an error.Creates a row vector (1xN matrix object) filled with the elements of the matrix aMatrix which are listed in the index array aIndices. The selected indices given by aIndices are offset indices, i.e. are obtained from the matrix row and column indices using the relation row index times number of columns plus column index.
The returned array has to be deallocated using cpl_array_delete().
set CPL_ERROR_NULL_INPUT, return NULL | a parameter is NULL |
set CPL_ERROR_INVALID_TYPE, return NULL | aIndices type is not CPL_TYPE_SIZE |
Definition at line 615 of file muse_cplwrappers.c.
Referenced by muse_find_stars().
cpl_matrix* muse_cplmatrix_multiply_create | ( | const cpl_matrix * | aMatrix1, |
const cpl_matrix * | aMatrix2 | ||
) |
Compute the element-wise product of two matrices.
aMatrix1 | First matrix object. |
aMatrix2 | Second matrix object. |
NULL
is returned.The function multiplies the matrices aMatrix1 and aMatrix2 element by element. The input matrices must have the same dimensions. The result is returned in a new matrix object.
The returned matrix has to be deallocated using cpl_matrix_delete().
set CPL_ERROR_NULL_INPUT, return NULL | a parameter is NULL |
set CPL_ERROR_INCOMPATIBLE_INPUT, return NULL | input matrices have different sizes |
Definition at line 530 of file muse_cplwrappers.c.
Referenced by muse_find_stars().
cpl_array* muse_cplmatrix_where | ( | const cpl_matrix * | aMatrix, |
double | aValue, | ||
muse_cplmatrix_element_compare_func | aCondition | ||
) |
Select matrix elements according to a condition.
aMatrix | A matrix object. |
aValue | The value to compare with the matrix elements. |
aCondition | The condition function to use for comparing matrix elements with the reference value |
NULL
is returned.Using the compare function aCondition all matrix elements are compared to the given value aValue. The position of the selected matrix element is stored in the returned index array. The returned position gives the offset from the start of the matrix data buffer.
Definition at line 563 of file muse_cplwrappers.c.
Referenced by muse_find_stars().
cpl_parameter* muse_cplparamerterlist_find_prefix | ( | cpl_parameterlist * | aParameters, |
const char * | aPrefix, | ||
const char * | aName | ||
) |
Return the full recipe parameter belonging to prefix and shortname.
aParameters | the list of parameters |
aPrefix | the prefix of the recipe |
aName | name of this parameter |
This function just concatenates aPrefix and aName with a dot in between and then searches for a parameter with this full name.
All error checking is already done inside cpl_parameterlist_find() which this function wraps.
Definition at line 2097 of file muse_cplwrappers.c.
Referenced by muse_basicproc_params_new(), and muse_combinepar_new().
cpl_parameterlist* muse_cplparameterlist_duplicate | ( | const cpl_parameterlist * | aPList | ) |
Duplicate a CPL parameter list.
aPList | the parameter list to duplicate |
set CPL_ERROR_NULL_INPUT, return NULL | aPList is NULL |
Definition at line 2242 of file muse_cplwrappers.c.
Referenced by muse_processing_new().
cpl_parameterlist* muse_cplparameterlist_from_propertylist | ( | const cpl_propertylist * | aHeader, |
int | aRecNum | ||
) |
Recreate a cpl_parameterlist from the RECi headers of an output MUSE product.
aHeader | the input FITS header |
aRecNum | the number of the ESO.PRO.REC header, i.e. 1 for REC1 |
This takes ESO.PRO.RECi.ID and ESO.PRO.RECi.PIPE.ID to construct a context for parameters, and then loops through all ESO.PRO.RECi.PARAMj.{NAME,VALUE} keywords. It takes the content of the NAME keyword to set the parameter name, and then tries to determine the type of keyword from the contents of the string in VALUE and creates an entry in the parameterlist for each such entry.
set CPL_ERROR_NULL_INPUT, return NULL | aHeader is NULL |
set CPL_ERROR_ILLEGAL_INPUT, return NULL | aRecNum is not positive |
set CPL_ERROR_ILLEGAL_INPUT, return NULL | no recipe name was found using ESO.PRO.RECi.ID |
set CPL_ERROR_INCOMPATIBLE_INPUT, return NULL | no muse pipeline ID was found using ESO.PRO.RECi.PIPE.ID |
Definition at line 2133 of file muse_cplwrappers.c.
Referenced by muse_basicproc_params_new_from_propertylist().
cpl_error_code muse_cplpropertylist_update_long_long | ( | cpl_propertylist * | aHeader, |
const char * | aKeyword, | ||
cpl_size | aValue | ||
) |
Update an integer-like property irrespective of the real type.
aHeader | the property list |
aKeyword | the keyword to update |
aValue | the value to set |
Since cpl_propertylist_update_long_long() still fails if the type of the property in the list is CPL_TYPE_INT or CPL_TYPE_LONG instead of CPL_TYPE_LONG_LONG, this function makes it easier to update properties that can be any of those three. The user should take care that the value cannot overflow the actual variable type.
set and return CPL_ERROR_NULL_INPUT | aHeader and/or aKeyword are NULL |
set and return CPL_ERROR_DATA_NOT_FOUND | no property named aKeyword was found |
Definition at line 2275 of file muse_cplwrappers.c.
Referenced by muse_pixtable_fix_exp_headers().
cpl_error_code muse_cpltable_append_file | ( | const cpl_table * | aTable, |
const char * | aFile, | ||
const char * | aExtension, | ||
const muse_cpltable_def | aDefinition[] | ||
) |
Save a table to disk (into a FITS extension)
aTable | Table to save. |
aFile | File name |
aExtension | Extension name |
aDefinition | Optional table definition. If not NULL, table will be checked against this definition before saving. |
CPL_ERROR_NONE | Success |
CPL_ERROR_NULL_INPUT | (aTable != NULL) not fulfilled |
CPL_ERROR_NULL_INPUT | (aFile != NULL) not fulfilled |
CPL_ERROR_NULL_INPUT | (aExtension != NULL) not fulfilled |
This function saves the table as an extension. It requires that the file already exists with at least the main header.
Definition at line 989 of file muse_cplwrappers.c.
References muse_cpltable_check().
Referenced by muse_lsf_params_save(), muse_sky_lines_save(), and muse_sky_save_continuum().
cpl_error_code muse_cpltable_check | ( | const cpl_table * | aTable, |
const muse_cpltable_def * | aDef | ||
) |
Check whether the table contains the fields of the definition.
aTable | CPL table to check. |
aDef | Column definitions. |
Definition at line 1021 of file muse_cplwrappers.c.
References muse_cpltable_def::name, muse_cpltable_def::required, and muse_cpltable_def::type.
Referenced by muse_cpltable_append_file(), muse_cpltable_load(), muse_geo_compute_pinhole_local_distance(), muse_geo_determine_horizontal(), muse_geo_determine_initial(), muse_geo_determine_vertical(), muse_geo_refine_horizontal(), muse_phys_air_to_vacuum(), muse_pixtable_compute_limits(), muse_pixtable_load_window(), muse_resampling_spectrum(), muse_resampling_spectrum_iterate(), muse_sky_subtract_continuum(), muse_sky_subtract_lines(), muse_trace_plot_samples(), muse_trace_plot_widths(), muse_wave_lines_check(), muse_wave_plot_column(), muse_wave_plot_residuals(), muse_wcs_optimize_solution(), and muse_wcs_solve().
cpl_error_code muse_cpltable_copy_array | ( | cpl_table * | aTable, |
const char * | aColumn, | ||
const cpl_array * | aArray | ||
) |
Copy an array into a table.
aTable | Pointer to table. |
aColumn | Name of table column to be accessed. |
aArray | Array to be copied |
CPL_ERROR_NONE | Everything went OK. |
return CPL_ERROR_NULL_INPUT | one of the input arguments is NULL |
Definition at line 1111 of file muse_cplwrappers.c.
Referenced by muse_pixtable_load_merge_channels().
cpl_array* muse_cpltable_extract_column | ( | cpl_table * | aTable, |
const char * | aColumn | ||
) |
Create an array from a section of a column.
aTable | Input table |
aColumn | Input column name |
set CPL_ERROR_NULL_INPUT, return NULL | (aTable) not fulfilled |
set CPL_ERROR_NULL_INPUT, return NULL | (aColumn) not fulfilled |
set CPL_ERROR_ILLEGAL_INPUT, return NULL | (Supported data type) not fulfilled |
The newly created array shares its data pointer with the original table, and should be deleted with cpl_array_unwrap(). If you need an independent array, duplicate it with cpl_array_duplicate().
Only column of type CPL_TYPE_DOUBLE
, CPL_TYPE_FLOAT
, and CPL_TYPE_INT
are supported. The validity of cells is ignored here.
Definition at line 1073 of file muse_cplwrappers.c.
Referenced by muse_cplarray_interpolate_table_linear(), muse_cpltable_find_sorted(), muse_lsf_params_fit(), muse_pixtable_spectrum_apply(), muse_postproc_process_exposure(), muse_postproc_revert_ffspec_maybe(), muse_sky_continuum_create(), muse_sky_lines_fit(), muse_sky_lines_fit_old(), muse_sky_lines_spectrum(), muse_sky_subtract_continuum(), and muse_sky_subtract_lines_old().
cpl_size muse_cpltable_find_sorted | ( | const cpl_table * | aTable, |
const char * | aColumn, | ||
double | aValue | ||
) |
Find a row in a table.
aTable | Pointer to the table. |
aColumn | Name of table column to be accessed. |
aValue | Value to search. |
set CPL_ERROR_NULL_INPUT, return 0 | (aTable != NULL) not fulfilled |
set CPL_ERROR_ILLEGAL_INPUT, return 0 | (Supported data type) not fulfilled |
This function assumes that the array is sorted. It then searches the last index where the value value is smaller than the specified value. The validity is ignored here.
Definition at line 1177 of file muse_cplwrappers.c.
References muse_cplarray_find_sorted(), and muse_cpltable_extract_column().
Referenced by muse_lsf_fit_slice(), muse_resampling_spectrum_iterate(), and select_arc_line().
cpl_array* muse_cpltable_get_array_copy | ( | cpl_table * | aTable, |
const char * | aColumn, | ||
cpl_size | aRow | ||
) |
Return the copy of an array of a table cell.
aTable | Pointer to table. |
aColumn | Name of table column to be accessed. |
aRow | Position of element to be read. |
set CPL_ERROR_NULL_INPUT, return NULL | (aTable && aColumn) not fulfilled |
Definition at line 1141 of file muse_cplwrappers.c.
Referenced by muse_lsf_params_load().
cpl_table* muse_cpltable_load | ( | const char * | aFile, |
const char * | aExtension, | ||
const muse_cpltable_def | aDefinition[] | ||
) |
Load a table from disk (and check against definition).
aFile | file name |
aExtension | extension name |
aDefinition | optional table definition; if not NULL, the loaded table will be checked against it |
propagate error code from cpl_fits_find_extension(), return NULL | extension with given name is not found |
Definition at line 951 of file muse_cplwrappers.c.
References muse_cpltable_check().
Referenced by muse_basicproc_params_delete(), muse_lsf_params_load(), muse_sky_continuum_load(), and muse_sky_lines_load().
cpl_table* muse_cpltable_new | ( | const muse_cpltable_def * | aDef, |
cpl_size | aLength | ||
) |
Create an empty table according to the specified definition.
aDef | Column definitions. |
aLength | Length of the table. |
This sets the depth of array columns (signified by CPL_TYPE_POINTER) to 2. If any other depth is required, use cpl_table_set_column_depth()
to set it after this call.
Definition at line 906 of file muse_cplwrappers.c.
References muse_cpltable_def::format, muse_cpltable_def::name, muse_cpltable_def::type, and muse_cpltable_def::unit.
Referenced by muse_flux_get_response_table(), muse_flux_get_telluric_table(), muse_geo_measure_spots(), muse_geo_table_new(), muse_lsf_create_arcpixtable(), muse_pixtable_create(), muse_quality_convert_dq(), muse_resampling_euro3d(), muse_resampling_params_delete(), muse_resampling_spectrum(), muse_sky_continuum_create(), muse_sky_lines_cut(), muse_sky_spectrum_from_cube(), muse_table_load_filter(), muse_trace(), muse_wave_calib(), muse_wave_calib_lampwise(), muse_wave_line_handle_multiplet(), muse_wave_line_handle_singlet(), muse_wave_lines_search(), muse_wave_poly_fit(), and muse_wcs_centroid_stars().
cpl_size muse_cplvector_count_unique | ( | const cpl_vector * | aVector | ) |
Count the number of unique entries in a given vector.
aVector | Input CPL vector. |
set CPL_ERROR_NULL_INPUT, return -1 | aVector is NULL |
Definition at line 847 of file muse_cplwrappers.c.
Referenced by muse_wave_calib(), and muse_wave_calib_lampwise().
cpl_error_code muse_cplvector_erase_element | ( | cpl_vector * | aVector, |
int | aElement | ||
) |
delete the given element from the input vector
aVector | Input cpl_vector |
aElement | Position of the element to remove |
This function is similar to cpl_matrix_erase_columns() but for CPL vectors. A portion of the vector data is physically removed. The pointer to the vector data may change, therefore pointers previously retrieved by calling cpl_vector_get_data() should be discarded.
Definition at line 819 of file muse_cplwrappers.c.
Referenced by muse_trace_iterate_fit(), muse_utils_iterate_fit_polynomial(), muse_wave_lines_get(), and muse_wave_poly_fit().
double muse_cplvector_get_adev_const | ( | const cpl_vector * | aVector, |
double | aCenter | ||
) |
Compute the average absolute deviation of a (constant) vector.
aVector | vector of values |
aCenter | pre-computed central value of the vector (e.g. the median) |
set CPL_ERROR_NULL_INPUT, return 0. | aVector is NULL |
Definition at line 651 of file muse_cplwrappers.c.
Referenced by muse_geo_determine_horizontal_wmean(), muse_quality_bad_columns(), muse_trace_edgefinder(), muse_trace_iterate_fit(), and muse_trace_locate_slices().
double muse_cplvector_get_median_dev | ( | cpl_vector * | aVector, |
double * | aMedian | ||
) |
Compute the median and average absolute deviation against the median of a vector.
aVector | vector of values |
aMedian | the computed median (optional, can be NULL) |
set CPL_ERROR_NULL_INPUT, return 0. | aVector is NULL |
Definition at line 677 of file muse_cplwrappers.c.
Referenced by muse_combine_sigclip_create().
double muse_cplvector_get_semiquartile | ( | cpl_vector * | aVector | ) |
compute the semi-quartile range of a vector of elements
aVector | Input cpl_vector |
The semiquartile range is a measure similar to standard deviation but it employs the median and rejects outliers so that it is more robust in the case of a few outliers.
Algorithm: determine median, then the medians of the parts of the sorted vector above and below the median value, subtract them, and divide by two
Definition at line 708 of file muse_cplwrappers.c.
cpl_vector* muse_cplvector_get_unique | ( | const cpl_vector * | aVector | ) |
Separate out all unique entries in a given vector into a new one.
aVector | Input CPL vector. |
set CPL_ERROR_NULL_INPUT, return -1 | aVector is NULL |
Definition at line 874 of file muse_cplwrappers.c.
Referenced by muse_geo_compute_pinhole_local_distance(), muse_geo_determine_initial(), and muse_geo_refine_horizontal().
cpl_error_code muse_cplvector_threshold | ( | cpl_vector * | aVec, |
double | aLoCut, | ||
double | aHiCut, | ||
double | aLoVal, | ||
double | aHiVal | ||
) |
Threshold a vector to a given interval.
aVec | Vector to threshold. |
aLoCut | Lower bound. |
aHiCut | Higher bound. |
aLoVal | Value to assign to pixels below low bound. |
aHiVal | Value to assign to pixels above high bound. |
Elements outside of the provided interval are assigned the given values.
Use DBL_MIN and DBL_MAX for the aLoCut and aHiCut to avoid any element replacement.
aLoCut must be smaller than or equal to aHiCut.
return CPL_ERROR_NULL_INPUT | NULL input vector |
return CPL_ERROR_ILLEGAL_INPUT | aLoCut is higher than aHiCut |
Definition at line 786 of file muse_cplwrappers.c.