This module contains the basic waveform handling routines and structures for libbpm
The bpmwf sublibrary implements 3 waveform types doublewf_t, intwf_t and complexwf_t, all of which are simple structure typedefs which hold the number of samples, the sampling frequency and a pointer "wf" to the waveform. So the data array is accessible via doublewf_t::wf as a normal array of integers, doubles and complex_t 's.
intwf_t *w = intwf_cast_new( doublewf_t *dw );
this allocates memory for intwf_t and returns a pointer it, or
intwf_cast( intwf_t *w, doublewf_t *dw );
this casts dw into existing intwf w.
The sublibrary employs the sampling convention, where the sample is taken at the time index corresponding to
t = (double) i / sampling_freq
Some advanced routines like differentiation, integration of the waveforms are also present. Also interpolation is impemented using various schemes which are more applicable depending on the type of waveform : linear, parabolic : for non repeatative signals, sinc and lanczos for repeatative signals (cfr. Shannon-Whittaker interpolation). (thinking of cubic-spline as well... but not implemented yet). Using these interpolation schemes, the sublibrary also implements resampling routines.
The complex waveforms have a set of routines to extract real/imag parts as well as phase and amplitude. Similar comments apply as for the casting routines, where the "_new" versions allocate memory in the routine and return a pointer to it.
doublewf_setvalues( doublewf_t *w, double *a)
or by calculating them from a function which returns the basic type of the waveform.
E.g. define a complex valued function in your code:
complex_t csin( double t, int npars, double a ) { complex_t z // calculate a complex number z from the time t and parameters... return z; }
which returns a complex value from the time t
and having npar
paramaters a
[0] ... a
[n-1]
You can fill a waveform ( and so bascially sample the function at sampling frequency fs ) by executing
complexwf_setfunction( complexwf_t *z, &csin, npars, a )
Also some routines are added to fill the waveforms with CW tones and decaying waves, along with some noise adding routines etc...
The WF_LINEAR interpolation option
The WF_QUADRATIC interpolation ption
The WF_SINC interpolation option
The WF_LANCZOS interpolation option
Files | |
file | bpm_wf.h |
Simple waveform handling routines for libbpm. | |
file | complexwf.c |
file | doublewf.c |
file | intwf.c |
file | wfstats.c |
Data Structures | |
struct | doublewf_t |
struct | intwf_t |
struct | complexwf_t |
struct | wfstat_t |
Defines | |
#define | WF_EPS |
#define | MAX_ALLOWED_NS |
#define | WF_NEAREST |
#define | WF_LINEAR |
#define | WF_QUADRATIC |
#define | WF_SINC |
#define | WF_LANCZOS |
Functions | |
EXTERN int | wfstat_reset (wfstat_t *s) |
EXTERN void | wfstat_print (FILE *of, wfstat_t *s) |
EXTERN doublewf_t * | doublewf (int ns, double fs) |
EXTERN doublewf_t * | doublewf_time_series (int ns, double fs) |
EXTERN doublewf_t * | doublewf_sample_series (int ns, double fs) |
EXTERN doublewf_t * | doublewf_frequency_series (int ns, double fs) |
EXTERN int | doublewf_setvalues (doublewf_t *w, double *x) |
EXTERN int | doublewf_setfunction (doublewf_t *w, double(*wffun)(double t, int, double *), int npars, double *par) |
EXTERN int | doublewf_copy (doublewf_t *copy, doublewf_t *src) |
EXTERN doublewf_t * | doublewf_copy_new (doublewf_t *w) |
EXTERN int | doublewf_subset (doublewf_t *sub, doublewf_t *w, int i1, int i2) |
EXTERN int | doublewf_reset (doublewf_t *w) |
EXTERN void | doublewf_delete (doublewf_t *w) |
EXTERN intwf_t * | intwf_cast_new (doublewf_t *w) |
EXTERN int | intwf_cast (intwf_t *iw, doublewf_t *w) |
EXTERN int | doublewf_compat (doublewf_t *w1, doublewf_t *w2) |
EXTERN int | doublewf_add (doublewf_t *w1, doublewf_t *w2) |
EXTERN int | doublewf_subtract (doublewf_t *w1, doublewf_t *w2) |
EXTERN int | doublewf_multiply (doublewf_t *w1, doublewf_t *w2) |
EXTERN int | doublewf_divide (doublewf_t *w1, doublewf_t *w2) |
EXTERN int | doublewf_scale (double f, doublewf_t *w) |
EXTERN int | doublewf_bias (double c, doublewf_t *w) |
EXTERN int | doublewf_add_cwtone (doublewf_t *w, double amp, double phase, double freq, double phasenoise) |
EXTERN int | doublewf_add_dcywave (doublewf_t *w, double amp, double phase, double freq, double ttrig, double tdcy, double phasenoise) |
EXTERN int | doublewf_add_ampnoise (doublewf_t *w, double sigma) |
EXTERN int | doublewf_basic_stats (doublewf_t *w, int s0, int s1, wfstat_t *stats) |
EXTERN int | doublewf_derive (doublewf_t *w) |
EXTERN int | doublewf_integrate (doublewf_t *w) |
EXTERN void | doublewf_print (FILE *of, doublewf_t *w) |
EXTERN double | doublewf_getvalue (doublewf_t *w, double t, unsigned int mode) |
EXTERN int | doublewf_resample (doublewf_t *w2, double fs, doublewf_t *w1, unsigned int mode) |
EXTERN intwf_t * | intwf (int ns, double fs) |
EXTERN intwf_t * | intwf_sample_series (int ns, double fs) |
EXTERN int | intwf_setvalues (intwf_t *w, int *x) |
EXTERN int | intwf_setfunction (intwf_t *w, int(*wffun)(double t, int, double *), int npars, double *par) |
EXTERN int | intwf_copy (intwf_t *copy, intwf_t *src) |
EXTERN intwf_t * | intwf_copy_new (intwf_t *w) |
EXTERN int | intwf_subset (intwf_t *sub, intwf_t *w, int i1, int i2) |
EXTERN int | intwf_reset (intwf_t *w) |
EXTERN void | intwf_delete (intwf_t *w) |
EXTERN doublewf_t * | doublewf_cast_new (intwf_t *w) |
EXTERN int | doublewf_cast (doublewf_t *w, intwf_t *iw) |
EXTERN int | intwf_compat (intwf_t *w1, intwf_t *w2) |
EXTERN int | intwf_add (intwf_t *w1, intwf_t *w2) |
EXTERN int | intwf_subtract (intwf_t *w1, intwf_t *w2) |
EXTERN int | intwf_multiply (intwf_t *w1, intwf_t *w2) |
EXTERN int | intwf_divide (intwf_t *w1, intwf_t *w2) |
EXTERN int | intwf_scale (int f, intwf_t *w) |
EXTERN int | intwf_bias (int c, intwf_t *w) |
EXTERN int | intwf_add_cwtone (intwf_t *w, double amp, double phase, double freq, double phasenoise) |
EXTERN int | intwf_add_dcywave (intwf_t *w, double amp, double phase, double freq, double ttrig, double tdcy, double phasenoise) |
EXTERN int | intwf_add_ampnoise (intwf_t *w, double sigma) |
EXTERN int | intwf_basic_stats (intwf_t *w, int s0, int s1, wfstat_t *stats) |
EXTERN int | intwf_derive (intwf_t *w) |
EXTERN int | intwf_integrate (intwf_t *w) |
EXTERN void | intwf_print (FILE *of, intwf_t *w) |
EXTERN int | intwf_getvalue (intwf_t *w, double t, unsigned int mode) |
EXTERN int | intwf_resample (intwf_t *w2, double fs, intwf_t *w1, unsigned int mode) |
EXTERN complexwf_t * | complexwf (int ns, double fs) |
EXTERN complexwf_t * | complexwf_copy_new (complexwf_t *w) |
EXTERN int | complexwf_copy (complexwf_t *copy, complexwf_t *src) |
EXTERN int | complexwf_subset (complexwf_t *sub, complexwf_t *w, int i1, int i2) |
EXTERN int | complexwf_setvalues (complexwf_t *w, complex_t *x) |
EXTERN int | complexwf_setfunction (complexwf_t *w, complex_t(*wffun)(double, int, double *), int npars, double *par) |
EXTERN int | complexwf_reset (complexwf_t *w) |
EXTERN void | complexwf_delete (complexwf_t *w) |
EXTERN int | complexwf_compat (complexwf_t *w1, complexwf_t *w2) |
EXTERN int | complexwf_add (complexwf_t *w1, complexwf_t *w2) |
EXTERN int | complexwf_subtract (complexwf_t *w1, complexwf_t *w2) |
EXTERN int | complexwf_multiply (complexwf_t *w1, complexwf_t *w2) |
EXTERN int | complexwf_divide (complexwf_t *w1, complexwf_t *w2) |
EXTERN int | complexwf_scale (complex_t f, complexwf_t *w) |
EXTERN int | complexwf_bias (complex_t c, complexwf_t *w) |
EXTERN int | complexwf_add_cwtone (complexwf_t *w, double amp, double phase, double freq, double phasenoise) |
EXTERN int | complexwf_add_dcywave (complexwf_t *w, double amp, double phase, double freq, double ttrig, double tdcy, double phasenoise) |
EXTERN int | complexwf_add_noise (complexwf_t *w, double sigma) |
EXTERN int | complexwf_add_ampnoise (complexwf_t *w, double sigma) |
EXTERN int | complexwf_add_phasenoise (complexwf_t *w, double sigma) |
EXTERN void | complexwf_print (FILE *of, complexwf_t *w) |
EXTERN int | complexwf_getreal (doublewf_t *re, complexwf_t *z) |
EXTERN int | complexwf_getimag (doublewf_t *im, complexwf_t *z) |
EXTERN int | complexwf_getamp (doublewf_t *r, complexwf_t *z) |
EXTERN int | complexwf_getphase (doublewf_t *theta, complexwf_t *z) |
EXTERN doublewf_t * | complexwf_getreal_new (complexwf_t *z) |
EXTERN doublewf_t * | complexwf_getimag_new (complexwf_t *z) |
EXTERN doublewf_t * | complexwf_getamp_new (complexwf_t *z) |
EXTERN doublewf_t * | complexwf_getphase_new (complexwf_t *z) |
EXTERN int | complexwf_setreal (complexwf_t *z, doublewf_t *re) |
EXTERN int | complexwf_setimag (complexwf_t *z, doublewf_t *im) |
#define WF_EPS |
A small number
Definition at line 157 of file bpm_wf.h.
Referenced by complexwf_compat(), doublewf_compat(), and intwf_compat().
#define MAX_ALLOWED_NS |
Maximum allowed number of samples (2^18)
Definition at line 158 of file bpm_wf.h.
Referenced by complexwf(), doublewf(), doublewf_resample(), intwf(), and intwf_resample().
#define WF_LINEAR |
Perform linear interpolation in XXXwf_getsample()
Definition at line 161 of file bpm_wf.h.
Referenced by doublewf_getvalue().
#define WF_QUADRATIC |
Perform quadratic (parabolic) interpolation
Definition at line 162 of file bpm_wf.h.
Referenced by doublewf_getvalue().
#define WF_SINC |
signal reconstruction using sinc kernel (0..ns)
Definition at line 163 of file bpm_wf.h.
Referenced by doublewf_getvalue().
#define WF_LANCZOS |
signal reconstruction using lanczos kernel (a=3)
Definition at line 164 of file bpm_wf.h.
Referenced by doublewf_getvalue().
EXTERN int wfstat_reset | ( | wfstat_t * | s | ) |
Reset the waveform statistics structure.
s | A pointer to a wfstat_t structure |
Definition at line 8 of file wfstats.c.
References bpm_error(), wfstat_t::imax, wfstat_t::imin, wfstat_t::max, wfstat_t::mean, wfstat_t::min, and wfstat_t::rms.
Referenced by doublewf_basic_stats().
EXTERN void wfstat_print | ( | FILE * | of, | |
wfstat_t * | s | |||
) |
Prints the waveform statistics to the screen,
of | A filepointer | |
s | A pointer to the waveform statistics structure |
Definition at line 29 of file wfstats.c.
References bpm_error(), wfstat_t::imax, wfstat_t::imin, wfstat_t::max, wfstat_t::mean, wfstat_t::min, and wfstat_t::rms.
EXTERN doublewf_t* doublewf | ( | int | ns, | |
double | fs | |||
) |
Allocates memory for a new waveform of doubles
ns | The number of samples in the waveform | |
fs | The sampling frequency of the waveform |
Definition at line 8 of file doublewf.c.
References bpm_error(), doublewf_t::fs, MAX_ALLOWED_NS, doublewf_t::ns, and doublewf_t::wf.
Referenced by _check_ddc_buffers(), add_mode_response(), complexwf_getamp_new(), complexwf_getimag_new(), complexwf_getphase_new(), complexwf_getreal_new(), ddc_initialise(), doublewf_cast_new(), doublewf_copy_new(), doublewf_frequency_series(), doublewf_sample_series(), doublewf_time_series(), and generate_bpmsignal().
EXTERN doublewf_t* doublewf_time_series | ( | int | ns, | |
double | fs | |||
) |
Allocates memory for a new waveform of doubles and fills it with the sample time values
ns | The number of samples in the waveform | |
fs | The sampling frequency of the waveform |
Definition at line 63 of file doublewf.c.
References doublewf(), doublewf_t::fs, doublewf_t::ns, and doublewf_t::wf.
EXTERN doublewf_t* doublewf_sample_series | ( | int | ns, | |
double | fs | |||
) |
Allocates memory for a new waveform of doubles and fills it with sample numbers.
ns | The number of samples in the waveform | |
fs | The sampling frequency of the waveform |
Definition at line 50 of file doublewf.c.
References doublewf(), doublewf_t::ns, and doublewf_t::wf.
EXTERN doublewf_t* doublewf_frequency_series | ( | int | ns, | |
double | fs | |||
) |
Allocates memory for a new waveform of doubles and fills it with the frequency values
ns | The number of samples in the waveform | |
fs | The sampling frequency of the waveform |
Definition at line 76 of file doublewf.c.
References doublewf(), doublewf_t::fs, doublewf_t::ns, and doublewf_t::wf.
EXTERN int doublewf_setvalues | ( | doublewf_t * | w, | |
double * | x | |||
) |
Fills the waveform of doubles with the values from the array x. No check is performed whether x contains enough samples, the user needs to be sure this is the case !
w | A pointer to the waveform of doubles | |
x | A pointer to the x values |
Definition at line 151 of file doublewf.c.
References bpm_error(), doublewf_t::ns, and doublewf_t::wf.
EXTERN int doublewf_setfunction | ( | doublewf_t * | w, | |
double(*)(double t, int, double *) | wffun, | |||
int | npars, | |||
double * | par | |||
) |
Fills the waveform with values from the function wffun(), this function has to return a double from argument t ( time ) and has npars parameters given by the array *par. The function will be evaluated at the time t of each sample...
w | A pointer to the waveform of doubles | |
wffun | A pointer to the function to fill the waveform with | |
t | The time parameter in the function | |
npars | Number of parameters for the function | |
par | Array of parameters for the function |
EXTERN int doublewf_copy | ( | doublewf_t * | copy, | |
doublewf_t * | src | |||
) |
Copies the values from existing waveform src into copy checks first whether the waveforms are compatible... This routine doesn't allocate memory internally and the waveforms should already have been created by the user...
copy | A pointer to the copy waveform | |
src | A pointer to the original waveform |
Definition at line 106 of file doublewf.c.
References bpm_error(), doublewf_compat(), doublewf_t::ns, and doublewf_t::wf.
Referenced by rf_mixer().
EXTERN doublewf_t* doublewf_copy_new | ( | doublewf_t * | w | ) |
Allocates memory and produces a copy of the waveform w;
w | A pointer to the original waveform |
Definition at line 89 of file doublewf.c.
References bpm_error(), doublewf(), doublewf_t::fs, doublewf_t::ns, and doublewf_t::wf.
Referenced by add_mode_response(), and get_mode_response().
EXTERN int doublewf_subset | ( | doublewf_t * | sub, | |
doublewf_t * | w, | |||
int | i1, | |||
int | i2 | |||
) |
Copies a subset from sample i1 to sample i2 ( inclusive ) to the sub waveform from waveform w. The routine expects the sub waveform to already exist with enough samples. ( this is not checked ! ) The sub->fs and sub->ns will be overwritten.
sub | Pointer to the waveform which will hold the subset | |
w | Pointer to the original waveform | |
i1 | First sample of w to copy | |
i2 | Last sample of w to copy |
Definition at line 127 of file doublewf.c.
References bpm_error(), doublewf_t::fs, doublewf_t::ns, and doublewf_t::wf.
EXTERN int doublewf_reset | ( | doublewf_t * | w | ) |
Resets the waveform of doubles to 0.
w | A pointer to the waveform of doubles |
Definition at line 185 of file doublewf.c.
References bpm_error(), doublewf_t::ns, and doublewf_t::wf.
Referenced by generate_bpmsignal().
EXTERN void doublewf_delete | ( | doublewf_t * | w | ) |
Frees up the memory used by the waveform
w | A pointer to the waveform of doubles |
Definition at line 202 of file doublewf.c.
References bpm_warning(), and doublewf_t::wf.
Referenced by _check_ddc_buffers(), add_mode_response(), ddc_cleanup(), get_mode_response(), intwf_basic_stats(), intwf_getvalue(), and intwf_resample().
EXTERN intwf_t* intwf_cast_new | ( | doublewf_t * | w | ) |
Cast the waveform of doubles to a new waveform of integers. Memory is allocated inside this routine so the user just needs to have a inwf_t pointer ready.
w | A pointer to the waveform of doubles |
Definition at line 219 of file doublewf.c.
References bpm_error(), dround(), doublewf_t::fs, intwf(), doublewf_t::ns, intwf_t::ns, intwf_t::wf, and doublewf_t::wf.
EXTERN int intwf_cast | ( | intwf_t * | iw, | |
doublewf_t * | w | |||
) |
Cast the waveform of doubles to an already existing waveform of integers.
iw | A pointer to an existing waveform of integers | |
w | A pointer to the waveform of doubles |
Definition at line 245 of file doublewf.c.
References bpm_error(), dround(), intwf_t::ns, intwf_t::wf, and doublewf_t::wf.
EXTERN int doublewf_compat | ( | doublewf_t * | w1, | |
doublewf_t * | w2 | |||
) |
Checks compatiblity of the two waveforms, returns true if the number of samples and the sampling frequencies match. For the sampling frequency, it is simply checked whether they match to WF_EPS.
w1 | A pointer to the first waveform of doubles | |
w2 | A pointer to the second waveform of doubles |
Definition at line 263 of file doublewf.c.
References bpm_error(), doublewf_t::fs, doublewf_t::ns, and WF_EPS.
Referenced by doublewf_add(), doublewf_copy(), doublewf_divide(), doublewf_multiply(), and doublewf_subtract().
EXTERN int doublewf_add | ( | doublewf_t * | w1, | |
doublewf_t * | w2 | |||
) |
Adds two waveforms of doubles w1+w2 sample per sample. The result is stored in w1.
w1 | A pointer to the first waveform of doubles | |
w2 | A pointer to the second waveform of doubles |
Definition at line 276 of file doublewf.c.
References bpm_error(), bpm_warning(), doublewf_compat(), doublewf_t::ns, and doublewf_t::wf.
EXTERN int doublewf_subtract | ( | doublewf_t * | w1, | |
doublewf_t * | w2 | |||
) |
Subtracts two waveforms of doubles w1-w2 sample per sample. The result is stored in w1.
w1 | A pointer to the first waveform of doubles | |
w2 | A pointer to the second waveform of doubles |
Definition at line 297 of file doublewf.c.
References bpm_error(), bpm_warning(), doublewf_compat(), doublewf_t::ns, and doublewf_t::wf.
EXTERN int doublewf_multiply | ( | doublewf_t * | w1, | |
doublewf_t * | w2 | |||
) |
Multiplies two waveforms of doubles w1*w2 sample per sample. The result is stored in w1.
w1 | A pointer to the first waveform of doubles | |
w2 | A pointer to the second waveform of doubles |
Definition at line 317 of file doublewf.c.
References bpm_error(), bpm_warning(), doublewf_compat(), doublewf_t::ns, and doublewf_t::wf.
Referenced by rf_mixer().
EXTERN int doublewf_divide | ( | doublewf_t * | w1, | |
doublewf_t * | w2 | |||
) |
Divides two waveforms of doubles w1/w2 sample per sample. The result is stored in w1. When w2[i] is 0, w1[i] will be set to 0. and a warning message is printed.
w1 | A pointer to the first waveform of doubles | |
w2 | A pointer to the second waveform of doubles |
Definition at line 338 of file doublewf.c.
References bpm_error(), bpm_warning(), doublewf_compat(), doublewf_t::ns, and doublewf_t::wf.
EXTERN int doublewf_scale | ( | double | f, | |
doublewf_t * | w | |||
) |
Scales the waveform of doubles w by factor f. The result is stored in w.
f | The scalefactor | |
w | A pointer to the waveform of doubles |
Definition at line 368 of file doublewf.c.
References bpm_error(), doublewf_t::ns, and doublewf_t::wf.
Referenced by add_mode_response(), get_mode_response(), and rf_amplify().
EXTERN int doublewf_bias | ( | double | c, | |
doublewf_t * | w | |||
) |
Biases the waveform of doubles w by a constant c. The result is stored in w.
c | The constant bias. | |
w | A pointer to the waveform of doubles |
Definition at line 385 of file doublewf.c.
References bpm_error(), doublewf_t::ns, and doublewf_t::wf.
EXTERN int doublewf_add_cwtone | ( | doublewf_t * | w, | |
double | amp, | |||
double | phase, | |||
double | freq, | |||
double | phasenoise | |||
) |
Adds a cosine-like CW tone to the entire waveform. The sampling time is taken on the array index, so t=(double)i/w->fs.
w | A pointer to the waveform structure | |
amp | Amplitude of the CW tone | |
phase | Phase of the CW tone | |
freq | Frequency of the CW tone | |
phasenoise | Sigma of the gaussian phasenoise |
Definition at line 402 of file doublewf.c.
References bpm_error(), doublewf_t::fs, nr_rangauss(), doublewf_t::ns, and doublewf_t::wf.
Referenced by rf_addLO().
EXTERN int doublewf_add_dcywave | ( | doublewf_t * | w, | |
double | amp, | |||
double | phase, | |||
double | freq, | |||
double | ttrig, | |||
double | tdcy, | |||
double | phasenoise | |||
) |
Adds a decaying wave pulse to the waveform. The sampling time is taken on the array index, so t=(double)i/w->fs. The added signal is of the form :
If desired, phasenoise is added to the phase of the waveform.
w | A pointer to the waveform structure | |
amp | Amplitude of the CW tone | |
phase | Phase of the CW tone | |
freq | Frequency of the CW tone | |
ttrig | Trigger time of the pulse | |
tdcy | Decay time of the pulse | |
phasenoise | Sigma of the gaussian phasenoise |
Definition at line 422 of file doublewf.c.
References bpm_error(), doublewf_t::fs, nr_rangauss(), doublewf_t::ns, and doublewf_t::wf.
EXTERN int doublewf_add_ampnoise | ( | doublewf_t * | w, | |
double | sigma | |||
) |
Adds gaussian amplitude noise to the waveform.
w | A pointer to the waveform structure | |
sigma | The gaussian sigma of the amplitude noise |
Definition at line 447 of file doublewf.c.
References bpm_error(), nr_rangauss(), doublewf_t::ns, and doublewf_t::wf.
EXTERN int doublewf_basic_stats | ( | doublewf_t * | w, | |
int | s0, | |||
int | s1, | |||
wfstat_t * | stats | |||
) |
Retrieves some basic statistics about the waveform of doubles in w, only considers samples between s0 and s1.
w | A pointer to the waveform structure | |
s0 | First sample to consider | |
s1 | Last sample to consider | |
stats | A filled wfstat_t structure is returned. |
Definition at line 467 of file doublewf.c.
References bpm_error(), bpm_warning(), wfstat_t::imax, wfstat_t::imin, wfstat_t::max, wfstat_t::mean, wfstat_t::min, doublewf_t::ns, wfstat_t::rms, doublewf_t::wf, and wfstat_reset().
Referenced by intwf_basic_stats().
EXTERN int doublewf_derive | ( | doublewf_t * | w | ) |
Produce the derivative waveform for w : dw/dt.
w | A pointer to the waveform structure. |
Definition at line 507 of file doublewf.c.
References bpm_error(), doublewf_t::fs, doublewf_t::ns, and doublewf_t::wf.
EXTERN int doublewf_integrate | ( | doublewf_t * | w | ) |
Produce the integrated waveform for w : ^t w(s)ds.
w | A pointer to the waveform structure. |
Definition at line 532 of file doublewf.c.
References bpm_error(), doublewf_t::fs, doublewf_t::ns, and doublewf_t::wf.
Referenced by add_mode_response(), and get_mode_response().
EXTERN void doublewf_print | ( | FILE * | of, | |
doublewf_t * | w | |||
) |
Print the waveform to the filepointer
of | A filepointer, use stdout for the terminal | |
w | A pointer to the waveform |
Definition at line 556 of file doublewf.c.
References bpm_error(), doublewf_t::fs, MHz, doublewf_t::ns, and doublewf_t::wf.
EXTERN double doublewf_getvalue | ( | doublewf_t * | w, | |
double | t, | |||
unsigned int | mode | |||
) |
Return the value for the waveform at sample time t, according to the interpolation mode.
w | A pointer to the waveform structure | |
t | A time at which to sample the waveform | |
mode | Interpolation mode |
Definition at line 575 of file doublewf.c.
References bpm_error(), doublewf_t::fs, lanczos(), nr_quadinterpol(), doublewf_t::ns, sinc(), doublewf_t::wf, WF_LANCZOS, WF_LINEAR, WF_QUADRATIC, and WF_SINC.
Referenced by digitise(), doublewf_resample(), intwf_getvalue(), and intwf_resample().
EXTERN int doublewf_resample | ( | doublewf_t * | w2, | |
double | fs, | |||
doublewf_t * | w1, | |||
unsigned int | mode | |||
) |
Resamples the waveform w1 into w2 with new fs sampling frequency This routine recalculates the correct number of samples required. However the user needs to make sure that there are enough samples in w2 available as this is not checked. The w2->ns value will be overwritten with the correct amount. The routine checkes whether the maximum allowed number of samples is not exceeded to avoid memory problems.
w | A pointer to the waveform structure | |
t | A time at which to sample the waveform | |
mode | Interpolation mode |
Definition at line 664 of file doublewf.c.
References bpm_error(), doublewf_getvalue(), doublewf_t::fs, MAX_ALLOWED_NS, doublewf_t::ns, and doublewf_t::wf.
EXTERN intwf_t* intwf | ( | int | ns, | |
double | fs | |||
) |
Allocates memory for a new waveform of integers
ns | The number of samples in the waveform | |
fs | The sampling frequency of the waveform |
Definition at line 8 of file intwf.c.
References bpm_error(), intwf_t::fs, MAX_ALLOWED_NS, intwf_t::ns, and intwf_t::wf.
Referenced by intwf_cast_new(), intwf_copy_new(), and intwf_sample_series().
EXTERN intwf_t* intwf_sample_series | ( | int | ns, | |
double | fs | |||
) |
Allocates memory for a new waveform of integers and fills it with sample numbers.
ns | The number of samples in the waveform | |
fs | The sampling frequency of the waveform |
Definition at line 50 of file intwf.c.
References intwf(), intwf_t::ns, and intwf_t::wf.
EXTERN int intwf_setvalues | ( | intwf_t * | w, | |
int * | x | |||
) |
Fills the waveform of integers with the values from the array x. No check is performed whether x contains enough samples, the user needs to be sure this is the case !
w | A pointer to the waveform of integers | |
x | A pointer to the x values |
Definition at line 126 of file intwf.c.
References bpm_error(), intwf_t::ns, and intwf_t::wf.
EXTERN int intwf_setfunction | ( | intwf_t * | w, | |
int(*)(double t, int, double *) | wffun, | |||
int | npars, | |||
double * | par | |||
) |
Fills the waveform with values from the function wffun(), this function has to return a double from argument t ( time ) and has npars parameters given by the array *par. The function will be evaluated at the time t of each sample...
w | A pointer to the waveform of integers | |
wffun | A pointer to the function to fill the waveform with | |
t | The time parameter in the function | |
npars | Number of parameters for the function | |
par | Array of parameters for the function |
Copies the values from existing waveform src into copy checks first whether the waveforms are compatible... This routine doesn't allocate memory internally and the waveforms should already have been created by the user...
copy | A pointer to the copy waveform | |
src | A pointer to the original waveform |
Definition at line 81 of file intwf.c.
References bpm_error(), intwf_compat(), intwf_t::ns, and intwf_t::wf.
Allocates memory and produces a copy of the waveform w;
w | A pointer to the original waveform |
Definition at line 63 of file intwf.c.
References bpm_error(), intwf_t::fs, intwf(), intwf_t::ns, and intwf_t::wf.
Copies a subset from sample i1 to sample i2 ( inclusive ) to the sub waveform from waveform w. The routine expects the sub waveform to already exist with enough samples. ( this is not checked ! ) The sub->fs and sub->ns will be overwritten.
sub | Pointer to the waveform which will hold the subset | |
w | Pointer to the original waveform | |
i1 | First sample of w to copy | |
i2 | Last sample of w to copy |
Definition at line 102 of file intwf.c.
References bpm_error(), intwf_t::fs, intwf_t::ns, and intwf_t::wf.
EXTERN int intwf_reset | ( | intwf_t * | w | ) |
Resets the waveform of integers to 0.
w | A pointer to the waveform of integers |
Definition at line 160 of file intwf.c.
References bpm_error(), intwf_t::ns, and intwf_t::wf.
EXTERN void intwf_delete | ( | intwf_t * | w | ) |
Frees up the memory used by the waveform
w | A pointer to the waveform of integers |
Definition at line 177 of file intwf.c.
References bpm_warning(), and intwf_t::wf.
EXTERN doublewf_t* doublewf_cast_new | ( | intwf_t * | w | ) |
Cast the waveform of integers to a new waveform of doubles. Memory is allocated inside this routine so the user just needs to have a inwf_t pointer ready.
w | A pointer to the waveform of integers |
Definition at line 194 of file intwf.c.
References bpm_error(), doublewf(), intwf_t::fs, intwf_t::ns, doublewf_t::wf, and intwf_t::wf.
Referenced by intwf_basic_stats(), intwf_getvalue(), and intwf_resample().
EXTERN int doublewf_cast | ( | doublewf_t * | w, | |
intwf_t * | iw | |||
) |
Cast the waveform of integers to an already existing waveform of doubles.
iw | A pointer to an existing waveform of integers | |
w | A pointer to the waveform of integers |
Definition at line 220 of file intwf.c.
References bpm_error(), intwf_t::ns, doublewf_t::wf, and intwf_t::wf.
Checks compatiblity of the two waveforms, returns true if the number of samples and the sampling frequencies match. For the sampling frequency, it is simply checked whether they match to WF_EPS.
w1 | A pointer to the first waveform of integers | |
w2 | A pointer to the second waveform of integers |
Definition at line 238 of file intwf.c.
References bpm_error(), intwf_t::fs, intwf_t::ns, and WF_EPS.
Referenced by intwf_add(), intwf_copy(), intwf_divide(), intwf_multiply(), and intwf_subtract().
Adds two waveforms of integers w1+w2 sample per sample. The result is stored in w1.
w1 | A pointer to the first waveform of integers | |
w2 | A pointer to the second waveform of integers |
Definition at line 251 of file intwf.c.
References bpm_error(), bpm_warning(), intwf_compat(), intwf_t::ns, and intwf_t::wf.
Subtracts two waveforms of integers w1-w2 sample per sample. The result is stored in w1.
w1 | A pointer to the first waveform of integers | |
w2 | A pointer to the second waveform of integers |
Definition at line 271 of file intwf.c.
References bpm_error(), bpm_warning(), intwf_compat(), intwf_t::ns, and intwf_t::wf.
Multiplies two waveforms of integers w1*w2 sample per sample. The result is stored in w1.
w1 | A pointer to the first waveform of integers | |
w2 | A pointer to the second waveform of integers |
Definition at line 291 of file intwf.c.
References bpm_error(), bpm_warning(), intwf_compat(), intwf_t::ns, and intwf_t::wf.
Divides two waveforms of integers w1/w2 sample per sample. The result is stored in w1. When w2[i] is 0, w1[i] will be set to 0. and a warning message is printed.
w1 | A pointer to the first waveform of integers | |
w2 | A pointer to the second waveform of integers |
Definition at line 313 of file intwf.c.
References bpm_error(), bpm_warning(), intwf_compat(), intwf_t::ns, and intwf_t::wf.
EXTERN int intwf_scale | ( | int | f, | |
intwf_t * | w | |||
) |
Scales the waveform of integers w by factor f. The result is stored in w.
f | The scalefactor | |
w | A pointer to the waveform of integers |
Definition at line 343 of file intwf.c.
References bpm_error(), intwf_t::ns, and intwf_t::wf.
EXTERN int intwf_bias | ( | int | c, | |
intwf_t * | w | |||
) |
Biases the waveform of integers w by a constant c. The result is stored in w.
c | The constant bias. | |
w | A pointer to the waveform of integers |
Definition at line 360 of file intwf.c.
References bpm_error(), intwf_t::ns, and intwf_t::wf.
EXTERN int intwf_add_cwtone | ( | intwf_t * | w, | |
double | amp, | |||
double | phase, | |||
double | freq, | |||
double | phasenoise | |||
) |
Adds a cosine-like CW tone to the entire waveform. The sampling time is taken on the array index, so t=(double)i/w->fs.
w | A pointer to the waveform structure | |
amp | Amplitude of the CW tone | |
phase | Phase of the CW tone | |
freq | Frequency of the CW tone | |
phasenoise | Sigma of the gaussian phasenoise |
Definition at line 377 of file intwf.c.
References bpm_error(), dround(), intwf_t::fs, nr_rangauss(), intwf_t::ns, and intwf_t::wf.
EXTERN int intwf_add_dcywave | ( | intwf_t * | w, | |
double | amp, | |||
double | phase, | |||
double | freq, | |||
double | ttrig, | |||
double | tdcy, | |||
double | phasenoise | |||
) |
Adds a decaying wave pulse to the waveform. The sampling time is taken on the array index, so t=(double)i/w->fs. The added signal is of the form :
If desired, phasenoise is added to the phase of the waveform.
w | A pointer to the waveform structure | |
amp | Amplitude of the CW tone | |
phase | Phase of the CW tone | |
freq | Frequency of the CW tone | |
ttrig | Trigger time of the pulse | |
tdcy | Decay time of the pulse | |
phasenoise | Sigma of the gaussian phasenoise |
Definition at line 397 of file intwf.c.
References bpm_error(), dround(), intwf_t::fs, nr_rangauss(), intwf_t::ns, and intwf_t::wf.
EXTERN int intwf_add_ampnoise | ( | intwf_t * | w, | |
double | sigma | |||
) |
Adds gaussian amplitude noise to the waveform.
w | A pointer to the waveform structure | |
sigma | The gaussian sigma of the amplitude noise |
Definition at line 423 of file intwf.c.
References bpm_error(), dround(), nr_rangauss(), intwf_t::ns, and intwf_t::wf.
Retrieves some basic statistics about the waveform of integers in w, only considers samples between s0 and s1.
w | A pointer to the waveform structure | |
s0 | First sample to consider | |
s1 | Last sample to consider | |
stats | A filled wfstat_t structure is returned. |
Definition at line 443 of file intwf.c.
References bpm_error(), doublewf_basic_stats(), doublewf_cast_new(), and doublewf_delete().
EXTERN int intwf_derive | ( | intwf_t * | w | ) |
Produce the derivative waveform for w : dw/dt.
w | A pointer to the waveform structure. |
Definition at line 469 of file intwf.c.
References bpm_error(), dround(), intwf_t::fs, intwf_t::ns, and intwf_t::wf.
EXTERN int intwf_integrate | ( | intwf_t * | w | ) |
Produce the integrated waveform for w : ^t w(s)ds.
w | A pointer to the waveform structure. |
Definition at line 494 of file intwf.c.
References bpm_error(), dround(), intwf_t::fs, intwf_t::ns, and intwf_t::wf.
EXTERN void intwf_print | ( | FILE * | of, | |
intwf_t * | w | |||
) |
Print the waveform to the filepointer
of | A filepointer, use stdout for the terminal | |
w | A pointer to the waveform |
Definition at line 525 of file intwf.c.
References bpm_error(), intwf_t::fs, MHz, intwf_t::ns, and intwf_t::wf.
EXTERN int intwf_getvalue | ( | intwf_t * | w, | |
double | t, | |||
unsigned int | mode | |||
) |
Return the value for the waveform at sample time t, according to the interpolation mode.
w | A pointer to the waveform structure | |
t | A time at which to sample the waveform | |
mode | Interpolation mode |
Definition at line 544 of file intwf.c.
References bpm_error(), doublewf_cast_new(), doublewf_delete(), doublewf_getvalue(), and dround().
Resamples the waveform w1 into w2 with new fs sampling frequency This routine recalculates the correct number of samples required. However the user needs to make sure that there are enough samples in w2 available as this is not checked. The w2->ns value will be overwritten with the correct amount. The routine checkes whether the maximum allowed number of samples is not exceeded to avoid memory problems.
w | A pointer to the waveform structure | |
t | A time at which to sample the waveform | |
mode | Interpolation mode |
Definition at line 571 of file intwf.c.
References bpm_error(), doublewf_cast_new(), doublewf_delete(), doublewf_getvalue(), dround(), intwf_t::fs, MAX_ALLOWED_NS, intwf_t::ns, and intwf_t::wf.
EXTERN complexwf_t* complexwf | ( | int | ns, | |
double | fs | |||
) |
Allocates memory for a new waveform of complex numbers
ns | The number of samples in the waveform | |
fs | The sampling frequency of the waveform |
Definition at line 8 of file complexwf.c.
References bpm_error(), complexwf_t::fs, MAX_ALLOWED_NS, complexwf_t::ns, and complexwf_t::wf.
Referenced by add_amplnoise(), add_mode_response(), complexwf_copy_new(), and generate_bpmsignal().
EXTERN complexwf_t* complexwf_copy_new | ( | complexwf_t * | w | ) |
Allocates memory and produces a copy of the complex waveform w;
w | A pointer to the original waveform |
Definition at line 50 of file complexwf.c.
References bpm_error(), complexwf(), complexwf_t::fs, complexwf_t::ns, and complexwf_t::wf.
Referenced by add_waveforms().
EXTERN int complexwf_copy | ( | complexwf_t * | copy, | |
complexwf_t * | src | |||
) |
Copies the values from existing complex waveform src into copy checks first whether the waveforms are compatible... This routine doesn't allocate memory internally and the waveforms should already have been created by the user...
copy | A pointer to the copy waveform | |
src | A pointer to the original waveform |
Definition at line 67 of file complexwf.c.
References bpm_error(), complexwf_compat(), complexwf_t::ns, and complexwf_t::wf.
EXTERN int complexwf_subset | ( | complexwf_t * | sub, | |
complexwf_t * | w, | |||
int | i1, | |||
int | i2 | |||
) |
Copies a subset from sample i1 to sample i2 ( inclusive ) to the sub waveform from complex waveform w. The routine expects the sub waveform to already exist with enough samples. ( this is not checked ! ) The sub->fs and sub->ns will be overwritten.
sub | Pointer to the waveform which will hold the subset | |
w | Pointer to the original waveform | |
i1 | First sample of w to copy | |
i2 | Last sample of w to copy |
Definition at line 88 of file complexwf.c.
References bpm_error(), complexwf_t::fs, complexwf_t::ns, and complexwf_t::wf.
EXTERN int complexwf_setvalues | ( | complexwf_t * | w, | |
complex_t * | x | |||
) |
Fills the complex waveform with the values from the array x. No check is performed whether x contains enough samples, the user needs to be sure this is the case !
w | A pointer to the waveform of complex numbers | |
x | A pointer to the complex x values |
Definition at line 112 of file complexwf.c.
References bpm_error(), complexwf_t::ns, and complexwf_t::wf.
EXTERN int complexwf_setfunction | ( | complexwf_t * | w, | |
complex_t(*)(double, int, double *) | wffun, | |||
int | npars, | |||
double * | par | |||
) |
Fills the waveform with values from the function wffun(), this function has to return a complex_t from argument t ( time ) and has npars parameters given by the array *par. The function will be evaluated at the time t of each sample...
w | A pointer to the waveform of complex numbers | |
wffun | A pointer to the function to fill the waveform with | |
t | The time parameter in the function | |
npars | Number of parameters for the function | |
par | Array of parameters for the function |
Definition at line 127 of file complexwf.c.
References bpm_error(), complexwf_t::fs, complexwf_t::ns, and complexwf_t::wf.
EXTERN int complexwf_reset | ( | complexwf_t * | w | ) |
Resets the waveform of complex numbers to 0+0i
w | A pointer to the complex waveform |
Definition at line 145 of file complexwf.c.
References bpm_error(), complex(), complexwf_t::ns, and complexwf_t::wf.
EXTERN void complexwf_delete | ( | complexwf_t * | w | ) |
Frees up the memory used by the waveform
w | A pointer to the waveform of complex numbers |
Definition at line 162 of file complexwf.c.
References bpm_warning(), and complexwf_t::wf.
Referenced by add_amplnoise(), add_mode_response(), and add_waveforms().
EXTERN int complexwf_compat | ( | complexwf_t * | w1, | |
complexwf_t * | w2 | |||
) |
Checks compatiblity of the two waveforms, returns true if the number of samples and the sampling frequencies match. For the sampling frequency, it is simply checked whether they match to WF_EPS.
w1 | A pointer to the first waveform of complex numbers | |
w2 | A pointer to the second waveform of complex numbers |
Definition at line 179 of file complexwf.c.
References bpm_error(), complexwf_t::fs, complexwf_t::ns, and WF_EPS.
Referenced by complexwf_add(), complexwf_copy(), complexwf_divide(), complexwf_multiply(), and complexwf_subtract().
EXTERN int complexwf_add | ( | complexwf_t * | w1, | |
complexwf_t * | w2 | |||
) |
Adds two waveforms of complex numbers w1+w2 sample per sample. The result is stored in w1.
w1 | A pointer to the first waveform of complex numbers | |
w2 | A pointer to the second waveform of comlex numbers |
Definition at line 192 of file complexwf.c.
References bpm_error(), bpm_warning(), c_sum(), complexwf_compat(), complexwf_t::ns, and complexwf_t::wf.
Referenced by add_mode_response(), and add_waveforms().
EXTERN int complexwf_subtract | ( | complexwf_t * | w1, | |
complexwf_t * | w2 | |||
) |
Subtracts two waveforms of complex numbers w1-w2 sample per sample. The result is stored in w1.
w1 | A pointer to the first waveform of complex numbers | |
w2 | A pointer to the second waveform of comlex numbers |
Definition at line 212 of file complexwf.c.
References bpm_error(), bpm_warning(), c_diff(), complexwf_compat(), complexwf_t::ns, and complexwf_t::wf.
EXTERN int complexwf_multiply | ( | complexwf_t * | w1, | |
complexwf_t * | w2 | |||
) |
Multiplies two waveforms of complex numbers w1*w2 sample per sample. The result is stored in w1.
w1 | A pointer to the first waveform of complex numbers | |
w2 | A pointer to the second waveform of comlex numbers |
Definition at line 233 of file complexwf.c.
References bpm_error(), bpm_warning(), c_mult(), complexwf_compat(), complexwf_t::ns, and complexwf_t::wf.
EXTERN int complexwf_divide | ( | complexwf_t * | w1, | |
complexwf_t * | w2 | |||
) |
Divides two waveforms of complex numbers w1/w2 sample per sample. The result is stored in w1.
w1 | A pointer to the first waveform of complex numbers | |
w2 | A pointer to the second waveform of comlex numbers |
Definition at line 255 of file complexwf.c.
References bpm_error(), bpm_warning(), c_div(), c_isequal(), complex(), complexwf_compat(), complexwf_t::ns, and complexwf_t::wf.
EXTERN int complexwf_scale | ( | complex_t | f, | |
complexwf_t * | w | |||
) |
Scales the waveform of complex numbers w with complex factor f The result is stored in w.
f | The complex scaling factor | |
w | A pointer to the waveform of comlex numbers |
Definition at line 287 of file complexwf.c.
References bpm_error(), c_mult(), complexwf_t::ns, and complexwf_t::wf.
Referenced by add_mode_response(), add_waveforms(), rf_amplify_complex(), and rf_phase_shifter().
EXTERN int complexwf_bias | ( | complex_t | c, | |
complexwf_t * | w | |||
) |
Biases the waveform of complex numbers w with complex constant c The result is stored in w.
c | The complex constant | |
w | A pointer to the waveform of comlex numbers |
Definition at line 304 of file complexwf.c.
References bpm_error(), c_sum(), complexwf_t::ns, and complexwf_t::wf.
EXTERN int complexwf_add_cwtone | ( | complexwf_t * | w, | |
double | amp, | |||
double | phase, | |||
double | freq, | |||
double | phasenoise | |||
) |
Adds a CW tone to the entire waveform. The sampling time is taken on the array index, so t=(double)i/w->fs. The real part will have the cos-like waveform, the imaginary part the sin-like waveform.
w | A pointer to the complex waveform structure | |
amp | Amplitude of the CW tone | |
phase | Phase of the CW tone | |
freq | Frequency of the CW tone | |
phasenoise | Sigma of the gaussian phasenoise |
Definition at line 321 of file complexwf.c.
References bpm_error(), complexwf_t::fs, complex_t::im, nr_rangauss(), complexwf_t::ns, complex_t::re, and complexwf_t::wf.
EXTERN int complexwf_add_dcywave | ( | complexwf_t * | w, | |
double | amp, | |||
double | phase, | |||
double | freq, | |||
double | ttrig, | |||
double | tdcy, | |||
double | phasenoise | |||
) |
Adds a decaying wave pulse to the waveform. The sampling time is taken on the array index, so t=(double)i/w->fs. The added signal is of the form :
The real part will have the cos-like component, the imaginary part the sin-like component. If desired, phasenoise is added to the phase of the waveform.
w | A pointer to the waveform structure | |
amp | Amplitude of the CW tone | |
phase | Phase of the CW tone | |
freq | Frequency of the CW tone | |
ttrig | Trigger time of the pulse | |
tdcy | Decay time of the pulse | |
phasenoise | Sigma of the gaussian phasenoise |
Definition at line 345 of file complexwf.c.
References bpm_error(), complexwf_t::fs, complex_t::im, nr_rangauss(), complexwf_t::ns, complex_t::re, and complexwf_t::wf.
EXTERN int complexwf_add_noise | ( | complexwf_t * | w, | |
double | sigma | |||
) |
Adds uncorrelated gaussian amplitude noise with uniformly distributed random phase to the complex the waveform.
w | A pointer to the complex waveform structure | |
sigma | The gaussian sigma of the amplitude noise, phase is uniform over 2pi |
Definition at line 372 of file complexwf.c.
References bpm_error(), c_sum(), complex(), nr_rangauss(), nr_ranuniform(), complexwf_t::ns, and complexwf_t::wf.
EXTERN int complexwf_add_ampnoise | ( | complexwf_t * | w, | |
double | sigma | |||
) |
Adds pure gaussian amplitude noise to the complex waveform and leaves the phase untouched
w | A pointer to the complex waveform structure | |
sigma | The gaussian sigma of the amplitude noise |
Definition at line 396 of file complexwf.c.
References bpm_error(), c_abs(), c_arg(), complex(), nr_rangauss(), complexwf_t::ns, and complexwf_t::wf.
EXTERN int complexwf_add_phasenoise | ( | complexwf_t * | w, | |
double | sigma | |||
) |
Adds pure gaussian phase noise to the complex waveform and leaves the amplitude untouched
w | A pointer to the complex waveform structure | |
sigma | The gaussian sigma of the phase noise |
Definition at line 420 of file complexwf.c.
References bpm_error(), c_abs(), c_arg(), complex(), nr_rangauss(), complexwf_t::ns, and complexwf_t::wf.
EXTERN void complexwf_print | ( | FILE * | of, | |
complexwf_t * | w | |||
) |
Print the waveform to the filepointer
of | A filepointer, use stdout for the terminal | |
w | A pointer to the waveform |
Definition at line 445 of file complexwf.c.
References bpm_error(), complexwf_t::fs, complex_t::im, MHz, complexwf_t::ns, complex_t::re, and complexwf_t::wf.
EXTERN int complexwf_getreal | ( | doublewf_t * | re, | |
complexwf_t * | z | |||
) |
Gets the real part of the comlex waveform into the waveform of doubles. The doublewf needs to be allocated by the user beforehand and have the same number of samples as the complex waveform.
re | A pointer to the waveform of doubles which will store the real part | |
z | A pointer to the complex waveform |
Definition at line 465 of file complexwf.c.
References bpm_error(), bpm_warning(), doublewf_t::ns, complexwf_t::ns, complex_t::re, doublewf_t::wf, and complexwf_t::wf.
Referenced by rf_rectify().
EXTERN int complexwf_getimag | ( | doublewf_t * | im, | |
complexwf_t * | z | |||
) |
Gets the imaginary part of the comlex waveform into the waveform of doubles. The doublewf needs to be allocated by the user beforehand and have the same number of samples as the complex waveform.
im | A pointer to the waveform of doubles which will store the imaginary part | |
z | A pointer to the complex waveform |
Definition at line 487 of file complexwf.c.
References bpm_error(), bpm_warning(), complex_t::im, doublewf_t::ns, complexwf_t::ns, doublewf_t::wf, and complexwf_t::wf.
EXTERN int complexwf_getamp | ( | doublewf_t * | r, | |
complexwf_t * | z | |||
) |
Gets the amplitude of the comlex waveform into the waveform of doubles. The doublewf needs to be allocated by the user beforehand and have the same number of samples as the complex waveform.
im | A pointer to the waveform of doubles which will store the amplitude | |
z | A pointer to the complex waveform |
Definition at line 509 of file complexwf.c.
References bpm_error(), bpm_warning(), c_abs(), doublewf_t::ns, complexwf_t::ns, doublewf_t::wf, and complexwf_t::wf.
EXTERN int complexwf_getphase | ( | doublewf_t * | theta, | |
complexwf_t * | z | |||
) |
Gets the phase of the comlex waveform into the waveform of doubles. The doublewf needs to be allocated by the user beforehand and have the same number of samples as the complex waveform.
im | A pointer to the waveform of doubles which will store the phase | |
z | A pointer to the complex waveform |
Definition at line 531 of file complexwf.c.
References bpm_error(), bpm_warning(), c_arg(), doublewf_t::ns, complexwf_t::ns, doublewf_t::wf, and complexwf_t::wf.
EXTERN doublewf_t* complexwf_getreal_new | ( | complexwf_t * | z | ) |
Retrieves the real part of the complex waveform in a newly allocated waveform of doubles. Memory on the heap is allocated inside this routine, the user has to deal with deal with freeing it him/her self.
z | A pointer to the complex waveform |
Definition at line 597 of file complexwf.c.
References bpm_error(), doublewf(), complexwf_t::fs, complexwf_t::ns, complex_t::re, doublewf_t::wf, and complexwf_t::wf.
EXTERN doublewf_t* complexwf_getimag_new | ( | complexwf_t * | z | ) |
Retrieves the imaginary part of the complex waveform in a newly allocated waveform of doubles. Memory on the heap is allocated inside this routine, the user has to deal with deal with freeing it him/her self.
z | A pointer to the complex waveform |
Definition at line 622 of file complexwf.c.
References bpm_error(), doublewf(), complexwf_t::fs, complex_t::im, complexwf_t::ns, doublewf_t::wf, and complexwf_t::wf.
EXTERN doublewf_t* complexwf_getamp_new | ( | complexwf_t * | z | ) |
Retrieves the amplitude of the complex waveform in a newly allocated waveform of doubles. Memory on the heap is allocated inside this routine, the user has to deal with deal with freeing it him/her self.
z | A pointer to the complex waveform |
Definition at line 647 of file complexwf.c.
References bpm_error(), c_abs(), doublewf(), complexwf_t::fs, complexwf_t::ns, doublewf_t::wf, and complexwf_t::wf.
EXTERN doublewf_t* complexwf_getphase_new | ( | complexwf_t * | z | ) |
Retrieves the phase of the complex waveform in a newly allocated waveform of doubles. Memory on the heap is allocated inside this routine, the user has to deal with deal with freeing it him/her self.
z | A pointer to the complex waveform |
Definition at line 672 of file complexwf.c.
References bpm_error(), c_arg(), doublewf(), complexwf_t::fs, complexwf_t::ns, doublewf_t::wf, and complexwf_t::wf.
EXTERN int complexwf_setreal | ( | complexwf_t * | z, | |
doublewf_t * | re | |||
) |
Set the real part of the complex waveform z to re. The complexwf needs to be allocated by the user beforehand and have the same number of samples as the double waveform.
z | A pointer to the complex waveform | |
re | A pointer to a waveform of double containing the real part |
Definition at line 553 of file complexwf.c.
References bpm_error(), bpm_warning(), doublewf_t::ns, complexwf_t::ns, complex_t::re, complexwf_t::wf, and doublewf_t::wf.
Referenced by add_mode_response(), ddc(), and get_mode_response().
EXTERN int complexwf_setimag | ( | complexwf_t * | z, | |
doublewf_t * | im | |||
) |
Set the imaginary part of the complex waveform z to im. The complexwf needs to be allocated by the user beforehand and have the same number of samples as the double waveform.
z | A pointer to the complex waveform | |
re | A pointer to a waveform of double containing the imaginary part |
Definition at line 575 of file complexwf.c.
References bpm_error(), bpm_warning(), complex_t::im, doublewf_t::ns, complexwf_t::ns, complexwf_t::wf, and doublewf_t::wf.
Referenced by add_mode_response(), ddc(), and get_mode_response().