Draft
Conversation
Member
Author
test_clamping.test_interpolation_clampFailing cdef np.ndarray _data_table_1 = np.array([0, 3000, 9000, 6000, 6900, 6000])
cdef double lookup_data_table_1(var_protocol__derived2_converted):
"""Look up data from interpolation_test_derived.csv."""
assert var_protocol__derived2_converted >= 0
assert var_protocol__derived2_converted <= 0.014999999999999999
cdef double offset_over_step = (var_protocol__derived2_converted - 0) * 333.33333333333331
cdef unsigned index = <unsigned>(offset_over_step)
cdef double y1 = _data_table_1[index]
cdef double y2 = _data_table_1[index + 1]
return y1 + (offset_over_step - index) * (y2 - y1)
cdef np.ndarray _data_table_2 = np.array([0, 3000, 9000, 6000, 6900, 6000])
cdef double lookup_data_table_2(var_protocol__table_key_converted):
"""Look up data from interpolation_test_derived.csv."""
assert var_protocol__table_key_converted >= 0
assert var_protocol__table_key_converted <= 0.014999999999999999
cdef double offset_over_step = (var_protocol__table_key_converted - 0) * 333.33333333333331
cdef unsigned index = <unsigned>(offset_over_step)
cdef double y1 = _data_table_2[index]
cdef double y2 = _data_table_2[index + 1]
return y1 + (offset_over_step - index) * (y2 - y1)Calculation of var_V = ((1.0 * var_time) if (0.001 * var_time <= 0.003 and 0.001 * var_time >= 0) else ((-3.0 + 2.0 * var_time) if (0.001 * var_time >= 0.003 and 0.001 * var_time <= 0.006) else ((21.000000000000004 - 2.0000000000000004 * var_time) if (0.001 * var_time >= 0.006 and 0.001 * var_time <= 0.0075) else ((6.0) if (0.001 * var_time >= 0.0075 and 0.001 * var_time <= 0.009) else ((3.300000000000001 + 0.29999999999999993 * var_time) if (0.001 * var_time >= 0.009 and 0.001 * var_time <= 0.012) else ((-1.3877787807814457e-17 + 1.0 * var_time) if (0.001 * var_time >= 0.012 and 0.001 * var_time <= 0.014) else (float('nan'))))))))
var_protocol__table_key = 5.0 + var_V
var_protocol__table_key_converted = 0.001 * var_protocol__table_key
var_protocol__interp = 0.001 * lookup_data_table_2(var_protocol__table_key_converted)
var_protocol__derived2 = ((-1.0) if (var_protocol__table_key > 14.0) else (((var_protocol__interp) if (var_protocol__table_key < 11.0) else (-2.0))))
var_protocol__derived2_converted = 0.001 * var_protocol__derived2Some examples: var_V 0.0
var_protocol__table_key 5.0
var_protocol__table_key_converted 0.005
var_protocol__interp 6.999999999999999
var_protocol__derived2 6.999999999999999
var_protocol__derived2_converted 0.006999999999999999
var_V 1.0
var_protocol__table_key 6.0
var_protocol__table_key_converted 0.006
var_protocol__interp 9.0
var_protocol__derived2 9.0
var_protocol__derived2_converted 0.009000000000000001
var_V 2.0
var_protocol__table_key 7.0
var_protocol__table_key_converted 0.007
var_protocol__interp 8.000000000000002
var_protocol__derived2 8.000000000000002
var_protocol__derived2_converted 0.008000000000000002
var_V 3.0
var_protocol__table_key 8.0
var_protocol__table_key_converted 0.008
var_protocol__interp 7.0
var_protocol__derived2 7.0
var_protocol__derived2_converted 0.007
var_V 5.0
var_protocol__table_key 10.0
var_protocol__table_key_converted 0.01
var_protocol__interp 6.3
var_protocol__derived2 6.3
var_protocol__derived2_converted 0.0063Values produced for 0.006999999999999999
0.009000000000000001
0.008000000000000002
0.007
0.0063
-0.002 # <--- Error!If
So this is probably failing when It is possible that the interpolation calculations are not correct. offset_over_step = (var_protocol__derived2_converted - 0) * 333.33333333333331
index = <unsigned>(offset_over_step)
y1 = _data_table_1[index]
y2 = _data_table_1[index + 1]
return y1 + (offset_over_step - index) * (y2 - y1)so offset_over_step = -0.6666666666666666
index == 0
y1 == 0
y2 == 3000
y1 + (offset_over_step - index) * (y2 - y1) == -2000.0This is not correct |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #236