Esempio n. 1
0
    def compute(self):
        roi=self.roi
        which=self.which

        roi.modify(which=which, model=self.model0, keep_old_flux=False)

        if not self.quiet: print 'fit source %s with model0 (%s)' % (which,self.model0.name)
        self.ll_0 = self.fit()

        if not self.quiet:
            print roi

        sed = PointlikeSED(roi,name=which)
        self.sed_points = sed.todict()

        # TODO, get SED points

        emin,emax=get_full_energy_range(roi)

        flux=self.model0.i_flux(emin=emin,emax=emax)
        self.model1.set_flux(flux,emin=emin,emax=emax)
        self.comprehensive_model = ComprehensiveModel(self.model0.copy(), self.model1.copy())
        self.comprehensive_model.theta=0.5

        self.comprehensive_model_start = self.comprehensive_model.copy()

        if not self.quiet: print 'fit source %s with model1 (%s)' % (which,self.model1.name)
        roi.modify(which=self.which, model=self.comprehensive_model, keep_old_flux=False)

        self.ll_1 = self.fit()

        if not self.quiet:
            print roi

        self.TS_comp = 2*(self.ll_1-self.ll_0)
Esempio n. 2
0
    def compute(self):
        roi = self.roi
        which = self.which

        roi.modify(which=which, model=self.model0, keep_old_flux=False)

        if not self.quiet:
            print 'fit source %s with model0 (%s)' % (which, self.model0.name)
        self.ll_0 = self.fit()

        if not self.quiet:
            print roi

        sed = PointlikeSED(roi, name=which)
        self.sed_points = sed.todict()

        # TODO, get SED points

        emin, emax = get_full_energy_range(roi)

        flux = self.model0.i_flux(emin=emin, emax=emax)
        self.model1.set_flux(flux, emin=emin, emax=emax)
        self.comprehensive_model = ComprehensiveModel(self.model0.copy(),
                                                      self.model1.copy())
        self.comprehensive_model.theta = 0.5

        self.comprehensive_model_start = self.comprehensive_model.copy()

        if not self.quiet:
            print 'fit source %s with model1 (%s)' % (which, self.model1.name)
        roi.modify(which=self.which,
                   model=self.comprehensive_model,
                   keep_old_flux=False)

        self.ll_1 = self.fit()

        if not self.quiet:
            print roi

        self.TS_comp = 2 * (self.ll_1 - self.ll_0)
Esempio n. 3
0
    fit(just_prefactor=True)
    fit(fit_bg_first=True)
    fit() 

    if localize:
        paranoid_localize(roi, name, verbosity=4)

    if fit_extension:
        roi.fit_extension(which=name)
        paranoid_localize(roi, name)

    fit()

    print 'Making pointlike SED for hypothesis %s' % hypothesis
    sed = PointlikeSED(roi, name, verbosity=4)
    sed.save('%s/sed_pointlike_4bpd_%s_%s.yaml' % (pipeline.dirdict['seds'],hypothesis,name))
    sed.plot('%s/sed_pointlike_4bpd_%s_%s.png' % (pipeline.dirdict['seds'],hypothesis,name)) 

    print_summary()

    p = source_dict(roi, name)

    if upper_limit:
        pul = PointlikePowerLawUpperLimit(roi, name, cl=.95, verbosity=4)
        p['powerlaw_upper_limit']=pul.todict()

    roi.toXML(filename="%s/srcmodel_pointlike_%s_%s.xml"%(pipeline.dirdict['data'], hypothesis, name))
 
    roi.save('roi_%s_%s.dat' % (hypothesis,name))
Esempio n. 4
0
    fit(just_prefactor=True)
    fit(fit_bg_first=True)
    fit()

    if localize:
        paranoid_localize(roi, name, verbosity=4)

    if fit_extension:
        roi.fit_extension(which=name)
        paranoid_localize(roi, name)

    fit()

    print 'Making pointlike SED for hypothesis %s' % hypothesis
    sed = PointlikeSED(roi, name, verbosity=4)
    sed.save('%s/sed_pointlike_4bpd_%s_%s.yaml' %
             (pipeline.dirdict['seds'], hypothesis, name))
    sed.plot('%s/sed_pointlike_4bpd_%s_%s.png' %
             (pipeline.dirdict['seds'], hypothesis, name))

    print_summary()

    p = source_dict(roi, name)

    if upper_limit:
        pul = PointlikePowerLawUpperLimit(roi, name, cl=.95, verbosity=4)
        p['powerlaw_upper_limit'] = pul.todict()

    roi.toXML(filename="%s/srcmodel_pointlike_%s_%s.xml" %
              (pipeline.dirdict['data'], hypothesis, name))
Esempio n. 5
0
            assert override_localization['method'] == 'MinuitLocalizer'
            m=MinuitLocalizer(roi, name, verbosity=4)
            print 'Localization Ellipse:',m.todict()


    if fit_extension:
        roi.fit_extension(which=name)
        ellipse = paranoid_localize(roi, name)
        print ellipse

    unfreeze_far_away(roi, frozen)

    fit()

    print 'Making pointlike SED for hypothesis %s' % hypothesis
    sed = PointlikeSED(roi, name, verbosity=4)
    sed.save('%s/sed_pointlike_4bpd_%s_%s.yaml' % (seddir,hypothesis,name))
    sed.plot('%s/sed_pointlike_4bpd_%s_%s.png' % (seddir,hypothesis,name)) 

    print_summary()

    p = source_dict(roi, name)

    pul = PointlikePowerLawUpperLimit(roi, name, emin=emin, emax=emax, cl=.95, verbosity=4)
    p['powerlaw_upper_limit']=pul.todict()
    cul = PointlikeCutoffUpperLimit(roi, name, Index=1.7, Cutoff=3e3, b=1, cl=.95, verbosity=4)
    p['cutoff_upper_limit']=cul.todict()

    if cutoff:
        try:
            tc = PointlikeCutoffTester(roi,name, cutoff_model=cutoff_model, verbosity=4)