Giter VIP home page Giter VIP logo

ecpli's Introduction

Derive limits on the energy cutoff parameter of a spectral model in gammapy-0.16.

Three methods are supported:

  • Profile likelihood
  • Bootstrap
  • Affine invariant Markov chain

Given a gammapy dataset (of type gammapy.modeling.Dataset), the target model (of type gammapy.modeling.models.SkyModel) and target parameter name needs to be defined:

import ecpli
limit_target = ecpli.LimitTarget(model=target_model,
                                 parameter_name="lambda_",
                                 parmin=0.,
                                 parmax=1./0.05)

Afterwards, a frequentist upper limit on this variable can be derived. Given a confidence level CL and a set of gammapy models for the dataset (of type gammapy.modeling.models.Models), e.g. a profile likelihood limit is derived as:

method = ecpli.ConstrainedLR(limit_target, dataset, models, CL)
ul = method.ul

As a complete example, consider the "3d analysis" notepad from the gammapy-0.16 documentation. Let the notepad run. As final cell, insert:

import ecpli
from gammapy.modeling.models import Models

limit_target = ecpli.LimitTarget(model=model,
                                 parameter_name="lambda_",
                                 parmin=0.,
                                 parmax=1./0.05)

method = ecpli.ConstrainedLR(limit_target, dataset,  Models([model,]), CL=0.95)
ul = method.ul

print("UL on lambda: " + str(ul))
print("LL on energy cutoff: " + str(1/ul))

Other implemented methods are

  • UnconstrainedLR
  • UniformPriorEnsembleMCMC, WeakPriorEnsembleMCMC
  • BestFitParametricBootstrap, PoissonParametricBootstrap, NonParametricBootstrap

These methods have a very similar API as ConstrainedLR in the example above.

The frequentist coverage of all provided methods is tested for typical gamma-ray point sources and confirmed at a confidence level of 95%.

ecpli's People

Contributors

dvnll 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.