Skip to content

jwave.signal_processing

analytic_signal(x, axis=-1)

Computes the analytic signal from a real signal x, using the FFT.

Parameters:

Name Type Description Default
x jnp.ndarray

[description]

required
axis int

[description]. Defaults to -1.

-1

Returns:

Type Description
Array

jnp.ndarray: [description]

apply_ramp(signal, dt, center_freq, warmup_cycles=3)

Processes the signal $s(t)$ as

$$ s(t)\cdot \text{min}(1, f_0t/\sigma) $$

Parameters:

Name Type Description Default
signal jnp.ndarray

[description]

required
dt float

[description]

required
center_freq float

$f_0$

required
warmup_cycles float

$\sigma$. Defaults to 3.

3

Returns:

Type Description
Array

jnp.ndarray: [description]

blackman(N)

Returns the blackman window of length N

Parameters:

Name Type Description Default
N int

[description]

required

Returns:

Type Description
Array

fourier_downsample(x, subsample=2, discard_last=True)

Downsample a signal by taking the Fourier transform and discarding the high frequencies.

Parameters:

Name Type Description Default
x jnp.ndarray

Signal to be downsampled

required
subsample int

Sumsampling factor. Defaults to 2.

2
discard_last bool

If True, the last dimension is not subsampled. Defaults to True.

True

Returns:

Type Description
Array

jnp.ndarray: [description]

fourier_upsample(x, upsample=2, discard_last=True)

Upsample a signal by taking the Fourier transform and adding zeros at the high frequencies.

Parameters:

Name Type Description Default
x jnp.ndarray

Signal to be upsampled

required
upsample int

Upsampling factor. Defaults to 2.

2

Returns:

Type Description
Array

jnp.ndarray: Upsampled signal

gaussian_window(signal, time, mu, sigma)

Returns the gaussian window

$$ s(t)\cdot \exp \left( - \frac{(t-\mu)^2}{\sigma^2} \right) $$

Parameters:

Name Type Description Default
signal jnp.ndarray

$s(t)$

required
time jnp.ndarray

$t$

required
mu float

$\mu$

required
sigma float

$\sigma$

required

Returns:

Type Description
Array

jnp.ndarray: [description]

smooth(x, exponent=1.0)

Smooths a n-dimensioanl signal by multiplying its spectrum by a blackman window.

Parameters:

Name Type Description Default
x jnp.ndarray

[description]

required

Returns:

Type Description
Array

jnp.ndarray: [description]

smoothing_filter(sample_input)

Returns a smoothing filter based on the blackman window, which works on a signal similar to the one provided as input. The filter is amenable to jax transformations.

Parameters:

Name Type Description Default
sample_input jnp.ndarray

Example signal

required

Returns:

Name Type Description
Callable Callable

Smoothing filter

tone_burst(sample_freq, signal_freq, num_cycles)

Returns a tone burst

Parameters:

Name Type Description Default
sample_freq float

Sampling frequency

required
signal_freq float

Signal frequency

required
num_cycles float

Number of cycles

required

Returns:

Type Description
Array

jnp.ndarray: The tone burst signal