VCSBeam
Functions
beam_psrfits.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <math.h>
#include <mpi.h>
#include <mwalib.h>
#include <star/pal.h>
#include <star/palmac.h>
#include <psrfits.h>
#include "vcsbeam.h"
Include dependency graph for beam_psrfits.c:

Functions

void populate_spliced_psrfits_header (vcsbeam_context *vm, struct psrfits *pf, int max_sec_per_file, int outpol, beam_geom *beam_geom_vals, char *basename, bool is_coherent)
 Populates a PSRFITS struct with data derived from the observation. More...
 
void populate_psrfits_header (vcsbeam_context *vm, struct psrfits *pf, int max_sec_per_file, int outpol, beam_geom *beam_geom_vals, char *incoh_basename, bool is_coherent)
 Populates a PSRFITS struct with data derived from the observation. More...
 
void free_psrfits (struct psrfits *pf)
 Frees the memory associated with a PSRFITS struct. More...
 
void vmInitMPIPsrfits (vcsbeam_context *vm, mpi_psrfits *mpf, int max_sec_per_file, int nstokes, beam_geom *bg, char *outfile, bool is_coherent)
 Initialises a struct for managing multiple PSRFITS files via MPI processes. More...
 
void free_mpi_psrfits (mpi_psrfits *mpf)
 Frees the memory associated with an mpi_psrfits struct. More...
 
void gather_splice_psrfits (mpi_psrfits *mpf)
 Splices the data for multiple coarse channels managed by an mpi_psrfits struct together into a single PSRFITS buffer ready for writing. More...
 
void wait_splice_psrfits (mpi_psrfits *mpf)
 Causes the master MPI thread to wait until the preceding MPI_GATHER operation is complete. More...
 

Function Documentation

◆ free_mpi_psrfits()

void free_mpi_psrfits ( mpi_psrfits *  mpf)

Frees the memory associated with an mpi_psrfits struct.

Parameters
mpfA pointer to the struct to be freed.

Only the memory associated with member variables are freed. The mpi_psrfits itself is not freed.

◆ free_psrfits()

void free_psrfits ( struct psrfits *  pf)

Frees the memory associated with a PSRFITS struct.

Parameters
pfThe PSRFITS struct to be freed.

This only frees the member variables (arrays), not the struct itself.

◆ gather_splice_psrfits()

void gather_splice_psrfits ( mpi_psrfits *  mpf)

Splices the data for multiple coarse channels managed by an mpi_psrfits struct together into a single PSRFITS buffer ready for writing.

Parameters
mpfA pointer to the mpi_psrfits struct that is managing which MPI process is associated with which frequency.

◆ populate_psrfits_header()

void populate_psrfits_header ( vcsbeam_context *  vm,
struct psrfits *  pf,
int  max_sec_per_file,
int  outpol,
beam_geom *  beam_geom_vals,
char *  incoh_basename,
bool  is_coherent 
)

Populates a PSRFITS struct with data derived from the observation.

Parameters
vmThe VCSBeam context struct
pfThe PSRFITS struct to be populated
max_sec_per_fileThe number of seconds written to each output PSRFITS file
outpolEither 1 (for Stokes I only) or 4 (for full Stokes)
beam_geom_valsA beam_geom struct containing pointing information
incoh_basenameThe prefix for the output PSRFITS files (only for incoherent beamforming)
is_coherenttrue for tied-array beamforming, false for incoherent beamforming

This function is designed for PSRFITS files containing a single coarse channel.

Todo:
Merge with populate_spliced_psrfits_header() to avoid code duplication.

◆ populate_spliced_psrfits_header()

void populate_spliced_psrfits_header ( vcsbeam_context *  vm,
struct psrfits *  pf,
int  max_sec_per_file,
int  outpol,
beam_geom *  beam_geom_vals,
char *  basename,
bool  is_coherent 
)

Populates a PSRFITS struct with data derived from the observation.

Parameters
vmThe VCSBeam context struct
pfThe PSRFITS struct to be populated
max_sec_per_fileThe number of seconds written to each output PSRFITS file
outpolEither 1 (for Stokes I only) or 4 (for full Stokes)
beam_geom_valsA beam_geom struct containing pointing information
basenameThe prefix for the output PSRFITS files
is_coherenttrue for tied-array beamforming, false for incoherent beamforming

This function is designed for PSRFITS files containing multiple coarse channels.

Todo:
Change the name to conform to standard.

◆ vmInitMPIPsrfits()

void vmInitMPIPsrfits ( vcsbeam_context *  vm,
mpi_psrfits *  mpf,
int  max_sec_per_file,
int  nstokes,
beam_geom *  bg,
char *  outfile,
bool  is_coherent 
)

Initialises a struct for managing multiple PSRFITS files via MPI processes.

Parameters
vmThe VCSBeam context struct
mpfA pointer to the new struct to be initialised
max_sec_per_fileThe number of seconds written to each output PSRFITS file
nstokesEither 1 (for Stokes I only) or 4 (for full Stokes)
bgA beam_geom struct containing pointing information
outfileThe prefix for the output PSRFITS files
is_coherenttrue for tied-array beamforming, false for incoherent beamforming

◆ wait_splice_psrfits()

void wait_splice_psrfits ( mpi_psrfits *  mpf)

Causes the master MPI thread to wait until the preceding MPI_GATHER operation is complete.

Parameters
mpfA pointer to the mpi_psrfits struct that is managing which MPI process is associated with which frequency.