Skip to content

Add RefractoryUnit; enforce refractory periods of one or two samples (#12) - #55

Merged
cboulay merged 1 commit into
devfrom
feat/refractory-unit
Nov 30, 2026
Merged

cboulay merged 1 commit into
devfrom
feat/refractory-unit

Conversation

@cboulay

@cboulay cboulay commented Nov 30, 2026

Copy link
Copy Markdown
Member

Closes #12.

RefractoryTransformer already existed, but it had no Unit. Sharing its code with ThresholdCrossing, the issue's other request, isn't practical: ThresholdCrossing's refractory check is fused into its Metal kernel. So this adds the Unit and closes the issue.

Changes (refractory.py)

  • New RefractoryUnit, registered as event.RefractoryUnit in ezmsg.components.
  • Fix: refractory periods of 1 or 2 samples were skipped entirely (if width <= 2: return message). Only a period under one sample is skipped now. For example, 1 ms at 1 kHz drops an event on the very next sample.
  • The dur docstring said the default was 0, but it is 0.001 s. Fixed.

Tests

  • New: refractory periods of 1 and 2 samples drop the right events. Both fail without the fix.
  • New: RefractoryUnit is a BaseTransformerUnit wrapping RefractorySettings.

Testing

  • Full suite passes. ruff clean.

@cboulay
cboulay merged commit b14ec48 into dev Nov 30, 2026
4 checks passed
@cboulay
cboulay deleted the feat/refractory-unit branch November 30, 2026 06:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant