MOONS Pipeline Reference Manual 0.13.2
Functions
DET_SINGLE format

Functions

moo_single * moo_single_new (moo_detector_type type, int ntas)
 Create a new moo_single.
 
moo_single * moo_single_create (const char *filename, moo_detector_type type, int ntas)
 Create a new moo_single from the given filename.
 
cpl_error_code moo_single_load (moo_single *self, unsigned int level)
 Load data in a single structure.
 
void moo_single_delete (moo_single *self)
 Delete a moo_single.
 
cpl_image * moo_single_get_data (moo_single *self)
 Get the DATA part of single DET.
 
cpl_image * moo_single_get_err (moo_single *self)
 Get the ERROR part of single DET.
 
cpl_error_code moo_single_apply_mask (moo_single *self, cpl_mask *mask, unsigned int level)
 Apply the given mask on the QUAL part.
 
cpl_image * moo_single_get_qual (moo_single *self)
 Get the QUAL part of single DET.
 
hdrl_image * moo_single_get_image (moo_single *self)
 Get the IMAGE part (DATA,ERR) of single DET.
 
cpl_error_code moo_single_free (moo_single *self)
 Free memory associate to this single DET.
 
void moo_single_save (moo_single *self, const char *filename, moo_detector_type type, int ntas)
 Save a moo_single to a FITS file.
 
cpl_error_code moo_single_dump (const moo_single *self, FILE *stream)
 Dump structural information of a Single DET.
 
cpl_error_code moo_single_sub (moo_single *a, moo_single *b)
 Subtract two single DET.
 
cpl_error_code moo_single_divide (moo_single *a, moo_single *b)
 Divide two single DET.
 
cpl_error_code moo_single_multiply_scalar (moo_single *a, double scalar)
 Elementwise multiplication of a single with a scalar.
 
cpl_error_code moo_single_sum (moo_single *a, moo_single *b)
 Add two single DET.
 
cpl_error_code moo_single_mean (moo_single *a, moo_single *b)
 Mean of two single DET.
 
cpl_error_code moo_single_filter_snr (moo_single *self, double min_snr)
 Flag low snr pixels from single DET structure.
 

Detailed Description

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

Functionality include:

Synopsis:
#include "moo_single.h"

Function Documentation

◆ moo_single_apply_mask()

cpl_error_code moo_single_apply_mask ( moo_single *  self,
cpl_mask *  mask,
unsigned int  level 
)

Apply the given mask on the QUAL part.

Parameters
selfmoo_single to read from
maskthe given mask
levelthe bad pixel level
Returns
the error code

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the level < 0

Definition at line 287 of file moo_single.c.

References moo_mask_to_badpix(), and moo_single_get_qual().

Referenced by moo_single_compute_noise_map().

◆ moo_single_create()

moo_single * moo_single_create ( const char *  filename,
moo_detector_type  type,
int  ntas 
)

Create a new moo_single from the given filename.

Parameters
filenamename of DET file
typethe type of detector
ntasnumber of spectrograph [1,2]
Returns
1 newly allocated moo_single or NULL in case of an error

If the filename doesnt have the extension name a NULL object is returned. The returned object must be deallocated using moo_single_delete().

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if ntas>2
  • CPL_ERROR_FILE_IO if filename not a fits file

Definition at line 105 of file moo_single.c.

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

Referenced by moo_det_create().

◆ moo_single_delete()

void moo_single_delete ( moo_single *  self)

Delete a moo_single.

Parameters
selfmoo_single to delete
Returns
void

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

Definition at line 211 of file moo_single.c.

Referenced by moo_det_delete().

◆ moo_single_divide()

cpl_error_code moo_single_divide ( moo_single *  a,
moo_single *  b 
)

Divide two single DET.

Parameters
asingle to divide
bsingle which is divide
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 532 of file moo_single.c.

References moo_single_get_image(), and moo_single_get_qual().

Referenced by moo_det_divide().

◆ moo_single_dump()

cpl_error_code moo_single_dump ( const moo_single *  self,
FILE *  stream 
)

Dump structural information of a Single DET.

Parameters
selfsingle 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 460 of file moo_single.c.

Referenced by moo_det_dump().

◆ moo_single_filter_snr()

cpl_error_code moo_single_filter_snr ( moo_single *  self,
double  min_snr 
)

Flag low snr pixels from single DET structure.

Parameters
selfsingle where to flag min_snr pixels
min_snrsecond single to mean
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 652 of file moo_single.c.

References MOO_BADPIX_LOW_QE, moo_mask_to_badpix(), moo_single_get_image(), and moo_single_get_qual().

Referenced by moo_det_filter_snr().

◆ moo_single_free()

cpl_error_code moo_single_free ( moo_single *  self)

Free memory associate to this single DET.

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 349 of file moo_single.c.

Referenced by moo_det_free_single().

◆ moo_single_get_data()

cpl_image * moo_single_get_data ( moo_single *  self)

Get the DATA part of single DET.

Parameters
selfmoo_single to read from
Returns
1 newly allocated cpl_image

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

Definition at line 239 of file moo_single.c.

Referenced by moo_detlist_get_single_data(), and moo_single_compute_noise_map().

◆ moo_single_get_err()

cpl_image * moo_single_get_err ( moo_single *  self)

Get the ERROR part of single DET.

Parameters
selfmoo_single to read from
Returns
1 newly allocated cpl_image

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

Definition at line 262 of file moo_single.c.

References moo_fits_load_extension_image().

◆ moo_single_get_image()

hdrl_image * moo_single_get_image ( moo_single *  self)

Get the IMAGE part (DATA,ERR) of single DET.

Parameters
selfmoo_single to read from
Returns
the image part of single DET

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

Definition at line 330 of file moo_single.c.

Referenced by moo_correct_bias(), moo_correct_dark(), moo_detlist_get_image(), moo_single_divide(), moo_single_filter_snr(), moo_single_mean(), moo_single_multiply_scalar(), moo_single_sub(), and moo_single_sum().

◆ moo_single_get_qual()

cpl_image * moo_single_get_qual ( moo_single *  self)

Get the QUAL part of single DET.

Parameters
selfmoo_single to read from
Returns
the QUAL part of DET

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

Definition at line 312 of file moo_single.c.

Referenced by moo_correct_bias(), moo_detlist_get_single_qual(), moo_single_apply_mask(), moo_single_divide(), moo_single_filter_snr(), moo_single_mean(), moo_single_sub(), and moo_single_sum().

◆ moo_single_load()

cpl_error_code moo_single_load ( moo_single *  self,
unsigned int  level 
)

Load data in a single structure.

Parameters
selfthe SINGLE to load
levelthe bad pixel level
Returns
error code or CPL_ERROR_NONE

If the filename doesnt have the extension name a NULL object is returned. The returned object must be deallocated using moo_detlist_delete().

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the frame group is not CPL_FRAME_GROUP_PRODUCT

Definition at line 152 of file moo_single.c.

References moo_badpix_to_mask(), moo_detector_get_qual_extname(), and moo_fits_load_extension_image().

Referenced by moo_det_load_h(), moo_det_load_ri(), moo_det_load_single(), moo_det_load_yj(), moo_masterbias(), and moo_masterdark().

◆ moo_single_mean()

cpl_error_code moo_single_mean ( moo_single *  a,
moo_single *  b 
)

Mean of two single DET.

Parameters
afirst single to mean wich contanins the result of the operation
bsecond single to mean
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 618 of file moo_single.c.

References moo_single_get_image(), and moo_single_get_qual().

Referenced by moo_det_mean().

◆ moo_single_multiply_scalar()

cpl_error_code moo_single_multiply_scalar ( moo_single *  a,
double  scalar 
)

Elementwise multiplication of a single with a scalar.

Parameters
asingle to be modified
scalarNumber to multiply with
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 562 of file moo_single.c.

References moo_single_get_image().

Referenced by moo_det_rescale_using_exptime().

◆ moo_single_new()

moo_single * moo_single_new ( moo_detector_type  type,
int  ntas 
)

Create a new moo_single.

Parameters
typethe type of detector
ntasnumber of spectrograph [1,2]
Returns
1 newly allocated moo_single or NULL in case of an error

The returned object must be deallocated using moo_single_delete().

Error code:

  • CPL_ERROR_NULL_INPUT The parameter list or name is a NULL pointer

Definition at line 73 of file moo_single.c.

References MOO_BADPIX_GOOD, and moo_detector_get_extname().

Referenced by moo_single_create().

◆ moo_single_save()

void moo_single_save ( moo_single *  self,
const char *  filename,
moo_detector_type  type,
int  ntas 
)

Save a moo_single to a FITS file.

Parameters
selfmoo_single to write to disk or NULL
filenameName of the file to write
typethe detector type (RI, YJ, H)
ntasthe number id of spectrograph

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

Definition at line 384 of file moo_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_det_save().

◆ moo_single_sub()

cpl_error_code moo_single_sub ( moo_single *  a,
moo_single *  b 
)

Subtract two single DET.

Parameters
asingle to subtract
bsingle which is subtract
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 502 of file moo_single.c.

References moo_single_get_image(), and moo_single_get_qual().

Referenced by moo_correct_dark(), and moo_det_subtract().

◆ moo_single_sum()

cpl_error_code moo_single_sum ( moo_single *  a,
moo_single *  b 
)

Add two single DET.

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 588 of file moo_single.c.

References moo_single_get_image(), and moo_single_get_qual().

Referenced by moo_det_sum().