Skip to content

Build the log histogram on dcio (M3) - #3

Merged
remislp merged 1 commit into
masterfrom
histogram
Sep 1, 2026
Merged

remislp merged 1 commit into
masterfrom
histogram

Conversation

@remislp

@remislp remislp commented Sep 1, 2026

Copy link
Copy Markdown
Member

Second half of M3: the binning arithmetic comes from the shared record layer,
ekplot keeps the drawing. Depends on DCPROGS/dcio#3.

This is a bug fix, not only a deduplication

The bin edges were built here, and the upper limit was computed as
exp(ceil(log(max(X)))) — a power of e, where the whole scheme is bins per
decade. That limit can land below the longest interval, and
np.histogram then drops the tail of the distribution without saying so.

Across 400 randomly drawn exponential samples the top edge fell below max(X)
in 119 of them. On glyr_experimental.scn it happens not to bite, which is
presumably how it survived.

What stays

__exponential_scale_factor looked like a third copy of HJCFIT's
ideal_pdf_scale_factor and is a different quantity — this one normalises an
exponential mixture already fitted to these data, HJCFIT's renormalises an
ideal pdf onto the resolved intervals from the Q-matrix survival. Both stay
where they are, and the docstring now says why.

prepare_xlog_hist keeps its signature and its list return type, so callers
and notebooks are unaffected.

Dependency

dcio is declared in install_requires. It is not on PyPI yet, so a source
install needs pip install git+https://github.com/DCPROGS/dcio first — the
comment in setup.py says so. That constraint goes away when dcio is
published.

Tests

6 new, including a regression that checks every interval is counted and
asserts the sample still exercises the old bug. 36 passing.

🤖 Generated with Claude Code

Second half of M3: the binning arithmetic now comes from the shared record
layer, and ekplot keeps the drawing.

This is a bug fix as well as a deduplication. The bin edges were built here,
and the upper limit was computed as exp(ceil(log(max(X)))) -- a power of e,
where the whole scheme is bins per decade. That limit can land below the
longest interval, and np.histogram then drops the tail of the distribution
without saying so. Across 400 randomly drawn exponential samples the top edge
fell below max(X) in 119 of them.

__exponential_scale_factor stays. It looked like a third copy of HJCFIT's
ideal_pdf_scale_factor and is a different quantity: this one normalises an
exponential mixture already fitted to the data, HJCFIT's renormalises an ideal
pdf onto the resolved intervals from the Q-matrix survival.

prepare_xlog_hist keeps its signature and its list return type, so callers and
notebooks are unaffected.

dcio is declared in install_requires. It is not on PyPI yet, so a source
install needs `pip install git+https://github.com/DCPROGS/dcio` first; the
comment says so.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@remislp
remislp merged commit 0f3cd4b into master Sep 1, 2026
@remislp
remislp deleted the histogram branch September 1, 2026 16:54
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