• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

PrincetonUniversity / PsyNeuLink / 28273519593
84%
master: 85%

Build:
Build:
LAST BUILD BRANCH: feat/pec-hierarchical
DEFAULT BRANCH: master
Ran 27 Jun 2026 01:45AM UTC
Jobs 1
Files 168
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

27 Jun 2026 12:53AM UTC coverage: 83.91% (+0.003%) from 83.907%
28273519593

push

github

web-flow
Fix FitzHughNagumoIntegrator reset crash and value-shape inconsistency in a Mechanism (#3560)

## Summary

Fixes two related bugs affecting `FitzHughNagumoIntegrator` (and
multi-stateful integrators generally) when used inside a `Mechanism`.
Both surfaced from the reproducer below.

### Reproducer

```python
import psyneulink as pnl

inp = pnl.ProcessingMechanism(input_shapes=1)
lc = pnl.TransferMechanism(
    input_shapes=1,
    integrator_mode=True,
    integrator_function=pnl.FitzHughNagumoIntegrator(),
    function=pnl.Linear(),
    output_ports=[{pnl.VARIABLE: (pnl.OWNER_VALUE, 1)}],
    reset_stateful_function_when=pnl.AtTrialStart(),
)
comp = pnl.Composition()
comp.add_nodes([inp, lc])
comp.add_projection(sender=inp, receiver=lc)
comp.run(inputs={inp: [[1.0]]})   # IndexError in Python mode; worked in LLVMRun
```

## Bug 1 — `IndexError` on reset (`mechanism.py`)

On reset, the Mechanism rebuilt its value from the integrator's reset
output but kept only element `[0]`:

```python
new_input = self.integrator_function.reset(...)[0]
```

`StatefulFunction.reset()` returns one entry per stateful attribute. For
single-attribute integrators (`AdaptiveIntegrator` → `[previous_value]`)
the `[0]` correctly unwraps. For `FitzHughNagumoIntegrator` → `[v, w,
time]` it discarded `w` and `time`, leaving the value with a single
element, so an `OutputPort` selecting `(OWNER_VALUE, 1)` indexed past
the end → `IndexError`. Compiled mode was unaffected (statically-typed
value buffer; reset only rewrites the integrator state).

**Fix:** keep all stateful terms when there is more than one.

## Bug 2 — value-shape inconsistency between Python and compiled
(`integratorfunctions.py`)

Even after Bug 1, the mechanism's value shape differed between modes:
Python produced `(3, 1, 1)`, compiled `(3, 1)` (and `defaults.value` was
`(3, 1)`). FHN stacks its three stateful terms; in a Mechanism,
`variable` is the Mechanism's 2d variable `(1, 1)` while the stateful
values are 1... (continued)

11061 of 14440 branches covered (76.6%)

Branch coverage included in aggregate %.

8 of 8 new or added lines in 3 files covered. (100.0%)

2 existing lines in 1 file now uncovered.

37808 of 43800 relevant lines covered (86.32%)

0.86 hits per line

Coverage Regressions

Lines Coverage ∆ File
2
84.35
-0.58% psyneulink/core/components/mechanisms/modulatory/learning/learningmechanism.py
Jobs
ID Job ID Ran Files Coverage
1 28273519593.1 27 Jun 2026 01:45AM UTC 168
83.91
GitHub Action Run
Source Files on build 28273519593
  • Tree
  • List 168
  • Changed 4
  • Source Changed 0
  • Coverage Changed 4
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • 48206050 on github
  • Prev Build on devel (#28142869122)
  • Next Build on devel (#28762971779)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc