本文整理汇总了Python中sherpa.astro.datastack.clear_stack函数的典型用法代码示例。如果您正苦于以下问题:Python clear_stack函数的具体用法?Python clear_stack怎么用?Python clear_stack使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了clear_stack函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
def setUp(self):
datastack.clear_stack()
ui.clean()
datastack.set_template_id("__ID")
self._this_dir = os.path.dirname(sys.modules[self.__module__].__file__)
self.loggingLevel = logger.getEffectiveLevel()
logger.setLevel(logging.ERROR)
示例2: tearDown
def tearDown(self):
datastack.clear_stack()
ui.clean()
datastack.set_template_id("__ID")
os.remove(self.lisname)
os.remove(self.name1)
os.remove(self.name2)
datastack.set_stack_verbose(False)
logger.setLevel(self.loggingLevel)
示例3: tearDown
def tearDown(self):
self.ds.clear_stack()
datastack.clear_stack()
datastack.set_template_id("__ID")
ui.clean()
示例4: setUp
def setUp(self):
datastack.clear_stack()
datastack.set_template_id("__ID")
ui.clean()
self.ds = datastack.DataStack()
示例5: test_case_2
def test_case_2(self):
x1 = np.arange(50)+100
y1 = 2*(3*x1**2 + x1)
x2 = np.arange(50)
y2 = 2*(x2**2 + 3*x2)
x3 = np.arange(50)+200
y3 = 2*(x3**2+3*x3)
datastack.load_arrays([[x1, y1], [x2, y2], [x3, y3]])
datastack.set_source([], 'const1d.const * polynom1d.poly__ID')
poly1 = ui._session._get_model_component('poly1')
poly2 = ui._session._get_model_component('poly2')
poly3 = ui._session._get_model_component('poly3')
const = ui._session._get_model_component('const')
datastack.freeze([], 'poly')
datastack.thaw([], 'poly.c0')
datastack.thaw([], 'poly.c1')
datastack.thaw([], 'poly.c2')
datastack.thaw([], 'const')
assert poly1.c0.frozen is False
assert poly1.c1.frozen is False
assert poly1.c2.frozen is False
assert poly1.c3.frozen is True
assert poly2.c0.frozen is False
assert poly2.c1.frozen is False
assert poly2.c2.frozen is False
assert poly2.c3.frozen is True
assert poly3.c0.frozen is False
assert poly3.c1.frozen is False
assert poly3.c2.frozen is False
assert poly3.c3.frozen is True
datastack.set_par([], 'poly.c1', 0.45)
assert poly1.c1.val == 0.45
assert poly2.c1.val == 0.45
assert poly3.c1.val == 0.45
datastack.set_par([1], 'poly.c1', 0.1)
assert poly1.c1.val == 0.1
assert poly2.c1.val == 0.45
assert poly3.c1.val == 0.45
datastack.set_par([], 'const.c0', 2)
assert const.c0.val == 2
datastack.set_par([], 'const.integrate', False)
datastack.freeze([], 'const.c0')
vals = datastack.get_par([], 'poly.c1.val')
assert ([0.1, 0.45, 0.45] == vals).all()
# QUS: pars is not checked, so is this just
# checking that get_par doesn't fail?
pars = datastack.get_par([], 'const.c0')
datastack.fit([])
assert round(poly1.c1.val) == 1
assert round(poly1.c2.val) == 3
assert round(poly2.c1.val) == 3
assert round(poly2.c2.val) == 1
assert round(poly3.c1.val) == 3
assert round(poly3.c2.val) == 1
datastack.clear_stack()
x1 = np.arange(50)+100
y1 = 7*(3*x1**2 + x1)
x2 = np.arange(50)
y2 = 2*(x2**2 + 3*x2)
x3 = np.arange(50)+200
y3 = 2*(x3**2+3*x3)
datastack.load_arrays([[x1, y1], [x2, y2], [x3, y3]])
datastack.set_template_id("foo")
datastack.set_source([], 'const1d.constfoo * polynom1d.polyfoo')
const1 = ui._session._get_model_component('const1')
const2 = ui._session._get_model_component('const2')
const3 = ui._session._get_model_component('const3')
datastack.link([2,3], 'const.c0')
datastack.set_par([2], 'const.c0', 3)
datastack.set_par([1], 'const.c0', 7)
datastack.freeze([1], 'const.c0')
assert const2.c0.frozen is False
#.........这里部分代码省略.........