Coder Social home page Coder Social logo

sdporzio / crfitter Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 2.0 172 KB

A fitter for cosmic rays which calculates a tolerance parameter to better determine uncertainties associated with the fit parameters.

Home Page: https://sdporzio.github.io/CRFitter/

License: MIT License

Python 97.23% Shell 2.77%
fitting cosmic-rays

crfitter's Introduction

CRFitter

CRFitter is a fitter for cosmic rays which calculates a tolerance parameter to better determine uncertainties associated with the fit parameters. This tolerance method is inspired by the work of Stump et al., 2001 and details can be found in their papers (https://arxiv.org/abs/hep-ph/0101051, https://arxiv.org/abs/hep-ph/0101032).

CRFitter depends on Python, ROOT (version 6.4.4 has been tested) and PyROOT and its operation is based on two scripts found in the Scripts/ directory. runToleranceAnalysis.py analyzes the datasets contained in the Data/ directory and determines a tolerance factor. fitWithTolerance.py uses this tolerance to determine the uncertainties on the parameters of the fit, which are then used to draw the uncertainty corridors. fitWithTolerance.py must be obviously executed after runToleranceAnalysis.py.

Both scripts rely on JSON configuration files which are located in Data/SettingFiles/. The JSON file must contain the path to all the datasets to be included in the analysis, plus additional settings for creating plots.

Deviation plots with inflation factors for uncertainties in the calorimeter region, as shown in Barr et al., 2005 (https://arxiv.org/abs/astro-ph/0611266), can be produced using the specific argument --Barr.


Usage:

fitWithTolerance.py [-h] [--tolerance TOLERANCE] [--data DATA]
                       [--primary PRIMARY] [--fname FNAME] [--Barr]
                       [--emin EMIN] [--emax EMAX] [--smin SMIN]
                       [--smax SMAX] [--outdir OUTDIR]

optional arguments:
-h, --help            show this help message and exit

--tolerance TOLERANCE     DAT file containing delta chi values from which to calculate the tolerance. (default: None)

--data DATA       JSON file containing locations of all of the data you want to include in the fit. (default: None)

--primary PRIMARY     Name of primary you are performing the global fit on. (default: Proton

--fname FNAME     Name of fitting function you want to use for the global fits. The choices are: * GSHL * AMSGSHL (GSHL with AMS modification) * Simple (Power Law) * H3a (default: GSHL)

--Barr        Flag if performing paper a la Barr et al. (default: False)

--emin EMIN       Minimum energy value for fitter. (default: 0.5)

--emax EMAX       Maximum energy value for fitter. (default: 250000)

--smin SMIN       Minimum solar modulation value for which to accept all data. (default: 416)

--smax SMAX       Maximum solar modulation value for which to accept all data. (default: 555)

--outdir OUTDIR       Directory to save output. Script is designed to create subdirectories and delete older plots if it needs to, so set this carefully! If none provided, all plots will be saved in CWD. (default: None)

Example usage:

python Scripts/runToleranceAnalysis.py --data Data/SettingsFiles/ProtonEnergyPerNucleonData.json --primary Proton --smin 385 --smax 564 --fname GSHL --Barr --outdir Outdir

python Scripts/fitWithTolerance.py --tolerance Outdir/GSHL/Proton/ToleranceMethod2/ToleranceData/Method2DeltaChi.dat --data Data/SettingsFiles/ProtonEnergyPerNucleonData.json --primary Proton --smin 385 --smax 564 --fname GSHL --Barr --outdir Outdir

Since the script takes a large number of arguments, it is possible to use a bash parser (runCRFitter.sh) which uses a setting file called config.sh. Arguments for the python script can be provided to the config.sh and CRFitter can run with:

./runCRFitter.sh

If you have any questions, queries or comments please contact the authors:

The authors make no guarrentee of the behaviour, stability or bug-free-ness of this code. This code is provide "as is", use is at own risk.

Copyright (2016) Salvatore Davide Porzio, Steven Wren


crfitter's People

Contributors

jackturner1 avatar sdporzio avatar steven-j-wren avatar

Stargazers

 avatar  avatar

Watchers

 avatar

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.