ANITA Analysis Framework
|
This class is intended to be the main storage vessel for ANITA waveforms. It is similar in principle to RFWaveform from FFTtools. . More...
#include <AnalysisWaveform.h>
Classes | |
struct | InterpolationOptions |
class | PowerCalculationOptions |
Public Types | |
enum | EvenEvaluationType { EVAL_LINEAR, EVAL_AKIMA } |
enum | InterpolationType { AKIMA, SPARSE_YEN, REGULARIZED_SPARSE_YEN } |
Public Member Functions | |
AnalysisWaveform (int Nt, const double *x, const double *y, double nominal_dt=1./2.6, InterpolationType type=defaultInterpolationType, InterpolationOptions *opt=&defaultInterpolationOptions) | |
AnalysisWaveform (int Nt, const double *y, double dt, double t0) | |
AnalysisWaveform (int Nt, const FFTWComplex *f, double df, double t0) | |
AnalysisWaveform (int Nt=260, double dt=1./2.6, double t0=0) | |
AnalysisWaveform (const AnalysisWaveform &other) | |
AnalysisWaveform * | autoCorrelation (int npadtime=1, int npadfreq=0, double scale=1) |
bool | checkIfPaddedInTime () const |
double | deltaF () const |
double | deltaT () const |
void | drawEven (const char *opt="", int color=-1) const |
void | drawHilbertEnvelope (const char *opt="", int color=-1) const |
void | drawPhase (const char *opt="", int color=-1) const |
void | drawPower (const char *opt="", int color=-1) const |
void | drawPowerdB (const char *opt="", int color=-1) const |
void | drawUneven (const char *opt="", int color=-1) const |
double | evalEven (double t, EvenEvaluationType=EVAL_LINEAR) const |
void | evalEven (int N, const double *__restrict t, double *__restrict v, EvenEvaluationType=EVAL_LINEAR) const |
const TGraphAligned * | even () const |
void | forceEvenSize (int size) |
const FFTWComplex * | freq () const |
double | getRMS () const |
const TGraphAligned * | groupDelay () const |
const TGraphAligned * | hilbertEnvelope () const |
const AnalysisWaveform * | hilbertTransform () const |
int | Neven () const |
int | Nfreq () const |
int | Nuneven () const |
AnalysisWaveform & | operator= (const AnalysisWaveform &other) |
void | padEven (int factor, int where=1) |
void | padFreq (int factor) |
void | padFreqAdd (int npad) |
const TGraphAligned * | phase () const |
const TGraphAligned * | power () const |
const TGraphAligned * | powerdB () const |
void | setColor (int c) |
void | setFreqDisplayRange (double low, double high) |
void | setPowerCalculationOptions (PowerCalculationOptions &opt) |
void | setTimeDisplayRange (double low, double high) |
void | setTitle (const char *title) |
void | setWidth (int w) |
const TGraphAligned * | uneven () const |
TGraphAligned * | updateEven () |
void | updateEven (const TGraph *replace_even) |
FFTWComplex * | updateFreq () |
void | updateFreq (int new_N, const FFTWComplex *new_freq, double new_df=0) |
TGraphAligned * | updateUneven () |
void | updateUneven (const TGraph *replace_uneven) |
void | zeroMeanEven () |
Static Public Member Functions | |
static void | allowEvenToUnevenConversion (bool allow) |
static void | basisChange (AnalysisWaveform *__restrict hpol_or_lcp, AnalysisWaveform *__restrict vpol_or_rcp) |
static AnalysisWaveform * | convolution (const AnalysisWaveform *A, const AnalysisWaveform *B, int npadfreq=0, double scale=1) |
static AnalysisWaveform * | correlation (const AnalysisWaveform *A, const AnalysisWaveform *B, int npadfreq=0, double scale=1, int window_normalize=0) |
static void | enableDebug (bool enable) |
static AnalysisWaveform * | makeWf (const TGraph *g, bool even=true, AnalysisWaveform *replace=0) |
static void | setCorrelationNag (bool nag) |
static void | sumDifference (AnalysisWaveform *__restrict a, AnalysisWaveform *__restrict b) |
Static Public Attributes | |
static InterpolationOptions | defaultInterpolationOptions |
static InterpolationType | defaultInterpolationType |
This class is intended to be the main storage vessel for ANITA waveforms. It is similar in principle to RFWaveform from FFTtools. .
This class holds 3 coupled versions of the waveform:
Transforming between uneven and even is accomplished via interpolation (which is not strictly invertible) Transforming between even and freq is accomplished via FT (which is more or less invertible, up to machine precision)
Because the transformation between even and uneven is not reversible, it usually only makes sense to access or modify uneven prior to modifying even or freq. If an access to uneven is attempted after modifying even or freq,
There are two types of accessors, const ones which retrieve const data:
And ones which allow modification of the data and will then recompute the other two versions the next time they're requested:
Those have two versions, one where you modify the return value and one where you replace the value.
In order to make it seem magic, there is a lot of internal state that is complicated to reason about. Hopefully there are no bugs...
Cosmin Deaconu cozzy d@ki cp.uc hica go.ed u
Definition at line 47 of file AnalysisWaveform.h.
The interpolation method used in e.g. evalEven
Definition at line 70 of file AnalysisWaveform.h.
The interpolation method used to transform in between evenly-sampled and unevenly-sampled waveforms
Definition at line 62 of file AnalysisWaveform.h.
AnalysisWaveform::AnalysisWaveform | ( | int | Nt, |
const double * | x, | ||
const double * | y, | ||
double | nominal_dt = 1./2.6 , |
||
InterpolationType | type = defaultInterpolationType , |
||
InterpolationOptions * | opt = &defaultInterpolationOptions |
||
) |
Constructor for unevenly sampled waveform
Nt | the number of samples |
x | the time values |
y | the voltage values |
nominal_dt | the mean sample rate, defaults to ANITA rate |
type | the InterpolationType used, defaults to defaultInterpolationType (which is probalby what you want to change to influence e.g. FilteredAnitaEvent). |
opt | the InterpolationOptions used, defaults to defaultInterpolationOptions (which is probably what you want to change to influence e.g. FilteredAnitaEvent). |
AnalysisWaveform::AnalysisWaveform | ( | int | Nt, |
const double * | y, | ||
double | dt, | ||
double | t0 | ||
) |
Constructor for evenly sampled waveform. Uneven waveform is set to even.
AnalysisWaveform::AnalysisWaveform | ( | int | Nt, |
const FFTWComplex * | f, | ||
double | df, | ||
double | t0 | ||
) |
Constructor from frequency domain (and uneven is set to be the same)
AnalysisWaveform::AnalysisWaveform | ( | int | Nt = 260 , |
double | dt = 1./2.6 , |
||
double | t0 = 0 |
||
) |
empty, even constructor
AnalysisWaveform::AnalysisWaveform | ( | const AnalysisWaveform & | other | ) |
Copy constructor. Will not blindly copy everything (like it won't bother copying anything that will have to be recalculated on its next access
|
static |
Enable (or disable) conversion from even to uneven. The default is that it's not allowed, which means that as soon as some transformation is done on the evenly-sampled waveform or in the frequency domain, the uneven waveform is set equal to the even waveform.
AnalysisWaveform* AnalysisWaveform::autoCorrelation | ( | int | npadtime = 1 , |
int | npadfreq = 0 , |
||
double | scale = 1 |
||
) |
Compute the (circular) autocorrelation of this waveform.
If you want non-circular correlation, you can pass 1 (or more) to npadtime. No scaling is applied, but you can set a scale by passing a scale parameter. User responsible for deleting returned value;
|
static |
change between vpol / hpol and lcp / rcp
bool AnalysisWaveform::checkIfPaddedInTime | ( | ) | const |
Checks if the even waveform is zeropadded (by comparing second half to zero)
|
static |
Computes the (circular) correlation (in the frequency domain) of the two waveforms as a new waveform. Note that if you want to correlate two traces, they should be padded first. This does not pad them for you, but will complain if they are not! To turn off the nagging, see below function. It is also assumed the two are of the same length.
By default is no normalization done at all, the frequency values are simply multiplied appropriately and then everything is divided by 1/scale.
If window_normalize is non-zero, then the total power of the overlapping window of at least size window_normalize at each point is used to scale. Smaller window sizes will use the smallest window size power ot normalize. An overall factor of scale is still applied.
|
inline |
Return the spacing between frequencies in the frequency domain
Definition at line 228 of file AnalysisWaveform.h.
|
inline |
Return the mean sampling period
Definition at line 225 of file AnalysisWaveform.h.
void AnalysisWaveform::drawEven | ( | const char * | opt = "" , |
int | color = -1 |
||
) | const |
Draw even
void AnalysisWaveform::drawHilbertEnvelope | ( | const char * | opt = "" , |
int | color = -1 |
||
) | const |
Draw Hilbert envelope
void AnalysisWaveform::drawPhase | ( | const char * | opt = "" , |
int | color = -1 |
||
) | const |
Draw phase
void AnalysisWaveform::drawPower | ( | const char * | opt = "" , |
int | color = -1 |
||
) | const |
Draw power
void AnalysisWaveform::drawPowerdB | ( | const char * | opt = "" , |
int | color = -1 |
||
) | const |
Draw power in dB
void AnalysisWaveform::drawUneven | ( | const char * | opt = "" , |
int | color = -1 |
||
) | const |
Draw uneven
|
static |
Enable (or disable) a bunch of debugging crap. Only possible with ANITA_ANALYSIS_DEBUG defined to avoid slow branches
double AnalysisWaveform::evalEven | ( | double | t, |
EvenEvaluationType | = EVAL_LINEAR |
||
) | const |
Evaluate the even waveform at a point.
void AnalysisWaveform::evalEven | ( | int | N, |
const double *__restrict | t, | ||
double *__restrict | v, | ||
EvenEvaluationType | = EVAL_LINEAR |
||
) | const |
Evaluate the even waveform at the specified points.
const TGraphAligned* AnalysisWaveform::even | ( | ) | const |
Constant accessor for even waveform. Dont' coerce into non-const unless you know what you're doing
void AnalysisWaveform::forceEvenSize | ( | int | size | ) |
Forces the even waveform to be a particular size. This is equivalent to updateEven()->Set() (with padding) with the exception that it may be deferred if even waveform needs to be (re)calculated.
const FFTWComplex* AnalysisWaveform::freq | ( | ) | const |
Constant accessor for frequency domain waveform. Dont' coerce into non-const unless you know what you're doing
const TGraphAligned* AnalysisWaveform::groupDelay | ( | ) | const |
Get the group delay
const TGraphAligned* AnalysisWaveform::hilbertEnvelope | ( | ) | const |
Get the hilbert envelope
const AnalysisWaveform* AnalysisWaveform::hilbertTransform | ( | ) | const |
Get the Hilbert Transform
|
static |
Constructor from TGraph. If even is true, it will assume it's evenly sampled, otherwise will check
|
inline |
Return the number of samples in the even waveform
Definition at line 219 of file AnalysisWaveform.h.
int AnalysisWaveform::Nfreq | ( | ) | const |
Return the length of the frequency domain complex waveform
|
inline |
Return the number of samples in the uneven waveform
Definition at line 222 of file AnalysisWaveform.h.
void AnalysisWaveform::padEven | ( | int | factor, |
int | where = 1 |
||
) |
pad the even waveform (equivalent to upsampling the frequency).
if where > 0, zeroes will be added at the end if where < 0, zeroes will be added at the beginning if where == 0, zeroes will be padded before and after
void AnalysisWaveform::padFreq | ( | int | factor | ) |
pad the frequency (equivalent to upsampling the even values)
void AnalysisWaveform::padFreqAdd | ( | int | npad | ) |
pad the frequency with a specific number of points (equivalent to upsampling the even values)
const TGraphAligned* AnalysisWaveform::phase | ( | ) | const |
Get the phase
const TGraphAligned* AnalysisWaveform::power | ( | ) | const |
Get the power
const TGraphAligned* AnalysisWaveform::powerdB | ( | ) | const |
Get the power in dB
void AnalysisWaveform::setPowerCalculationOptions | ( | PowerCalculationOptions & | opt | ) |
|
static |
Change between a ,b -> (a + b)/2, (a - b)/2
const TGraphAligned* AnalysisWaveform::uneven | ( | ) | const |
Constant accessor for uneven waveform. Dont' coerce into non-const unless you know what you're doing
TGraphAligned* AnalysisWaveform::updateEven | ( | ) |
Update the even graph by modifying return value
void AnalysisWaveform::updateEven | ( | const TGraph * | replace_even | ) |
Update the even graph by replacing with argument
FFTWComplex* AnalysisWaveform::updateFreq | ( | ) |
Update frequency graph by modifying return value
void AnalysisWaveform::updateFreq | ( | int | new_N, |
const FFTWComplex * | new_freq, | ||
double | new_df = 0 |
||
) |
Update frequency graph by replacing with argumetnts
TGraphAligned* AnalysisWaveform::updateUneven | ( | ) |
Update the uneven graph by modifying return value
void AnalysisWaveform::updateUneven | ( | const TGraph * | replace_uneven | ) |
Update the uneven graph by replacing with argument
void AnalysisWaveform::zeroMeanEven | ( | ) |
Zero mean even graph
|
static |
Default interpolation options, may be changed by user
Definition at line 112 of file AnalysisWaveform.h.
|
static |
The default type used. May be changed by user
Definition at line 77 of file AnalysisWaveform.h.