WSClean
|
This is a low-level interface useful for using WSClean as the "operator" in functions such as compressed sensing. More...
Go to the source code of this file.
Functions | |
void | wsclean_deinitialize (void *userData) |
Release all resources. More... | |
void | wsclean_initialize (void **userData, const imaging_parameters *parameters, imaging_data *imgData) |
Initialize WSClean for use as measurement operator in compressed sensing application. More... | |
void | wsclean_operator_A (void *userData, DCOMPLEX *dataOut, const double *dataIn) |
Calculate the unweighted visibilities for the given image data. More... | |
void | wsclean_operator_At (void *userData, double *dataOut, const DCOMPLEX *dataIn) |
Calculate the dirty image from the visibilities. More... | |
double | wsclean_parse_angle (const char *angle) |
Convert a string with units to an angle in radians. More... | |
void | wsclean_read (void *userData, DCOMPLEX *data, double *weights) |
Reads the visibility data array from the measurement set. More... | |
void | wsclean_write (void *userData, const char *filename, const double *image) |
Write the final image out. More... | |
This is a low-level interface useful for using WSClean as the "operator" in functions such as compressed sensing.
It allows using the WSClean gridding / prediction operations. This header can be used both for C and for C++ programs.
This interface tries to abstract the measurement set, such that the interfacing program does not need to read/write to the measurement set at all.
The general order to call this is:
Methods are thread safe, in that one can e.g. call the operator methods at the same time from different threads, and things will still work. However, this is accomplished by using a global lock, such that this will actually not speed up processing.
void wsclean_deinitialize | ( | void * | userData | ) |
Release all resources.
After this call, the userData should no longer be used. Every call to wsclean_initialize() should be followed by a call to wsclean_deinitialize().
userData | A wsclean userdata struct as returned by wsclean_initialize(). |
void wsclean_initialize | ( | void ** | userData, |
const imaging_parameters * | parameters, | ||
imaging_data * | imgData | ||
) |
Initialize WSClean for use as measurement operator in compressed sensing application.
This should be called before any other function.
The way to pass the userdata pointer is as in the following example:
userData | should be a pointer to a void pointer which will be set to a structure that WSClean internally uses. |
parameters | domain specific information, containing the measurement set. |
imgData | will be filled with info describing the data. |
void wsclean_operator_A | ( | void * | userData, |
DCOMPLEX * | dataOut, | ||
const double * | dataIn | ||
) |
Calculate the unweighted visibilities for the given image data.
userData | A wsclean userdata struct as returned by wsclean_initialize(). |
dataOut | Array that will be filled with the predicted visibilities. |
dataIn | The image data: array of size width x height. |
void wsclean_operator_At | ( | void * | userData, |
double * | dataOut, | ||
const DCOMPLEX * | dataIn | ||
) |
Calculate the dirty image from the visibilities.
The weights will be applied while imaging, so the client should not already have multiplied the visibilities with the weights (see wsclean_read() ). If the client does not want to apply the weights, the client can divide the visibilities by the weights beforehand, and multiply the image by the sum of weights afterwards.
userData | A wsclean userdata struct as returned by wsclean_initialize(). |
dataOut | Array of size width x height that will be filled with the dirty image. |
dataIn | The visibility data to image. |
double wsclean_parse_angle | ( | const char * | angle | ) |
Convert a string with units to an angle in radians.
A client program can use this to convert a string like "10asec" or "1deg" to a numeric angle that can be passed to wsclean_initialize().
angle | A string specifying an angle. |
void wsclean_read | ( | void * | userData, |
DCOMPLEX * | data, | ||
double * | weights | ||
) |
Reads the visibility data array from the measurement set.
The returned data are unweighted. The weights can be used by the client program to converge optimally, but should not be applied (or should be unapplied) to the data before calling the operator functions.
userData | A wsclean userdata struct as returned by wsclean_initialize(). |
data | An already allocated array of data which will be set to the selected data in the measurement set. The array should be of the size that wsclean_initialize() returned in the imaging_data struct. |
weights | An already allocated array which will be set to the weights, of equal size as the data. |
void wsclean_write | ( | void * | userData, |
const char * | filename, | ||
const double * | image | ||
) |
Write the final image out.
userData | A wsclean userdata struct as returned by wsclean_initialize(). |
filename | Filename of fits output file. |
image | The image data of size width x height. |