Skip to content

Commit bf4055c

Browse files
authored
Remove vis info from petab.v2 (#407)
Remove visualization tables until there is progress on #398.
1 parent c94bb1b commit bf4055c

File tree

4 files changed

+4
-160
lines changed

4 files changed

+4
-160
lines changed

petab/v2/C.py

Lines changed: 0 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -233,114 +233,6 @@
233233
#: Supported noise distributions
234234
NOISE_DISTRIBUTIONS = [NORMAL, LAPLACE, LOG_NORMAL, LOG_LAPLACE]
235235

236-
237-
# VISUALIZATION
238-
239-
#: Plot ID column in the visualization table
240-
PLOT_ID = "plotId"
241-
#: Plot name column in the visualization table
242-
PLOT_NAME = "plotName"
243-
#: Value for plot type 'simulation' in the visualization table
244-
PLOT_TYPE_SIMULATION = "plotTypeSimulation"
245-
#: Value for plot type 'data' in the visualization table
246-
PLOT_TYPE_DATA = "plotTypeData"
247-
#: X values column in the visualization table
248-
X_VALUES = "xValues"
249-
#: X offset column in the visualization table
250-
X_OFFSET = "xOffset"
251-
#: X label column in the visualization table
252-
X_LABEL = "xLabel"
253-
#: X scale column in the visualization table
254-
X_SCALE = "xScale"
255-
#: Y values column in the visualization table
256-
Y_VALUES = "yValues"
257-
#: Y offset column in the visualization table
258-
Y_OFFSET = "yOffset"
259-
#: Y label column in the visualization table
260-
Y_LABEL = "yLabel"
261-
#: Y scale column in the visualization table
262-
Y_SCALE = "yScale"
263-
#: Legend entry column in the visualization table
264-
LEGEND_ENTRY = "legendEntry"
265-
266-
#: Mandatory columns of visualization table
267-
VISUALIZATION_DF_REQUIRED_COLS = [PLOT_ID]
268-
269-
#: Optional columns of visualization table
270-
VISUALIZATION_DF_OPTIONAL_COLS = [
271-
PLOT_NAME,
272-
PLOT_TYPE_SIMULATION,
273-
PLOT_TYPE_DATA,
274-
X_VALUES,
275-
X_OFFSET,
276-
X_LABEL,
277-
X_SCALE,
278-
Y_VALUES,
279-
Y_OFFSET,
280-
Y_LABEL,
281-
Y_SCALE,
282-
LEGEND_ENTRY,
283-
DATASET_ID,
284-
]
285-
286-
#: Visualization table columns
287-
VISUALIZATION_DF_COLS = [
288-
*VISUALIZATION_DF_REQUIRED_COLS,
289-
*VISUALIZATION_DF_OPTIONAL_COLS,
290-
]
291-
292-
#: Visualization table columns that contain subplot specifications
293-
VISUALIZATION_DF_SUBPLOT_LEVEL_COLS = [
294-
PLOT_ID,
295-
PLOT_NAME,
296-
PLOT_TYPE_SIMULATION,
297-
PLOT_TYPE_DATA,
298-
X_LABEL,
299-
X_SCALE,
300-
Y_LABEL,
301-
Y_SCALE,
302-
]
303-
304-
#: Visualization table columns that contain single plot specifications
305-
VISUALIZATION_DF_SINGLE_PLOT_LEVEL_COLS = [
306-
X_VALUES,
307-
X_OFFSET,
308-
Y_VALUES,
309-
Y_OFFSET,
310-
LEGEND_ENTRY,
311-
DATASET_ID,
312-
]
313-
314-
#: Plot type value in the visualization table for line plot
315-
LINE_PLOT = "LinePlot"
316-
#: Plot type value in the visualization table for bar plot
317-
BAR_PLOT = "BarPlot"
318-
#: Plot type value in the visualization table for scatter plot
319-
SCATTER_PLOT = "ScatterPlot"
320-
#: Supported plot types
321-
PLOT_TYPES_SIMULATION = [LINE_PLOT, BAR_PLOT, SCATTER_PLOT]
322-
323-
#: Supported xScales
324-
X_SCALES = [LIN, LOG, LOG10]
325-
326-
#: Supported yScales
327-
Y_SCALES = [LIN, LOG, LOG10]
328-
329-
330-
#: Plot type "data" value in the visualization table for mean and standard
331-
# deviation
332-
MEAN_AND_SD = "MeanAndSD"
333-
#: Plot type "data" value in the visualization table for mean and standard
334-
# error
335-
MEAN_AND_SEM = "MeanAndSEM"
336-
#: Plot type "data" value in the visualization table for replicates
337-
REPLICATE = "replicate"
338-
#: Plot type "data" value in the visualization table for provided noise values
339-
PROVIDED = "provided"
340-
#: Supported settings for handling replicates
341-
PLOT_TYPES_DATA = [MEAN_AND_SD, MEAN_AND_SEM, REPLICATE, PROVIDED]
342-
343-
344236
# YAML
345237
#: PEtab version key in the YAML file
346238
FORMAT_VERSION = "format_version"
@@ -388,8 +280,6 @@
388280
SIMULATION = "simulation"
389281
#: Residual value column in the residual table
390282
RESIDUAL = "residual"
391-
#: ???
392-
NOISE_VALUE = "noiseValue"
393283

394284
#: separator for multiple parameter values (bounds, observableParameters, ...)
395285
PARAMETER_SEPARATOR = ";"

petab/v2/lint.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
"CheckExperimentConditionsExist",
3636
"CheckAllParametersPresentInParameterTable",
3737
"CheckValidParameterInConditionOrParameterTable",
38-
"CheckVisualizationTable",
3938
"CheckUnusedExperiments",
4039
"CheckObservablesDoNotShadowModelEntities",
4140
"CheckUnusedConditions",
@@ -711,24 +710,6 @@ def run(self, problem: Problem) -> ValidationIssue | None:
711710
return None
712711

713712

714-
class CheckVisualizationTable(ValidationTask):
715-
"""A task to validate the visualization table of a PEtab problem."""
716-
717-
def run(self, problem: Problem) -> ValidationIssue | None:
718-
if problem.visualization_df is None:
719-
return None
720-
721-
from ..v1.visualize.lint import validate_visualization_df
722-
723-
if validate_visualization_df(problem):
724-
return ValidationIssue(
725-
level=ValidationIssueSeverity.ERROR,
726-
message="Visualization table is invalid.",
727-
)
728-
729-
return None
730-
731-
732713
class CheckPriorDistribution(ValidationTask):
733714
"""A task to validate the prior distribution of a PEtab problem."""
734715

@@ -1039,7 +1020,6 @@ def get_placeholders(
10391020
CheckUnusedExperiments(),
10401021
CheckUnusedConditions(),
10411022
# TODO: atomize checks, update to long condition table, re-enable
1042-
# CheckVisualizationTable(),
10431023
# TODO validate mapping table
10441024
CheckValidParameterInConditionOrParameterTable(),
10451025
CheckAllParametersPresentInParameterTable(),

petab/v2/petab1to2.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import re
66
import shutil
77
from contextlib import suppress
8-
from itertools import chain
98
from pathlib import Path
109
from tempfile import TemporaryDirectory
1110
from urllib.parse import urlparse
@@ -100,11 +99,9 @@ def petab_files_1to2(yaml_config: Path | str, output_dir: Path | str):
10099
parameter_df, get_dest_path(new_yaml_config.parameter_files[0])
101100
)
102101

103-
# copy files that don't need conversion
104-
# (models, visualizations)
105-
for file in chain(
106-
(model.location for model in new_yaml_config.model_files.values()),
107-
new_yaml_config.visualization_files,
102+
# copy files that don't need conversion: models
103+
for file in (
104+
model.location for model in new_yaml_config.model_files.values()
108105
):
109106
_copy_file(get_src_path(file), Path(get_dest_path(file)))
110107

@@ -290,7 +287,6 @@ def _update_yaml(yaml_config: dict) -> dict:
290287
v1.C.CONDITION_FILES,
291288
v1.C.MEASUREMENT_FILES,
292289
v1.C.OBSERVABLE_FILES,
293-
v1.C.VISUALIZATION_FILES,
294290
):
295291
if file_type in problem:
296292
yaml_config[file_type] = problem[file_type]

petab/v2/problem.py

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
validate_yaml_syntax,
2525
yaml,
2626
)
27-
from ..v1.core import concat_tables, get_visualization_df
2827
from ..v1.distributions import Distribution
2928
from ..v1.models.model import Model, model_factory
3029
from ..v1.yaml import get_path_prefix
@@ -53,8 +52,6 @@ class Problem:
5352
- observable table
5453
- mapping table
5554
56-
Optionally, it may contain visualization tables.
57-
5855
See also :doc:`petab:v2/documentation_data_format`.
5956
"""
6057

@@ -67,8 +64,6 @@ def __init__(
6764
measurement_tables: list[core.MeasurementTable] = None,
6865
parameter_tables: list[core.ParameterTable] = None,
6966
mapping_tables: list[core.MappingTable] = None,
70-
# TODO: remove
71-
visualization_df: pd.DataFrame = None,
7267
config: ProblemConfig = None,
7368
):
7469
from ..v2.lint import default_validation_tasks
@@ -98,8 +93,6 @@ def __init__(
9893
core.ParameterTable(parameters=[])
9994
]
10095

101-
self.visualization_df = visualization_df
102-
10396
def __str__(self):
10497
model = f"with model ({self.model})" if self.model else "without model"
10598

@@ -262,15 +255,6 @@ def get_path(filename):
262255
else None
263256
)
264257

265-
# TODO: remove in v2?!
266-
visualization_files = [get_path(f) for f in config.visualization_files]
267-
# If there are multiple tables, we will merge them
268-
visualization_df = (
269-
concat_tables(visualization_files, get_visualization_df)
270-
if visualization_files
271-
else None
272-
)
273-
274258
observable_tables = (
275259
[
276260
core.ObservableTable.from_tsv(get_path(f))
@@ -298,7 +282,6 @@ def get_path(filename):
298282
measurement_tables=measurement_tables,
299283
parameter_tables=parameter_tables,
300284
mapping_tables=mapping_tables,
301-
visualization_df=visualization_df,
302285
)
303286

304287
@staticmethod
@@ -308,7 +291,6 @@ def from_dfs(
308291
experiment_df: pd.DataFrame = None,
309292
measurement_df: pd.DataFrame = None,
310293
parameter_df: pd.DataFrame = None,
311-
visualization_df: pd.DataFrame = None,
312294
observable_df: pd.DataFrame = None,
313295
mapping_df: pd.DataFrame = None,
314296
config: ProblemConfig = None,
@@ -322,7 +304,6 @@ def from_dfs(
322304
measurement_df: PEtab measurement table
323305
parameter_df: PEtab parameter table
324306
observable_df: PEtab observable table
325-
visualization_df: PEtab visualization table
326307
mapping_df: PEtab mapping table
327308
model: The underlying model
328309
config: The PEtab problem configuration
@@ -343,7 +324,6 @@ def from_dfs(
343324
measurement_tables=[measurement_table],
344325
parameter_tables=[parameter_table],
345326
mapping_tables=[mapping_table],
346-
visualization_df=visualization_df,
347327
config=config,
348328
)
349329

@@ -1227,8 +1207,7 @@ def model_dump(self, **kwargs) -> dict[str, Any]:
12271207
'measurement_files': [],
12281208
'model_files': {},
12291209
'observable_files': [],
1230-
'parameter_file': [],
1231-
'visualization_files': []},
1210+
'parameter_file': []},
12321211
'experiments': [],
12331212
'mappings': [],
12341213
'measurements': [],
@@ -1307,7 +1286,6 @@ class ProblemConfig(BaseModel):
13071286
condition_files: list[str | AnyUrl] = []
13081287
experiment_files: list[str | AnyUrl] = []
13091288
observable_files: list[str | AnyUrl] = []
1310-
visualization_files: list[str | AnyUrl] = []
13111289
mapping_files: list[str | AnyUrl] = []
13121290

13131291
#: Extensions used by the problem.

0 commit comments

Comments
 (0)