Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Bliss
python-handel
Commits
1ffa30d8
Commit
1ffa30d8
authored
Aug 31, 2017
by
Vincent Michel
Browse files
Force uint to 32 bits
parent
1411a95b
Pipeline
#907
passed with stages
in 1 minute and 16 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
handel/interface.py
View file @
1ffa30d8
...
...
@@ -122,8 +122,8 @@ def get_run_data_length(channel):
def
get_run_data
(
channel
):
length
=
get_run_data_length
(
channel
)
array
=
numpy
.
zeros
(
length
,
dtype
=
'uint'
)
data
=
ffi
.
cast
(
'u
nsigned long
*'
,
array
.
ctypes
.
data
)
array
=
numpy
.
zeros
(
length
,
dtype
=
'uint
32
'
)
data
=
ffi
.
cast
(
'u
int32_t
*'
,
array
.
ctypes
.
data
)
code
=
handel
.
xiaGetRunData
(
channel
,
b
'mca'
,
data
)
check_error
(
code
)
return
array
...
...
@@ -151,8 +151,8 @@ def get_buffer(channel, buffer_id):
bid
=
to_buffer_id
(
buffer_id
)
command
=
b
'buffer_%c'
%
bid
length
=
get_buffer_length
(
channel
)
array
=
numpy
.
zeros
(
length
,
dtype
=
'uint'
)
data
=
ffi
.
cast
(
'u
nsigned long
*'
,
array
.
ctypes
.
data
)
array
=
numpy
.
zeros
(
length
,
dtype
=
'uint
32
'
)
data
=
ffi
.
cast
(
'u
int32_t
*'
,
array
.
ctypes
.
data
)
code
=
handel
.
xiaGetRunData
(
channel
,
command
,
data
)
check_error
(
code
)
return
array
...
...
tests/test_interface.py
View file @
1ffa30d8
...
...
@@ -185,7 +185,7 @@ def test_get_run_data(interface):
assert
False
m
.
side_effect
=
side_effect
expected
=
numpy
.
array
(
range
(
10
),
dtype
=
'uint'
)
expected
=
numpy
.
array
(
range
(
10
),
dtype
=
'uint
32
'
)
diff
=
interface
.
get_run_data
(
1
)
==
expected
assert
diff
.
all
()
m
.
assert_called
()
...
...
@@ -245,7 +245,7 @@ def test_get_buffer(interface):
assert
False
m
.
side_effect
=
side_effect
expected
=
numpy
.
array
(
range
(
10
),
dtype
=
'uint'
)
expected
=
numpy
.
array
(
range
(
10
),
dtype
=
'uint
32
'
)
diff
=
interface
.
get_buffer
(
1
,
'a'
)
==
expected
assert
diff
.
all
()
m
.
assert_called
()
...
...
@@ -496,8 +496,7 @@ def test_get_config_files(interface):
def
test_get_config
(
interface
):
filename
=
interface
.
get_config_files
(
'.'
)[
0
]
d
=
interface
.
get_config
(
filename
)
assert
d
[
'detector definitions'
][
'alias'
]
==
'detector1'
assert
'DEFAULT'
not
in
d
conf
=
interface
.
get_config
(
filename
)
assert
'alias = detector1'
in
conf
with
pytest
.
raises
(
IOError
):
interface
.
get_config
(
'i_dont_exist.ini'
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment