Skip to content
This repository was archived by the owner on Jun 27, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 8 additions & 28 deletions saba/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from collections import OrderedDict
from sherpa.fit import Fit
from sherpa.data import Data1D, Data1DInt, Data2D, Data2DInt, DataSimulFit
from sherpa.data import BaseData
from sherpa.data import Data
from sherpa.models import UserModel, Parameter, SimulFitModel
from sherpa.stats import Chi2, Chi2ConstVar, Chi2DataVar, Chi2Gehrels
from sherpa.stats import Chi2ModVar, Chi2XspecVar, LeastSq
Expand Down Expand Up @@ -673,12 +673,12 @@ def _converter(inp, *x):
linkedpars = []
for pname in model.param_names:
param = getattr(model, pname)
vals = [param.name, param.value, param.min, param.max, param.min,
vals = [pname, param.value, param.min, param.max, param.min,
param.max, None, param.fixed, False]
attrnames = ["name", "val", "min", "max", "hard_min", "hard_max",
"units", "frozen", "alwaysfrozen"]
if model.name is None:
model._name = ""
model._name = "astropy_model"

pars.append(Parameter(modelname="wrap_" + model.name, **dict([(atr, val) for atr, val in zip(attrnames, vals) if val is not None])))
if param.tied is not False:
Expand Down Expand Up @@ -759,12 +759,7 @@ def __init__(self, name, xlo, xhi, y, bkg, staterror=None, bkg_scale=1, src_scal
self.subtracted = False

self._backgrounds = [BkgDataset(bkg, bkg_scale)]
BaseData.__init__(self)

self.xlo = xlo
self.xhi = xhi
self.y = y
self.staterror = staterror
Data.__init__(self, (xlo, xhi), y, staterror)


class Data1DBkg(Data1D):
Expand Down Expand Up @@ -814,11 +809,8 @@ def __init__(self, name, x, y, bkg, staterror=None, bkg_scale=1, src_scale=1):
self.subtracted = False

self._backgrounds = [BkgDataset(bkg, bkg_scale)]
BaseData.__init__(self)
Data.__init__(self, name, (x, ), y, staterror)

self.x = x
self.y = y
self.staterror = staterror


class Data2DIntBkg(Data2DInt):
Expand Down Expand Up @@ -875,14 +867,7 @@ def __init__(self, name, xlo, xhi, ylo, yhi, z, bkg, staterror=None, bkg_scale=1
self.subtracted = False

self._backgrounds = [BkgDataset(bkg, bkg_scale)]
BaseData.__init__(self)

self.xlo = xlo
self.xhi = xhi
self.ylo = ylo
self.yhi = yhi
self.z = z
self.staterror = staterror
Data.__init__(self, (xlo, xhi, ylo, yhi), z, staterror)


class Data2DBkg(Data2D):
Expand Down Expand Up @@ -935,13 +920,8 @@ def __init__(self, name, x, y, z, bkg, staterror=None, bkg_scale=1, src_scale=1)
self.subtracted = False

self._backgrounds = [BkgDataset(bkg, bkg_scale)]
BaseData.__init__(self)

self.x = x
self.y = y
self.z = z
self.staterror = staterror

Data.__init__(self, name, (x, y), z, staterror)


class BkgDataset(object):
"""
Expand Down