HAWKI Pipeline Reference Manual 1.8.12
Functions
Miscellaneous Utilities

Functions

int hawki_apply_harmonization (cpl_imagelist *in, double h1, double h2, double h3, double h4)
 Apply the harmonization.
cpl_image * hawki_compute_darkbpm (const cpl_image *in, double sigma)
 Compute the bpm from the dark (hot pixels)
cpl_image * hawki_compute_flatbpm (const cpl_image *in, double sigma, double lowval, double highval)
 Compute the bpm from the flat (aka cold pixels mask)
int hawki_compute_harmonization (const cpl_imagelist *in, double *h1, double *h2, double *h3, double *h4, double *h)
 Compute the harmonization.
cpl_image * hawki_compute_lsbg (const cpl_image *in)
 Compute the large scale background.
int * hawki_detectors_labelise (const cpl_frameset *in)
 Get the frames in which the star is for a given chip.
int hawki_detectors_locate_star (const cpl_frameset *in, double star_ra, double star_dec, int *labels)
 Get the frames in which the star is for a given chip.
const char * hawki_extract_first_filename (const cpl_frameset *in, const char *tag)
 Extract the filename ffor the first frame of the given tag.
cpl_error_code hawki_frameset_append (cpl_frameset *self, const cpl_frameset *other)
 Insert all frames of other in self. To be removed after the same functionality exists in CPL.
hawki_band hawki_get_band (const char *f)
 Get the band.
cpl_bivector * hawki_get_header_tel_offsets (const cpl_frameset *fset)
 Get the nominal header offsets from a set of frames.
const char * hawki_get_license (void)
 Get the pipeline copyright and license.
double hawki_get_mean_airmass (cpl_frameset *set)
 Get the mean airmass for a set of frames.
const char * hawki_get_version (void)
 Returns the version of the pipeline.
cpl_error_code hawki_image_inverse_threshold (cpl_image *image_in, double lo_valid, double hi_valid, double assign_in_range, double assign_out_range)
 Create an image with a given value for pixels within a range and another value for pixels outside that range.
cpl_image * hawki_images_stitch (cpl_image **ima, double *x, double *y)
 Apply the stitching.
void hawki_print_banner (void)
 Issue a banner with the pipeline version.
const char * hawki_std_band_name (hawki_band band)
 Return a band name.
int hawki_utils_check_equal_double_keys (cpl_frameset *frames, double(*func)(const cpl_propertylist *))
 Check that all the frames share the same value of a given keyword.
int hawki_utils_check_equal_int_keys (cpl_frameset *frames, int(*func)(const cpl_propertylist *))
 Check that all the frames share the same value of a given keyword.
void hawki_utils_dec2str (char *str, int length_str, double dec)
 This functions formats a declination in degrees to a string of the form DD:MM:SS. It is based on dec2str from file libwcs/ang2str.c in wcstools library (http://tdc-www.harvard.edu/wcstools/)
void hawki_utils_ra2str (char *str, int length_str, double ra)
 This functions formats a right ascension in degrees to a string of the form HH:MM:SS. It is based on ra2str from file libwcs/ang2str.c in wcstools library (http://tdc-www.harvard.edu/wcstools/)
double hawki_vector_get_max_select (const cpl_vector *self, const cpl_vector *valid)
 Gets the maximum value of a vector according to an array of flags.
double hawki_vector_get_min_select (const cpl_vector *self, const cpl_vector *valid)
 Gets the minimum value of a vector according to an array of flags.
double hawki_vector_get_mode (cpl_vector *vec)
 Compute the histogram mode.

Function Documentation

int hawki_apply_harmonization ( cpl_imagelist *  in,
double  h1,
double  h2,
double  h3,
double  h4 
)

Apply the harmonization.

Parameters:
inthe input images
h1the factor to apply to chip 1
h2the factor to apply to chip 2
h3the factor to apply to chip 3
h4the factor to apply to chip 4
Returns:
0 if ok, -1 otherwise

Definition at line 384 of file hawki_utils.c.

cpl_image* hawki_compute_darkbpm ( const cpl_image *  in,
double  sigma 
)

Compute the bpm from the dark (hot pixels)

Parameters:
inthe input image
sigmathe sigma for the threshold
Returns:
The bad pixels map

Definition at line 119 of file hawki_utils.c.

cpl_image* hawki_compute_flatbpm ( const cpl_image *  in,
double  sigma,
double  lowval,
double  highval 
)

Compute the bpm from the flat (aka cold pixels mask)

Parameters:
inthe input image
sigmathe sigma for the threshold
lowvalthe lower value for the threshold
highvalthe upper value for the threshold
Returns:
The bad pixels map

This function creates a mask of pixels below and above a certain limit (lowval, highval) and pixels a certain number of sigmas (sigma) above the background (which is obtained smoothing with a 3x3 kernel the input image).

Definition at line 164 of file hawki_utils.c.

References hawki_image_inverse_threshold().

int hawki_compute_harmonization ( const cpl_imagelist *  in,
double *  h1,
double *  h2,
double *  h3,
double *  h4,
double *  h 
)

Compute the harmonization.

Parameters:
inthe input images
h1the factor to apply to chip 1
h2the factor to apply to chip 2
h3the factor to apply to chip 3
h4the factor to apply to chip 4
hthe general factor
Returns:
0 if ok, -1 otherwise

chip3 | | chip4 ------ ------ ------ ------ chip1 | |chip2

the edges averages avgi of all chips i are computed -> h=avg(avgi) hi = h/avgi

Definition at line 422 of file hawki_utils.c.

cpl_image* hawki_compute_lsbg ( const cpl_image *  in)

Compute the large scale background.

Parameters:
theinput image
Returns:
The background or NULL in error case

Definition at line 531 of file hawki_utils.c.

int* hawki_detectors_labelise ( const cpl_frameset *  in)

Get the frames in which the star is for a given chip.

Parameters:
inthe input frameset
Returns:
The newly allocated frameset

The signs of the header offsets in x and y are used:

  • and - -> chip 1 + and - -> chip 2 + and + -> chip 3
  • and + -> chip 4

Definition at line 782 of file hawki_utils.c.

References hawki_get_header_tel_offsets().

int hawki_detectors_locate_star ( const cpl_frameset *  in,
double  star_ra,
double  star_dec,
int *  labels 
)

Get the frames in which the star is for a given chip.

Parameters:
inthe input frameset
Returns:
The newly allocated frameset

Definition at line 837 of file hawki_utils.c.

References hawki_get_ext_from_detector(), hawki_pfits_get_naxis1(), and hawki_pfits_get_naxis2().

const char* hawki_extract_first_filename ( const cpl_frameset *  in,
const char *  tag 
)

Extract the filename ffor the first frame of the given tag.

Parameters:
inA non-empty frameset
tagThe tag of the requested file
Returns:
Pointer to the file

Definition at line 639 of file hawki_utils.c.

cpl_error_code hawki_frameset_append ( cpl_frameset *  self,
const cpl_frameset *  other 
)

Insert all frames of other in self. To be removed after the same functionality exists in CPL.

Parameters:
selfA frame set.
otherThe frames to insert.

Definition at line 1276 of file hawki_utils.c.

hawki_band hawki_get_band ( const char *  f)

Get the band.

Parameters:
fthe filter name from the header
Returns:
the band

Definition at line 657 of file hawki_utils.c.

cpl_bivector* hawki_get_header_tel_offsets ( const cpl_frameset *  fset)

Get the nominal header offsets from a set of frames.

Parameters:
fsetthe set of frames
Returns:
The offsets in a bivector or NULL in error case

The offsets returned are the telescope offsets, a mirror transformation must be performed to use them in as the image offsets, which is the cpl convention.

Definition at line 695 of file hawki_utils.c.

References hawki_pfits_get_cumoffsetx(), and hawki_pfits_get_cumoffsety().

Referenced by hawki_detectors_labelise().

const char* hawki_get_license ( void  )

Get the pipeline copyright and license.

Returns:
The copyright and license string

The function returns a pointer to the statically allocated license string. This string should not be modified using the returned pointer.

Definition at line 65 of file hawki_utils.c.

double hawki_get_mean_airmass ( cpl_frameset *  set)

Get the mean airmass for a set of frames.

Parameters:
setthe input frame set
Returns:
The mean airmass of all the input frames.

Definition at line 740 of file hawki_utils.c.

References hawki_pfits_get_airmass_end(), and hawki_pfits_get_airmass_start().

const char* hawki_get_version ( void  )

Returns the version of the pipeline.

Definition at line 106 of file hawki_utils.c.

Referenced by hawki_print_banner().

cpl_error_code hawki_image_inverse_threshold ( cpl_image *  image_in,
double  lo_valid,
double  hi_valid,
double  assign_in_range,
double  assign_out_range 
)

Create an image with a given value for pixels within a range and another value for pixels outside that range.

Parameters:
image_inImage to threshold.
lo_validLower bound of the valid range
hi_validHigher bound of the valid range
assign_in_rangeValue to assign to pixels within valid range
assign_out_rangeValue to assign to pixels outside valid range
Returns:
the #_cpl_error_code_ or CPL_ERROR_NONE

Images can be CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE. lo_cut must be smaller than or equal to hi_cut.

Possible #_cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL
  • CPL_ERROR_INVALID_TYPE if the passed image type is not supported
  • CPL_ERROR_ILLEGAL_INPUT if lo_valid is greater than hi_valid

Definition at line 241 of file hawki_utils.c.

Referenced by hawki_compute_flatbpm().

cpl_image* hawki_images_stitch ( cpl_image **  ima,
double *  x,
double *  y 
)

Apply the stitching.

Parameters:
imaThe HAWKI_NB_DETECTORS input images
xThe HAWKI_NB_DETECTORS x positions
yThe HAWKI_NB_DETECTORS y positions
Returns:
The stitched image or NULL in error case.

Definition at line 305 of file hawki_utils.c.

void hawki_print_banner ( void  )

Issue a banner with the pipeline version.

Definition at line 93 of file hawki_utils.c.

References hawki_get_version().

const char* hawki_std_band_name ( hawki_band  band)

Return a band name.

Parameters:
banda BB
Returns:
1 pointer to a static band name.

Definition at line 674 of file hawki_utils.c.

int hawki_utils_check_equal_double_keys ( cpl_frameset *  frames,
double(*)(const cpl_propertylist *)  func 
)

Check that all the frames share the same value of a given keyword.

Parameters:
framesthe framset
functhe function which returns the value of the kwd, given the propertylist
Returns:
1 if all the frames have the same values. 0 elsewhere.

Definition at line 1052 of file hawki_utils.c.

int hawki_utils_check_equal_int_keys ( cpl_frameset *  frames,
int(*)(const cpl_propertylist *)  func 
)

Check that all the frames share the same value of a given keyword.

Parameters:
framesthe framset
functhe function which returns the value of the kwd, given the propertylist
Returns:
1 if all the frames have the same values. 0 elsewhere.

Definition at line 1089 of file hawki_utils.c.

void hawki_utils_dec2str ( char *  str,
int  length_str,
double  dec 
)

This functions formats a declination in degrees to a string of the form DD:MM:SS. It is based on dec2str from file libwcs/ang2str.c in wcstools library (http://tdc-www.harvard.edu/wcstools/)

Parameters:
strThe string to write to
length_strThe maximum lenght to write
decThe declination in degrees

Definition at line 1198 of file hawki_utils.c.

void hawki_utils_ra2str ( char *  str,
int  length_str,
double  ra 
)

This functions formats a right ascension in degrees to a string of the form HH:MM:SS. It is based on ra2str from file libwcs/ang2str.c in wcstools library (http://tdc-www.harvard.edu/wcstools/)

Parameters:
strThe string to write to
length_strThe maximum lenght to write
raThe right ascension in degrees

Definition at line 1127 of file hawki_utils.c.

double hawki_vector_get_max_select ( const cpl_vector *  self,
const cpl_vector *  valid 
)

Gets the maximum value of a vector according to an array of flags.

Parameters:
selfThe input vector with the values
validVector of flags (>=-0.5: valid, <-0.5: invalid)
Returns:
The minimum value.

Definition at line 918 of file hawki_utils.c.

double hawki_vector_get_min_select ( const cpl_vector *  self,
const cpl_vector *  valid 
)

Gets the minimum value of a vector according to an array of flags.

Parameters:
selfThe input vector with the values
validVector of flags (>=-0.5: valid, <-0.5: invalid)
Returns:
The minimum value.

Definition at line 952 of file hawki_utils.c.

double hawki_vector_get_mode ( cpl_vector *  vec)

Compute the histogram mode.

Parameters:
vecthe vector
Returns:
the mode or -1 in error case

Definition at line 983 of file hawki_utils.c.