本文整理汇总了Python中mantid.simpleapi.SimulatedDensityOfStates类的典型用法代码示例。如果您正苦于以下问题:Python SimulatedDensityOfStates类的具体用法?Python SimulatedDensityOfStates怎么用?Python SimulatedDensityOfStates使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SimulatedDensityOfStates类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_lorentzian_function
def test_lorentzian_function(self):
wks = SimulatedDensityOfStates(PHONONFile=self._phonon_file,
Function='Lorentzian')
self.assertEquals(wks.getNumberHistograms(), 2)
v_axis_values = wks.getAxis(1).extractValues()
self.assertEquals(v_axis_values[0], 'Lorentzian')
self.assertEquals(v_axis_values[1], 'Stick')
示例2: test_partial
def test_partial(self):
spec_type = 'DOS'
ws = SimulatedDensityOfStates(File=self._file_name, SpectrumType=spec_type, Ions='H,C,O')
workspaces = ws.getNames()
self.assertEquals(len(workspaces), 3)
示例3: test_bond_table
def test_bond_table(self):
wks = SimulatedDensityOfStates(CASTEPFile=self._castep_file,
SpectrumType='BondTable')
self.assertTrue(isinstance(wks, ITableWorkspace))
self.assertEqual(wks.columnCount(), 6)
self.assertEqual(wks.rowCount(), 74)
示例4: test_partial_cross_section_scale
def test_partial_cross_section_scale(self):
spec_type = 'DOS'
ws = SimulatedDensityOfStates(File=self._file_name, SpectrumType=spec_type, Ions='H,C,O', ScaleByCrossSection='Incoherent')
workspaces = ws.getNames()
self.assertEquals(len(workspaces), 3)
示例5: test_ir_active
def test_ir_active(self):
spec_type = 'IR_Active'
wks = SimulatedDensityOfStates(PHONONFile=self._phonon_file,
SpectrumType=spec_type)
self.assertEquals(wks.getNumberHistograms(), 2)
v_axis_values = wks.getAxis(1).extractValues()
self.assertEquals(v_axis_values[0], 'Gaussian')
self.assertEquals(v_axis_values[1], 'Stick')
示例6: test_isotope_element_indices_loading
def test_isotope_element_indices_loading(self):
"""
"""
wks_grp = SimulatedDensityOfStates(PHONONFile=self._isotope_phonon,
SpectrumType='DOS',
CalculateIonIndices=True,
Ions='H:P,C:P')
self.assertEqual(2, len(wks_grp))
self.assertEqual('wks_grp_C(13)_0', wks_grp.getItem(0).getName())
self.assertEqual('wks_grp_H(2)_1' , wks_grp.getItem(1).getName())
示例7: test_isotopes_are_parsed_correctly
def test_isotopes_are_parsed_correctly(self):
"""
Test that isotopes in the file in the format `element:P` are valid
"""
wks_grp = SimulatedDensityOfStates(PHONONFile=self._isotope_phonon,
SpectrumType='DOS',
Ions='H:P,C:P,O')
self.assertEqual(3, wks_grp.size())
self.assertEqual('wks_grp_C(13)', wks_grp.getItem(0).getName())
self.assertEqual('(C13)', wks_grp.getItem(0).sample().getMaterial().name())
示例8: test_bin_width
def test_bin_width(self):
import math
ref = SimulatedDensityOfStates(File=self._file_name)
ws = SimulatedDensityOfStates(File=self._file_name, BinWidth=2)
size = ws.blocksize()
ref_size = ref.blocksize()
self.assertEquals(size, math.ceil(ref_size/2.0))
示例9: test_zero_threshold
def test_zero_threshold(self):
import numpy as np
ws = SimulatedDensityOfStates(File=self._file_name, ZeroThreshold=20)
x = ws.readX(0)
y = ws.readY(0)
mask = np.where(x < 20)
self.assertEquals(sum(y[mask]), 0)
示例10: test_isotopes_are_parsed_correctly
def test_isotopes_are_parsed_correctly(self):
"""
Test that isotopes in the file in the format `element:P` are valid
"""
wks_grp = SimulatedDensityOfStates(PHONONFile=self._isotope_phonon,
SpectrumType='DOS',
Ions='H:P,C:P,O')
self.assertEqual(3, wks_grp.size())
self.assertTrue(_is_name_material_in_group(wks_group = wks_grp, \
name_to_find = 'wks_grp_C(13)', material_to_find = '(C13)'))
示例11: test_bin_width
def test_bin_width(self):
import math
ref = SimulatedDensityOfStates(PHONONFile=self._phonon_file)
wks = SimulatedDensityOfStates(PHONONFile=self._phonon_file,
BinWidth=2)
size = wks.blocksize()
ref_size = ref.blocksize()
self.assertEquals(size, math.ceil(ref_size/2.0))
示例12: test_zero_threshold
def test_zero_threshold(self):
import numpy as np
wks = SimulatedDensityOfStates(PHONONFile=self._phonon_file,
ZeroThreshold=20)
x_data = wks.readX(0)
y_data = wks.readY(0)
mask = np.where(x_data < 20)
self.assertEquals(sum(y_data[mask]), 0)
示例13: test_ion_table
def test_ion_table(self):
wks = SimulatedDensityOfStates(PHONONFile=self._phonon_file,
SpectrumType='IonTable')
self.assertTrue(isinstance(wks, ITableWorkspace))
self.assertEqual(wks.columnCount(), 10)
self.assertEqual(wks.rowCount(), 20)
all_species = wks.column('Species')
self.assertEqual(all_species.count('H'), 4)
self.assertEqual(all_species.count('C'), 8)
self.assertEqual(all_species.count('O'), 8)
示例14: test_non_isotpe_element_indices_loading
def test_non_isotpe_element_indices_loading(self):
"""
Test that the individual indices for each element can be loaded seperately
Tests parse_chemical_and_ws_name for non-isotope + indices
"""
wks_grp = SimulatedDensityOfStates(PHONONFile=self._phonon_file,
SpectrumType='DOS',
CalculateIonIndices=True,
Ions='H,C,O')
self.assertEqual(20, len(wks_grp))
self.assertEqual('wks_grp_H_0' , wks_grp.getItem(0).getName())
self.assertEqual('wks_grp_C_4' , wks_grp.getItem(4).getName())
self.assertEqual('wks_grp_O_12', wks_grp.getItem(12).getName())
示例15: test_bin_ranges_are_correct
def test_bin_ranges_are_correct(self):
"""
Test that the bin ranges are correct when draw peak function is called
"""
bin_width = 3
wks_grp = SimulatedDensityOfStates(PHONONFile=self._phonon_file,
SpectrumType='DOS',
BinWidth=bin_width,
Ions='H,C,O')
expected_x_min = -0.051481
for idx in range(wks_grp.getNumberOfEntries()):
ws = wks_grp.getItem(idx)
self.assertAlmostEqual(expected_x_min,ws.readX(0)[0])
self.assertAlmostEqual(bin_width,(ws.readX(0)[1] - ws.readX(0)[0]))