#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <mwalib.h>
#include <vdifio.h>
#include "vcsbeam.h"
#include "mwa_header.h"
#include "ascii_header.h"
|
void | float2int8_trunc (float *f, int n, float min, float max, int8_t *i) |
| Converts floats to 8-bit integers. More...
|
|
void | vdif_write_second (struct vdifinfo *vf, vdif_header *vhdr, float *data_buffer_vdif) |
| Writes a second's worth of data to a VDIF file. More...
|
|
void | vdif_write_data (struct vdifinfo *vf, int8_t *output) |
| Write VDIF data to file. More...
|
|
void | vmPopulateVDIFHeader (vcsbeam_context *vm, beam_geom *beam_geom_vals, double mjd_start, double sec_offset) |
| Populates a VDIF header with data derived from the observation. More...
|
|
void | to_offset_binary (int8_t *i, int n) |
| Convert from two's complement to "offset binary" (??) More...
|
|
◆ float2int8_trunc()
void float2int8_trunc |
( |
float * |
f, |
|
|
int |
n, |
|
|
float |
min, |
|
|
float |
max, |
|
|
int8_t * |
i |
|
) |
| |
Converts floats to 8-bit integers.
- Parameters
-
[in] | f | The (source) buffer of floats |
| n | The number of floats in f |
| min | The smallest allowed float |
| max | The largest allowed float |
[out] | i | The (destination) buffer of 8-bit integers |
◆ to_offset_binary()
void to_offset_binary |
( |
int8_t * |
i, |
|
|
int |
n |
|
) |
| |
Convert from two's complement to "offset binary" (??)
- Parameters
-
i | An array of integers to be converted |
n | The number of integers in i |
◆ vdif_write_data()
void vdif_write_data |
( |
struct vdifinfo * |
vf, |
|
|
int8_t * |
output |
|
) |
| |
Write VDIF data to file.
- Parameters
-
vf | A struct containing metadata about the target VDIF file |
output | The buffer to be written to file |
- Todo:
- Make sure that the header file is unneccesarily re-written each time this function is called. If so, put this bit somewhere more sensible.
◆ vdif_write_second()
void vdif_write_second |
( |
struct vdifinfo * |
vf, |
|
|
vdif_header * |
vhdr, |
|
|
float * |
data_buffer_vdif |
|
) |
| |
Writes a second's worth of data to a VDIF file.
- Parameters
-
vf | A struct containing metadata about the target VDIF file |
vhdr | A pointer to the VDIF frame header buffer |
data_buffer_vdif | The data to be written out |
The data to be written out are first normalised and scaled to fit in the range -126 to 127 and demoted to integers. "Blocks" of data are then written to file, along with the appropriate binary headers for each "frame", via the function vdif_write_data().
◆ vmPopulateVDIFHeader()
void vmPopulateVDIFHeader |
( |
vcsbeam_context * |
vm, |
|
|
beam_geom * |
beam_geom_vals, |
|
|
double |
mjd_start, |
|
|
double |
sec_offset |
|
) |
| |
Populates a VDIF header with data derived from the observation.
- Parameters
-
vm | The VCSBeam context struct |
beam_geom_vals | A beam_geom struct containing pointing information |
mjd_start | The start MJD of the observation |
sec_offset | The offset from the start of the observation in seconds |