Processing API
Signal processing pipeline — DAG-based, immutable processing steps.
ProcessingNode
dataclass
A single node in the processing DAG.
Each node represents one processing step applied to its parent's data. The root node (step 0) holds the original unprocessed data.
Source code in dig/processing/pipeline.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | |
to_dict()
Serialize node metadata (excluding data array) for audit export.
Source code in dig/processing/pipeline.py
41 42 43 44 45 46 47 48 49 50 | |
ProcessingPipeline
Immutable DAG processing pipeline.
Usage
pipe = ProcessingPipeline(raw_data)
Chain operations — each returns a new pipeline instance
pipe = pipe.process(dewow_fft, sample_rate=1000.0) pipe = pipe.process(remove_background_global) pipe = pipe.process(bandpass_butterworth, low_cut=100e6, high_cut=500e6)
Branch from any previous step (non-linear undo)
branch = pipe.branch(step_id=1) branch = branch.process(different_filter, ...)
Export audit trail
history = pipe.export_history()
Source code in dig/processing/pipeline.py
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 | |
current_step
property
The most recent processing node.
data
property
Current (latest) data array.
original_data
property
The original unprocessed data (root node).
steps
property
All processing steps in order.
branch(step_id)
Create a branch from a previous step (non-linear undo).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step_id
|
int
|
The step ID to branch from |
required |
Returns:
| Type | Description |
|---|---|
ProcessingPipeline
|
New pipeline starting from that step's data |
Source code in dig/processing/pipeline.py
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | |
export_history(include_data=False)
Export the processing history as a list of serializable dicts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
include_data
|
bool
|
If True, include array shapes in output |
False
|
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
List of step dicts suitable for JSON serialization |
Source code in dig/processing/pipeline.py
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | |
export_history_json(indent=2)
Export processing history as a JSON string.
Source code in dig/processing/pipeline.py
198 199 200 | |
get_step(step_id)
Get a specific processing step by ID.
Source code in dig/processing/pipeline.py
202 203 204 205 206 | |
process(func, /, **kwargs)
Apply a processing function and return a new pipeline instance.
The function receives the current data as its first argument. Additional keyword arguments are passed through and recorded in the audit trail.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
func
|
Callable[..., ndarray]
|
Processing function (data, **kwargs) -> np.ndarray |
required |
**kwargs
|
Any
|
Additional arguments passed to the function |
{}
|
Returns:
| Type | Description |
|---|---|
ProcessingPipeline
|
New ProcessingPipeline with the step appended |
Source code in dig/processing/pipeline.py
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 | |