MOONS Pipeline Reference Manual 0.13.1
Functions
EXT_SINGLE format

Functions

moo_ext_single * moo_ext_single_new (moo_detector_type type, int ntas)
 Create a new moo_ext_single.
 
moo_ext_single * moo_ext_single_create (const char *filename, moo_detector_type type, int ntas)
 Create a new moo_ext_single from the given EXT filename.
 
cpl_error_code moo_ext_single_load (moo_ext_single *self, unsigned int level)
 load a moo_ext_single using the level for badpixel
 
void moo_ext_single_delete (moo_ext_single *self)
 Delete a moo_ext_single.
 
void moo_ext_single_save (const moo_ext_single *self, const char *filename, moo_detector_type type, int ntas)
 Save a moo_ext_single to a FITS file.
 
cpl_error_code moo_ext_single_dump (const moo_ext_single *self, FILE *stream)
 Dump structural information of EXT_SINGLE.
 
hdrl_image * moo_ext_single_get_image (moo_ext_single *self)
 Get image of EXT_SINGLE.
 
cpl_image * moo_ext_single_get_data (moo_ext_single *self)
 Get image of data.
 
cpl_image * moo_ext_single_get_errs (moo_ext_single *self)
 Get image of errs.
 
cpl_image * moo_ext_single_get_qual (moo_ext_single *self)
 Get image of qual.
 
cpl_propertylist * moo_ext_single_get_header (moo_ext_single *self)
 Get header of ext single.
 
cpl_error_code moo_ext_single_set_wcs1 (moo_ext_single *self, double crpix1, double crval1, double cd1_1, const char *ctype1, const char *cunit1)
 Set the WCS1 of the extension.
 
cpl_error_code moo_ext_single_free (moo_ext_single *self)
 Free memory associate to this single EXT.
 
cpl_error_code moo_ext_single_sum (moo_ext_single *a, moo_ext_single *b)
 Add two single EXT.
 
double moo_ext_single_compute_snr (moo_ext_single *self, int ext_idx, cpl_image *wmap, moo_spectral_format_info *sinfo, moo_sky_lines_list *skylines, double *dersnr)
 Compute SNR for a given target.
 

Detailed Description

This module provides functions to create, use, and destroy a moo_ext_single

Functionality include:

Synopsis:
#include "moo_ext_single.h"

Function Documentation

◆ moo_ext_single_compute_snr()

double moo_ext_single_compute_snr ( moo_ext_single *  self,
int  ext_idx,
cpl_image *  wmap,
moo_spectral_format_info *  sinfo,
moo_sky_lines_list *  skylines,
double *  dersnr 
)

Compute SNR for a given target.

Parameters
self[EXT_SINGLE] ext_single structure
ext_idxindex in EXT
wmapthe WAVELENGTH map corresponding to detector
sinfothe spectral information corresponding to detector
skylinesthe sky lines corresponding to detector
dersnrsnr compute per der_snr
Returns
snr

Definition at line 629 of file moo_ext_single.c.

References moo_ext_single_get_image(), moo_sky_lines_list_get_free_zones(), and moo_vector_get_dersnr().

Referenced by moo_ext_compute_snr().

◆ moo_ext_single_create()

moo_ext_single * moo_ext_single_create ( const char *  filename,
moo_detector_type  type,
int  ntas 
)

Create a new moo_ext_single from the given EXT filename.

Parameters
filenamethe EXT filename
typethe type of detector
ntasthe number id of spectropgraph
Returns
1 newly allocated moo_ext_single or NULL in case of an error

The returned object must be deallocated using moo_ext_single_delete(). Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

Definition at line 97 of file moo_ext_single.c.

References moo_detector_get_extname(), moo_ext_single_new(), and moo_pfits_get_naxis().

Referenced by moo_ext_create().

◆ moo_ext_single_delete()

void moo_ext_single_delete ( moo_ext_single *  self)

Delete a moo_ext_single.

Parameters
selfmoo_ext_single to delete
Returns
void

If the moo_ext_single self is NULL, nothing is done and no error is set.

Definition at line 189 of file moo_ext_single.c.

Referenced by moo_ext_delete().

◆ moo_ext_single_dump()

cpl_error_code moo_ext_single_dump ( const moo_ext_single *  self,
FILE *  stream 
)

Dump structural information of EXT_SINGLE.

Parameters
selfEXT_SINGLE to dump
streamOutput stream, accepts stdout or stderr
Returns
CPL_ERROR_NONE or the relevant cpl_error_code on error

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_FILE_IO if a write operation fails

Definition at line 278 of file moo_ext_single.c.

Referenced by moo_ext_dump().

◆ moo_ext_single_free()

cpl_error_code moo_ext_single_free ( moo_ext_single *  self)

Free memory associate to this single EXT.

Parameters
selfmoo_single where want to free memory
Returns
error_code or CPL_ERROR_NONE

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

Definition at line 564 of file moo_ext_single.c.

Referenced by moo_ext_free_single().

◆ moo_ext_single_get_data()

cpl_image * moo_ext_single_get_data ( moo_ext_single *  self)

Get image of data.

Parameters
selfEXT_SINGLE
Returns
image or NULL

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

Definition at line 319 of file moo_ext_single.c.

Referenced by moo_extlist_get_single_data().

◆ moo_ext_single_get_errs()

cpl_image * moo_ext_single_get_errs ( moo_ext_single *  self)

Get image of errs.

Parameters
selfEXT_SINGLE
Returns
image or NULL

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_FILE_IO if a write operation fails

Definition at line 344 of file moo_ext_single.c.

◆ moo_ext_single_get_header()

cpl_propertylist * moo_ext_single_get_header ( moo_ext_single *  self)

Get header of ext single.

Parameters
selfEXT_SINGLE
Returns
the header or NULL

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_FILE_IO if a write operation fails

Definition at line 396 of file moo_ext_single.c.

◆ moo_ext_single_get_image()

hdrl_image * moo_ext_single_get_image ( moo_ext_single *  self)

Get image of EXT_SINGLE.

Parameters
selfEXT_SINGLE
Returns
image or NULL

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

Definition at line 301 of file moo_ext_single.c.

Referenced by moo_ext_single_compute_snr(), moo_ext_single_sum(), and moo_extlist_get_image().

◆ moo_ext_single_get_qual()

cpl_image * moo_ext_single_get_qual ( moo_ext_single *  self)

Get image of qual.

Parameters
selfEXT_SINGLE
Returns
image or NULL

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

Definition at line 368 of file moo_ext_single.c.

References moo_fits_load_extension_image().

Referenced by moo_ext_single_sum(), and moo_extlist_get_single_qual().

◆ moo_ext_single_load()

cpl_error_code moo_ext_single_load ( moo_ext_single *  self,
unsigned int  level 
)

load a moo_ext_single using the level for badpixel

Parameters
selfthe EXT_SINGLE
levelthe reference badpixel to build the image mask
Returns
1 newly allocated moo_ext_single or NULL in case of an error

The returned object must be deallocated using moo_ext_single_delete(). Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

Definition at line 132 of file moo_ext_single.c.

References moo_badpix_to_mask(), and moo_fits_load_extension_image().

Referenced by moo_ext_load(), and moo_ext_load_single().

◆ moo_ext_single_new()

moo_ext_single * moo_ext_single_new ( moo_detector_type  type,
int  ntas 
)

Create a new moo_ext_single.

Returns
1 newly allocated moo_ext_single or NULL in case of an error

The returned object must be deallocated using moo_ext_single_delete().

Definition at line 71 of file moo_ext_single.c.

References MOO_BADPIX_GOOD, and moo_detector_get_extname().

Referenced by moo_ext_single_create().

◆ moo_ext_single_save()

void moo_ext_single_save ( const moo_ext_single *  self,
const char *  filename,
moo_detector_type  type,
int  ntas 
)

Save a moo_ext_single to a FITS file.

Parameters
selfmoo_ext_single to write to disk or NULL
filenameName of the file to write
typethe type of detector
ntasthe number id of spectropgraph
Returns
CPL_ERROR_NONE or the relevant cpl_error_code on error

This function saves a moo_loc_single to a FITS file, using cfitsio. Only not NULL extensions are written.

Definition at line 219 of file moo_ext_single.c.

References moo_detector_get_extname(), moo_fits_write_extension_image(), moo_pfits_append_hduclass_error(), and moo_pfits_append_hduclass_quality().

Referenced by moo_ext_add_single(), and moo_ext_save().

◆ moo_ext_single_set_wcs1()

cpl_error_code moo_ext_single_set_wcs1 ( moo_ext_single *  self,
double  crpix1,
double  crval1,
double  cd1_1,
const char *  ctype1,
const char *  cunit1 
)

Set the WCS1 of the extension.

Parameters
selfsingle the extension
crpix1the crpix1 keyword
crval1the crval1 keyword
cd1_1the cd1_1 keyword
ctype1the ctype1 keyword
cunit1the cunit1 keyword
Returns
the relevant error code

the header of the extension must be preallocated before calling this function Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if a field of extension is NULL

Definition at line 524 of file moo_ext_single.c.

◆ moo_ext_single_sum()

cpl_error_code moo_ext_single_sum ( moo_ext_single *  a,
moo_ext_single *  b 
)

Add two single EXT.

Parameters
asingle to add
bsingle which is add
Returns
CPL_ERROR_NONE or the relevant cpl_error_code on error

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

Definition at line 597 of file moo_ext_single.c.

References moo_ext_single_get_image(), and moo_ext_single_get_qual().

Referenced by moo_ext_sum().