Some sigproc generators will reset their state when the incoming sample rate or array shape have changed, because the state (e.g. filter coefficients) depend on these variables.
AxisArray now has .key which can also be used to trigger a reset.
Here is a list of stateful processors and the changes they need:
[x] affine_transform - only state is labels which only exist in monkey patched AxisArray objects. Add resetting on key change; will still fail if target axis changes shape but this is unavoidable due to weights
[x] filtergen - non-target axes shape already done; key; targ-axis gain not relevant because coefs are external.
[x] butter - targ-axis gain -- others handled by filtergen
[x] filterbank - data dtype (complex or not); gain; non-target axes shape; key
[x] sampler - already resets on gain or shape changes; key
[x] scaler_np - gain; already does shape; key
[x] slicer - target axis shape, but only if more than 1 slice provided; key
[x] spectrum - already does len of targ axis; needs axis_idx; number of off-target dims changes (but not actual shape); key not necessary as fft is not dynamic.
[ ] cwt - dtype; gain; off-axis shape; key
[ ] window - already does off-axis shape and on-axis gain; key
Note 1: Even with the above fixes, many of the above will still crash if the axis order is permuted. Most cases will be handled by shape checking.
Note 2: I'll do my best to package the comparison variables into a dict or similar. In the future, if we want, we can nest the comparison variables and the state into a keyed-dict and do a per-key state. i.e., b_reset = b_reset or in_msg.key != check["key"] becomes b_reset = b_reset or in_msg.key not in check.
Some sigproc generators will reset their state when the incoming sample rate or array shape have changed, because the state (e.g. filter coefficients) depend on these variables.
AxisArray now has
.key
which can also be used to trigger a reset.Here is a list of stateful processors and the changes they need:
labels
which only exist in monkey patched AxisArray objects. Add resetting on key change; will still fail if target axis changes shape but this is unavoidable due toweights
Note 1: Even with the above fixes, many of the above will still crash if the axis order is permuted. Most cases will be handled by shape checking.
Note 2: I'll do my best to package the comparison variables into a dict or similar. In the future, if we want, we can nest the comparison variables and the state into a
key
ed-dict and do a per-key state. i.e.,b_reset = b_reset or in_msg.key != check["key"]
becomesb_reset = b_reset or in_msg.key not in check
.