File: test-numpy.py

package info (click to toggle)
xraylib 4.2.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 46,976 kB
  • sloc: ansic: 16,363; f90: 9,202; java: 6,998; python: 1,580; cpp: 1,317; pascal: 1,139; makefile: 810; ruby: 622; php: 594; perl: 573; cs: 193; sh: 160
file content (26 lines) | stat: -rw-r--r-- 665 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import os
if "EXTRA_DLL_SEARCH_PATHS" in os.environ and hasattr(os, "add_dll_directory"):
    for path in os.environ["EXTRA_DLL_SEARCH_PATHS"].split(os.pathsep):
        os.add_dll_directory(path)
import unittest
import xraylib
import numpy as np



class TestNumpy(unittest.TestCase):
    def _test_np(self, dtype):
        for Z in np.arange(10, 20, dtype=dtype):
            print( xraylib.LineEnergy(Z, xraylib.KL2_LINE))

    def test_np_i16(self):
        self._test_np(np.int16)

    def test_np_i32(self):
        self._test_np(np.int32)

    def test_np_i64(self):
        self._test_np(np.int64)

if __name__ == '__main__':
    unittest.main(verbosity=2)