API Overview¶
The package currently centers on three public objects.
TimeSeries¶
TimeSeries represents one-dimensional sampled time-domain data and the sample spacing dt.
Typical operations:
- inspect
times - transform to
FrequencySeries - transform to
WDM - call
plot()
FrequencySeries¶
FrequencySeries represents one-dimensional FFT-domain data and the frequency spacing df.
Typical operations:
- inspect
freqs - convert back to
TimeSeries - transform to
WDM - call
plot()
WDM¶
WDM stores the packed coefficient matrix and the transform metadata:
dt- window parameter
a - auxiliary parameter
d - backend
Typical operations:
WDM.from_time_series(...)TimeSeries.to_wdm(...)FrequencySeries.to_wdm(...)to_time_series()to_frequency_series()plot()
Backend model¶
The backend system is intentionally small right now. A backend provides:
- an array namespace
- an FFT namespace
asarray(...)
That is enough for the current NumPy implementation and sets up a clean insertion point for JAX and CuPy later.
Live API Reference¶
The sections below are generated from live docstrings with mkdocstrings, so signatures stay
aligned with the implementation.
Core Objects Reference¶
TimeSeries¶
Public import: from wdm_transform import TimeSeries
One-dimensional sampled time-domain data.
Parameters¶
data : array_like Sample values on a uniform time grid. dt : float Time spacing between adjacent samples. backend : Backend Array backend used for computation.
Source code in src/wdm_transform/datatypes/series.py
duration
property
¶
Total signal duration n * dt.
This follows the discrete-Fourier convention used throughout the
package, not times[-1] - times[0].
to_frequency_series ¶
Return the discrete Fourier transform of this series.
The output keeps the same backend and uses the Fourier spacing implied
by self.dt.
Source code in src/wdm_transform/datatypes/series.py
to_wdm ¶
to_wdm(*, nt: int, a: float = 1.0 / 3.0, d: float = 1.0, backend: str | Backend | None = None) -> 'WDM'
Compute the WDM transform of this time series.
Source code in src/wdm_transform/datatypes/series.py
plot ¶
Plot the time-domain samples using the shared plotting helper.
FrequencySeries¶
Public import: from wdm_transform import FrequencySeries
One-dimensional FFT-domain data with spacing metadata.
Parameters¶
data : array_like Spectrum samples on the discrete Fourier grid. df : float Frequency spacing between adjacent Fourier bins. backend : Backend Array backend used for computation.
Source code in src/wdm_transform/datatypes/series.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | |
to_time_series ¶
Return the inverse discrete Fourier transform as a time series.
Parameters¶
real : bool, default=False
If True, discard any residual imaginary part after the inverse
FFT and return a real-valued series.
Source code in src/wdm_transform/datatypes/series.py
to_wdm ¶
to_wdm(*, nt: int, a: float = 1.0 / 3.0, d: float = 1.0, backend: str | Backend | None = None) -> 'WDM'
Compute the WDM transform of this frequency-domain series.
Source code in src/wdm_transform/datatypes/series.py
plot ¶
Plot the spectrum using the shared plotting helper.
WDM¶
Public import: from wdm_transform import WDM
Real-valued WDM coefficients together with transform metadata.
Parameters¶
coeffs : array, shape (nt, nf + 1) Real-valued coefficient matrix. Column m corresponds to frequency channel m (0 ≤ m ≤ nf). dt : float Sampling interval of the original time-domain signal. a : float Window roll-off parameter (default 1/3). d : float Reserved window parameter (default 1, currently unused). backend : Backend Array backend used for computation.
Source code in src/wdm_transform/datatypes/wdm.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 | |
from_time_series
classmethod
¶
from_time_series(series: TimeSeries, *, nt: int, a: float = 1.0 / 3.0, d: float = 1.0, backend: str | Backend | None = None) -> 'WDM'
Compute the forward WDM transform of a time-domain signal.
Parameters¶
series : TimeSeries
Input signal. Its length must be divisible by nt.
nt : int
Number of WDM time bins (must be even).
a : float
Window roll-off parameter.
d : float
Reserved (unused).
backend : str, Backend, or None
Override backend; defaults to the series' backend.
Source code in src/wdm_transform/datatypes/wdm.py
from_frequency_series
classmethod
¶
from_frequency_series(series: FrequencySeries, *, nt: int, a: float = 1.0 / 3.0, d: float = 1.0, backend: str | Backend | None = None) -> 'WDM'
Compute the forward WDM transform from a frequency-domain signal.
Any non-Hermitian component of series is discarded so the result
matches applying the WDM transform to real(ifft(series.data)).
Parameters¶
series : FrequencySeries
Input spectrum. Its length must be divisible by nt.
nt : int
Number of WDM time bins (must be even).
a : float
Window roll-off parameter.
d : float
Reserved (unused).
backend : str, Backend, or None
Override backend; defaults to the series' backend.
Source code in src/wdm_transform/datatypes/wdm.py
nf
property
¶
Number of interior frequency channels.
The total number of frequency channels is nf + 1
(m = 0, 1, …, nf), so coeffs.shape[1] == nf + 1.
df
property
¶
Fourier-bin spacing of the underlying original signal.
This is the discrete-Fourier spacing implied by the original sample
cadence. For the WDM frequency-grid spacing, use :attr:delta_f.
nyquist
property
¶
Nyquist frequency of the underlying original signal.
This is also the frequency of the highest WDM channel,
freq_grid[-1].
delta_t
property
¶
Spacing of the WDM time grid.
Each WDM time bin spans nf * dt in the original sampling.
For the underlying original sample spacing, use :attr:dt.
delta_f
property
¶
Spacing of the WDM frequency grid.
This is the spacing between adjacent WDM channels. For the underlying
Fourier-bin spacing of the original signal, use :attr:df.
duration
property
¶
Total signal duration nt * delta_t represented by this transform.
Equivalently, this is nt * nf * dt. This convention matches the
transform construction and is not the same as time_grid[-1] - time_grid[0].
to_time_series ¶
Reconstruct the time-domain signal via the inverse WDM transform.
Source code in src/wdm_transform/datatypes/wdm.py
to_frequency_series ¶
Reconstruct the frequency-domain signal from the Gabor atom expansion.
Source code in src/wdm_transform/datatypes/wdm.py
plot ¶
Plot the WDM coefficient grid using the shared plotting helper.
Backend Utilities Reference¶
Backend¶
Minimal backend wrapper around an array namespace and FFT namespace.
Source code in src/wdm_transform/backends/base.py
asarray ¶
get_backend¶
Resolve a backend object from a name, instance, or environment default.
Source code in src/wdm_transform/backends/__init__.py
register_backend¶
Register a backend by name and return the resulting backend object.
Plotting Helpers Reference¶
These helpers power the datatype .plot() methods and remain available as standalone functions.
plot_time_series¶
Plot a time-domain series against its sample times.
Source code in src/wdm_transform/plotting.py
plot_frequency_series¶
Plot a frequency-domain series.
By default, only non-negative frequencies are shown.
Source code in src/wdm_transform/plotting.py
plot_periodogram¶
Plot the squared spectrum magnitude on log-log axes.
Source code in src/wdm_transform/plotting.py
plot_spectrogram¶
Compute and plot a scipy spectrogram for a time-domain series.
Source code in src/wdm_transform/plotting.py
plot_wdm_grid¶
Render the WDM coefficient grid as an image over time and frequency.
Source code in src/wdm_transform/plotting.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | |