Skip to content

Commit 0917194

Browse files
authored
fix override check for empty measurement table (#56)
* fixup * fixup typehints
1 parent 2a164df commit 0917194

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

petab/lint.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ def is_scalar_float(x: Any):
546546

547547

548548
def measurement_table_has_timepoint_specific_mappings(
549-
measurement_df: pd.DataFrame,
549+
measurement_df: Optional[pd.DataFrame],
550550
allow_scalar_numeric_noise_parameters: bool = False,
551551
allow_scalar_numeric_observable_parameters: bool = False,
552552
) -> bool:
@@ -569,6 +569,9 @@ def measurement_table_has_timepoint_specific_mappings(
569569
True if there are time-point or replicate specific (non-numeric)
570570
parameter assignments in the measurement table, False otherwise.
571571
"""
572+
if measurement_df is None:
573+
return False
574+
572575
# since we edit it, copy it first
573576
measurement_df = copy.deepcopy(measurement_df)
574577

@@ -609,7 +612,7 @@ def measurement_table_has_timepoint_specific_mappings(
609612

610613

611614
def observable_table_has_nontrivial_noise_formula(
612-
observable_df: pd.DataFrame) -> bool:
615+
observable_df: Optional[pd.DataFrame]) -> bool:
613616
"""
614617
Does any observable have a noise formula that is not just a single
615618
parameter?
@@ -621,6 +624,8 @@ def observable_table_has_nontrivial_noise_formula(
621624
True if any noise formula does not consist of a single identifier,
622625
False otherwise.
623626
"""
627+
if observable_df is None:
628+
return False
624629

625630
return not observable_df[NOISE_FORMULA].apply(
626631
lambda x: is_scalar_float(x) or

0 commit comments

Comments
 (0)