Пример #1
0
 def init(self, parent_widget=None):
     decl = rt_params.declarations(self.FILE_PREFIX)
     self.defaults = rt_params.defaults(self.FILE_PREFIX, decl)
     self.params = rt_params.init_params(self.defaults)
     self._view = genesis_pane.View(self, parent_widget)
     self.w = {}
     return self._view
Пример #2
0
 def init(self, parent_widget=None):
     decl = rt_params.declarations(self.FILE_PREFIX)
     self.defaults = rt_params.defaults(
         self.FILE_PREFIX + '_' + self.SRW_MODE,
         decl['simulation_complexity'][self.SRW_MODE + '_particle'])
     self.params = rt_params.init_params(self.defaults)
     self._view = srw_pane.View(self, parent_widget)
     return self._view
Пример #3
0
def test_init_params():
    """Verify a couple of values exist"""
    decl = rt_params.declarations('srw')['simulation_complexity']['multi_particle']
    p = rt_params.init_params(
        rt_params.defaults('srw_multi', decl),
    )
    assert 0.5 == p['beam']['avg_current'], \
        'Value must be converted to type correctly'
    assert 1000 == p['simulation_kind']['e']['wavefront']['num_points_energy'], \
        'Selectors must be parsed correctly'
    assert p
Пример #4
0
def test_defaults():
    """Verify a couple of values exist"""
    decl = rt_params.declarations('srw')['simulation_complexity']['multi_particle']
    d = rt_params.defaults('srw_multi', decl)
    assert isinstance(
        d['undulator']['orientation'].value,
        srw_enums.UndulatorOrientation), \
        'Value must be parsed correctly'
    assert 101 == \
        d['simulation_kind']['x_and_y']['wavefront']['num_points_x'].value, \
        'Value must be parsed correctly'
    _assert_unicode(d)
Пример #5
0
def test_iter_defaults():
    """Verify a couple of values exist"""
    decl = rt_params.declarations('srw')['simulation_complexity']['multi_particle']
    defaults = rt_params.defaults('srw_multi', decl)
    it = defaults['precision'].iter_leaves()
    assert 'Initial Harmonic' == it.next().decl.label, \
        'Ensure values are in order of leaves'
    assert 'Final Harmonic' == it.next().decl.label, \
        'Ensure see we can traverse to second leaf'
    it = defaults['precision'].iter_nodes()
    assert 'Precision' == it.next().decl.label, \
        'Ensure parent is first value'
    assert 'Spectral Flux Calculation' == it.next().decl.label, \
        'Ensure see first parent node'
    assert 'Initial Harmonic' == it.next().decl.label, \
        'Ensure see first leaf'
    assert 'Final Harmonic' == it.next().decl.label, \
        'Ensure see we can traverse to second leaf'