X-shooter Pipeline Reference Manual 3.8.15
Macros | Functions
xsh_spectrum.c File Reference
#include <math.h>
#include <float.h>
#include <cpl.h>
#include "xsh_spectrum.h"
#include "xsh_utils_wrappers.h"

Go to the source code of this file.

Macros

#define SPECTRUM_HW   16
 
#define MIN_THRESH_FACT   0.9
 
#define MAX_THRESH_FACT   1.1
 
#define SPEC_SHADOW_FACT   30.0 /* Negative spectrum intensity*/
 
#define SPEC_MAXWIDTH   48
 

Functions

static int select_valid_spectra (cpl_image *in, cpl_apertures *aperts, int offset, spec_shadows shadows, int max_spec_width, int *n_valid_specs, int **valid_specs)
 Selects the valid spectra in a spectral image.
 
static int valid_spectrum (cpl_image *in, cpl_apertures *aperts, int offset, spec_shadows shadows, int max_spec_width, int objnum)
 Helper function to select_valid_spectra.
 
int xsh_spectrum_find_brightest (const cpl_image *in, int offset, spec_shadows shadows, double min_bright, int orient, double *pos)
 Finds the brightest spectrum in an image.
 
cpl_vector * xsh_spectrum_detect_peaks (const cpl_vector *in, int fwhm, double kappa, int display)
 Detect the brightest features in a spectrum.
 

Macro Definition Documentation

◆ MAX_THRESH_FACT

#define MAX_THRESH_FACT   1.1

Definition at line 49 of file xsh_spectrum.c.

◆ MIN_THRESH_FACT

#define MIN_THRESH_FACT   0.9

Definition at line 48 of file xsh_spectrum.c.

◆ SPEC_MAXWIDTH

#define SPEC_MAXWIDTH   48

Definition at line 51 of file xsh_spectrum.c.

◆ SPEC_SHADOW_FACT

#define SPEC_SHADOW_FACT   30.0 /* Negative spectrum intensity*/

Definition at line 50 of file xsh_spectrum.c.

◆ SPECTRUM_HW

#define SPECTRUM_HW   16

Definition at line 47 of file xsh_spectrum.c.

Function Documentation

◆ select_valid_spectra()

static int select_valid_spectra ( cpl_image *  in,
cpl_apertures *  aperts,
int  offset,
spec_shadows  shadows,
int  max_spec_width,
int *  n_valid_specs,
int **  valid_specs 
)
static

Selects the valid spectra in a spectral image.

Parameters
inthe 1d image
apertsdetected objects
offsetthe distance to the two shadows of the bright spectrum
shadowsshadows mode
max_spec_widthmaximal spectrum width
n_valid_specsnumber of valid spectra
valid_specslut giving the object number of a found spectrum
Returns
0 if ok, -1 in error case

Definition at line 412 of file xsh_spectrum.c.

References valid_spectrum().

Referenced by xsh_spectrum_find_brightest().

◆ valid_spectrum()

static int valid_spectrum ( cpl_image *  in,
cpl_apertures *  aperts,
int  offset,
spec_shadows  shadows,
int  max_spec_width,
int  objnum 
)
static

Helper function to select_valid_spectra.

Parameters
inthe 1d image
apertsdetected objects
offsetthe distance to the two shadows of the bright spectrum
shadowsshadows mode
max_spec_widthmaximal spectrum width
objnumindex of the object to test (1 for the first)
Returns
1 if valid 0 if not

Definition at line 465 of file xsh_spectrum.c.

References NO_SHADOW, ONE_SHADOW, SPEC_SHADOW_FACT, and TWO_SHADOWS.

Referenced by select_valid_spectra().