MOONS Pipeline Reference Manual 0.13.2
Functions
SCI_LIST format

Functions

moo_scilist * moo_scilist_new (void)
 Create a new moo_scilist.
 
moo_sci * moo_scilist_unset (moo_scilist *self, cpl_size pos)
 Remove a SCI from a SCI list.
 
void moo_scilist_empty (moo_scilist *self)
 Empty an moo_scilist and deallocate all its SCI.
 
void moo_scilist_unwrap (moo_scilist *self)
 Free memory used by a moo_scilist object, except the SCI.
 
void moo_scilist_delete (moo_scilist *self)
 Free all memory used by a moo_scilist object including the SCI.
 
cpl_size moo_scilist_get_size (const moo_scilist *self)
 Get the number of SCI in the scilist.
 
cpl_error_code moo_scilist_set (moo_scilist *self, moo_sci *sci, cpl_size pos)
 Insert a SCI into an moo_scilist.
 
cpl_error_code moo_scilist_push (moo_scilist *self, moo_sci *sci)
 Insert a SCI a the end of moo_scilist.
 
moo_scilist * moo_scilist_create (cpl_frameset *frameset)
 Create a new moo_scilist from the given SCI frameset.
 
moo_scilist * moo_scilist_create_clean (cpl_frameset *frameset)
 Create a new moo_scilist from the given SCI frameset ignoring SCI with 0 targets.
 
moo_sci * moo_scilist_get (moo_scilist *self, int i)
 Get the SCI at the position i in the list.
 
moo_sci_single * moo_scilist_get_single (moo_scilist *self, int i, moo_detector_type type)
 Get the SCI SINGLE at the position i in the list for the given detector.
 
cpl_error_code moo_scilist_load_single (const moo_scilist *self, moo_detector_type type, int level)
 Load the type part for all SCI in the scilist.
 
hdrl_imagelist * moo_scilist_get_image (const moo_scilist *self, moo_detector_type type)
 Get the all the images of the type part in the scilist.
 
cpl_imagelist * moo_scilist_get_qual (const moo_scilist *self, moo_detector_type type)
 Get the all the QUAL of the type part in the scilist.
 
cpl_imagelist * moo_scilist_get_sky (const moo_scilist *self, moo_detector_type type)
 Get the all the SKY of the type part in the scilist.
 

Detailed Description

Function Documentation

◆ moo_scilist_create()

moo_scilist * moo_scilist_create ( cpl_frameset *  frameset)

Create a new moo_scilist from the given SCI frameset.

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

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

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

Definition at line 321 of file moo_scilist.c.

References moo_sci_create(), moo_scilist_new(), and moo_scilist_push().

◆ moo_scilist_create_clean()

moo_scilist * moo_scilist_create_clean ( cpl_frameset *  frameset)

Create a new moo_scilist from the given SCI frameset ignoring SCI with 0 targets.

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

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

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

Definition at line 345 of file moo_scilist.c.

References moo_sci_create(), moo_sci_delete(), moo_sci_get_target_table(), moo_scilist_new(), and moo_scilist_push().

◆ moo_scilist_delete()

void moo_scilist_delete ( moo_scilist *  self)

Free all memory used by a moo_scilist object including the SCI.

Parameters
selfThe SCI list or NULL
Returns
void
See also
moo_scilist_empty(), moo_scilist_unwrap() If the SCI_LIST format self is NULL, nothing is done and no error is set.

Definition at line 176 of file moo_scilist.c.

References moo_scilist_empty(), and moo_scilist_unwrap().

◆ moo_scilist_empty()

void moo_scilist_empty ( moo_scilist *  self)

Empty an moo_scilist and deallocate all its SCI.

Parameters
selfThe SCI list or NULL
Returns
Nothing
See also
moo_scilist_delete()
Note
If self is NULL nothing is done and no error is set.

After the call the moo_sci list can be populated again. It must eventually be deallocated with a call to moo_scilist_delete().

Definition at line 120 of file moo_scilist.c.

References moo_sci_delete(), and moo_scilist_unset().

Referenced by moo_scilist_delete().

◆ moo_scilist_get()

moo_sci * moo_scilist_get ( moo_scilist *  self,
int  i 
)

Get the SCI at the position i in the list.

Parameters
selfthe list of SCI
iposition in the list
Returns
SCI element or NULL

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if i <0 or i >= list size

Definition at line 384 of file moo_scilist.c.

References moo_scilist_get_size().

Referenced by moo_coadd(), moo_compute_resp(), moo_resp_create(), and moo_telluric_create().

◆ moo_scilist_get_image()

hdrl_imagelist * moo_scilist_get_image ( const moo_scilist *  self,
moo_detector_type  type 
)

Get the all the images of the type part in the scilist.

Parameters
selfthe list of SCI
typethe type of extension to load
Returns
The image list or NULL

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

Definition at line 468 of file moo_scilist.c.

References moo_sci_get_single(), and moo_sci_single_get_image().

◆ moo_scilist_get_qual()

cpl_imagelist * moo_scilist_get_qual ( const moo_scilist *  self,
moo_detector_type  type 
)

Get the all the QUAL of the type part in the scilist.

Parameters
selfthe list of SCI
typethe type of extension to load
Returns
The QUAL list or NULL

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

Definition at line 514 of file moo_scilist.c.

References moo_sci_get_single(), and moo_sci_single_get_qual().

◆ moo_scilist_get_single()

moo_sci_single * moo_scilist_get_single ( moo_scilist *  self,
int  i,
moo_detector_type  type 
)

Get the SCI SINGLE at the position i in the list for the given detector.

Parameters
selfthe list of SCI
iposition in the list
typedetector type
Returns
SCI_SINGLE element or NULL

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if i <0 or i >= list size

Definition at line 409 of file moo_scilist.c.

References moo_sci_get_single(), and moo_scilist_get_size().

Referenced by moo_coadd().

◆ moo_scilist_get_size()

cpl_size moo_scilist_get_size ( const moo_scilist *  self)

Get the number of SCI in the scilist.

Parameters
selfthe list of SCI
Returns
The number of SCI or -1 on error

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

Definition at line 198 of file moo_scilist.c.

Referenced by moo_coadd(), moo_compute_resp(), moo_resp_create(), moo_scilist_get(), moo_scilist_get_single(), and moo_telluric_create().

◆ moo_scilist_get_sky()

cpl_imagelist * moo_scilist_get_sky ( const moo_scilist *  self,
moo_detector_type  type 
)

Get the all the SKY of the type part in the scilist.

Parameters
selfthe list of SCI
typethe type of extension to load
Returns
The SKY list or NULL

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

Definition at line 560 of file moo_scilist.c.

References moo_sci_get_single(), and moo_sci_single_get_sky().

◆ moo_scilist_load_single()

cpl_error_code moo_scilist_load_single ( const moo_scilist *  self,
moo_detector_type  type,
int  level 
)

Load the type part for all SCI in the scilist.

Parameters
selfthe list of SCI
typethe type of extension to load
levelMask error level
Returns
The 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 439 of file moo_scilist.c.

References moo_sci_load_single().

Referenced by moo_coadd().

◆ moo_scilist_new()

moo_scilist * moo_scilist_new ( void  )

Create a new moo_scilist.

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

The returned object must be deallocated using moo_scilist_delete().

Definition at line 56 of file moo_scilist.c.

Referenced by moo_scilist_create(), and moo_scilist_create_clean().

◆ moo_scilist_push()

cpl_error_code moo_scilist_push ( moo_scilist *  self,
moo_sci *  sci 
)

Insert a SCI a the end of moo_scilist.

Parameters
selfThe moo_scilist
sciThe SCI to insert
Returns
CPL_ERROR_NONE or the relevant cpl_error_code on error
See also
moo_scilist_set()

No action occurs if a SCI is inserted more than once into the same position. It is allowed to insert the same SCI into two different positions in a list.

The SCI is inserted at the end in the SCI list. If the SCI already there is only present in that one location in the list, then the SCI is deallocated.

The added SCI is owned by the moo_scilist object, which deallocates it moo_scilist_delete is called. Other option is to use moo_scilist_unset to recover ownership of the SCI, in which case the moo_scilist object is not longer responsible for deallocating it.

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

Definition at line 304 of file moo_scilist.c.

References moo_scilist_set().

Referenced by moo_scilist_create(), and moo_scilist_create_clean().

◆ moo_scilist_set()

cpl_error_code moo_scilist_set ( moo_scilist *  self,
moo_sci *  sci,
cpl_size  pos 
)

Insert a SCI into an moo_scilist.

Parameters
selfThe moo_scilist
sciThe SCI to insert
posThe list position (from 0 to number of SCI)
Returns
CPL_ERROR_NONE or the relevant cpl_error_code on error

It is allowed to specify the position equal to the number of SCI in the list. This will increment the size of the scilist.

No action occurs if a SCI is inserted more than once into the same position. It is allowed to insert the same SCI into two different positions in a list.

The SCI is inserted at the position pos in the SCI list. If the SCI already there is only present in that one location in the list, then the SCI is deallocated.

The added SCI is owned by the moo_scilist object, which deallocates it moo_scilist_delete is called. Other option is to use moo_scilist_unset to recover ownership of the SCI, in which case the moo_scilist object is not longer responsible for deallocating it.

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if pos is negative
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if pos is bigger than the number of SCI in scilist

Definition at line 240 of file moo_scilist.c.

References moo_sci_delete().

Referenced by moo_scilist_push().

◆ moo_scilist_unset()

moo_sci * moo_scilist_unset ( moo_scilist *  self,
cpl_size  pos 
)

Remove a SCI from a SCI list.

Parameters
selfThe moo_scilist
posThe list position (from 0 to number of SCI-1)
Returns
The pointer to the removed SCI or NULL in error case

The specified SCI is not deallocated, it is simply removed from the list. The pointer to the SCI is returned to let the user decide to deallocate it or not. Eventually, the SCI will have to be deallocated with moo_sci_delete().

Possible cpl_error_code set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if pos is negative
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if pos is bigger than the number of images in self

Definition at line 82 of file moo_scilist.c.

Referenced by moo_scilist_empty().

◆ moo_scilist_unwrap()

void moo_scilist_unwrap ( moo_scilist *  self)

Free memory used by a moo_scilist object, except the SCI.

Parameters
selfThe SCI list or NULL
Returns
Nothing
See also
moo_scilist_empty()
Note
The caller must have pointers to all SCI in the list and is reponsible for their deallocation. If self is NULL nothing is done and no error is set.

Definition at line 156 of file moo_scilist.c.

Referenced by moo_scilist_delete().