API Reference¶
Magnifiers¶
pyevm.ColorMagnifier
¶
Colour-based EVM magnifier.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha
|
float
|
Luminance amplification factor. |
50.0
|
freq_low
|
float
|
Temporal bandpass lower frequency (Hz). |
0.4
|
freq_high
|
float
|
Temporal bandpass upper frequency (Hz). |
3.0
|
n_levels
|
int
|
Gaussian pyramid levels (typically 4–6). |
6
|
chrom_attenuation
|
float
|
Scale applied to amplified I, Q channels (0 = no chrominance amplification, 1 = same as luma). |
0.1
|
pyramid_level
|
int | None
|
Which Gaussian level to temporally filter (default
|
None
|
filter_type
|
str
|
|
'ideal'
|
device
|
device | None
|
Compute device (auto-selected if |
None
|
dtype
|
dtype
|
Tensor dtype. |
float32
|
Source code in src/pyevm/magnification/color.py
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 | |
process(frames, fps)
¶
Run colour EVM on a video tensor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frames
|
Tensor
|
|
required |
fps
|
float
|
Frames per second. |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
Amplified |
Source code in src/pyevm/magnification/color.py
process_stream(frames, fps, n_frames=None, chunk_size=64)
¶
Process frames in chunks, yielding each output frame.
Uses Butterworth IIR regardless of filter_type (the ideal FFT filter requires all frames at once and cannot be used in streaming mode).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frames
|
Iterable[Tensor]
|
Iterable of |
required |
fps
|
float
|
Frames per second. |
required |
n_frames
|
int | None
|
Total frame count (optional, used for the progress bar). |
None
|
chunk_size
|
int
|
Number of frames to process per GPU batch. |
64
|
Yields:
| Type | Description |
|---|---|
Tensor
|
Amplified |
Source code in src/pyevm/magnification/color.py
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 | |
pyevm.MotionMagnifier
¶
Motion-based EVM magnifier.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha
|
float
|
Nominal amplification factor (may be reduced per level). |
20.0
|
freq_low
|
float
|
Temporal bandpass lower frequency (Hz). |
0.4
|
freq_high
|
float
|
Temporal bandpass upper frequency (Hz). |
3.0
|
n_levels
|
int
|
Laplacian pyramid levels. |
6
|
lambda_c
|
float
|
Spatial wavelength cutoff (pixels) for adaptive scaling (default 16, matching the reference MATLAB code). |
16.0
|
filter_type
|
str
|
|
'butterworth'
|
device
|
device | None
|
Compute device. |
None
|
dtype
|
dtype
|
Tensor dtype. |
float32
|
Source code in src/pyevm/magnification/motion.py
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 | |
process(frames, fps)
¶
Run motion EVM on a video tensor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frames
|
Tensor
|
|
required |
fps
|
float
|
Frames per second. |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
Amplified |
Source code in src/pyevm/magnification/motion.py
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 | |
process_stream(frames, fps, n_frames=None, chunk_size=64)
¶
Process frames in chunks, yielding each output frame.
Uses Butterworth IIR regardless of filter_type (the ideal FFT filter requires all frames at once and cannot be used in streaming mode).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frames
|
Iterable[Tensor]
|
Iterable of |
required |
fps
|
float
|
Frames per second. |
required |
n_frames
|
int | None
|
Total frame count (optional, used for the progress bar). |
None
|
chunk_size
|
int
|
Number of frames to process per GPU batch. |
64
|
Yields:
| Type | Description |
|---|---|
Tensor
|
Amplified |
Source code in src/pyevm/magnification/motion.py
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 | |
pyevm.PhaseMagnifier
¶
Phase-based EVM magnifier.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
factor
|
float
|
Phase amplification factor. |
10.0
|
freq_low
|
float
|
Temporal bandpass lower frequency (Hz). |
0.4
|
freq_high
|
float
|
Temporal bandpass upper frequency (Hz). |
3.0
|
n_scales
|
int
|
Number of pyramid scales. |
6
|
n_orientations
|
int
|
Number of orientation bands per scale. |
8
|
sigma
|
float
|
Spatial phase smoothing sigma (pixels, |
0.0
|
filter_type
|
str
|
|
'ideal'
|
attenuate_motion
|
bool
|
If |
False
|
attenuate_mag
|
float
|
Threshold for large-motion attenuation (radians).
Default |
pi
|
device
|
device | None
|
Compute device. |
None
|
dtype
|
dtype
|
Real tensor dtype (sub-band coefficients are complex). |
float32
|
Source code in src/pyevm/magnification/phase.py
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 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 | |
process(frames, fps)
¶
Run phase-based EVM on a video tensor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frames
|
Tensor
|
|
required |
fps
|
float
|
Frames per second. |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
Amplified |
Source code in src/pyevm/magnification/phase.py
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 | |
process_stream(frames, fps, n_frames=None, chunk_size=64)
¶
Process frames in chunks, yielding each output frame.
Buffers chunk_size frames, then runs the batched pyramid build and
collapse in one GPU call. The Butterworth IIR filter state carries
across chunk boundaries via its zi parameter.
Uses Butterworth IIR regardless of filter_type (the ideal FFT filter requires all frames at once and cannot be used in streaming mode).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frames
|
Iterable[Tensor]
|
Iterable of |
required |
fps
|
float
|
Frames per second. |
required |
n_frames
|
int | None
|
Total frame count (optional, used for the progress bar). |
None
|
chunk_size
|
int
|
Number of frames to process per GPU batch. |
64
|
Yields:
| Type | Description |
|---|---|
Tensor
|
Amplified |
Source code in src/pyevm/magnification/phase.py
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 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 | |
Video I/O¶
pyevm.io.video.VideoReader
¶
Read a video file into a tensor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Path to the video file. |
required |
device
|
device | None
|
Tensor device (CPU only when using decord CPU bridge; the returned tensor is always moved to device after reading). |
None
|
max_frames
|
int | None
|
Limit number of frames read ( |
None
|
Source code in src/pyevm/io/video.py
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 | |
metadata
property
¶
Return {"fps": float, "n_frames": int, "height": int, "width": int}.
read()
¶
Read video frames.
Returns:
| Type | Description |
|---|---|
Tensor
|
|
float
|
tensor in |
Source code in src/pyevm/io/video.py
stream()
¶
Yield frames one at a time as (C, H, W) float32 tensors on self.device.
Memory cost is constant — only one decoded frame lives in RAM at a
time, regardless of video length. Use this for large videos where
:meth:read would exhaust available memory.
Uses torchcodec when available (GPU-accelerated), falling back to OpenCV.
Source code in src/pyevm/io/video.py
pyevm.io.video.VideoWriter
¶
Write a tensor to a video file.
Prefers piping frames through FFmpeg for better codec support and
hardware-accelerated encoding. Falls back to cv2.VideoWriter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Output file path (.mp4 recommended). |
required |
fps
|
float
|
Frames per second. |
required |
use_ffmpeg
|
bool
|
Try FFmpeg first (default |
True
|
Source code in src/pyevm/io/video.py
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 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 | |
write(frames)
¶
Write frames to disk.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frames
|
Tensor
|
|
required |
Source code in src/pyevm/io/video.py
write_stream(frames, height, width, n_frames=None)
¶
Write frames from a generator to disk without buffering the full video.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frames
|
Iterable[Tensor]
|
Iterable of |
required |
height
|
int
|
Frame height in pixels (needed to open the encoder upfront). |
required |
width
|
int
|
Frame width in pixels. |
required |
n_frames
|
int | None
|
Total frame count, used only for the progress bar. |
None
|
Source code in src/pyevm/io/video.py
Pyramids¶
pyevm.pyramids.gaussian.GaussianPyramid
¶
Multi-scale Gaussian pyramid.
Frames are expected as (B, C, H, W) float tensors, values in [0, 1].
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_levels
|
int
|
Number of pyramid levels (including the original). |
6
|
device
|
device | None
|
Compute device. |
None
|
dtype
|
dtype
|
Floating-point dtype (default |
float32
|
Source code in src/pyevm/pyramids/gaussian.py
build(frame)
¶
Decompose frame into a Gaussian pyramid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frame
|
Tensor
|
|
required |
Returns:
| Type | Description |
|---|---|
list[Tensor]
|
List of tensors from finest (level 0 = original) to coarsest. |
Source code in src/pyevm/pyramids/gaussian.py
collapse(levels)
¶
Reconstruct from pyramid by upsampling the coarsest level.
This simply returns the upsampled coarsest level (level 0 = original
resolution). For reconstruction with residuals use
:class:LaplacianPyramid.
Returns:
| Type | Description |
|---|---|
Tensor
|
|
Source code in src/pyevm/pyramids/gaussian.py
pyevm.pyramids.laplacian.LaplacianPyramid
¶
Multi-scale Laplacian pyramid (difference-of-Gaussians).
Each level stores the band-pass detail image; the coarsest level stores the low-pass residual (a Gaussian level).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_levels
|
int
|
Number of pyramid levels. |
6
|
device
|
device | None
|
Compute device. |
None
|
dtype
|
dtype
|
Floating-point dtype. |
float32
|
Source code in src/pyevm/pyramids/laplacian.py
build(frame)
¶
Decompose frame into a Laplacian pyramid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frame
|
Tensor
|
|
required |
Returns:
| Type | Description |
|---|---|
list[Tensor]
|
List of |
list[Tensor]
|
images; level n-1 is the low-pass Gaussian residual. |
Source code in src/pyevm/pyramids/laplacian.py
collapse(levels)
¶
Reconstruct frame from Laplacian pyramid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
levels
|
list[Tensor]
|
Pyramid returned by :meth: |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
|
Source code in src/pyevm/pyramids/laplacian.py
pyevm.pyramids.steerable.SteerablePyramid
¶
Complex steerable pyramid (tight frame, near-perfect reconstruction).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_scales
|
int
|
Number of octave levels. |
4
|
n_orientations
|
int
|
Oriented sub-bands per scale (2, 4, 6, or 8). |
6
|
device
|
device | None
|
Compute device. |
None
|
dtype
|
dtype
|
Real floating-point dtype. |
float32
|
Source code in src/pyevm/pyramids/steerable.py
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 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 | |
build(frame)
¶
Decompose one or more single-channel frames into the complex steerable pyramid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frame
|
Tensor
|
|
required |
Returns:
| Type | Description |
|---|---|
dict
|
Dictionary with keys: |
dict
|
|
dict
|
|
dict
|
|
dict
|
|
Source code in src/pyevm/pyramids/steerable.py
collapse(pyramid)
¶
Reconstruct a frame from a (possibly phase-modified) pyramid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pyramid
|
dict
|
Dictionary as returned by :meth: |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
Reconstructed |
Source code in src/pyevm/pyramids/steerable.py
Filters¶
pyevm.filters.temporal.IdealBandpass
¶
FFT-based ideal bandpass filter over the time axis, with optional notch stops.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fps
|
float
|
Frames per second of the video. |
required |
freq_low
|
float
|
Lower cut-off frequency in Hz. |
required |
freq_high
|
float
|
Upper cut-off frequency in Hz. |
required |
notch_freqs
|
list[float] | None
|
Frequencies to notch out (Hz). Each notch zeros a
symmetric window of width |
None
|
notch_width
|
float
|
Width of each notch in Hz (default 1.0). |
1.0
|
Source code in src/pyevm/filters/temporal.py
apply(signal)
¶
Filter signal along its first (time) dimension.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
signal
|
Tensor
|
|
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
Bandpass-filtered (and notch-filtered) tensor with the same shape. |
Source code in src/pyevm/filters/temporal.py
pyevm.filters.temporal.ButterworthBandpass
¶
Butterworth IIR bandpass filter applied causally chunk-by-chunk, with optional IIR notch stops cascaded after the bandpass.
On CUDA/MPS devices the filter runs entirely on the accelerator
(torch.jit.script loop, no CPU↔device roundtrip). On CPU the
original scipy.signal.sosfilt path is used.
Filter state is maintained between :meth:apply_chunk calls so the
result is numerically identical to processing the whole video at once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fps
|
float
|
Frames per second of the video. |
required |
freq_low
|
float
|
Lower cut-off frequency in Hz. |
required |
freq_high
|
float
|
Upper cut-off frequency in Hz. |
required |
order
|
int
|
Filter order (default 1 — matches reference MATLAB code). |
1
|
notch_freqs
|
list[float] | None
|
Frequencies to notch out (Hz). Each notch is a
2nd-order IIR notch filter with Q = |
None
|
notch_width
|
float
|
Bandwidth of each notch in Hz (default 1.0). |
1.0
|
Source code in src/pyevm/filters/temporal.py
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 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 | |
apply(signal)
¶
Filter signal along its first (time) dimension (batch mode).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
signal
|
Tensor
|
|
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
Filtered tensor with the same shape. |
Source code in src/pyevm/filters/temporal.py
apply_chunk(signal)
¶
Filter a chunk of frames along the time dimension, updating state.
Equivalent to calling :meth:step T times in sequence; the IIR state
is updated so the next call picks up seamlessly.
Uses the GPU JIT path on CUDA/MPS devices (no PCIe roundtrip).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
signal
|
Tensor
|
|
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
Filtered tensor with the same shape. |
Source code in src/pyevm/filters/temporal.py
reset(signal_shape)
¶
Initialise CPU filter state for streaming on a signal of signal_shape.
Call once before the first :meth:step call.
Source code in src/pyevm/filters/temporal.py
step(frame)
¶
Filter a single frame, updating internal state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frame
|
Tensor
|
|
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
Filtered frame with the same shape. |
Source code in src/pyevm/filters/temporal.py
Device¶
pyevm.device
¶
Device detection and management for GPU/MPS/CPU compute.
get_device(force=None)
¶
Return the best available compute device.
Priority: CUDA > MPS > CPU, unless force overrides.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
force
|
str | None
|
One of |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
A |
device
|
class: |
Source code in src/pyevm/device.py
device_info(device)
¶
Return a human-readable summary of device capabilities.