Skip to content

Commit

Permalink
- more checking of noiseparameters
Browse files Browse the repository at this point in the history
  • Loading branch information
fbergmann committed May 26, 2023
1 parent caa2281 commit 3b4fc29
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion copasi_petab_importer/convert_petab.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,19 @@ def assign_weight(self, petab, observable, obj_map, i):
observable_name = noise_formula[index + 1:]
# get the noiseParameters
noise_parameter = petab.measurement_data.query('observableId == "' + observable_name + '"') \
.noiseParameters.values[0].split(';')
.noiseParameters.values
if len(noise_parameter) == 0:
return False

try:
noise_parameter = noise_parameter[0].split(';')
except AttributeError:
try:
noise_parameter = float(noise_parameter)
noise_parameter = [ noise_parameter]
except ValueError:
return False

if len(noise_parameter) >= number:
# get the value from the column
noise_parameter = noise_parameter[number - 1]
Expand Down

0 comments on commit 3b4fc29

Please sign in to comment.