Skip to content

Commit

Permalink
fix for type of parser
Browse files Browse the repository at this point in the history
  • Loading branch information
jcblemai committed Oct 25, 2023
1 parent 65ad35a commit 13542d1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions flepimop/gempyor_pkg/src/gempyor/compartments.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,13 @@ def parse_parameter_strings_to_numpy_arrays_v2(self, parameters, parameter_names
# Apply the lambdify function with parameter values as a list
substituted_formulas = substitution_function(*parameter_values_list)
for i in range(len(substituted_formulas)):
if string_list[i] == "1": # this should not happen anymore, but apparently it submmit one
substituted_formulas[i] = np.ones_like(substituted_formulas[i + 1])
# sometime it's "1" or "1*1*1*..." which produce an int or float instead of an array
# in this case we find the next array and set it to that size,
# TODO: instead of searching for the next array, better to just use the parameter shape.
if not isinstance(substituted_formulas[i], np.ndarray):
for k in range(len(substituted_formulas)):
if isinstance(substituted_formulas[k], np.ndarray):
substituted_formulas[i] = substituted_formulas[i] * np.ones_like(substituted_formulas[k])

return np.array(substituted_formulas)

Expand Down

0 comments on commit 13542d1

Please sign in to comment.