Open source Very Long Baseline Interferometry
OpenVLBI
Using OpenVLBI

You can write an application using libopenvlbi by linking against libopenvlbi.so in your gcc command line:

gcc yourapp.c -lopenvlbi -o yourapp

Each instance of vlbi is initiated by vlbi_init():

vlbi_context context = vlbi_init();
...
// you must be familiar with the dsp_stream_p type, see "DSP API Documentation"
dsp_stream_p stream1 = dsp_stream_new();
dsp_stream_add_dim(stream1, elements_n);
//dsp_buffer_copy converts numeric types into dsp_t (aka double)
dsp_buffer_copy(input_arr, stream1->in, stream1->len);
//Latitude and longitude in degrees, elevation in meters OSL
stream1->location.geographic.lat = Latitude;
stream1->location.geographic.lon = Longitude;
stream1->location.geographic.el = Elevation;
stream1->starttimeutc = vlbi_time_string_to_timespec("2018-06-22T02:12.000154874");
//assign to this node a friendly, unique name and add it to the context, tell to OpenVLBI to use geographic conversion
vlbi_add_node(context, stream1, "location1_capture", 1);
...
vlbi_add_node(context, stream2, "location2_capture", 1);
...
vlbi_add_stream(context, stream3);
...
double* target = calloc(sizeof(double), 3);
//RA must be in 24H format
target[0] = RightAscension * 360.0 / 24.0;
target[1] = Declination;
double frequency = 60.0e+6;
double samplerate = 100.0e+6;
//since we're using geographic coordinates we'd calculate the delay of each baseline
int no_delay_calculation = 0;
//telescopes do not change their location during capture, so no location companion stream
int moving_baseline = 0;
//obtain the UV plot of the observation and save it as model,
vlbi_get_uv_plot(context, "obs1_plot_model", 1024, 1024, target, frequency, samplerate, no_delay_calculation, moving_baseline, vlbi_default_delegate);
//the default delegate just multiplies each element of the stream by indexing them according to their delay from the farest node to the target
//after this operation a new model with size 1024x1024 containing the plot of the correlation degrees of all baselines will be added into the context
//you should add a model with an estimation of the phase to get an inverse fourier transform
vlbi_add_model_from_png(context, "my_phase_estimation.png", "my_phase_estimation");
//Create a new model containing the inverse Fourier transform of your observation as magnitude component and your estimation of the phase
vlbi_get_ifft(context, "ifft_estimation", "obs1_plot_model", "my_phase_estimation");
dsp_stream_p image_estimation = vlbi_get_model(context, "ifft_estimation");
...
dsp_stream_free_buffer(image_estimation);
dsp_stream_free(image_estimation);
vlbi_exit(context);

You can read the API documentation at https://iliaplatone.github.io/OpenVLBI/

vlbi_init
DLL_EXPORT vlbi_context vlbi_init(void)
Initialize a OpenVLBI instance.
vlbi_exit
DLL_EXPORT void vlbi_exit(vlbi_context ctx)
Close a OpenVLBI instance.
vlbi_get_uv_plot
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...
vlbi_add_model_from_png
DLL_EXPORT void vlbi_add_model_from_png(void *ctx, char *filename, const char *name)
Add a model from a png file.
vlbi_default_delegate
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:635
dsp_stream_t
Contains a set of informations and data relative to a buffer and how to use it.
Definition: dsp.h:375
dsp_stream_free
DLL_EXPORT void dsp_stream_free(dsp_stream_p stream)
Free the DSP stream passed as argument.
dsp_stream_new
DLL_EXPORT dsp_stream_p dsp_stream_new(void)
Allocate a new DSP stream type.
dsp_stream_alloc_buffer
DLL_EXPORT void dsp_stream_alloc_buffer(dsp_stream_p stream, int len)
Allocate a buffer with length len on the stream passed as argument.
dsp_stream_add_dim
DLL_EXPORT void dsp_stream_add_dim(dsp_stream_p stream, int len)
Add a dimension with length len to a DSP stream.
vlbi_context
void * vlbi_context
the OpenVLBI context object type
Definition: vlbi.h:345
vlbi_get_ifft
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...
vlbi_time_string_to_timespec
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.
dsp_buffer_copy
#define dsp_buffer_copy(in, out, len)
Fill the output buffer with the values of the elements of the input stream by casting them to the out...
Definition: dsp.h:1051
vlbi_get_model
DLL_EXPORT dsp_stream_p vlbi_get_model(void *ctx, const char *name)
Get a single model from the current OpenVLBI context.
vlbi_add_node
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.