28#ifndef ERIS_IFU_UTILS_H
29#define ERIS_IFU_UTILS_H
41#include "eris_ifu_constants.h"
42#include "eris_ifu_vector.h"
43#include "eris_ifu_dfs.h"
45#define MAX_STR_SIZE 512
46#define FILE_NAME_SZ 256
61enum idl_rel_ops {eq, ne, ge, gt, le, lt};
67 const cpl_vector *indices);
100 const char* filename,
int create,
101 const cpl_propertylist *pl);
103 const char* filename,
int create);
105 const char* filename,
int col,
int create);
107 const char* filename,
int create,
const cpl_propertylist *pl);
109 const char* filename,
int create);
111 const char* filename,
int create,
const cpl_propertylist *pl);
113 const char* filename,
int create);
115 const char* name,
int singlefile,
116 const cpl_propertylist *pl);
120 const char* filename,
int singlefile,
121 const cpl_propertylist *pl);
123 const char* filename,
int singlefile);
126 const cpl_propertylist *plist,
127 const cpl_parameterlist *parlist,
130 const char *filename,
132 const cpl_image *img);
136 const cpl_propertylist *plist,
137 const cpl_parameterlist *parlist,
140 const char *filename,
142 const cpl_imagelist *imglist);
145 const cpl_mask *mask);
160 const char *category,
166 int exposureCorrectionMode);
172 const cpl_parameterlist *p2);
174cpl_error_code eris_ifu_file_exists(
const char *filename);
189cpl_image* eris_ifu_image_create_window(
const cpl_image* img);
194cpl_error_code eris_ifu_strehl_flag_nans(hdrl_image** hima);
198 deqQualityType qualityType);
204 cpl_imagelist *dataCube,
205 cpl_imagelist *errorCube);
208 cpl_imagelist *dataCube,
209 cpl_imagelist *errorCube,
210 cpl_imagelist *qualCube);
235 const char* key_name,
237 const char* key_help);
250cpl_propertylist* eris_qc_init(
void);
253eris_qc_add_int(cpl_propertylist* table,
261eris_qc_add_bool(cpl_propertylist* table,
269eris_qc_add_float(cpl_propertylist* table,
277eris_qc_add_double(cpl_propertylist* table,
285eris_qc_add_string(cpl_propertylist* table,
297 cpl_propertylist* qc_list,
302 cpl_propertylist* qc_list,
306 const char* context);
309eris_gaussian_maxpos(
const cpl_image * self,
330 hdrl_imagelist** iml,
332 cpl_propertylist* header);
void eris_ifu_free_frameset(cpl_frameset **item)
free memory and set pointer to null
cpl_error_code eris_ifu_save_table_dbg(const cpl_table *tbl, const char *filename, int create)
eris_ifu_save_table_dbg
cpl_error_code eris_ifu_save_cpl_image_dbg(const cpl_image *img, const char *name, int singlefile, const cpl_propertylist *pl)
save CPL image for debug purposes
cpl_error_code eris_ifu_save_imagelist(cpl_frameset *fs, cpl_frame *inherit, const cpl_propertylist *plist, const cpl_parameterlist *parlist, const char *recipe, const char *procatg, const char *filename, cpl_type type, const cpl_imagelist *imglist)
save imagelist
cpl_error_code eris_ifu_save_imagelist_dbg(const cpl_imagelist *imglist, const char *filename, int create)
save CPL imagelist for debug purposes
void eris_ifu_free_propertylist(cpl_propertylist **item)
free memory and set pointer to null
cpl_vector * eris_ifu_idl_values_at_indices(const cpl_vector *data, const cpl_vector *indices)
Returns a vector of given indices.
void eris_ifu_free_apertures(cpl_apertures **item)
free memory and set pointer to null
void eris_ifu_free_string(char **item)
free memory and set pointer to null
char * eris_ifu_get_lampString(int lampStatus)
eris_ifu_get_lampString
cpl_error_code eris_ifu_parameterlist_append_list(cpl_parameterlist *p1, const cpl_parameterlist *p2)
Append a parameterlist to another one.
void eris_ifu_free_double_array(double **item)
free memory and set pointer to null
cpl_table * eris_qclog_init(void)
Initialize QC table.
void eris_ifu_free_vector(cpl_vector **item)
free memory and set pointer to null
cpl_error_code eris_ifu_save_vector_dbg(const cpl_vector *vec, const char *filename, int create, const cpl_propertylist *pl)
save vector
cpl_error_code eris_ifu_save_image_dbg(const cpl_image *img, const char *filename, int create, const cpl_propertylist *pl)
eris_ifu_save_image_dbg
void eris_ifu_free_table(cpl_table **item)
free memory and set pointer to null
cpl_error_code eris_ifu_save_ifu_vector_dbg(const eris_ifu_vector *vec, const char *filename, int create)
save vector
cpl_error_code eris_ifu_cut_endings(cpl_vector **vec, int *begin, int *end, int cut)
Cut leading and trailing -1 of a vector.
cpl_error_code eris_ifu_mask_nans_in_hdrlimage(hdrl_image **hima)
Flag NANs in image.
const char * eris_ifu_get_bandString(ifsBand band)
eris_ifu_get_bandString
void eris_ifu_free_ifu_vector(eris_ifu_vector **item)
free memory and set pointer to null
cpl_error_code eris_ifu_split_hdrl_imagelist(hdrl_imagelist *cube, cpl_imagelist *dataCube, cpl_imagelist *errorCube)
extract from hdrl_imagelist the data and error information
cpl_error_code eris_get_pupil_shift(hdrl_imagelist *iml, const int n, cpl_table **qclog_tbl)
Get what object shift.
cpl_mask * eris_ifu_load_badpixel_mask(const cpl_frameset *frameset, const char *category, int ext)
**
cpl_error_code eris_ifu_hdrl_image_reject_mask(hdrl_image *img, const cpl_mask *mask)
'Add' the mask to the image
cpl_error_code eris_ifu_get_plane_cut_min_max(ifsBand band, cpl_size *zmin, cpl_size *zmax)
eris_ifu_get_plane_cut_min_max
const char * eris_ifu_get_instrumentString(ifsInstrument instrument)
eris_ifu_get_instrumentString
cpl_error_code eris_pfits_put_qc(cpl_propertylist *plist, cpl_table *qclog)
convert table with QC parameter information to a propertylist
cpl_error_code eris_ifu_get_badpix_qc_from_ima(const cpl_image *image, cpl_propertylist *qc_list, const char *prefix)
compute QC keyword with number of bad pixels and fraction to total
void eris_ifu_free_polynomial(cpl_polynomial **item)
free memory and set pointer to null
hdrl_imagelist * eris_ifu_get_hdrlimagelist_by_tag(cpl_frameset *frameset, const char *tag, int exposureCorrectionMode)
Return HDRL imagelist by searching tagged frames in frameset.
void eris_ifu_free_parameter(cpl_parameter **item)
free memory and set pointer to null
cpl_propertylist * eris_compute_psf_qc(hdrl_image *hima, const cpl_parameterlist *parlist, const char *context)
compute QC parameters on a PSF STD image
cpl_error_code eris_ifu_save_bivector_dbg(const cpl_bivector *bivec, const char *filename, int col, int create)
save bivector as a vector (col=1 or col=2) or as a table
cpl_imagelist * eris_ifu_hdrl_get_imagelist(const hdrl_imagelist *hdrl_imglist, enum hdrl_t type)
Extract from a HDRL-imglist a specific CPL-imglist.
cpl_mask * eris_ifu_hima_get_obj_mask_percent(hdrl_image *hima, const double percent)
find mask flagging pixels above percent(%) pixels with lower intensity
cpl_mask * eris_ifu_mask_create_border(const cpl_mask *mask)
eris_ifu_mask_create_border
cpl_error_code eris_qclog_add_double_f(cpl_table *table, const char *key_name, const double value, const char *key_help)
add QC float info to table
void eris_ifu_free_int_array(int **item)
free memory and set pointer to null
cpl_error_code eris_qclog_add_string(cpl_table *table, const char *name, const char *value, const char *help)
add QC string info to table
cpl_error_code eris_qclog_add_double(cpl_table *table, const char *name, const double value, const char *help)
add QC double info to table
cpl_error_code eris_ifu_save_mask_dbg(const cpl_mask *mask, const char *filename, int create, const cpl_propertylist *pl)
eris_ifu_save_mask_dbg
void eris_ifu_free_imagelist(cpl_imagelist **item)
free memory and set pointer to null
cpl_vector * eris_ifu_idl_where(const cpl_vector *data, double val, int op)
Implements the where-function knownm from IDL.
cpl_mask * eris_ifu_quality2bp_mask(const cpl_image *qualityMask, deqQualityType qualityType)
transform input image (quality mask) to output mask with given bit code
cpl_error_code eris_ifu_cube_set_values(hdrl_imagelist **iml)
remove planes from input iml and bpm in the range [0, zmin), (zmax,sz]
void eris_ifu_free_frame(cpl_frame **item)
free memory and set pointer to null
cpl_error_code eris_qclog_add_bool(cpl_table *table, const char *name, const char *help)
add QC boolean info to table
cpl_error_code eris_ifu_mask_nans_in_cube(cpl_imagelist *cube)
mask NANs in input data cube
void eris_ifu_free_hdrl_imagelist(hdrl_imagelist **item)
free memory and set pointer to null
cpl_error_code eris_qclog_add_int(cpl_table *table, const char *name, const int value, const char *help)
add QC int info to table
cpl_error_code eris_ifu_save_hdrl_imagelist_dbg(const hdrl_imagelist *imgList, const char *filename, int singlefile)
eris_ifu_save_hdrl_imagelist_dbg
cpl_error_code eris_ifu_save_cpl_imagelist_dbg(const cpl_imagelist *imglist, const char *name)
save CPL imagelist for debugging purposes
cpl_error_code eris_ifu_save_hdrl_image_dbg(const hdrl_image *hdrl_img, const char *filename, int singlefile, const cpl_propertylist *pl)
save HDRL imagelist for debugging purposes
cpl_mask * eris_ifu_mask_from_image(const cpl_image *img_mask)
eris_ifu_mask_from_image
void eris_ifu_free_float_array(float **item)
free memory and set pointer to null
void eris_ifu_free_hdrl_image(hdrl_image **item)
free memory and set pointer to null
cpl_error_code eris_ifu_cube_trim_nans(const cpl_size zmin, const cpl_size zmax, hdrl_imagelist **iml, cpl_imagelist **bpm, cpl_propertylist *header)
remove planes from input iml and bpm in the range [0, zmin), (zmax,sz]
cpl_imagelist * eris_ifu_interpolatedMask_to_maskZero(cpl_imagelist *bpmCube, double threshold)
return cube flagging (as 1) pixels above a given threshold
cpl_error_code eris_ifu_get_badpix_qc_from_mask(const cpl_mask *bp_mask, cpl_propertylist *qc_list, const char *prefix)
compute QC keyword with number of bad pixels and fraction to total
void eris_ifu_free_image(cpl_image **item)
free memory and set pointer to null
cpl_error_code eris_qclog_add_double_format(cpl_table *table, const char *name, const double value, const char *help)
add QC double (with format) info to table
void eris_ifu_free_matrix(cpl_matrix **item)
free memory and set pointer to null
void eris_ifu_free_mask(cpl_mask **item)
free memory and set pointer to null
cpl_frameset * eris_ifu_get_frameset_by_tag(const cpl_frameset *frameset, const char *tag)
Get frames with given tag from frameset.
const char * eris_ifu_get_preopticsScaleString(ifsPreopticsScale scale)
eris_ifu_get_preopticsScaleString
void eris_ifu_free_parameterlist(cpl_parameterlist **item)
free memory and set pointer to null
cpl_error_code eris_ifu_split3_hdrl_imagelist(hdrl_imagelist *cube, cpl_imagelist *dataCube, cpl_imagelist *errorCube, cpl_imagelist *qualCube)
extract from hdrl_imagelist the data and error information
cpl_error_code eris_ifu_save_image(cpl_frameset *fs, const cpl_propertylist *plist, const cpl_parameterlist *parlist, const char *recipe, const char *procatg, const char *filename, cpl_type type, const cpl_image *img)
save image
double eris_ifu_get_band_resolution(ifsBand band)
eris_ifu_get_band_resolution
void eris_ifu_free_bivector(cpl_bivector **item)
free memory and set pointer to null
void eris_ifu_free_hdrl_parameter(hdrl_parameter **item)
free memory and set pointer to null
cpl_mask * eris_ifu_hima_get_obj_mask(hdrl_image *hima, const cpl_size niter, const double kappa)
find mask flagging pixels above a threshold set by ks-clip algorithm