#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <math.h>
#include <mwalib.h>
#include <star/pal.h>
#include <star/palmac.h>
#include "vcsbeam.h"
#include "gpu_macros.h"
|
void | calc_geometric_delays (beam_geom *beam_geom_vals, uint32_t freq_hz, MetafitsMetadata *obs_metadata, gpuDoubleComplex *phi) |
| Calculates the phase delays required for phasing up each antenna. More...
|
|
void | vmCalcPhi (vcsbeam_context *vm, beam_geom *beam_geom_vals) |
| Calculates the phase delays for all relevant frequencies and pointings. More...
|
|
void | vmCreateGeometricDelays (vcsbeam_context *vm) |
| Allocates memory for the delay phase arrays on both host and device. More...
|
|
void | free_geometric_delays (geometric_delays *gdelays) |
| Frees memory for the delay phase arrays on both host and device. More...
|
|
void | vmPushPhi (vcsbeam_context *vm) |
| Copies the delay phase arrays from CPU memory to GPU memory. More...
|
|
void | calc_beam_geom (double ras_hours, double decs_degs, double mjd, beam_geom *bg) |
| Populates a beam_geom struct with pointing information derived from a given set of RAs, Decs, and MJDs. More...
|
|
void | dec2hms (char *out, double in, int sflag) |
| Converts a decimal RA to the format "HH:MM:SS.S". More...
|
|
void | mjd2lst (double mjd, double *lst) |
| Convert MJD to LST. More...
|
|
double | parse_ra (char *ra_hhmmss) |
| Parse an RA string. More...
|
|
double | parse_dec (char *dec_ddmmss) |
| Parse a Dec string. More...
|
|
double | calc_array_factor (MetafitsMetadata *obs_metadata, uint32_t freq_hz, beam_geom *bg1, beam_geom *bg2) |
| Calculates the array factor. More...
|
|
◆ calc_array_factor()
double calc_array_factor |
( |
MetafitsMetadata * |
obs_metadata, |
|
|
uint32_t |
freq_hz, |
|
|
beam_geom * |
bg1, |
|
|
beam_geom * |
bg2 |
|
) |
| |
Calculates the array factor.
- Parameters
-
[in] | obs_metadata | The observation metadata |
[in] | freq_hz | The frequency in Hz |
[in] | bg1 | The look-direction |
[in] | bg2 | The direction in which to calculate the array factor |
- Returns
- The array factor
This function computes the array factor as described in the appendix of Meyers et al. (2017).
◆ calc_beam_geom()
void calc_beam_geom |
( |
double |
ras_hours, |
|
|
double |
decs_degs, |
|
|
double |
mjd, |
|
|
beam_geom * |
bg |
|
) |
| |
Populates a beam_geom
struct with pointing information derived from a given set of RAs, Decs, and MJDs.
- Parameters
-
[in] | ras_hours | An array of RAs (in decimal hours) |
[in] | decs_degs | An array of Decs (in decimal degrees) |
[in] | mjd | The Modified Julian Date |
[out] | bg | The struct containing various geometric quantities |
The quantities which are calculated are
Quantity | Description |
bg->mean_ra | The mean RA of the pointing |
bg->mean_dec | The mean Dec of the pointing |
bg->az | The azimuth of the pointing |
bg->el | The elevation of the pointing |
bg->lmst | The local mean sidereal time |
bg->fracmjd | The fractional part of the MJD |
bg->intmjd | The integer part of the MJD |
bg->unit_N | The normalised projection of the look-direction onto local North |
bg->unit_E | The normalised projection of the look-direction onto local East |
bg->unit_H | The normalised projection of the look-direction onto local "Up" |
- Todo:
- Put the table describing the beam_geom struct where it belongs: with the documentation for the beam_geom struct!
◆ calc_geometric_delays()
void calc_geometric_delays |
( |
beam_geom * |
beam_geom_vals, |
|
|
uint32_t |
freq_hz, |
|
|
MetafitsMetadata * |
obs_metadata, |
|
|
gpuDoubleComplex * |
phi |
|
) |
| |
Calculates the phase delays required for phasing up each antenna.
- Parameters
-
[in] | beam_geom_vals | Struct containing pointing information for the requested beams. |
[in] | freq_hz | The frequency in Hz |
[in] | obs_metadata | The observation metadata |
[out] | phi | The calculated phase delays |
This function calculates the phase delays for the given look-direction and frequency, for each antenna. This consists of both a "geometric delay" component, related to the different times a planar wavefront coming from a particular direction arrives at each antenna, and a "cable delay" component, related to the physical lengths of the cables connecting the antennas to the rest of the system.
The equations implemented here are the first three equations in Ord et al. (2019).
◆ dec2hms()
void dec2hms |
( |
char * |
out, |
|
|
double |
in, |
|
|
int |
sflag |
|
) |
| |
Converts a decimal RA to the format "HH:MM:SS.S".
- Parameters
-
[out] | out | A buffer for the output string |
[in] | in | The decimal RA |
| sflag | Whether to include a leading '+' |
The out
buffer must already be allocated.
- Todo:
- Figure out whether dec2hms() is actually just for RAs, or whether it is more general than that (and, if so, change the name to reflect this).
◆ free_geometric_delays()
void free_geometric_delays |
( |
geometric_delays * |
gdelays | ) |
|
◆ mjd2lst()
void mjd2lst |
( |
double |
mjd, |
|
|
double * |
lst |
|
) |
| |
Convert MJD to LST.
- Parameters
-
[in] | mjd | The Modified Julian Date |
[out] | lst | The Local Sidereal Time |
- Todo:
- Consider removing mjd2lst(), since it consists only of a single call to a
pal
function.
◆ parse_dec()
double parse_dec |
( |
char * |
dec_ddmmss | ) |
|
Parse a Dec string.
- Parameters
-
[in] | dec_ddmmss | A string representing a Dec in the DD:MM:SS.S format |
- Returns
- The Dec in decimal degrees.
◆ parse_ra()
double parse_ra |
( |
char * |
ra_hhmmss | ) |
|
Parse an RA string.
- Parameters
-
[in] | ra_hhmmss | A string representing an RA in the HH:MM:SS.S format |
- Returns
- The RA in decimal hours.
◆ vmCalcPhi()
void vmCalcPhi |
( |
vcsbeam_context * |
vm, |
|
|
beam_geom * |
beam_geom_vals |
|
) |
| |
Calculates the phase delays for all relevant frequencies and pointings.
Calls calc_geometric_delays() for all frequencies in the relevant coarse channel, and for all requested pointings.
- Todo:
- Incorporate the
beam_geom
struct into the vm
struct.
◆ vmCreateGeometricDelays()
void vmCreateGeometricDelays |
( |
vcsbeam_context * |
vm | ) |
|
◆ vmPushPhi()
void vmPushPhi |
( |
vcsbeam_context * |
vm | ) |
|
Copies the delay phase arrays from CPU memory to GPU memory.