Skip to content
Snippets Groups Projects
Commit 141fdeaf authored by Philip Elson's avatar Philip Elson :snake:
Browse files

Merge branch 'fix/discreet_function_set' into 'master'

Add tests for, and fix, the conversion of Python values to Discreet functions

See merge request !55
parents 6ba83388 95221f21
No related branches found
No related tags found
1 merge request!55Add tests for, and fix, the conversion of Python values to Discreet functions
Pipeline #2222840 passed
......@@ -1222,7 +1222,7 @@ class PyJapc(object):
elif ts == "DiscreteFunctionList":
# Allcoate JArray for DFs
dfa = jp.JArray(jp.JPackage("cern").japc.value.spi.value.DiscreteFunctionImpl)(len(pyVal))
dfa = jp.JArray(jp.JPackage("cern").japc.value.DiscreteFunction)(len(pyVal))
# Iterate over first dimension of user data
for i, funcDat in enumerate(pyVal):
funcDat2 = np.array(funcDat, dtype="double")
......
......@@ -263,6 +263,20 @@ def test_array_conversions(japc, np_array, arr_val_type):
assert np.array_equal(np_array, j2np_array)
def test_py_to_simple_discreet_function(japc):
np_array = np.arange(4, dtype=np.double).reshape(2, 2)
j_array = japc._convertPyToVal(np_array, dtype="DiscreteFunction")
arr_type = jp.JClass("cern.japc.value.spi.value.simple.DiscreteFunctionValue")
assert isinstance(j_array, arr_type)
def test_py_to_simple_discreet_function_list(japc):
list_of_2d_functions = [np.arange(4, dtype=np.double).reshape(2, 2), ]
j_array = japc._convertPyToVal(list_of_2d_functions, dtype="DiscreteFunctionList")
arr_type = jp.JClass("cern.japc.value.spi.value.simple.DiscreteFunctionListValue")
assert isinstance(j_array, arr_type)
def test_parameter_groups(japc, japc_mock):
# NOTE: Requires all services to be mocked, hence the need for japc_mock.
p1 = "LHC.BQTrig.HB1/Acquisition#sequence"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment