|
GRAVI Pipeline Reference Manual 1.9.2
|
#include "gravi_astrometry.h"#include "gravi_dfs.h"#include "gravi_pfits.h"#include "gravi_utils.h"#include <assert.h>#include <ctype.h>#include <math.h>#include <gsl/gsl_matrix.h>#include <gsl/gsl_vector.h>#include <gsl/gsl_blas.h>#include <gsl/gsl_complex.h>#include <gsl/gsl_complex_math.h>#include <gsl/gsl_statistics.h>#include <gsl/gsl_multimin.h>Go to the source code of this file.
Data Structures | |
| struct | _astrometry_data_ |
| struct | _gravi_astrometry_model_params_ |
Macros | |
| #define | PI 3.14159265359 |
| #define | TWOPI 6.28318530718 |
| #define | MAS_TO_RAD (2.0 * PI / (3600 * 360 * 1000)) |
Typedefs | |
| typedef enum _find_closest_mode | find_closest_mode |
| typedef struct _gravi_astrometry_model_params_ | gravi_astrometry_model_params |
Enumerations | |
| enum | _find_closest_mode { FIND_MODE_NONE , FIND_MODE_BEFORE , FIND_MODE_AFTER } |
Functions | |
| static gsl_vector * | load_vector (cpl_table *table, const char *name) |
| Load data from table into GSL vector. | |
| static gsl_matrix * | load_matrix (cpl_table *table, const char *name) |
| Load data from table into GSL matrix. Each table row is copied into the corresponding matrix row. | |
| static gsl_matrix_complex * | load_matrix_complex (cpl_table *table, const char *name) |
| Load data from table into GSL matrix. Each table row is copied into the corresponding matrix row. | |
| static cpl_error_code | gravi_astrometry_scale_visibilities (astro_data *self, double factor) |
| Scale VISDATA, VISREF, errors by scalar factor. | |
| static cpl_error_code | gravi_astrometry_mul_visibilities (astro_data *self, const gsl_vector *factor) |
| Scale VISDATA, VISREF, errors by vector factor, broadcasting over wavelength axis. | |
| static cpl_error_code | gravi_astrometry_add_phase (astro_data *self, const gsl_matrix *phase) |
| Add phase to visRef, updating errors accordingly. | |
| static cpl_error_code | gravi_astrometry_recentre_phase (astro_data *self, double xvalue, double yvalue) |
| Recentre visRef and visRefError on the given position (in mas) by shifting the phases. | |
| static cpl_size | gravi_astrometry_find_closest_mjd (astro_data *self, astro_data **others, cpl_size n_other, find_closest_mode mode) |
| Given observation and list of reference observations, find closest in time from the list. | |
| static gsl_vector * | average_vector_over_dits (gsl_vector *v, int ndit, int nchannel) CPL_ATTR_ALLOC |
| static gsl_matrix * | average_matrix_over_dits (gsl_matrix *m, int ndit, int nchannel, int nwave, gsl_matrix_int *flag) CPL_ATTR_ALLOC |
| static gsl_matrix_complex * | average_matrix_complex_over_dits (gsl_matrix_complex *m, int ndit, int nchannel, int nwave, gsl_matrix_int *flag) CPL_ATTR_ALLOC |
| static astro_data * | gravi_astrometry_average_over_dits (astro_data *self) |
| Average input astro_data over DITs and return new flattened astro_data. | |
| static gsl_matrix_complex * | gravi_astrometry_calculate_visref_swap (astro_data **data, cpl_size ndata, double ra, double dec) CPL_ATTR_ALLOC |
| static gsl_matrix_complex * | gravi_astrometry_create_swap_reference (astro_data **swap_data, cpl_size nswap) |
| Centre swap data on zero OPD and extract average phase. | |
| static double | gravi_astrometry_calculate_chi2 (const gsl_vector *X, void *params) |
| Evaluate chi^2 statistic. | |
| static cpl_error_code | gravi_astrometry_minimise_chi2_grid (gravi_astrometry_model_params *params, const gsl_vector *ra_grid, const gsl_vector *dec_grid, gsl_vector *ra_dec_out, gsl_matrix *chi2_map) |
| static cpl_error_code | gravi_astrometry_minimise_chi2_descent (gravi_astrometry_model_params *params, double ra_guess, double dec_guess, gsl_vector *Xsolve) |
| static int | _gsl_vector_int_sum (const gsl_vector_int *a) |
| cpl_error_code | gravi_astrometry_filter_ftflux (astro_data *self, double threshold) |
| Filter based on FT flux threshold and normalise. | |
| cpl_error_code | gravi_astrometry_normalise_to_ft (astro_data *self) |
| Normalise visibilities to average FT flux. | |
| astro_data * | gravi_astrometry_load (gravi_data *data) |
| Load data for astrometry from a gravi_data. | |
| cpl_error_code | gravi_astrometry_dump (astro_data *self, FILE *handle) |
| void | gravi_astrometry_delete (astro_data *self) |
| double | gravi_astrometry_get_mean_ftflux (astro_data *self) |
| cpl_error_code | gravi_astrometry_create_phase_reference (astro_data *self, astro_data **phase_refs, cpl_size nphase, astro_data **swaps, cpl_size nswap, cpl_parameterlist *parlist) |
| Compute the final astrometric phase reference. | |
| cpl_table * | gravi_astrometry_get_phase_reference (astro_data *self) |
| cpl_error_code | gravi_astrometry_reduce_swaps (astro_data **swap_data, cpl_size nswap, cpl_parameterlist *parlist) |
| #define MAS_TO_RAD (2.0 * PI / (3600 * 360 * 1000)) |
Definition at line 48 of file gravi_astrometry.c.
| #define PI 3.14159265359 |
Definition at line 46 of file gravi_astrometry.c.
| #define TWOPI 6.28318530718 |
Definition at line 47 of file gravi_astrometry.c.
| typedef enum _find_closest_mode find_closest_mode |
| typedef struct _gravi_astrometry_model_params_ gravi_astrometry_model_params |
| enum _find_closest_mode |
| Enumerator | |
|---|---|
| FIND_MODE_NONE | |
| FIND_MODE_BEFORE | |
| FIND_MODE_AFTER | |
Definition at line 89 of file gravi_astrometry.c.
|
static |
Definition at line 126 of file gravi_astrometry.c.
Referenced by gravi_astrometry_average_over_dits().
|
static |
Definition at line 1122 of file gravi_astrometry.c.
Referenced by gravi_astrometry_average_over_dits(), gravi_astrometry_create_phase_reference(), and gravi_astrometry_create_swap_reference().
|
static |
Definition at line 1089 of file gravi_astrometry.c.
Referenced by gravi_astrometry_average_over_dits(), and gravi_astrometry_create_phase_reference().
|
static |
Definition at line 1077 of file gravi_astrometry.c.
Referenced by gravi_astrometry_average_over_dits().
|
static |
Add phase to visRef, updating errors accordingly.
Definition at line 294 of file gravi_astrometry.c.
References FREE, _astrometry_data_::nchannel, _astrometry_data_::ndit, _astrometry_data_::nwave, _astrometry_data_::vis_ref, _astrometry_data_::vis_ref_cov, and _astrometry_data_::vis_ref_pcov.
Referenced by gravi_astrometry_load(), and gravi_astrometry_recentre_phase().
|
static |
Average input astro_data over DITs and return new flattened astro_data.
Definition at line 1158 of file gravi_astrometry.c.
References _gsl_vector_int_sum(), average_matrix_complex_over_dits(), average_matrix_over_dits(), average_vector_over_dits(), cpl_msg_debug(), _astrometry_data_::dit, _astrometry_data_::filename, _astrometry_data_::flag, gravi_astrometry_recentre_phase(), _astrometry_data_::insname, _astrometry_data_::mjd, _astrometry_data_::nchannel, _astrometry_data_::ndit, _astrometry_data_::nflag, _astrometry_data_::nwave, _astrometry_data_::nwave_ft, _astrometry_data_::sobj_x, _astrometry_data_::sobj_y, _astrometry_data_::swap, _astrometry_data_::u, _astrometry_data_::ucoord, _astrometry_data_::v, _astrometry_data_::vcoord, _astrometry_data_::vis_ref, _astrometry_data_::vis_ref_cov, _astrometry_data_::vis_ref_pcov, _astrometry_data_::visdata, and _astrometry_data_::wave.
Referenced by gravi_astrometry_reduce_swaps().
|
static |
Evaluate chi^2 statistic.
| x | Vector of model parameters [ra, dec]. |
| params | Fit parameter values, of actual type gravi_astrometry_model_params. |
Definition at line 1297 of file gravi_astrometry.c.
References FREE, gravi_astrometry_calculate_visref_swap(), _gravi_astrometry_model_params_::group1, _gravi_astrometry_model_params_::group2, _gravi_astrometry_model_params_::n1, _gravi_astrometry_model_params_::n2, _astrometry_data_::nchannel, and _astrometry_data_::nwave.
Referenced by gravi_astrometry_minimise_chi2_descent(), and gravi_astrometry_minimise_chi2_grid().
|
static |
Definition at line 1237 of file gravi_astrometry.c.
References _astrometry_data_::flag, FREE, MAS_TO_RAD, _astrometry_data_::nchannel, _astrometry_data_::ndit, _astrometry_data_::nwave, _astrometry_data_::swap, TWOPI, _astrometry_data_::ucoord, _astrometry_data_::vcoord, and _astrometry_data_::vis_ref.
Referenced by gravi_astrometry_calculate_chi2().
| cpl_error_code gravi_astrometry_create_phase_reference | ( | astro_data * | self, |
| astro_data ** | phase_refs, | ||
| cpl_size | nphase, | ||
| astro_data ** | swaps, | ||
| cpl_size | nswap, | ||
| cpl_parameterlist * | parlist | ||
| ) |
Compute the final astrometric phase reference.
| self | astro_data to compute ref for. |
| phase_refs | list of astro_data to compute ref from. |
| nphase | length of list. |
| swaps | list of astro_data to compute swap ref from. |
| nswap | length of list. |
| parlist | recipe parameters, esp. "calib_strategy". |
Definition at line 772 of file gravi_astrometry.c.
References _astrometry_data_::amp_ref_astro, average_matrix_complex_over_dits(), average_matrix_over_dits(), cpl_msg_debug(), CPLCHECK_INT, _astrometry_data_::filename, FIND_MODE_AFTER, FIND_MODE_BEFORE, _astrometry_data_::flag, FREE, gravi_astrometry_find_closest_mjd(), _astrometry_data_::nchannel, _astrometry_data_::ndit, _astrometry_data_::nwave, _astrometry_data_::phase_ref_astro, _astrometry_data_::swap, and _astrometry_data_::vis_ref.
Referenced by gravity_astrometry().
|
static |
Centre swap data on zero OPD and extract average phase.
| swap_data | list of astro_data for swaps. |
| nswap | length of list. |
Definition at line 1634 of file gravi_astrometry.c.
References average_matrix_complex_over_dits(), FREE, gravi_astrometry_recentre_phase(), _astrometry_data_::nchannel, _astrometry_data_::ndit, _astrometry_data_::nwave, _astrometry_data_::swap, _astrometry_data_::swap_astrometry_fit, and _astrometry_data_::vis_ref.
Referenced by gravi_astrometry_reduce_swaps().
| void gravi_astrometry_delete | ( | astro_data * | self | ) |
Definition at line 666 of file gravi_astrometry.c.
References _astrometry_data_::amp_ref_astro, _astrometry_data_::filename, _astrometry_data_::flag, FREE, FREELOOP, _astrometry_data_::insname, _astrometry_data_::nchannel, _astrometry_data_::ndit, _astrometry_data_::opd_disp, _astrometry_data_::phase_met_telfc, _astrometry_data_::phase_ref, _astrometry_data_::phase_ref_astro, _astrometry_data_::u, _astrometry_data_::v, _astrometry_data_::vis_ref, _astrometry_data_::vis_ref_cov, _astrometry_data_::vis_ref_pcov, _astrometry_data_::visdata, _astrometry_data_::visdata_ft, _astrometry_data_::viserr, and _astrometry_data_::wave.
Referenced by gravi_astrometry_reduce_swaps(), gravity_astrometry(), and load_data().
| cpl_error_code gravi_astrometry_dump | ( | astro_data * | self, |
| FILE * | handle | ||
| ) |
Definition at line 647 of file gravi_astrometry.c.
References _astrometry_data_::filename, _astrometry_data_::flag, _astrometry_data_::insname, _astrometry_data_::nchannel, _astrometry_data_::ndit, _astrometry_data_::nwave, _astrometry_data_::ucoord, _astrometry_data_::vcoord, _astrometry_data_::vis_ref, and _astrometry_data_::visdata.
| cpl_error_code gravi_astrometry_filter_ftflux | ( | astro_data * | self, |
| double | threshold | ||
| ) |
Filter based on FT flux threshold and normalise.
Definition at line 373 of file gravi_astrometry.c.
References cpl_msg_debug(), _astrometry_data_::flag, _astrometry_data_::nchannel, _astrometry_data_::ndit, _astrometry_data_::nflag, _astrometry_data_::nwave, _astrometry_data_::nwave_ft, _astrometry_data_::visdata, and _astrometry_data_::visdata_ft.
Referenced by gravity_astrometry().
|
static |
Given observation and list of reference observations, find closest in time from the list.
| self | baseline astro_data. |
| others | list of reference astro_data. |
| n_other | length of list. |
| mode | if FIND_MODE_BEFORE, require closest that precedes. If FIND_MODE_AFTER, require closest that succeeds. Else, return closest regardless of sign of time difference. |
Definition at line 719 of file gravi_astrometry.c.
References FIND_MODE_AFTER, FIND_MODE_BEFORE, and _astrometry_data_::mjd.
Referenced by gravi_astrometry_create_phase_reference().
| double gravi_astrometry_get_mean_ftflux | ( | astro_data * | self | ) |
Definition at line 695 of file gravi_astrometry.c.
References _astrometry_data_::nchannel, _astrometry_data_::ndit, _astrometry_data_::nwave_ft, and _astrometry_data_::visdata_ft.
Referenced by gravity_astrometry().
| cpl_table * gravi_astrometry_get_phase_reference | ( | astro_data * | self | ) |
Return CPL table with the final astrometric phase reference. Return CPL table with the final astrometric phase reference.
| self | astro_data to extract table from. |
Definition at line 1020 of file gravi_astrometry.c.
References _astrometry_data_::amp_ref_astro, CPLCHECK_NUL, FREE, _astrometry_data_::nchannel, _astrometry_data_::ndit, _astrometry_data_::nwave, _astrometry_data_::phase_ref_astro, _astrometry_data_::vis_ref_cov, and _astrometry_data_::vis_ref_pcov.
Referenced by gravity_astrometry().
| astro_data * gravi_astrometry_load | ( | gravi_data * | data | ) |
Load data for astrometry from a gravi_data.
Definition at line 441 of file gravi_astrometry.c.
References _astrometry_data_::amp_ref_astro, cpl_msg_debug(), _astrometry_data_::dit, _astrometry_data_::filename, _astrometry_data_::flag, FREE, gravi_astrometry_add_phase(), gravi_astrometry_scale_visibilities(), gravi_data_get_header, gravi_data_get_oi_vis, gravi_data_get_oi_wave, gravi_data_get_oi_wave_plist, GRAVI_FT, GRAVI_SC, _astrometry_data_::insname, load_matrix(), load_matrix_complex(), load_vector(), _astrometry_data_::mjd, _astrometry_data_::nchannel, _astrometry_data_::ndit, _astrometry_data_::nflag, _astrometry_data_::nwave, _astrometry_data_::nwave_ft, _astrometry_data_::opd_disp, _astrometry_data_::phase_met_telfc, _astrometry_data_::phase_ref, _astrometry_data_::phase_ref_astro, _astrometry_data_::sobj_x, _astrometry_data_::sobj_y, _astrometry_data_::swap, TWOPI, _astrometry_data_::u, _astrometry_data_::ucoord, _astrometry_data_::v, _astrometry_data_::vcoord, _astrometry_data_::vis_ref, _astrometry_data_::vis_ref_cov, _astrometry_data_::vis_ref_pcov, _astrometry_data_::visdata, _astrometry_data_::visdata_ft, _astrometry_data_::viserr, and _astrometry_data_::wave.
Referenced by load_data().
|
static |
Definition at line 1373 of file gravi_astrometry.c.
References cpl_msg_debug(), FREE, and gravi_astrometry_calculate_chi2().
Referenced by gravi_astrometry_reduce_swaps().
|
static |
Definition at line 1331 of file gravi_astrometry.c.
References cpl_msg_debug(), and gravi_astrometry_calculate_chi2().
Referenced by gravi_astrometry_reduce_swaps().
|
static |
Scale VISDATA, VISREF, errors by vector factor, broadcasting over wavelength axis.
| self | astro_data to modify inplace. |
| factor | vector of scaling factors, of size self->ndit * self->nchannel. |
Definition at line 258 of file gravi_astrometry.c.
References FREE, _astrometry_data_::nchannel, _astrometry_data_::ndit, _astrometry_data_::nwave, _astrometry_data_::nwave_ft, _astrometry_data_::vis_ref, _astrometry_data_::vis_ref_cov, _astrometry_data_::vis_ref_pcov, _astrometry_data_::visdata, and _astrometry_data_::visdata_ft.
Referenced by gravi_astrometry_normalise_to_ft().
| cpl_error_code gravi_astrometry_normalise_to_ft | ( | astro_data * | self | ) |
Normalise visibilities to average FT flux.
Definition at line 423 of file gravi_astrometry.c.
References FREE, gravi_astrometry_mul_visibilities(), _astrometry_data_::nchannel, _astrometry_data_::ndit, _astrometry_data_::nwave, _astrometry_data_::nwave_ft, and _astrometry_data_::visdata_ft.
Referenced by gravity_astrometry().
|
static |
Recentre visRef and visRefError on the given position (in mas) by shifting the phases.
Definition at line 349 of file gravi_astrometry.c.
References FREE, gravi_astrometry_add_phase(), MAS_TO_RAD, _astrometry_data_::nchannel, _astrometry_data_::ndit, _astrometry_data_::nwave, TWOPI, _astrometry_data_::ucoord, and _astrometry_data_::vcoord.
Referenced by gravi_astrometry_average_over_dits(), and gravi_astrometry_create_swap_reference().
| cpl_error_code gravi_astrometry_reduce_swaps | ( | astro_data ** | swap_data, |
| cpl_size | nswap, | ||
| cpl_parameterlist * | parlist | ||
| ) |
Definition at line 1423 of file gravi_astrometry.c.
References cpl_msg_debug(), CPLCHECK_CLEAN, CPLCHECK_MSG, FREE, FREELOOP, gravi_astrometry_average_over_dits(), gravi_astrometry_create_swap_reference(), gravi_astrometry_delete(), gravi_astrometry_minimise_chi2_descent(), gravi_astrometry_minimise_chi2_grid(), _gravi_astrometry_model_params_::group1, _astrometry_data_::phase_ref_astro, _astrometry_data_::sobj_x, _astrometry_data_::sobj_y, _astrometry_data_::swap, _astrometry_data_::swap_astrometry_fit, and _astrometry_data_::swap_astrometry_guess.
Referenced by gravity_astrometry().
|
static |
Scale VISDATA, VISREF, errors by scalar factor.
| self | astro_data to modify inplace. |
| factor | scaling factor. |
Definition at line 234 of file gravi_astrometry.c.
References _astrometry_data_::nchannel, _astrometry_data_::ndit, _astrometry_data_::vis_ref, _astrometry_data_::vis_ref_cov, _astrometry_data_::vis_ref_pcov, _astrometry_data_::visdata, and _astrometry_data_::visdata_ft.
Referenced by gravi_astrometry_load().
|
static |
Load data from table into GSL matrix. Each table row is copied into the corresponding matrix row.
Definition at line 167 of file gravi_astrometry.c.
Referenced by gravi_astrometry_load().
|
static |
Load data from table into GSL matrix. Each table row is copied into the corresponding matrix row.
Definition at line 198 of file gravi_astrometry.c.
Referenced by gravi_astrometry_load().
|
static |
Load data from table into GSL vector.
Definition at line 141 of file gravi_astrometry.c.
Referenced by gravi_astrometry_load().