Skip to content

Check burst segmentation against the rule transcribed from the Fortran - #7

Merged
remislp merged 1 commit into
masterfrom
fortran-burst-tests
Sep 8, 2026
Merged

remislp merged 1 commit into
masterfrom
fortran-burst-tests

Conversation

@remislp

@remislp remislp commented Sep 8, 2026

Copy link
Copy Markdown
Member

test_bursts.py fixes the burst conventions by stating them. This fixes them against a separate reading of the original, which is a different kind of evidence: the three implementations in the DCPROGS stack disagreed on exactly these points, and agreeing with each other would not have settled which was right.

hjclik.for in DCPROGS/DCFORTRAN is the likelihood that produced every published HJCFIT result, Colquhoun, Hatton & Hawkes (2003) among them. It does not pre-split a record; line 1009 walks it and ends the group when a shut time exceeds tcrit:

if(tint(in,jset).gt.tcrit(jset)) goto 92   !end present group with prev opening

Three things follow, and each gets a test

The comparison is strictly greater, so a gap exactly equal to tcrit is within-burst.

The group ends "with prev opening", so the separating gap belongs to no group and every group starts and ends on an opening.

The test is not guarded by burst(jset) — so a tcrit of zero ends the group at every shut time. HJCFIT means "do not divide" by setting tcrit enormous: 3.1536e10 ms, one year (Hjcfit1-09122003.for line 1568), not by setting it to zero.

That last one deserves its own test. A caller who passes zero expecting "no division" gets one group per opening, silently and with no error, and both implementations behave that way. It cost real time to find, and a test is cheaper than finding it again.

Result

The two implementations agree group for group on five records of 4000 intervals and at four values of tcrit, from one that splits almost everything to one that splits almost nothing.

13 tests. Full suite: 358 passed, 2 skipped.

Written while reproducing Colquhoun, Hatton & Hawkes (2003), where the same transcription showed 0 differences over 83 282 bursts — this brings that check into the repository so it keeps being run.

🤖 Generated with Claude Code

test_bursts.py fixes the burst conventions by stating them. This fixes them
against a separate reading of the original, which is a different kind of
evidence: the three implementations in the DCPROGS stack disagreed on exactly
these points, and agreeing with each other would not have settled which was
right.

hjclik.for in DCPROGS/DCFORTRAN is the likelihood that produced every published
HJCFIT result, Colquhoun, Hatton & Hawkes (2003) among them. It does not
pre-split a record; line 1009 walks it and ends the group when a shut time
exceeds tcrit:

  if(tint(in,jset).gt.tcrit(jset)) goto 92  !end present group with prev opening

Three things follow, and each gets a test:

  the comparison is strictly greater, so a gap exactly equal to tcrit is
  within-burst;
  the group ends "with prev opening", so the separating gap belongs to no group
  and every group starts and ends on an opening;
  the test is NOT guarded by burst(jset), so a tcrit of zero ends the group at
  every shut time. HJCFIT means "do not divide" by setting tcrit enormous --
  3.1536e10 ms, one year (Hjcfit1-09122003.for line 1568) -- not by setting it
  to zero.

That last one is worth a test on its own. A caller who passes zero expecting
"no division" gets one group per opening, silently and with no error, and both
implementations behave that way. Finding it cost real time.

The two agree group for group on five records of 4000 intervals and at four
values of tcrit.

13 tests.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@remislp
remislp merged commit 5d4a691 into master Sep 8, 2026
10 checks passed
@remislp
remislp deleted the fortran-burst-tests branch September 8, 2026 09:13
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