JelleAalbers / blueice

Build Likelihoods Using Efficient Interpolations and monte-Carlo generated Events
BSD 3-Clause "New" or "Revised" License
9 stars 9 forks source link

Cache loaded source data to reduce memory footprint #21

Closed JelleAalbers closed 6 years ago

JelleAalbers commented 6 years ago

This lets Source keep a dictionary cache of loaded source-data (like PDFs), which reduces memory footprint if the same source is being loaded many times (for example, in models with many nuisance parameters that don't affect all sources). Thanks to @kdund for spotting and correctly diagnosing the problem.

I also included two bonus features I've been meaning to commit for a while:

kdund commented 6 years ago

Checked with 3d likelihood using binned histograms-- ran as expected, and decreases memory use.

Best_anchor checked for run, sensible returns, but no detailed checks performed.

Caching in the source avoids two problems my solution had: