MUSE Pipeline Reference Manual  1.0.2
Data Structures | Functions
Pixel grid

Data Structures

struct  muse_pixels_ext
 The pixel extension map. More...
 
struct  muse_pixgrid
 The pixel grid. More...
 

Functions

muse_pixgridmuse_pixgrid_create (muse_pixtable *aPixtable, cpl_propertylist *aHeader, cpl_size aXSize, cpl_size aYSize, cpl_size aZSize)
 Convert selected rows of a pixel table into pixel grid, linking the grid points to entries (=rows) in the pixel table. More...
 
muse_pixgridmuse_pixgrid_2d_create (cpl_table *aTable, double aDX, double aZMin, double aZMax, double aDZ, float *aXMin)
 Convert selected rows of a pixel table into 2D pixgrid, linking the grid points to entries (=rows) in the pixel table. More...
 
void muse_pixgrid_delete (muse_pixgrid *aPixels)
 Delete a pixgrid and remove its memory. More...
 
static cpl_size muse_pixgrid_get_index (muse_pixgrid *aPixels, cpl_size aX, cpl_size aY, cpl_size aZ, cpl_boolean aAllowOutside)
 Get the grid index determined from all three coordinates. More...
 
static cpl_size muse_pixgrid_get_count (muse_pixgrid *aPixels, cpl_size aIndex)
 Return the number of rows stored in one pixel. More...
 
static const cpl_size * muse_pixgrid_get_rows (muse_pixgrid *aPixels, cpl_size aIndex)
 Return a pointer to the rows stored in one pixel. More...
 

Detailed Description

The pixel grid is an index structure that is used when resampling a pixel table into a datacube but can generally be used to find neighbors in the 3D data of the pixel table.

Function Documentation

muse_pixgrid* muse_pixgrid_2d_create ( cpl_table *  aTable,
double  aDX,
double  aZMin,
double  aZMax,
double  aDZ,
float *  aXMin 
)

Convert selected rows of a pixel table into 2D pixgrid, linking the grid points to entries (=rows) in the pixel table.

Parameters
aTablethe table component of a MUSE pixel table
aDXX (spaxel) bin size
aZMinLower z (wavelength) limit
aZMaxUpper z (wavelength) limit
aDZZ (wavelength) bin size
aXMinLower x (spaxel) limit computed here (can be NULL)
Returns
The output pixgrid or NULL on error.

The Y coordinate is ignored in this function.

Exceptions
set CPL_ERROR_NULL_INPUT, return NULLaTable is NULL or it contains zero rows
set CPL_ERROR_ILLEGAL_INPUT, return NULLone of the sizes is not positive
set CPL_ERROR_DATA_NOT_FOUND, return NULLaTable is missing one of the coordinate columns

Definition at line 330 of file muse_pixgrid.c.

References muse_pixgrid_get_index().

muse_pixgrid* muse_pixgrid_create ( muse_pixtable aPixtable,
cpl_propertylist *  aHeader,
cpl_size  aXSize,
cpl_size  aYSize,
cpl_size  aZSize 
)

Convert selected rows of a pixel table into pixel grid, linking the grid points to entries (=rows) in the pixel table.

Parameters
aPixtablethe input pixel table
aHeaderthe FITS header of the MUSE datacube to be created
aXSizex size of the output grid
aYSizey size of the output grid
aZSizez size of the output grid (wavelength direction)
Returns
A muse_pixels * buffer for the output pixel grid or NULL on error.
Remarks
The returned pixel grid has to be deallocated after use with muse_pixgrid_delete().

Construct a standard C array, where the array indices representing the 3D grid in the sense the the x-coordinate is varying fastest, the lambda-coordinate varying slowest (like in FITS buffers), i.e. index = [i + nx * j + nx*ny * l] (i: x-axis index, j: y-axis index, l: lambda-axis index, nx: x-axis length, ny: y-axis length). For each pixel table row search for the closest grid point. Store the pixel table row number in that grid point.

Exceptions
set CPL_ERROR_NULL_INPUT, return NULLaPixtable is NULL or it contains zero rows
set CPL_ERROR_ILLEGAL_INPUT, return NULLone of the sizes is not positive
set CPL_ERROR_UNSUPPORTED_MODE, return NULLthe WCS in the pixel table is neither in pixels nor degrees
set CPL_ERROR_DATA_NOT_FOUND, return NULLaPixtable is missing one of the coordinate columns

Definition at line 168 of file muse_pixgrid.c.

References muse_wcs::cd22, muse_wcs::crpix2, muse_wcs::crval2, muse_pixtable::header, muse_wcs::iscelsph, muse_pixgrid_get_count(), muse_pixgrid_get_index(), muse_pixtable_get_nrow(), MUSE_PIXTABLE_WCS_CELSPH, muse_pixtable_wcs_check(), MUSE_PIXTABLE_WCS_PIXEL, muse_wcs_new(), muse_wcs_pixel_from_celestial_fast(), muse_wcs_pixel_from_projplane_fast(), and muse_pixtable::table.

Referenced by muse_resampling_cube().

void muse_pixgrid_delete ( muse_pixgrid aPixels)

Delete a pixgrid and remove its memory.

Parameters
aPixelsPointer to pixgrid.

Definition at line 398 of file muse_pixgrid.c.

Referenced by muse_dar_check(), muse_postproc_cube_resample_and_collapse(), and muse_resampling_cube().

static cpl_size muse_pixgrid_get_count ( muse_pixgrid aPixels,
cpl_size  aIndex 
)
static

Return the number of rows stored in one pixel.

Parameters
aPixelsPointer to pixgrid.
aIndexPixel index, as computed by muse_pixgrid_get_index().
Note
This function is defined as static inline, i.e. should get integrated into the caller by the compiler, to maximise execution speed.

Definition at line 129 of file muse_pixgrid.h.

Referenced by muse_dar_check(), muse_pixgrid_create(), and muse_resampling_collapse_pixgrid().

static cpl_size muse_pixgrid_get_index ( muse_pixgrid aPixels,
cpl_size  aX,
cpl_size  aY,
cpl_size  aZ,
cpl_boolean  aAllowOutside 
)
static

Get the grid index determined from all three coordinates.

Parameters
aPixelsPointer to pixgrid.
aXx index
aYy index
aZz index
aAllowOutsideif true, return a positive value for pixels nominally outside the grid
Returns
Index to be used in the other pixgrid functions, or -1 on error.
Note
This function is defined as static inline, i.e. should get integrated into the caller by the compiler, to maximise execution speed.

Definition at line 89 of file muse_pixgrid.h.

Referenced by muse_dar_check(), muse_pixgrid_2d_create(), muse_pixgrid_create(), and muse_resampling_collapse_pixgrid().

static const cpl_size* muse_pixgrid_get_rows ( muse_pixgrid aPixels,
cpl_size  aIndex 
)
static

Return a pointer to the rows stored in one pixel.

Parameters
aPixelsPointer to pixgrid.
aIndexPixel index, as computed by muse_pixgrid_get_index().
Note
This function is defined as static inline, i.e. should get integrated into the caller by the compiler, to maximise execution speed.

Definition at line 150 of file muse_pixgrid.h.

Referenced by muse_dar_check(), and muse_resampling_collapse_pixgrid().