Commit 1ffa30d8 authored by Vincent Michel's avatar Vincent Michel
Browse files

Force uint to 32 bits

parent 1411a95b
Pipeline #907 passed with stages
in 1 minute and 16 seconds
...@@ -122,8 +122,8 @@ def get_run_data_length(channel): ...@@ -122,8 +122,8 @@ def get_run_data_length(channel):
def get_run_data(channel): def get_run_data(channel):
length = get_run_data_length(channel) length = get_run_data_length(channel)
array = numpy.zeros(length, dtype='uint') array = numpy.zeros(length, dtype='uint32')
data = ffi.cast('unsigned long *', array.ctypes.data) data = ffi.cast('uint32_t *', array.ctypes.data)
code = handel.xiaGetRunData(channel, b'mca', data) code = handel.xiaGetRunData(channel, b'mca', data)
check_error(code) check_error(code)
return array return array
...@@ -151,8 +151,8 @@ def get_buffer(channel, buffer_id): ...@@ -151,8 +151,8 @@ def get_buffer(channel, buffer_id):
bid = to_buffer_id(buffer_id) bid = to_buffer_id(buffer_id)
command = b'buffer_%c' % bid command = b'buffer_%c' % bid
length = get_buffer_length(channel) length = get_buffer_length(channel)
array = numpy.zeros(length, dtype='uint') array = numpy.zeros(length, dtype='uint32')
data = ffi.cast('unsigned long *', array.ctypes.data) data = ffi.cast('uint32_t *', array.ctypes.data)
code = handel.xiaGetRunData(channel, command, data) code = handel.xiaGetRunData(channel, command, data)
check_error(code) check_error(code)
return array return array
......
...@@ -185,7 +185,7 @@ def test_get_run_data(interface): ...@@ -185,7 +185,7 @@ def test_get_run_data(interface):
assert False assert False
m.side_effect = side_effect m.side_effect = side_effect
expected = numpy.array(range(10), dtype='uint') expected = numpy.array(range(10), dtype='uint32')
diff = interface.get_run_data(1) == expected diff = interface.get_run_data(1) == expected
assert diff.all() assert diff.all()
m.assert_called() m.assert_called()
...@@ -245,7 +245,7 @@ def test_get_buffer(interface): ...@@ -245,7 +245,7 @@ def test_get_buffer(interface):
assert False assert False
m.side_effect = side_effect m.side_effect = side_effect
expected = numpy.array(range(10), dtype='uint') expected = numpy.array(range(10), dtype='uint32')
diff = interface.get_buffer(1, 'a') == expected diff = interface.get_buffer(1, 'a') == expected
assert diff.all() assert diff.all()
m.assert_called() m.assert_called()
...@@ -496,8 +496,7 @@ def test_get_config_files(interface): ...@@ -496,8 +496,7 @@ def test_get_config_files(interface):
def test_get_config(interface): def test_get_config(interface):
filename = interface.get_config_files('.')[0] filename = interface.get_config_files('.')[0]
d = interface.get_config(filename) conf = interface.get_config(filename)
assert d['detector definitions']['alias'] == 'detector1' assert 'alias = detector1' in conf
assert 'DEFAULT' not in d
with pytest.raises(IOError): with pytest.raises(IOError):
interface.get_config('i_dont_exist.ini') interface.get_config('i_dont_exist.ini')
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment