Skip to content

Commit

Permalink
Fixing tests in PlasmaXRTSCalculator.
Browse files Browse the repository at this point in the history
  • Loading branch information
CFGrote committed Sep 16, 2020
1 parent 8843431 commit dc0f71a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Sources/python/SimEx/Calculators/PlasmaXRTSCalculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,8 @@ def _parseStaticData(data_string):
static_dict = {}

# Extract static data from
pattern_after_equal = '\\s\\d+\\.\\d+e[\+,\-]\\d+'
static_dict['k'] = extractDate('k\(w=0\)\\s+\[m\^-1\]\\s+='+pattern_after_equal, data_string)
pattern_after_equal = '\\s*\\d+\\.*\\d*[e,E]*[\+,\-]*\\d*'
static_dict['k'] = extractDate('k\(w=0\)\\s+\[m\^-1\]\\s+='+pattern_after_equal, data_string)
static_dict['fk'] = extractDate('f\(k\)\\s+='+pattern_after_equal, data_string)
static_dict['qk'] = extractDate('q\(k\)\\s+='+pattern_after_equal, data_string)
static_dict['Sk_ion'] = extractDate('S_ii\(k\)\\s+='+pattern_after_equal, data_string)
Expand Down Expand Up @@ -351,7 +351,7 @@ def extractDate(pattern_string, text):
line = pattern.findall(text)

# Extract value (behind the '=' symbol).
pattern = re.compile("=\\s")
pattern = re.compile('=\\s')
return float( pattern.split( line[0] )[-1] )
#
# Check and set functions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def testSaveH5(self):
self.assertAlmostEqual( h5['data/static']['Sk_core'].value, 0.05999, 4)
self.assertAlmostEqual( h5['data/static']['Wk'].value, 4.084 , 2)
self.assertAlmostEqual( h5['data/static']['Sk_total'].value, 6.002, 3)
self.assertAlmostEqual( h5['data/static']['ipl'].value, 38.35, 3)
self.assertAlmostEqual( h5['data/static']['ipl'].value, 38.353, 3)
# IPL has a unit.
self.assertEqual( h5['data/static']['ipl'].attrs['unit'], 'eV')
self.assertAlmostEqual( h5['data/static']['lfc'].value, 0.000 , 3)
Expand Down

0 comments on commit dc0f71a

Please sign in to comment.