fitter icon indicating copy to clipboard operation
fitter copied to clipboard

Quality-of-Life Improvements: PEP 8 Standards and NumPy 2.0 Compatibility v2 plus I think some other fixes

Open tg12 opened this issue 2 months ago • 4 comments

Previously using histogram bin centers instead of the actual data to compute log-likelihood. That made AIC/BIC comparisons meaningless because likelihood was based on aggregated counts, not raw observations.

Fixed so it now runs dist.logpdf() on the real data array. AIC/BIC now reflect real statistical fit quality

The old code divided the standard deviation by sqrt(2π). That factor belongs to the Gaussian PDF normalization, not the variance itself.

Replaced with a proper weighted variance using bin frequencies as weights

Killed double-logging of log values in some branches. Cleaned up weighting logic so weighted stats are always coherent.

Please check these changes carefully, I might have made a mistake.

tg12 avatar Oct 18 '25 22:10 tg12

Figure_1

tg12 avatar Oct 18 '25 22:10 tg12

@tg12 looks great. Except the ruff stuff (see my comments) the rest looks good to me. would you mind remove it. I understand this is may be more powerful that pyproject, but I wish to keep the repo as simple as possible. Once the PR is accepted, I will update the README to add a contributor section where I will add your contrib.

cokelaer avatar Oct 19 '25 20:10 cokelaer

Check you are satisfied with the changes. All tests pass. I want a second set of eyes on the math fixes. Ignore the ruff files if you want; they are only part of my development tooling. It is just a formatter and linter. If you are curious, it is here: https://github.com/astral-sh/ruff

tg12 avatar Oct 19 '25 20:10 tg12

I think the reason its failing is because it needs a Python version bump.

tg12 avatar Oct 20 '25 08:10 tg12