Open source Very Long Baseline Interferometry
OpenVLBI
vlbi.h
1/* OpenVLBI - Open Source Very Long Baseline Interferometry
2* Copyright © 2017-2022 Ilia Platone
3*
4* This program is free software; you can redistribute it and/or
5* modify it under the terms of the GNU Lesser General Public
6* License as published by the Free Software Foundation; either
7* version 3 of the License, or (at your option) any later version.
8*
9* This program is distributed in the hope that it will be useful,
10* but WITHOUT ANY WARRANTY; without even the implied warranty of
11* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12* Lesser General Public License for more details.
13*
14* You should have received a copy of the GNU Lesser General Public License
15* along with this program; if not, write to the Free Software Foundation,
16* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17*/
18
19#ifndef _VLBI_H
20#define _VLBI_H
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26#include <stdio.h>
27#include <stdlib.h>
28#include <math.h>
29#include <time.h>
30#include <errno.h>
31#include <unistd.h>
32#include <string.h>
33#include <math.h>
34#include <float.h>
35#include <libgen.h>
36#include <sys/types.h>
37#include <assert.h>
38#include <pthread.h>
39#include <dsp.h>
40
41#ifndef DLL_EXPORT
42#define DLL_EXPORT extern
43#endif
278typedef struct {
282 double *Location;
284 int Geo;
288 char *Name;
290 int Index;
291} vlbi_node;
292
294typedef struct {
300 double *Target;
302 double Ra;
304 double Dec;
306 double *baseline;
308 double u;
310 double v;
312 double delay;
322 char *Name;
326
337typedef double(* vlbi_func2_t)(double, double);
338
340typedef void* vlbi_context;
341
343typedef struct timespec timespec_t;
350#ifndef Min
352#define Min(a,b) \
353 ({ __typeof (a) _a = (a); \
354 __typeof (b) _b = (b); \
355 _a < _b ? _a : _b; })
356#endif
357#ifndef Max
359#define Max(a,b) \
360 ({ __typeof (a) _a = (a); \
361 __typeof (b) _b = (b); \
362 _a > _b ? _a : _b; })
363#endif
364#ifndef Log
366#define Log(a,b) \
367( log(a) / log(b) )
368#endif
369
370#ifndef hz2rad
372#define hz2rad(hz) (2.0*PI*hz)
373#endif
374
375#ifndef sinpsin
377#define sinpsin(s1, s2) (2.0*sin((asin(s1)+asin(s2))/2.0)*cos((asin(s1)-asin(s2))/2.0))
378#endif
379
380#ifndef sinmsin
382#define sinmsin(s1, s2) (2.0*cos((asin(s1)+asin(s2))/2.0)*sin((asin(s1)-asin(s2))/2.0))
383#endif
384
385#ifndef cospcos
387#define cospcos(c1, c2) (2.0*cos((acos(s1)+acos(s2))/2.0)*cos((acos(s1)-acos(s2))/2.0))
388#endif
389
390#ifndef cosmcos
392#define cosmcos(c1, c2) (2.0*sin((acos(s1)+acos(s2))/2.0)*sin((acos(s1)-acos(s2))/2.0))
393#endif
394
395#ifndef sinxsin
397#define sinxsin(s1, s2) ((cos(asin(s1)-asin(s2))-cos(asin(s1)+asin(s2)))/2.0)
398#endif
399
400#ifndef cosxcos
402#define cosxcos(c1, c2) ((cos(acos(s1)+acos(s2))+cos(acos(s1)-acos(s2)))/2.0)
403#endif
404
405#ifndef sinxcos
407#define sinxcos(s, c) ((sin(asin(s)+acos(c))+sin(asin(s)-acos(c)))/2.0)
408#endif
409
410#ifndef sin2cos
412#define sin2cos(s) cos(asin(s))
413#endif
414
415#ifndef cos2sin
417#define cos2sin(c) sin(acos(c))
418#endif
419
420#ifndef VLBI_VERSION_STRING
422#define VLBI_VERSION_STRING "1.23.2"
423#endif
424
425#ifndef VLBI_CATALOG_PATH
427#define VLBI_CATALOG_PATH "/usr/share/OpenVLBI/cat/index.txt"
428#endif
429
430#ifndef CIRCLE_DEG
432#define CIRCLE_DEG 360.0
433#endif
434#ifndef CIRCLE_AM
436#define CIRCLE_AM (CIRCLE_DEG * 60.0)
437#endif
438#ifndef CIRCLE_AS
440#define CIRCLE_AS (CIRCLE_AM * 60.0)
441#endif
442#ifndef RAD_AS
444#define RAD_AS (CIRCLE_AS/(PI*2.0))
445#endif
446#ifndef ONE_SECOND_TICKS
448#define ONE_SECOND_TICKS 100000000
449#endif
450#ifndef ONE_MILLISECOND_TICKS
452#define ONE_MILLISECOND_TICKS 100000
453#endif
454#ifndef ONE_MICROSECOND_TICKS
456#define ONE_MICROSECOND_TICKS 100
457#endif
458#ifndef SOLAR_DAY
460#define SOLAR_DAY 86400
461#endif
462#ifndef SIDEREAL_DAY
464#define SIDEREAL_DAY 86164.0905
465#endif
466#ifndef TRACKRATE_SIDEREAL
468#define TRACKRATE_SIDEREAL (CIRCLE_AS / SIDEREAL_DAY)
469#endif
470#ifndef TRACKRATE_SOLAR
472#define TRACKRATE_SOLAR (CIRCLE_AS / SOLAR_DAY)
473#endif
474#ifndef TRACKRATE_LUNAR
476#define TRACKRATE_LUNAR 14.511415
477#endif
478#ifndef EARTHRADIUSEQUATORIAL
480#define EARTHRADIUSEQUATORIAL 6378137.0
481#endif
482#ifndef EARTHRADIUSPOLAR
484#define EARTHRADIUSPOLAR 6356752.0
485#endif
486#ifndef EARTHRADIUSMEAN
488#define EARTHRADIUSMEAN 6372797.0
489#endif
490#ifndef AVOGADRO
492#define AVOGADRO 6.02214076E+23
493#endif
494#ifndef EULER
496#define EULER 2.71828182845904523536028747135266249775724709369995
497#endif
498#ifndef PLANK
500#define PLANK 6.62607015E-34
501#endif
502#ifndef BOLTSMANN
504#define BOLTSMANN 1.380649E-23
505#endif
506#ifndef STEPHAN_BOLTSMANN
508#define STEPHAN_BOLTSMANN (2.0*pow(PI, 5)*pow(BOLTSMANN, 2)/(pow(LIGHTSPEED, 2)*15*pow(PLANK, 3)))
509#endif
510#ifndef GAS_R
512#define GAS_R (BOLTSMANN * AVOGADRO)
513#endif
514#ifndef ROOT2
516#define ROOT2 1.41421356237309504880168872420969807856967187537694
517#endif
518#ifndef PI
520#define PI 3.14159265358979323846
521#endif
522#ifndef AIRY
524#define AIRY 1.21966
525#endif
526#ifndef LIGHTSPEED
528#define LIGHTSPEED 299792458.0
529#endif
530#ifndef J2000
532#define J2000 2451545.0
533#endif
534#ifndef GAMMAJ2000
536#define GAMMAJ2000 18.6971378528
537#endif
538#ifndef ELECTRON
540#define ELECTRON 1.602176634E-19
541#endif
542#ifndef CANDLE
544#define CANDLE 0.683
545#endif
546#ifndef ASTRONOMICALUNIT
548#define ASTRONOMICALUNIT 1.495978707E+11
549#endif
550#ifndef PARSEC
552#define PARSEC (ASTRONOMICALUNIT/sin(PI*2.0/CIRCLE_AS))
553#endif
554#ifndef LY
556#define LY (LIGHTSPEED * SIDEREAL_DAY * 365.0)
557#endif
558#ifndef AU2M
564#define AU2M(au) (au * ASTRONOMICALUNIT)
565#endif
566#ifndef PARSEC2M
572#define PARSEC2M(parsec) (parsec * PARSEC)
573#endif
574#ifndef LY2M
580#define LY2M(ly) (ly * LY)
581#endif
582#ifndef M2AU
588#define M2AU(m) (m / ASTRONOMICALUNIT)
589#endif
590#ifndef M2PARSEC
596#define M2PARSEC(m) (m / PARSEC)
597#endif
598#ifndef M2LY
604#define M2LY(m) (m / LY)
605#endif
606#ifndef RAD2AS
612#define RAD2AS(rad) (rad * RAD_AS)
613#endif
614#ifndef AS2RAD
620#define AS2RAD(as) (as / RAD_AS);
621#endif
622
630inline double vlbi_default_delegate(double x, double y) {
631 return x*y;
632}
633
642inline double vlbi_magnitude_delegate(double x, double y) {
643 return sqrt(pow(x, 2)+pow(y, 2));
644}
645
654inline double vlbi_phase_delegate(double x, double y) {
655 double mag = sqrt(pow(x, 2)+pow(y, 2));
656 double rad = 0.0;
657 if(mag > 0.0) {
658 rad = acos (y / (mag > 0.0 ? mag : 1.0));
659 if(x < 0 && rad != 0)
660 rad = PI*2-rad;
661 }
662 return rad;
663}
664
672inline double vlbi_magnitude_correlator_delegate(double x, double y) {
673 return x*y;
674}
675
683inline double vlbi_phase_correlator_delegate(double x, double y) {
684 return sinxsin(x, y);
685}
686
698DLL_EXPORT unsigned long int vlbi_max_threads(unsigned long value);
699
704DLL_EXPORT const char *vlbi_get_version(void);
705
710DLL_EXPORT vlbi_context vlbi_init(void);
711
716DLL_EXPORT void vlbi_exit(vlbi_context ctx);
717
731DLL_EXPORT void vlbi_add_node(vlbi_context ctx, dsp_stream_p Stream, const char *name, int geographic_coordinates);
732
739DLL_EXPORT void vlbi_copy_node(void *ctx, const char *name, const char *node);
740
747DLL_EXPORT dsp_stream_p vlbi_get_node(void *ctx, const char *name);
748
755DLL_EXPORT int vlbi_has_node(void *ctx, const char *name);
756
762DLL_EXPORT void vlbi_del_node(vlbi_context ctx, const char *name);
763
770DLL_EXPORT int vlbi_get_nodes(void *ctx, vlbi_node** nodes);
771
779DLL_EXPORT void vlbi_add_node_from_fits(void *ctx, char *filename, const char *name, int geo);
780
788DLL_EXPORT void vlbi_add_nodes_from_sdfits(void *ctx, char *filename, const char *name, int geo);
789
797DLL_EXPORT void vlbi_filter_lp_node(void *ctx, const char *name, const char *node, double radians);
798
806DLL_EXPORT void vlbi_filter_hp_node(void *ctx, const char *name, const char *node, double radians);
807
816DLL_EXPORT void vlbi_filter_bp_node(void *ctx, const char *name, const char *node, double lo_radians, double hi_radians);
817
826DLL_EXPORT void vlbi_filter_br_node(void *ctx, const char *name, const char *node, double lo_radians, double hi_radians);
827
840DLL_EXPORT int vlbi_get_baselines(void *ctx, vlbi_baseline** baselines);
841
853DLL_EXPORT void vlbi_set_baseline_buffer(void *ctx, const char *node1, const char *node2, complex_t *buffer, int len);
854
862DLL_EXPORT dsp_stream_p vlbi_get_baseline_stream(void *ctx, const char *node1, const char *node2);
863
870DLL_EXPORT void vlbi_unlock_baseline(void *ctx, const char *node1, const char *node2);
871
882DLL_EXPORT void vlbi_set_baseline_stream(void *ctx, const char *node1, const char *node2, dsp_stream_p stream);
883
891DLL_EXPORT void vlbi_set_location(void *ctx, double lat, double lon, double el);
892
904DLL_EXPORT void vlbi_get_offsets(vlbi_context ctx, double J2000Time, const char* node1, const char* node2, double Ra, double Dec, double *offset1, double *offset2);
905
926DLL_EXPORT void vlbi_get_uv_plot(void *ctx, const char *name, int u, int v, double *target, double freq, double sr, int nodelay, int moving_baseline, vlbi_func2_t delegate, int *interrupt);
927
934DLL_EXPORT void vlbi_add_model(vlbi_context ctx, dsp_stream_p Stream, const char *name);
935
942DLL_EXPORT void vlbi_copy_model(void *ctx, const char *name, const char *node);
943
949DLL_EXPORT void vlbi_del_model(vlbi_context ctx, const char *name);
950
957DLL_EXPORT int vlbi_get_models(void *ctx, dsp_stream_p** models);
958
965DLL_EXPORT dsp_stream_p vlbi_get_model(void *ctx, const char *name);
966
973DLL_EXPORT int vlbi_has_model(void *ctx, const char *name);
974
982DLL_EXPORT void vlbi_get_ifft(vlbi_context ctx, const char *name, const char *magnitude, const char *phase);
983
991DLL_EXPORT void vlbi_get_fft(vlbi_context ctx, const char *model, const char *magnitude, const char *phase);
992
1000DLL_EXPORT void vlbi_apply_mask(vlbi_context ctx, const char *name, const char *model, const char *mask);
1001
1009DLL_EXPORT void vlbi_apply_convolution_matrix(vlbi_context ctx, const char *name, const char *model, const char *matrix);
1010
1018DLL_EXPORT void vlbi_stack_models(vlbi_context ctx, const char *name, const char *model1, const char *model2);
1019
1027DLL_EXPORT void vlbi_diff_models(vlbi_context ctx, const char *name, const char *model1, const char *model2);
1028
1034DLL_EXPORT void vlbi_shift(vlbi_context ctx, const char *name);
1035
1042DLL_EXPORT void vlbi_add_model_from_png(void *ctx, char *filename, const char *name);
1043
1050DLL_EXPORT void vlbi_add_model_from_jpeg(void *ctx, char *filename, const char *name);
1051
1058DLL_EXPORT void vlbi_add_model_from_fits(void *ctx, char *filename, const char *name);
1059
1066DLL_EXPORT void vlbi_get_model_to_png(void *ctx, char *filename, const char *name);
1067
1074DLL_EXPORT void vlbi_get_model_to_jpeg(void *ctx, char *filename, const char *name);
1075
1082DLL_EXPORT void vlbi_get_model_to_fits(void *ctx, char *filename, const char *name);
1083
1097DLL_EXPORT double* vlbi_matrix_calc_baseline_center(double *loc1, double *loc2);
1098
1106DLL_EXPORT double* vlbi_matrix_calc_3d_projection(double alt, double az, double *baseline);
1107
1114DLL_EXPORT double* vlbi_matrix_calc_uv_coordinates(double *proj, double wavelength);
1115
1121DLL_EXPORT double* vlbi_matrix_calc_location(double *loc);
1122
1129DLL_EXPORT double vlbi_matrix_estimate_geocentric_elevation(double latitude, double sea_level_elevation);
1130
1136DLL_EXPORT double vlbi_matrix_estimate_resolution_zero(double frequency);
1137
1144DLL_EXPORT double vlbi_matrix_estimate_resolution(double resolution0, double baseline);
1145
1163DLL_EXPORT timespec_t vlbi_time_mktimespec(int year, int month, int dom, int hour, int minute, int second, long nanosecond);
1164
1171
1177DLL_EXPORT double vlbi_time_J2000time_to_lst(double secs_since_J2000, double Long);
1178
1184DLL_EXPORT timespec_t vlbi_time_string_to_timespec(const char *time);
1185
1191DLL_EXPORT timespec_t vlbi_time_J2000time_to_timespec(double secs_since_J2000);
1192
1204DLL_EXPORT double vlbi_astro_mean_speed(double speed);
1205
1216DLL_EXPORT void vlbi_astro_alt_az_from_ra_dec(double J2000time, double Ra, double Dec, double Lat, double Long, double* Alt, double *Az);
1217
1224DLL_EXPORT double vlbi_astro_get_local_hour_angle(double local_sideral_time, double ra);
1225
1234DLL_EXPORT void vlbi_astro_get_alt_az_coordinates(double hour_angle, double dec, double latitude, double* alt, double *az);
1235
1241DLL_EXPORT dsp_stream_p vlbi_astro_load_spectrum(char *filename);
1242
1250DLL_EXPORT int vlbi_astro_load_spectra_catalog(char *path, dsp_stream_p **catalog, int *catalog_size);
1251
1259
1265DLL_EXPORT void vlbi_astro_save_spectrum(dsp_stream_p stream, char *filename);
1266
1272DLL_EXPORT void vlbi_astro_scan_spectrum(dsp_stream_p stream, int sample_size);
1273
1283DLL_EXPORT dsp_align_info vlbi_astro_align_spectra(dsp_stream_p spectrum, dsp_stream_p catalog, int max_lines, double decimals, double min_score);
1284
1292DLL_EXPORT double vlbi_astro_diff_spectra(dsp_stream_p spectrum0, dsp_stream_p spectrum, double decades);
1293
1301DLL_EXPORT double vlbi_astro_flux_ratio(double flux0, double flux, double delta_spectrum);
1302
1309DLL_EXPORT double vlbi_astro_estimate_brightness_temperature(double wavelength, double flux);
1310
1317DLL_EXPORT double vlbi_astro_estimate_temperature(double wavelength, double flux);
1318
1325DLL_EXPORT double vlbi_astro_estimate_flux(double wavelength, double temperature);
1326
1333DLL_EXPORT double vlbi_astro_estimate_temperature_ratio(double rad_ratio, double flux_ratio);
1334
1341DLL_EXPORT double vlbi_astro_estimate_size_ratio(double luminosity_ratio, double temperature_ratio);
1342
1349DLL_EXPORT double vlbi_astro_estimate_luminosity_ratio(double size_ratio, double flux_ratio);
1350
1357DLL_EXPORT double vlbi_astro_estimate_distance_ratio(double luminosity_ratio, double flux_ratio);
1358
1365DLL_EXPORT double vlbi_astro_estimate_distance_parallax(double rad, double baseline);
1366
1373DLL_EXPORT double vlbi_astro_estimate_redshift(double wavelength0, int wavelength);
1374
1381DLL_EXPORT double vlbi_astro_estimate_size_transient(double transient_object_velocity, double transit_time);
1382
1389DLL_EXPORT double vlbi_astro_redshift_adjust(double distance, double redshift);
1390
1396DLL_EXPORT dsp_stream_p vlbi_file_read_fits(char *filename);
1397
1404DLL_EXPORT dsp_stream_p *vlbi_file_read_sdfits(char * filename, long *n);
1405
1411#ifdef __cplusplus
1412}
1413#endif
1414
1415#endif //_VLBI_H
1416
DLL_EXPORT double vlbi_astro_estimate_temperature(double wavelength, double flux)
Estimate the physical temperature with a given flux.
DLL_EXPORT dsp_stream_p vlbi_astro_create_reference_catalog(dsp_stream_p *catalog, int catalog_size)
Create a dsp_stream_p containing all the spectral lines of all elements of a catalog.
DLL_EXPORT double vlbi_astro_diff_spectra(dsp_stream_p spectrum0, dsp_stream_p spectrum, double decades)
Compare a spectrum to a reference one.
DLL_EXPORT dsp_stream_p * vlbi_file_read_sdfits(char *filename, long *n)
Returns the distance of a far object adjusted with its measured redshift.
DLL_EXPORT double vlbi_astro_estimate_distance_ratio(double luminosity_ratio, double flux_ratio)
Returns the distance ratio of two celestial object.
DLL_EXPORT dsp_align_info vlbi_astro_align_spectra(dsp_stream_p spectrum, dsp_stream_p catalog, int max_lines, double decimals, double min_score)
Align a spectrum to a reference catalog.
DLL_EXPORT double vlbi_astro_estimate_flux(double wavelength, double temperature)
Estimate the flux from a physical temperature.
DLL_EXPORT double vlbi_astro_estimate_distance_parallax(double rad, double baseline)
Returns the distance of an object from its parallax.
DLL_EXPORT dsp_stream_p vlbi_astro_load_spectrum(char *filename)
Load a spectrum file.
DLL_EXPORT int vlbi_astro_load_spectra_catalog(char *path, dsp_stream_p **catalog, int *catalog_size)
Load a spectrum file catalog.
DLL_EXPORT double vlbi_astro_estimate_brightness_temperature(double wavelength, double flux)
Estimate the brightness temperature from a flux.
DLL_EXPORT double vlbi_astro_flux_ratio(double flux0, double flux, double delta_spectrum)
Returns the flux ratio of two objects.
DLL_EXPORT void vlbi_astro_alt_az_from_ra_dec(double J2000time, double Ra, double Dec, double Lat, double Long, double *Alt, double *Az)
Obtain the altitude and azimuth coordinate of a celestial coordinate at a specific time.
DLL_EXPORT void vlbi_astro_scan_spectrum(dsp_stream_p stream, int sample_size)
Scan a dsp_stream_p and detect the relevant spectral lines.
DLL_EXPORT void vlbi_astro_save_spectrum(dsp_stream_p stream, char *filename)
Save a spectrum stream into a file.
DLL_EXPORT void vlbi_astro_get_alt_az_coordinates(double hour_angle, double dec, double latitude, double *alt, double *az)
Returns alt-azimuth coordinates of an object.
DLL_EXPORT double vlbi_astro_estimate_luminosity_ratio(double size_ratio, double flux_ratio)
Returns the luminosity ratio between two celestial objects.
DLL_EXPORT double vlbi_astro_redshift_adjust(double distance, double redshift)
Returns the distance of a far object adjusted with its measured redshift.
DLL_EXPORT double vlbi_astro_estimate_temperature_ratio(double rad_ratio, double flux_ratio)
Returns the temperature ratio of two objects.
DLL_EXPORT double vlbi_astro_estimate_redshift(double wavelength0, int wavelength)
Returns the redshift of an object.
DLL_EXPORT dsp_stream_p vlbi_file_read_fits(char *filename)
Returns the distance of a far object adjusted with its measured redshift.
DLL_EXPORT double vlbi_astro_estimate_size_transient(double transient_object_velocity, double transit_time)
Returns the size of an object by the observation of a transient body.
DLL_EXPORT double vlbi_astro_estimate_size_ratio(double luminosity_ratio, double temperature_ratio)
Returns the size ratio of two objects.
DLL_EXPORT double vlbi_astro_get_local_hour_angle(double local_sideral_time, double ra)
Returns local hour angle of an object.
DLL_EXPORT double vlbi_astro_mean_speed(double speed)
Obtain or set the reference constant speed of the radiation to measure.
DLL_EXPORT dsp_stream_p vlbi_get_baseline_stream(void *ctx, const char *node1, const char *node2)
Obtain the baseline dsp_stream structure containing the complex visibility data.
DLL_EXPORT void vlbi_unlock_baseline(void *ctx, const char *node1, const char *node2)
Unlock the baseline and get visibility from its nodes correlations.
DLL_EXPORT void vlbi_get_offsets(vlbi_context ctx, double J2000Time, const char *node1, const char *node2, double Ra, double Dec, double *offset1, double *offset2)
Get the offsets of a single baseline nodes to the farest node to the target.
DLL_EXPORT void vlbi_set_baseline_buffer(void *ctx, const char *node1, const char *node2, complex_t *buffer, int len)
Fill the buffer of a single baseline with complex visibility data. This function locks this baeline a...
DLL_EXPORT int vlbi_get_baselines(void *ctx, vlbi_baseline **baselines)
List all baselines of the current OpenVLBI context.
DLL_EXPORT void vlbi_set_baseline_stream(void *ctx, const char *node1, const char *node2, dsp_stream_p stream)
Set the baseline dsp_stream structure containing the complex visibility data. This function locks thi...
DLL_EXPORT void vlbi_set_location(void *ctx, double lat, double lon, double el)
Set the location of the reference station.
#define sinxsin(s1, s2)
Multiply a sine to a sine.
Definition: vlbi.h:397
double vlbi_default_delegate(double x, double y)
A placeholder delegate that simply multiplies the values received from vlbi_get_uv_plot.
Definition: vlbi.h:630
#define PI
Our PI constant.
Definition: vlbi.h:520
double vlbi_magnitude_correlator_delegate(double x, double y)
A magnitude correlator delegate for vlbi_get_uv_plot.
Definition: vlbi.h:672
double vlbi_phase_correlator_delegate(double x, double y)
A phase correlator delegate for vlbi_get_uv_plot.
Definition: vlbi.h:683
double vlbi_phase_delegate(double x, double y)
A phase calculator delegate for vlbi_get_uv_plot.
Definition: vlbi.h:654
double vlbi_magnitude_delegate(double x, double y)
A magnitude calculator delegate for vlbi_get_uv_plot.
Definition: vlbi.h:642
DLL_EXPORT const char * vlbi_get_version(void)
Print the current version of OpenVLBI.
DLL_EXPORT void vlbi_exit(vlbi_context ctx)
Close a OpenVLBI instance.
DLL_EXPORT unsigned long int vlbi_max_threads(unsigned long value)
get/set the maximum number of threads allowed
DLL_EXPORT vlbi_context vlbi_init(void)
Initialize a OpenVLBI instance.
DLL_EXPORT double * vlbi_matrix_calc_baseline_center(double *loc1, double *loc2)
Return The baseline center in geographic coordinates.
DLL_EXPORT double * vlbi_matrix_calc_uv_coordinates(double *proj, double wavelength)
Return The UV coordinates of the current observation.
DLL_EXPORT double * vlbi_matrix_calc_3d_projection(double alt, double az, double *baseline)
Return The 3d projection of the current observation.
DLL_EXPORT double * vlbi_matrix_calc_location(double *loc)
Convert geographic location into xyz location.
DLL_EXPORT double vlbi_matrix_estimate_geocentric_elevation(double latitude, double sea_level_elevation)
Returns an estimation of the actual geocentric elevation.
DLL_EXPORT double vlbi_matrix_estimate_resolution_zero(double frequency)
Estimate the angular resolution of a 1 meter baseline at a given frequency.
DLL_EXPORT double vlbi_matrix_estimate_resolution(double resolution0, double baseline)
Estimate Signal to noise ratio after a given integration time.
DLL_EXPORT void vlbi_add_model_from_fits(void *ctx, char *filename, const char *name)
Add a model from a fits file.
DLL_EXPORT void vlbi_get_model_to_fits(void *ctx, char *filename, const char *name)
Write a model to a fits file.
DLL_EXPORT void vlbi_add_model(vlbi_context ctx, dsp_stream_p Stream, const char *name)
Add a model into the current OpenVLBI context.
DLL_EXPORT int vlbi_get_models(void *ctx, dsp_stream_p **models)
List all models of the current OpenVLBI context.
DLL_EXPORT void vlbi_get_model_to_jpeg(void *ctx, char *filename, const char *name)
Write a model to a jpeg file.
DLL_EXPORT void vlbi_stack_models(vlbi_context ctx, const char *name, const char *model1, const char *model2)
Stack two models into a new one.
DLL_EXPORT void vlbi_diff_models(vlbi_context ctx, const char *name, const char *model1, const char *model2)
Diff two models into a new one.
DLL_EXPORT int vlbi_has_model(void *ctx, const char *name)
Determine if a model is present into the current OpenVLBI context.
DLL_EXPORT void vlbi_add_model_from_png(void *ctx, char *filename, const char *name)
Add a model from a png file.
DLL_EXPORT void vlbi_copy_model(void *ctx, const char *name, const char *node)
Copy a model into a new one.
DLL_EXPORT void vlbi_shift(vlbi_context ctx, const char *name)
Shift a model by its dimensions.
DLL_EXPORT void vlbi_apply_convolution_matrix(vlbi_context ctx, const char *name, const char *model, const char *matrix)
Convolute a model with a convolution matrix.
DLL_EXPORT void vlbi_get_ifft(vlbi_context ctx, const char *name, const char *magnitude, const char *phase)
Save into name an inverse fourier transform of the uv plot using its current magnitude and phase comp...
DLL_EXPORT void vlbi_get_fft(vlbi_context ctx, const char *model, const char *magnitude, const char *phase)
Get the fourier transform of the given model and save its magnitude and phase components into two new...
DLL_EXPORT dsp_stream_p vlbi_get_model(void *ctx, const char *name)
Get a single model from the current OpenVLBI context.
DLL_EXPORT void vlbi_del_model(vlbi_context ctx, const char *name)
Remove a model from the current OpenVLBI context.
DLL_EXPORT void vlbi_add_model_from_jpeg(void *ctx, char *filename, const char *name)
Add a model from a jpeg file.
DLL_EXPORT void vlbi_apply_mask(vlbi_context ctx, const char *name, const char *model, const char *mask)
Mask the stream with the content of the mask stream, by multiplication of each element.
DLL_EXPORT void vlbi_get_model_to_png(void *ctx, char *filename, const char *name)
Write a model to a png file.
DLL_EXPORT void vlbi_get_uv_plot(void *ctx, const char *name, int u, int v, double *target, double freq, double sr, int nodelay, int moving_baseline, vlbi_func2_t delegate, int *interrupt)
Fill a fourier plane with an aperture synthesis projection of the baselines during the integration ti...
DLL_EXPORT dsp_stream_p vlbi_get_node(void *ctx, const char *name)
Get a stream from the current OpenVLBI context.
DLL_EXPORT void vlbi_copy_node(void *ctx, const char *name, const char *node)
Copy a node into a new one.
DLL_EXPORT void vlbi_add_node(vlbi_context ctx, dsp_stream_p Stream, const char *name, int geographic_coordinates)
Add a stream into the current OpenVLBI context.
DLL_EXPORT void vlbi_add_node_from_fits(void *ctx, char *filename, const char *name, int geo)
Add a node from a 2d image fits file.
DLL_EXPORT void vlbi_add_nodes_from_sdfits(void *ctx, char *filename, const char *name, int geo)
Add nodes from each row of a single dish fits -SDFITS- file.
DLL_EXPORT int vlbi_has_node(void *ctx, const char *name)
Determine if a node is present into the current OpenVLBI context.
DLL_EXPORT void vlbi_filter_bp_node(void *ctx, const char *name, const char *node, double lo_radians, double hi_radians)
Apply a band pass filter on the node buffer.
DLL_EXPORT void vlbi_del_node(vlbi_context ctx, const char *name)
Remove a stream from the current OpenVLBI context.
DLL_EXPORT void vlbi_filter_hp_node(void *ctx, const char *name, const char *node, double radians)
Apply a high pass filter on the node buffer.
DLL_EXPORT int vlbi_get_nodes(void *ctx, vlbi_node **nodes)
List all nodes of the current OpenVLBI context.
DLL_EXPORT void vlbi_filter_lp_node(void *ctx, const char *name, const char *node, double radians)
Apply a low pass filter on the node buffer.
DLL_EXPORT void vlbi_filter_br_node(void *ctx, const char *name, const char *node, double lo_radians, double hi_radians)
Apply a band reject filter on the node buffer.
DLL_EXPORT timespec_t vlbi_time_string_to_timespec(const char *time)
Obtain a timespec struct containing the date and time specified by a time string.
DLL_EXPORT timespec_t vlbi_time_J2000time_to_timespec(double secs_since_J2000)
Obtain a timespec struct containing the date and time specified by a J2000 time.
DLL_EXPORT timespec_t vlbi_time_mktimespec(int year, int month, int dom, int hour, int minute, int second, long nanosecond)
Obtain a timespec struct containing the date and time specified.
DLL_EXPORT double vlbi_time_timespec_to_J2000time(timespec_t tp)
Convert a timespec into J2000 time.
DLL_EXPORT double vlbi_time_J2000time_to_lst(double secs_since_J2000, double Long)
Obtain the local sidereal time at an arbitrary moment and location.
double(* vlbi_func2_t)(double, double)
The delegate function type to pass to vlbi_plot_uv_plane.
Definition: vlbi.h:337
void * vlbi_context
the OpenVLBI context object type
Definition: vlbi.h:340
struct timespec timespec_t
Definition of the timespec_t in a C type, just for convenience.
Definition: vlbi.h:343
Alignment informations needed.
Definition: dsp.h:270
Contains a set of informations and data relative to a buffer and how to use it.
Definition: dsp.h:363
A single baseline, returned by vlbi_get_baselines into an array.
Definition: vlbi.h:294
int relative
Whether this baseline's nodes use coordinates relative to the context reference station.
Definition: vlbi.h:296
char * Name
Baseline's name.
Definition: vlbi.h:322
double delay
Current delay in seconds.
Definition: vlbi.h:312
double * baseline
The baseline's 3d sizes in meters.
Definition: vlbi.h:306
double u
Current u perspective location in pixels.
Definition: vlbi.h:308
vlbi_node Node2
Latter node.
Definition: vlbi.h:320
int locked
Whether this baseline's nodes use coordinates relative to the context reference station.
Definition: vlbi.h:298
double WaveLength
Wavelength observed in meters.
Definition: vlbi.h:314
dsp_stream_p Stream
Baseline's DSP stream.
Definition: vlbi.h:324
double * Target
The baseline's current celestial target array.
Definition: vlbi.h:300
vlbi_node Node1
Earlier node.
Definition: vlbi.h:318
double Ra
The baseline's current celestial target right ascension.
Definition: vlbi.h:302
double SampleRate
Samples per second.
Definition: vlbi.h:316
double Dec
The baseline's current celestial target declination.
Definition: vlbi.h:304
double v
Current v perspective location in pixels.
Definition: vlbi.h:310
A single node, returned by vlbi_get_nodes into an array.
Definition: vlbi.h:278
int Geo
Whether this node uses geographic coordinates.
Definition: vlbi.h:284
double * GeographicLocation
Geographic coordinates array (latitude, longitude, elevation)
Definition: vlbi.h:280
dsp_stream_p Stream
Node's DSP stream.
Definition: vlbi.h:286
int Index
Node's index - oldest zero.
Definition: vlbi.h:290
double * Location
Current location array in meters.
Definition: vlbi.h:282
char * Name
Node's name.
Definition: vlbi.h:288