Giter Site home page Giter Site logo

ast0815 / remu Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 1.0 117.15 MB

ReMU - Response Matrix Utilities

License: MIT License

Python 99.68% Shell 0.32%
likelihood markov-chain hypothesis-testing binning parameter-estimation response-matrix smearing-matrix

remu's Introduction

ReMU - Response Matrix Utilities

A framework for likelihood calculations and hypothesis testing using binned events and response matrices.

[Documentation] [Coverage] [license: MIT] [DOI: 10.5281/zenodo.1217572]

Setup

Installing development version from source

It is recommended to run this software in a virtual Python environment (virtualenv). This ensures that all required packages are present in the tested version and do not interfere with other packages installed on the system. The easiest way to do so, is to simply source setup.sh after checking out the source code:

$ . setup.sh

This will automatically do something along these lines:

$ # Create a new virtual environment
$ virtualenv ENV
$ # Activate the environment
$ . ENV/bin/activate
$ # Upgrade pip to the latest version (optional)
$ pip install --upgrade pip
$ # Install all required packages
$ pip install -r requirements.txt
$ # Install actual package
$ pip install -e .

It will only create a new virtual environment if one does not exist already. You can also specify which Python version to use by providing the respective virtualenv argument to setup.sh, e.g. . setup.sh -p python3. You might need to install additional system libraries to compile all packages.

ReMU requires Python >=3.8.

Installing official releases with pip

Alternatively you can install official releases directly with pip:

$ # Create a new virtual environment
$ virtualenv ENV
$ # Activate the environment
$ . ENV/bin/activate
$ # Upgrade pip to the latest version (optional)
$ pip install --upgrade pip
$ # Install remu and its dependencies
$ pip install remu==1.0.0

If you want to make sure the optional dependencies are also installed, use pip's 'Extras' syntax:

$ # install remu including all optional dependencies
$ pip install remu[mcmc]==1.0.0

Tests

Run all test cases of the framework:

$ pip install -r test-requirements.txt
$ ./run_tests.sh

Online documentation

Online documentation including examples can be found on the project's readthedocs page:

https://remu.readthedocs.io

Citing

If you use ReMU in a publication, please cite it as follows:

L. Koch, ReMU - Response Matrix Utilities, http://github.com/ast0815/remu, doi:10.5281/zenodo.1217572

Or just use the DOI and let your bibliography manager handle the rest for you. You can cite specific versions of the software too. Just follow the link behind the DOI badge and choose the DOI specific for the release.

remu's People

Contributors

ast0815 avatar dependabot[bot] avatar pre-commit-ci[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

alokekumardas

remu's Issues

Consistently marginalise over subbinnings when plotting

Right now the subbinning marginalisation is handled separately from the marginalisation for plotting puposes. The plotting marginalisation functions should also be applied in one swoop to the subbinning entries, instead of marginalising the subbinnings first.

Do calculations on GPU

We re doing a lot of matrix multiplying here. Running this on a GPU might speed things up. Possible packages to facilitate this:

  • Numba
  • CuPy
  • cudamat
  • PyTorch

Add a CategoricalBinning

Rather than (mis)using LinearBinnings, often it would be handy to just have category bins. E.g. spcific bins for reaction type enums, or text fields.

Publication with ReMU

Someone needs to do an actual publication using ReMU. We will freeze version 1.0 for that first publication.

Matplotlib warning during tests with Python 3

Test plotting matrices. ... No handles with labels found to put in legend.
No handles with labels found to put in legend.
No handles with labels found to put in legend.
No handles with labels found to put in legend.
ok

Flux uncertainty helper

We need a helper class to deal with flux uncertainties:

  • User provides XSEC prediction for each neutrino energy bin.
  • Helper class uses flux prediction and covariance matrix (and target mass uncertainty?) to generate randomly varied event rate predictions.
  • Set of predictions is fed to LikelihoodMachine to calculate p-values etc.

Unclear subbinning method documentation

The documentation about the insertion and marginalisation of subbinnings is a bit unclear. It should be made more obvious that they do not change the object itself, but only return a modified clone.

Adding of Predictors

Simple hypotheses can be added, because they are just vectors of values, i.e. arrays. It could be useful to also add composite hypotheses. The result would be a new composite hypothesis with the parameters of both input hypotheses.

Support ROOT files as inputs

It might be a good idea to support ROOT files/trees as inputs to fill Binnings. A lot of particle physics experiments use root files as de-facto standard of data exchange.

Single-file format

It might be useful to have a "one file stores all" format for sharing matrices, instead of the current "the needed information is spread over multiple files" approach.

Archival file format

To ensure a maximum data shelf life, we should support storing everything in a neat, self-explanatory text format.

Needs a better name

Likelihood Machine is an unwieldy name. This software deserves something better.

Ideas:

  • Likelihound
  • Smearfic

Model comparisons without data

It would be useful to create model comparisons without data, i.e. determine whether two models are distinguishable given a detector response.

Examples need revisiting

I have not looked at the examples in a while. Need to make sure they work and represent the intended workflow for v1.0.

Fix JeffreysPrior

Does not follow the general design at the moment. It treats the response matrix separate from the parameter translator, while now everything is a Predictor.

MCMC trace plotting needs some love

Right now the MCMC trace plotting functions are only working for MCMCs where all truth bins are free parameters directly. This should be made usable for all sorts of CompositeHypotheses.

Refactoring heavy classes

Some of the classes are pretty heavy. Might want to think about refactoring some of the methods to live somewhere else. At the very least the plotting methods seems to be a prime candidate for this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.