snax.waveforms module

class snax.waveforms.HalfSineGaussianGenerator(parameters, rates, bins, mismatch=0.2, tolerance=0.005, downsample_factor=0.8)[source]

Bases: TemplateGenerator

Generates half-Sine-Gaussian templates based on a f, Q range and a sampling frequency.

duration(f, q)[source]

return the duration of a half sine-gaussian waveform such that its edges will die out to tolerance of the peak.

generate_grid()[source]

Generates (f_samp, f, Q) pairs based on f, Q ranges

generate_templates(rate, quadrature=True, sampling_rate=None)[source]

generate all half sine gaussian templates corresponding to a parameter range and template duration for a given sampling rate.

latency(rate)[source]

Return the latency in sample points associated with half-Sine-Gaussians with a particular sampling rate.

times(rate)[source]

Return the time samples associated with half-Sine-Gaussians with a particular sampling rate.

waveform(rate, phase, f, q)[source]

construct half sine gaussian waveforms that taper to tolerance at edges of window. f is the central frequency of the waveform

class snax.waveforms.SineGaussianGenerator(parameters, rates, bins, mismatch=0.2, tolerance=0.005, downsample_factor=0.8)[source]

Bases: HalfSineGaussianGenerator

Generates sine gaussian templates based on a f, Q range and a sampling frequency.

duration(f, q)[source]

return the duration of a sine-gaussian waveform such that its edges will die out to tolerance of the peak.

latency(rate)[source]

Return the latency in sample points associated with half-Sine-Gaussians with a particular sampling rate.

times(rate)[source]

Return the time samples associated with half-Sine-Gaussians with a particular sampling rate.

class snax.waveforms.TaperedSineGaussianGenerator(parameters, rates, bins, mismatch=0.2, tolerance=0.005, downsample_factor=0.8, max_latency=1)[source]

Bases: HalfSineGaussianGenerator

Generates tapered sine-Gaussian templates based on f, Q range and a sampling frequency.

Tapering is based off of a ‘max_latency’ kwarg that a sine-Gaussian template should incur.

duration(f, q)[source]

return the duration of a tapered sine-gaussian waveform such that its edges will die out to tolerance of the peak.

latency(rate)[source]

Return the latency in sample points associated with tapered Sine-Gaussians with a particular sampling rate.

times(rate)[source]

Return the time samples associated with tapered Sine-Gaussians with a particular sampling rate.

waveform(rate, phase, f, q)[source]

construct tapered sine-Gaussian waveforms that taper to tolerance at edges of window f is the central frequency of the waveform

class snax.waveforms.TemplateGenerator(parameters, rates, bins, mismatch=0.2, tolerance=0.005, downsample_factor=0.8)[source]

Bases: object

Generate templates within a parameter space.

Parameters

parametersDict[Tuple[float, float]]

Specified in the form {‘parameter’: (param_low, param_high)}. NOTE: ‘frequency’ parameter is required.

ratesList[int]

Sampling rates used when performing matched filtering.

mismatchfloat, optional

Minimal mismatch for adjacent templates to be placed.

tolerancefloat, optional

Maximum value at the waveform edges, used to mitigate edge effects when matched filtering.

downsample_factorfloat, optional

Used to shift the distribution of templates in a particular frequency band downwards to avoid placing templates too close to where we lose power due to due to low-pass rolloff.

bin_mixer_coeffs(rate, bin_idx)[source]

Gives matrix mixing coefficients to split up streams based on a frequency binning and sampling rate.

duration(*params)[source]

Return the duration of a waveform such that its edges will die out to tolerance of the peak.

filter_duration(rate)[source]

Return the filter duration associated with waveforms with a particular sampling rate.

frequency2rate(frequency)[source]

Maps a frequency to the correct sampling rate considered.

generate_grid()[source]

Generates (rate, *param) pairs based on parameter ranges.

generate_templates(rate, quadrature=True, sampling_rate=None)[source]

Generate all templates corresponding to a parameter range for a given sampling rate.

If quadrature is set, yield two templates corresponding to in-phase and quadrature components of the waveform.

index_by_bin(rate)[source]

Given a sampling rate, returns the indices of waveforms whose central frequencies fall within each frequency bin.

index_to_waveform(rate, bin_idx, row_idx)[source]

Maps a sampling rate and bin/row indices to a particular waveform. This is useful in conjunction with index_by_bin() to provide an inverse mapping to the index_by_bin() operation.

latency(rate)[source]

Return the latency in sample points associated with waveforms with a particular sampling rate.

sample_pts(rate)[source]

Return the number of sample points associated with waveforms with a particular sampling rate.

times(rate)[source]

Return the time samples associated with waveforms with a particular sampling rate.

waveform(rate, phase, *params)[source]

Construct waveforms that taper to tolerance at edges of window.