Ejemplo n.º 1
0
 def __init__(self, name='integrate1d'):
     tol = numpy.finfo(float).eps
     self.epsabs = Parameter(name, 'epsabs', tol, alwaysfrozen=True)
     self.epsrel = Parameter(name, 'epsrel', 0, alwaysfrozen=True)
     self.maxeval = Parameter(name, 'maxeval', 10000, alwaysfrozen=True)
     ArithmeticModel.__init__(self, name,
                              (self.epsabs, self.epsrel, self.maxeval))
Ejemplo n.º 2
0
 def __init__(self, name='normgauss2d'):
     self.fwhm = Parameter(name, 'fwhm', 10, tinyval, hard_min=tinyval)
     self.xpos = Parameter(name, 'xpos', 0)
     self.ypos = Parameter(name, 'ypos', 0)
     self.ellip = Parameter(name,
                            'ellip',
                            0,
                            0,
                            0.999,
                            0,
                            0.9999,
                            frozen=True)
     self.theta = Parameter(name,
                            'theta',
                            0,
                            -2 * numpy.pi,
                            2 * numpy.pi,
                            -2 * numpy.pi,
                            4 * numpy.pi,
                            'radians',
                            frozen=True)
     self.ampl = Parameter(name, 'ampl', 1)
     ArithmeticModel.__init__(self, name,
                              (self.fwhm, self.xpos, self.ypos, self.ellip,
                               self.theta, self.ampl))
     self.cache = 0
Ejemplo n.º 3
0
 def __init__(self, name='logparabola'):
     self.ref = Parameter(name, 'ref', 1, alwaysfrozen=True)
     self.c1 = Parameter(name, 'c1', 1)
     self.c2 = Parameter(name, 'c2', 1)
     self.ampl = Parameter(name, 'ampl', 1, 0)
     ArithmeticModel.__init__(self, name, (self.ref,self.c1,
                                           self.c2,self.ampl))
Ejemplo n.º 4
0
 def __init__(self, name='integrate1d'):
     tol = numpy.finfo(float).eps
     self.epsabs = Parameter(name, 'epsabs', tol, alwaysfrozen=True)
     self.epsrel = Parameter(name, 'epsrel', 0, alwaysfrozen=True)
     self.maxeval = Parameter(name, 'maxeval', 10000, alwaysfrozen=True)
     ArithmeticModel.__init__(self, name, (self.epsabs,self.epsrel,
                                           self.maxeval))
Ejemplo n.º 5
0
 def __init__(self, name='logparabola'):
     self.ref = Parameter(name, 'ref', 1, alwaysfrozen=True)
     self.c1 = Parameter(name, 'c1', 1)
     self.c2 = Parameter(name, 'c2', 1)
     self.ampl = Parameter(name, 'ampl', 1, 0)
     ArithmeticModel.__init__(self, name,
                              (self.ref, self.c1, self.c2, self.ampl))
Ejemplo n.º 6
0
    def __init__(self, name='templatemodel', pars=(), parvals=[], templates=[]):
        self.parvals = parvals
        self.templates = templates
        for par in pars:
            self.__dict__[par.name] = par

        # Construct kdtree from parameter space
        self.tree = None

        lpars = len(pars)

        if lpars < 2:
            raise TypeError("Use tablemodel for a single template parameter")
        if lpars > 10:
            raise TypeError("Greater than 10 template parameters is unsupported")

        klass = getattr(sherpa.utils.kdtree, 'KDTree_%iDouble' % lpars)
        tree = klass()

        for ii, parval in enumerate(parvals):
            tree.add((tuple(parval), ii))        

        tree.optimize()
        self.tree = tree
        ArithmeticModel.__init__(self, name, pars)
Ejemplo n.º 7
0
 def __init__(self, name="box2d"):
     self.xlow = Parameter(name, "xlow", 0)
     self.xhi = Parameter(name, "xhi", 0)
     self.ylow = Parameter(name, "ylow", 0)
     self.yhi = Parameter(name, "yhi", 0)
     self.ampl = Parameter(name, "ampl", 1)
     ArithmeticModel.__init__(self, name, (self.xlow, self.xhi, self.ylow, self.yhi, self.ampl))
     self.cache = 0
Ejemplo n.º 8
0
 def __init__(self, name='tablemodel'):
     # these attributes should remain somewhat private
     # as not to conflict with user defined parameter names
     self.__x = None
     self.__y = None
     self.__filtered_y = None
     self.filename = None
     self.ampl = Parameter(name, 'ampl', 1)
     ArithmeticModel.__init__(self, name, (self.ampl,))
Ejemplo n.º 9
0
 def __init__(self, name='box2d'):
     self.xlow = Parameter(name, 'xlow', 0)
     self.xhi = Parameter(name, 'xhi', 0)
     self.ylow = Parameter(name, 'ylow', 0)
     self.yhi = Parameter(name, 'yhi', 0)
     self.ampl = Parameter(name, 'ampl', 1)
     ArithmeticModel.__init__(
         self, name, (self.xlow, self.xhi, self.ylow, self.yhi, self.ampl))
     self.cache = 0
Ejemplo n.º 10
0
 def __init__(self, name="tablemodel"):
     # these attributes should remain somewhat private
     # as not to conflict with user defined parameter names
     self.__x = None
     self.__y = None
     self.__filtered_y = None
     self.filename = None
     self.method = linear_interp  # interpolation method
     self.ampl = Parameter(name, "ampl", 1)
     ArithmeticModel.__init__(self, name, (self.ampl,))
Ejemplo n.º 11
0
 def __init__(self, name='tablemodel'):
     # these attributes should remain somewhat private
     # as not to conflict with user defined parameter names
     self.__x = None
     self.__y = None
     self.__filtered_y = None
     self.filename = None
     self.method = linear_interp  # interpolation method
     self.ampl = Parameter(name, 'ampl', 1)
     ArithmeticModel.__init__(self, name, (self.ampl, ))
Ejemplo n.º 12
0
 def __init__(self, name='box2d'):
     self.xlow = Parameter(name, 'xlow', 0)
     self.xhi = Parameter(name, 'xhi', 0)
     self.ylow = Parameter(name, 'ylow', 0)
     self.yhi = Parameter(name, 'yhi', 0)
     self.ampl = Parameter(name, 'ampl', 1)
     ArithmeticModel.__init__(self, name,
                              (self.xlow, self.xhi, self.ylow, self.yhi,
                               self.ampl))
     self.cache = 0
Ejemplo n.º 13
0
 def __init__(self, name="normgauss2d"):
     self.fwhm = Parameter(name, "fwhm", 10, tinyval, hard_min=tinyval)
     self.xpos = Parameter(name, "xpos", 0)
     self.ypos = Parameter(name, "ypos", 0)
     self.ellip = Parameter(name, "ellip", 0, 0, 0.999, 0, 0.9999, frozen=True)
     self.theta = Parameter(
         name, "theta", 0, -2 * numpy.pi, 2 * numpy.pi, -2 * numpy.pi, 4 * numpy.pi, "radians", frozen=True
     )
     self.ampl = Parameter(name, "ampl", 1)
     ArithmeticModel.__init__(self, name, (self.fwhm, self.xpos, self.ypos, self.ellip, self.theta, self.ampl))
     self.cache = 0
Ejemplo n.º 14
0
 def __init__(self, name="sigmagauss2d"):
     self.sigma_a = Parameter(name, "sigma_a", 10, tinyval, hard_min=tinyval)
     self.sigma_b = Parameter(name, "sigma_b", 10, tinyval, hard_min=tinyval)
     self.xpos = Parameter(name, "xpos", 0)
     self.ypos = Parameter(name, "ypos", 0)
     self.theta = Parameter(
         name, "theta", 0, -2 * numpy.pi, 2 * numpy.pi, -2 * numpy.pi, 4 * numpy.pi, "radians", frozen=True
     )
     self.ampl = Parameter(name, "ampl", 1)
     ArithmeticModel.__init__(self, name, (self.sigma_a, self.sigma_b, self.xpos, self.ypos, self.theta, self.ampl))
     self.cache = 0
Ejemplo n.º 15
0
 def __init__(self, name='usermodel', pars=None):
     # these attributes should remain somewhat private
     # as not to conflict with user defined parameter names
     self._y = []
     self._file = None
     if pars is None:
         self.ampl = Parameter(name, 'ampl', 1)
         pars = (self.ampl,)
     else:
         for par in pars:
             self.__dict__[par.name] = par
     ArithmeticModel.__init__(self, name, pars)
Ejemplo n.º 16
0
 def __init__(self, name='usermodel', pars=None):
     # these attributes should remain somewhat private
     # as not to conflict with user defined parameter names
     self._y = []
     self._file = None
     if pars is None:
         self.ampl = Parameter(name, 'ampl', 1)
         pars = (self.ampl, )
     else:
         for par in pars:
             self.__dict__[par.name] = par
     ArithmeticModel.__init__(self, name, pars)
Ejemplo n.º 17
0
    def __init__(self, name='templatemodel', pars=(), parvals=[], templates=[]):
        self.parvals = parvals
        self.templates = templates
        self.index = {}

        for par in pars:
            self.__dict__[par.name] = par

        for ii, parval in enumerate(parvals):
            self.index[tuple(parval)] = templates[ii]        

        ArithmeticModel.__init__(self, name, pars)
        self.is_discrete = True
Ejemplo n.º 18
0
 def __init__(self, name='sigmagauss2d'):
     self.sigma_a = Parameter(name, 'sigma_a', 10, tinyval, hard_min=tinyval)
     self.sigma_b = Parameter(name, 'sigma_b', 10, tinyval, hard_min=tinyval)
     self.xpos = Parameter(name, 'xpos', 0)
     self.ypos = Parameter(name, 'ypos', 0)
     self.theta = \
         Parameter(name, 'theta', 0, -2*numpy.pi, 2*numpy.pi, \
                       -2*numpy.pi, 4*numpy.pi, 'radians', frozen=True)
     self.ampl = Parameter(name, 'ampl', 1)
     ArithmeticModel.__init__(self, name,
                              (self.sigma_a, self.sigma_b, self.xpos,
                               self.ypos, self.theta, self.ampl))
     self.cache = 0
Ejemplo n.º 19
0
 def __init__(self, name='normgauss2d'):
     self.fwhm = Parameter(name, 'fwhm', 10, tinyval, hard_min=tinyval)
     self.xpos = Parameter(name, 'xpos', 0)
     self.ypos = Parameter(name, 'ypos', 0)
     self.ellip = Parameter(name, 'ellip', 0, 0, 0.999, 0, 0.9999,
                            frozen=True)
     self.theta = Parameter(name, 'theta', 0, 0, 2*numpy.pi, -2*numpy.pi,
                            4*numpy.pi, 'radians', frozen=True)
     self.ampl = Parameter(name, 'ampl', 1)
     ArithmeticModel.__init__(self, name,
                              (self.fwhm, self.xpos, self.ypos, self.ellip,
                               self.theta, self.ampl))
     self.cache = 0
Ejemplo n.º 20
0
 def __init__(self, name="polynom2d"):
     self.c = Parameter(name, "c", 1)
     self.cx1 = Parameter(name, "cx1", 0)
     self.cx2 = Parameter(name, "cx2", 0)
     self.cy1 = Parameter(name, "cy1", 0)
     self.cy2 = Parameter(name, "cy2", 0)
     self.cx1y1 = Parameter(name, "cx1y1", 0)
     self.cx1y2 = Parameter(name, "cx1y2", 0)
     self.cx2y1 = Parameter(name, "cx2y1", 0)
     self.cx2y2 = Parameter(name, "cx2y2", 0)
     ArithmeticModel.__init__(
         self, name, (self.c, self.cy1, self.cy2, self.cx1, self.cx1y1, self.cx1y2, self.cx2, self.cx2y1, self.cx2y2)
     )
     self.cache = 0
Ejemplo n.º 21
0
    def __init__(self, name='polynom1d'):
        pars = []

        for i in xrange(9):
            pars.append(Parameter(name, 'c%d' % i, 0, frozen=True))
        pars[0].val = 1
        pars[0].frozen = False
        for p in pars:
            setattr(self, p.name, p)

        self.offset = Parameter(name, 'offset', 0, frozen=True)
        pars.append(self.offset)

        ArithmeticModel.__init__(self, name, pars)
Ejemplo n.º 22
0
    def __init__(self, name='polynom1d'):
        pars = []
        
        for i in xrange(9):
            pars.append(Parameter(name, 'c%d' % i, 0, frozen=True))
        pars[0].val = 1
        pars[0].frozen = False
        for p in pars:
            setattr(self, p.name, p)

        self.offset = Parameter(name, 'offset', 0, frozen=True)
        pars.append(self.offset)

        ArithmeticModel.__init__(self, name, pars)
Ejemplo n.º 23
0
 def __init__(self, name='polynom2d'):
     self.c = Parameter(name, 'c', 1)
     self.cx1 = Parameter(name, 'cx1', 0)
     self.cx2 = Parameter(name, 'cx2', 0)
     self.cy1 = Parameter(name, 'cy1', 0)
     self.cy2 = Parameter(name, 'cy2', 0)
     self.cx1y1 = Parameter(name, 'cx1y1', 0)
     self.cx1y2 = Parameter(name, 'cx1y2', 0)
     self.cx2y1 = Parameter(name, 'cx2y1', 0)
     self.cx2y2 = Parameter(name, 'cx2y2', 0)
     ArithmeticModel.__init__(
         self, name, (self.c, self.cy1, self.cy2, self.cx1, self.cx1y1,
                      self.cx1y2, self.cx2, self.cx2y1, self.cx2y2))
     self.cache = 0
Ejemplo n.º 24
0
 def __init__(self, name='polynom2d'):
     self.c = Parameter(name, 'c', 1)
     self.cx1 = Parameter(name, 'cx1', 0)
     self.cx2 = Parameter(name, 'cx2', 0)
     self.cy1 = Parameter(name, 'cy1', 0)
     self.cy2 = Parameter(name, 'cy2', 0)
     self.cx1y1 = Parameter(name, 'cx1y1', 0)
     self.cx1y2 = Parameter(name, 'cx1y2', 0)
     self.cx2y1 = Parameter(name, 'cx2y1', 0)
     self.cx2y2 = Parameter(name, 'cx2y2', 0)
     ArithmeticModel.__init__(self, name,
                              (self.c, self.cy1, self.cy2, self.cx1,
                               self.cx1y1, self.cx1y2, self.cx2,
                               self.cx2y1, self.cx2y2))
     self.cache = 0
Ejemplo n.º 25
0
    def __init__(self,
                 name='templatemodel',
                 pars=(),
                 parvals=[],
                 templates=[]):
        self.parvals = parvals
        self.templates = templates
        self.index = {}

        for par in pars:
            self.__dict__[par.name] = par

        for ii, parval in enumerate(parvals):
            self.index[tuple(parval)] = templates[ii]

        ArithmeticModel.__init__(self, name, pars)
        self.is_discrete = True
Ejemplo n.º 26
0
 def __init__(self, name='sigmagauss2d'):
     self.sigma_a = Parameter(name,
                              'sigma_a',
                              10,
                              tinyval,
                              hard_min=tinyval)
     self.sigma_b = Parameter(name,
                              'sigma_b',
                              10,
                              tinyval,
                              hard_min=tinyval)
     self.xpos = Parameter(name, 'xpos', 0)
     self.ypos = Parameter(name, 'ypos', 0)
     self.theta = \
         Parameter(name, 'theta', 0, -2*numpy.pi, 2*numpy.pi, \
                       -2*numpy.pi, 4*numpy.pi, 'radians', frozen=True)
     self.ampl = Parameter(name, 'ampl', 1)
     ArithmeticModel.__init__(self, name,
                              (self.sigma_a, self.sigma_b, self.xpos,
                               self.ypos, self.theta, self.ampl))
     self.cache = 0
Ejemplo n.º 27
0
 def __init__(self, name='powlaw1d'):
     self.gamma = Parameter(name, 'gamma', 1, -10, 10)
     self.ref = Parameter(name, 'ref', 1, alwaysfrozen=True)
     self.ampl = Parameter(name, 'ampl', 1, 0)
     ArithmeticModel.__init__(self, name, (self.gamma, self.ref, self.ampl))
Ejemplo n.º 28
0
 def __init__(self, name='box1d'):
     self.xlow = Parameter(name, 'xlow', 0)
     self.xhi = Parameter(name, 'xhi', 0)
     self.ampl = Parameter(name, 'ampl', 1, -1, 1)
     ArithmeticModel.__init__(self, name, (self.xlow, self.xhi, self.ampl))
Ejemplo n.º 29
0
 def __init__(self, name='poisson'):
     self.mean = Parameter(name, 'mean', 1, 1e-05, hard_min=tinyval)
     self.ampl = Parameter(name, 'ampl', 1)
     ArithmeticModel.__init__(self, name, (self.mean, self.ampl))
Ejemplo n.º 30
0
 def __init__(self, name='delta2d'):
     self.xpos = Parameter(name, 'xpos', 0)
     self.ypos = Parameter(name, 'ypos', 0)
     self.ampl = Parameter(name, 'ampl', 1)
     ArithmeticModel.__init__(self, name, (self.xpos, self.ypos, self.ampl))
     self.cache = 0
Ejemplo n.º 31
0
 def __init__(self, name='powlaw1d'):
     self.gamma = Parameter(name, 'gamma', 1, -10, 10)
     self.ref = Parameter(name, 'ref', 1, alwaysfrozen=True)
     self.ampl = Parameter(name, 'ampl', 1, 0)
     ArithmeticModel.__init__(self, name, (self.gamma, self.ref, self.ampl))
Ejemplo n.º 32
0
 def __init__(self, name='steplo1d'):
     self.xcut = Parameter(name, 'xcut', 0)
     self.ampl = Parameter(name, 'ampl', 1, 0)
     ArithmeticModel.__init__(self, name, (self.xcut, self.ampl))
Ejemplo n.º 33
0
 def __init__(self, name='steplo1d'):
     self.xcut = Parameter(name, 'xcut', 0)
     self.ampl = Parameter(name, 'ampl', 1, 0)
     ArithmeticModel.__init__(self, name, (self.xcut, self.ampl))
Ejemplo n.º 34
0
 def __init__(self, name='delta2d'):
     self.xpos = Parameter(name, 'xpos', 0)
     self.ypos = Parameter(name, 'ypos', 0)
     self.ampl = Parameter(name, 'ampl', 1)
     ArithmeticModel.__init__(self, name, (self.xpos, self.ypos, self.ampl))
     self.cache = 0
Ejemplo n.º 35
0
 def __setstate__(self, state):
     self.__x = None
     self.__y = state.pop('_y', None)
     self.__filtered_y = state.pop('_filtered_y', None)
     self.filename = state.pop('_file', None)
     ArithmeticModel.__setstate__(self, state)
Ejemplo n.º 36
0
 def __init__(self, name='const1d'):
     self.c0 = Parameter(name, 'c0', 1)
     ArithmeticModel.__init__(self, name, (self.c0, ))
Ejemplo n.º 37
0
 def __setstate__(self, state):
     self.__x = None
     self.__y = state.pop('_y', None)
     self.__filtered_y = state.pop('_filtered_y', None)
     self.filename = state.pop('_file', None)
     ArithmeticModel.__setstate__(self, state)
Ejemplo n.º 38
0
 def __init__(self, name, template_model):
     self.template_model = template_model
     for par in template_model.pars:
         self.__dict__[par.name] = par
         self.parvals = template_model.parvals
     ArithmeticModel.__init__(self, name, template_model.pars)
Ejemplo n.º 39
0
 def __init__(self, name='box1d'):
     self.xlow = Parameter(name, 'xlow', 0)
     self.xhi = Parameter(name, 'xhi', 0)
     self.ampl = Parameter(name, 'ampl', 1, -1, 1)
     ArithmeticModel.__init__(self, name, (self.xlow, self.xhi, self.ampl))
Ejemplo n.º 40
0
 def __init__(self, name='erfc'):
     self.ampl = Parameter(name, 'ampl', 1, 0)
     self.offset = Parameter(name, 'offset', 0, 0, hard_min=0)
     self.sigma = Parameter(name, 'sigma', 1, 1e-10, 10, tinyval)
     ArithmeticModel.__init__(self, name,
                              (self.ampl, self.offset, self.sigma))
Ejemplo n.º 41
0
 def __init__(self, name='sqrt'):
     self.offset = Parameter(name, 'offset', 0)
     self.ampl = Parameter(name, 'ampl', 1, 0)
     ArithmeticModel.__init__(self, name, (self.offset, self.ampl))
Ejemplo n.º 42
0
 def __init__(self, name='log10'):
     self.offset = Parameter(name, 'offset', 0)
     self.coeff = Parameter(name, 'coeff', -1)
     self.ampl = Parameter(name, 'ampl', 1, 0)
     ArithmeticModel.__init__(self, name,
                              (self.offset, self.coeff, self.ampl))
Ejemplo n.º 43
0
 def __init__(self, name='delta1d'):
     self.pos = Parameter(name, 'pos', 0)
     self.ampl = Parameter(name, 'ampl', 1)
     ArithmeticModel.__init__(self, name, (self.pos, self.ampl))
Ejemplo n.º 44
0
 def __init__(self, name='sqrt'):
     self.offset = Parameter(name, 'offset', 0)
     self.ampl = Parameter(name, 'ampl', 1, 0)
     ArithmeticModel.__init__(self, name, (self.offset, self.ampl))
Ejemplo n.º 45
0
 def __init__(self, name='const1d'):
     self.c0 = Parameter(name, 'c0', 1)
     ArithmeticModel.__init__(self, name, (self.c0,))
Ejemplo n.º 46
0
 def __init__(self, name='normgauss1d'):
     self.fwhm = Parameter(name, 'fwhm', 10, tinyval, hard_min=tinyval)
     self.pos = Parameter(name, 'pos', 0)
     self.ampl = Parameter(name, 'ampl', 1)
     ArithmeticModel.__init__(self, name, (self.fwhm, self.pos, self.ampl))
Ejemplo n.º 47
0
    def __init__(self, name, template_model):
        self.template_model = template_model
        for par in template_model.pars:
            self.__dict__[par.name] = par
	ArithmeticModel.__init__(self, name, template_model.pars)
Ejemplo n.º 48
0
 def __init__(self, name='normgauss1d'):
     self.fwhm = Parameter(name, 'fwhm', 10, tinyval, hard_min=tinyval)
     self.pos = Parameter(name, 'pos', 0)
     self.ampl = Parameter(name, 'ampl', 1)
     ArithmeticModel.__init__(self, name, (self.fwhm, self.pos, self.ampl))
Ejemplo n.º 49
0
 def __init__(self, name='log10'):
     self.offset = Parameter(name, 'offset', 0)
     self.coeff = Parameter(name, 'coeff', -1)
     self.ampl = Parameter(name, 'ampl', 1, 0)
     ArithmeticModel.__init__(self, name,
                              (self.offset, self.coeff, self.ampl))
Ejemplo n.º 50
0
 def __init__(self, name='poisson'):
     self.mean = Parameter(name, 'mean', 1, 1e-05, hard_min=tinyval)
     self.ampl = Parameter(name, 'ampl', 1)
     ArithmeticModel.__init__(self, name, (self.mean, self.ampl))
Ejemplo n.º 51
0
 def __init__(self, name='cos'):
     self.period = Parameter(name, 'period', 1, 1e-10, 10, tinyval)
     self.offset = Parameter(name, 'offset', 0, 0, hard_min=0)
     self.ampl = Parameter(name, 'ampl', 1, 1e-05, hard_min=0)
     ArithmeticModel.__init__(self, name,
                              (self.period, self.offset, self.ampl))
Ejemplo n.º 52
0
 def __init__(self, name='cos'):
     self.period = Parameter(name, 'period', 1, 1e-10, 10, tinyval)
     self.offset = Parameter(name, 'offset', 0, 0, hard_min=0)
     self.ampl = Parameter(name, 'ampl', 1, 1e-05, hard_min=0)
     ArithmeticModel.__init__(self, name,
                              (self.period, self.offset, self.ampl))
Ejemplo n.º 53
0
 def __init__(self, name='delta1d'):
     self.pos = Parameter(name, 'pos', 0)
     self.ampl = Parameter(name, 'ampl', 1)
     ArithmeticModel.__init__(self, name, (self.pos, self.ampl))
Ejemplo n.º 54
0
 def __init__(self, name='erfc'):
     self.ampl = Parameter(name, 'ampl', 1, 0)
     self.offset = Parameter(name, 'offset', 0, 0, hard_min=0)
     self.sigma = Parameter(name, 'sigma', 1, 1e-10, 10, tinyval)
     ArithmeticModel.__init__(self, name,
                              (self.ampl, self.offset, self.sigma))