MUSE Pipeline Reference Manual  2.1.1
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 pixel grid, linking the grid points to entries (=rows) in the pixel table. More...
 
void muse_pixgrid_delete (muse_pixgrid *aGrid)
 Delete a pixel grid and remove its memory. More...
 
static cpl_size muse_pixgrid_get_index (muse_pixgrid *aGrid, 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 *aGrid, cpl_size aIndex)
 Return the number of rows stored in one pixel. More...
 
static const cpl_size * muse_pixgrid_get_rows (muse_pixgrid *aGrid, 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 pixel grid, 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 pixel grid 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 507 of file muse_pixgrid.c.

References muse_pixgrid_get_index(), MUSE_PIXTABLE_LAMBDA, and MUSE_PIXTABLE_XPOS.

Referenced by muse_pixgrid_get_rows(), and muse_resampling_collapse_pixgrid().

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
set CPL_ERROR_ILLEGAL_OUTPUT and ERROR message, but return created gridaPixtable contains different number of pixels than the output pixel grid

Definition at line 237 of file muse_pixgrid.c.

References muse_wcs::cd22, muse_wcs::crpix2, muse_wcs::crval2, muse_pixtable::header, muse_wcs::iscelsph, muse_pfits_get_cd(), muse_pfits_get_crpix(), muse_pfits_get_crval(), muse_pfits_get_ctype(), muse_pixgrid_get_count(), muse_pixgrid_get_index(), muse_pixtable_get_nrow(), MUSE_PIXTABLE_LAMBDA, MUSE_PIXTABLE_WCS_CELSPH, muse_pixtable_wcs_check(), MUSE_PIXTABLE_WCS_PIXEL, MUSE_PIXTABLE_XPOS, MUSE_PIXTABLE_YPOS, muse_wcs_new(), muse_wcs_pixel_from_celestial_fast(), muse_wcs_pixel_from_projplane_fast(), and muse_pixtable::table.

Referenced by muse_pixgrid_get_rows(), and muse_resampling_cube().

void muse_pixgrid_delete ( muse_pixgrid aGrid)

Delete a pixel grid and remove its memory.

Parameters
aGridPointer to pixel grid.

Definition at line 575 of file muse_pixgrid.c.

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

static cpl_size muse_pixgrid_get_count ( muse_pixgrid aGrid,
cpl_size  aIndex 
)
static

Return the number of rows stored in one pixel.

Parameters
aGridPointer to pixel grid.
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 140 of file muse_pixgrid.h.

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

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

Get the grid index determined from all three coordinates.

Parameters
aGridPointer to pixel grid.
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 pixel grid 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 100 of file muse_pixgrid.h.

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

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

Return a pointer to the rows stored in one pixel.

Parameters
aGridPointer to pixel grid.
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 171 of file muse_pixgrid.h.

References muse_pixgrid_2d_create(), muse_pixgrid_create(), and muse_pixgrid_delete().

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