CR2RE Pipeline Reference Manual 1.6.8
Functions
Polarimetry

Functions

cpl_bivector * cr2res_pol_demod_stokes (cpl_vector **intens, cpl_vector **wl, cpl_vector **errors, int n)
 Demodulate extracted spectra into Stokes parameter.
 
int cr2res_pol_resample (cpl_vector **intens, cpl_vector **wl, cpl_vector **errors, int n, cpl_vector **xmin, cpl_vector **xmax)
 Resample all spectra to the same wavelength grid.
 
cpl_bivector * cr2res_pol_demod_null (cpl_vector **intens, cpl_vector **wl, cpl_vector **errors, int n)
 Demodulate extracted spectra into Null spectrum.
 
cpl_bivector * cr2res_pol_demod_intens (cpl_vector **intens, cpl_vector **wl, cpl_vector **errors, int n)
 Combine extracted spectra into Intensity spectrum.
 
cpl_table * cr2res_pol_POL_SPEC_create (int *orders, cpl_vector **wl, cpl_bivector **stokes, cpl_bivector **null, cpl_bivector **intens, int norders)
 Create the POL_SPEC table to be saved.
 
int * cr2res_pol_sort_frames (const cpl_frame *frame1, const cpl_frame *frame2, const cpl_frame *frame3, const cpl_frame *frame4)
 Compute the positions of the passed frames.
 
cpl_table * cr2res_pol_spec_pol_merge (const cpl_table **pol_spec_list, int pol_spec_nb)
 Merge several POL_SPEC tables together, by averaging.
 
cpl_table * cr2res_pol_get_beam_trace (const cpl_table *tw_in, cr2res_decker decker_position, int up_or_down)
 Compute the traces for the polarimetric beams.
 

Detailed Description

Function Documentation

◆ cr2res_pol_demod_intens()

cpl_bivector * cr2res_pol_demod_intens ( cpl_vector **  intens,
cpl_vector **  wl,
cpl_vector **  errors,
int  n 
)

Combine extracted spectra into Intensity spectrum.

Parameters
intensArray of n extracted intensities
wlArray of n extracted wavelengths
errorsArray of n extracted errors
nLength of intens, wl and errors [needs to be 8]
Returns
cpl_bivector with intensity spectrum and error, needs to be de-allocated by caller.

The calculation is a simple sum of input spectra, divided by half the number of spectra, since two pol-beams together make up one unit intensity.

Important : the first of the 8 input wavelength vectors (wl[0]) is the reference one for which the output parameters shall be computed

Definition at line 528 of file cr2res_pol.c.

References cr2res_pol_resample().

◆ cr2res_pol_demod_null()

cpl_bivector * cr2res_pol_demod_null ( cpl_vector **  intens,
cpl_vector **  wl,
cpl_vector **  errors,
int  n 
)

Demodulate extracted spectra into Null spectrum.

Parameters
intensArray of n extracted intensities
wlArray of n extracted wavelengths
errorsArray of n extracted errors
nLength of intens, wl and errors [needs to be 8]
Returns
cpl_bivector with Null spectrum and error, needs to be de-allocated by caller.

The input list of spectra needs to come in this order: 1u, 1d, 2u , 2d, 3u, 3d, 4u, 4d i.e. first exposure upper beam, then down, then second exposure etc.

Demodulation formula is N = (R^1/4 - 1) / (R^1/4 + 1) , with R = 1u/1d * 2u/2d * 3d/3u * 4d/4u see equation 3 in Donati et al. 1997 bibcode: 1997MNRAS.291..658D This is analogous to the Stokes demodulation but the last two ratios are inverted which makes the true polarization signal cancel out. Thus the Null spectrum's deviation from zero is an inverse measure of quality. We simply re-use the Stokes demodulation after switching the spectra in the input order.

Important : the first of the 8 input wavelength vectors (wl[0]) is the reference one for which the output parameters shall be computed

Definition at line 410 of file cr2res_pol.c.

References cr2res_pol_demod_stokes().

◆ cr2res_pol_demod_stokes()

cpl_bivector * cr2res_pol_demod_stokes ( cpl_vector **  intens,
cpl_vector **  wl,
cpl_vector **  errors,
int  n 
)

Demodulate extracted spectra into Stokes parameter.

Parameters
intensArray of n extracted intensities
wlArray of n extracted wavelengths
errorsArray of n extracted errors
nLength of intens, wl and errors [needs to be 8]
Returns
cpl_bivector with Stokes parameter spectrum (P/I) and error, needs to be de-allocated by caller.

The input list of the n spectra needs to come in this order: 1u, 1d, 2u , 2d, 3u, 3d, 4u, 4d i.e. first exposure upper beam, then down, then second exposure etc.

The demodulation formula is P/I = (R^1/4 - 1) / (R^1/4 + 1) with R = 1u/1d * 2d/2u * 3d/3u * 4u/4d see equation 2 in Donati et al. 1997 bibcode: 1997MNRAS.291..658D Important : the first of the 8 input wavelength vectors (wl[0]) is the reference one for which the output parameters shall be computed

Definition at line 106 of file cr2res_pol.c.

References cr2res_pol_resample().

Referenced by cr2res_pol_demod_null().

◆ cr2res_pol_get_beam_trace()

cpl_table * cr2res_pol_get_beam_trace ( const cpl_table *  tw_in,
cr2res_decker  decker_position,
int  up_or_down 
)

Compute the traces for the polarimetric beams.

Parameters
tw_inThe input traces
decker_nameThe decker name
up_downUpper or lower beam
Returns
The newly computed trace

Uses hardcoded correction polynomials to account for the diverging beams

Definition at line 970 of file cr2res_pol.c.

References cr2res_get_trace_wave_poly(), and cr2res_trace_new_slit_fraction().

◆ cr2res_pol_POL_SPEC_create()

cpl_table * cr2res_pol_POL_SPEC_create ( int *  orders,
cpl_vector **  wl,
cpl_bivector **  stokes,
cpl_bivector **  null,
cpl_bivector **  intens,
int  norders 
)

Create the POL_SPEC table to be saved.

Parameters
ordersList of orders
wlWavelength for the different orders
stokesStokes parameters for the different orders with errors
nullNull parameters for the different orders with errors
intensIntensity for the different orders with errors
nordersNumber of orders
Returns
the POL_SPEC table or NULL

Definition at line 696 of file cr2res_pol.c.

References cr2res_dfs_POL_INTENS_colname(), cr2res_dfs_POL_INTENS_ERROR_colname(), cr2res_dfs_POL_NULL_colname(), cr2res_dfs_POL_NULL_ERROR_colname(), cr2res_dfs_POL_STOKES_colname(), cr2res_dfs_POL_STOKES_ERROR_colname(), and cr2res_dfs_POL_WAVELENGTH_colname().

◆ cr2res_pol_resample()

int cr2res_pol_resample ( cpl_vector **  intens,
cpl_vector **  wl,
cpl_vector **  errors,
int  n,
cpl_vector **  xmin,
cpl_vector **  xmax 
)

Resample all spectra to the same wavelength grid.

Parameters
intensvectors to be resampled
wlwavelengths of those vectors
errorsuncertainties of the vectors
nnumber of spectra
Returns
0 on success, != 0 on failure

Important : the first of the 8 input wavelength vectors (wl[0]) is the reference one for which the output parameters shall be computed

Definition at line 289 of file cr2res_pol.c.

Referenced by cr2res_pol_demod_intens(), and cr2res_pol_demod_stokes().

◆ cr2res_pol_sort_frames()

int * cr2res_pol_sort_frames ( const cpl_frame *  frame1,
const cpl_frame *  frame2,
const cpl_frame *  frame3,
const cpl_frame *  frame4 
)

Compute the positions of the passed frames.

Parameters
frame1Frame #1
frame2Frame #2
frame3Frame #3
frame4Frame #4
Returns
an array of 4 integer indices or NULL in error case

If the Out array is giving the new position : ordering[0] is the position of frame1, ordering[1] is the position of frame2, etc... If the Frames order needs to be Frame #4, #1, #3, #2, ordering will contain [3, 0, 2, 1]

The returned positions correspond to the 1,2,3,4 inputs in the demod fuctions.

Definition at line 833 of file cr2res_pol.c.

References cr2res_pfits_get_poltype().

◆ cr2res_pol_spec_pol_merge()

cpl_table * cr2res_pol_spec_pol_merge ( const cpl_table **  pol_spec_list,
int  pol_spec_nb 
)

Merge several POL_SPEC tables together, by averaging.

Parameters
pol_spec_listThe list of tables
pol_spec_nbThe number of tables in list
Returns
A merged table of the same format.

Definition at line 915 of file cr2res_pol.c.