@@ -600,8 +600,26 @@ def create_mapping(self, experiments, petab):
600600 continue
601601 obj_map .setRole (num_cols + i , role )
602602
603- def generate_copasi_data (self , petab ):
603+ def update_conditions (self , petab ):
604+ # go through all columns of the condition table
605+ # and replace potential NaN entries with the value from the model
606+ # ignore the first column (conditionId)
607+ for col in petab .condition_data .columns [1 :]:
608+ if petab .condition_data [col ].isna ().any ():
609+ for i in range (petab .condition_data .shape [0 ]):
610+ if np .isnan (petab .condition_data .loc [i , col ]):
611+ obj = dm .findObjectByDisplayName (str ('Values[' + col + ']' ))
612+ if obj is None :
613+ obj = dm .findObjectByDisplayName (col )
614+ if obj is not None :
615+ if isinstance (obj , COPASI .CMetab ):
616+ value = obj .getInitialConcentration ()
617+ else :
618+ value = obj .getInitialValue ()
619+ petab .condition_data .loc [i , col ] = value
604620
621+ def generate_copasi_data (self , petab ):
622+ self .update_conditions (petab )
605623 self .experiments = self .get_experiments (petab )
606624 self .write_experiments (self .experiments , petab )
607625 self .create_mapping (self .experiments , petab )
0 commit comments