Giter Site home page Giter Site logo

Comments (2)

ashleyrback avatar ashleyrback commented on August 29, 2024

Yes I think dividing them into two types of background, those that we want to scale and those that we don't seems an obvious solution, but I'm not sure if we actually need to pass _both_ lists to the SetLimit class. For example say we have something like:

# Load spectra
bkg1 = store.load("bkg1.hdf5")
bkg2 = store.load("bkg2.hdf5")

backgrounds = { bkg1: scaling1, bkg2: scaling2}  # realistically we probably want 
                                                 # this to be defined already in some
                                                 # sort of config file
# define backgrounds_to_float list of backgrounds that need to be floated

If you were passing this list to the SetLimit class, you'd then do:

# Create SetLimit instance
set_limit = limit_setting.LimitSetting(signal, backgrounds, backgrounds_to_float
                                       roi=roi, pre_shrink=True)

Then in SetLimit.__init__:

self._total_backgrounds = Spectra("total", total_events)
for background, scaling in backgrounds.iteritems():
    background.scale(scaling)
    self._total_backgrounds.add(background)

But you could equally do exactly the same thing before creating the SetLimit instance:

total_backgrounds = Spectra("total", total_events)
for background, scaling in backgrounds.iteritems():
    background.scale(scaling)
    total_backgrounds.add(background)

# Create SetLimit instance
set_limit = limit_setting.LimitSetting(signal, total_background, backgrounds_to_float
                                       roi=roi, pre_shrink=True)

here passing total_backgrounds as a pre-made background spectrum, for the backgrounds we don't want to float. Which I think avoids overcomplicating the constructor of SetLimit and since it is something that only needs to be done once. @jwaterfield let me know what you think.

Also I did have an alternate idea that we could take this opportunity to generalise the to any systematic (because when we float the backgrounds, what we are actually doing is floating the individual background rates as systematics). So what you could do is change the current _backgrounds list to a list of all _systematics and then create variations on the limit_config class for different types of systematic. But this would not be simple.

from echidna.

jwaterfield avatar jwaterfield commented on August 29, 2024

Yeah that makes sense to me, it's similar to what I have coded currently although I have a function within LimitSetting which builds your fixed backgrounds for you rather than the user having to do this themselves but I guess it is more sensible to do this in a function outside the LimitSetting class.

from echidna.

Related Issues (20)

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.