Skip to content

Commit ad9ba38

Browse files
committed
fixup
1 parent 04670c9 commit ad9ba38

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

petab/v2/lint.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ def run(self, problem: Problem) -> ValidationIssue | None:
324324
# handle default-experiment
325325
used_experiments = set(
326326
filter(
327-
lambda x: not isinstance(x, float) or not np.isnan(x),
327+
lambda x: not pd.isna(x),
328328
used_experiments,
329329
)
330330
)
@@ -839,7 +839,8 @@ def append_overrides(overrides):
839839
CheckMeasurementTable(),
840840
CheckConditionTable(),
841841
CheckExperimentTable(),
842-
CheckValidPetabIdColumn("experiment", EXPERIMENT_ID, ignore_nan=True),
842+
CheckValidPetabIdColumn("measurement", EXPERIMENT_ID, ignore_nan=True),
843+
CheckValidPetabIdColumn("experiment", EXPERIMENT_ID),
843844
CheckValidPetabIdColumn("experiment", CONDITION_ID),
844845
CheckExperimentConditionsExist(),
845846
CheckObservableTable(),

petab/v2/petab1to2.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
from .. import v1, v2
1313
from ..v1 import Problem as ProblemV1
1414
from ..v1.yaml import get_path_prefix, load_yaml, validate, write_yaml
15-
from ..v2.models import MODEL_TYPE_SBML
1615
from ..versions import get_major_version
16+
from .models import MODEL_TYPE_SBML
1717

1818
__all__ = ["petab1to2"]
1919

@@ -70,7 +70,6 @@ def petab1to2(yaml_config: Path | str, output_dir: Path | str = None):
7070
# Update YAML file
7171
new_yaml_config = _update_yaml(yaml_config)
7272

73-
# Write new YAML file
7473
output_dir = Path(output_dir)
7574
output_dir.mkdir(parents=True, exist_ok=True)
7675

@@ -179,10 +178,8 @@ def create_experiment_id(sim_cond_id: str, preeq_cond_id: str) -> str:
179178
# add pre-eq condition id if not present or convert to string
180179
# for simplicity
181180
if v1.C.PREEQUILIBRATION_CONDITION_ID in measurement_df.columns:
182-
measurement_df[
183-
v1.C.PREEQUILIBRATION_CONDITION_ID
184-
] = measurement_df[v1.C.PREEQUILIBRATION_CONDITION_ID].fillna(
185-
""
181+
measurement_df.fillna(
182+
{v1.C.PREEQUILIBRATION_CONDITION_ID: ""}, inplace=True
186183
)
187184
else:
188185
measurement_df[v1.C.PREEQUILIBRATION_CONDITION_ID] = ""
@@ -223,6 +220,7 @@ def create_experiment_id(sim_cond_id: str, preeq_cond_id: str) -> str:
223220
measurement_df, get_dest_path(measurement_file)
224221
)
225222

223+
# Write new YAML file
226224
new_yaml_file = output_dir / Path(yaml_file).name
227225
write_yaml(new_yaml_config, new_yaml_file)
228226

0 commit comments

Comments
 (0)