diff --git a/petab/v2/C.py b/petab/v2/C.py index 02bee5dd..05e8d3dd 100644 --- a/petab/v2/C.py +++ b/petab/v2/C.py @@ -233,114 +233,6 @@ #: Supported noise distributions NOISE_DISTRIBUTIONS = [NORMAL, LAPLACE, LOG_NORMAL, LOG_LAPLACE] - -# VISUALIZATION - -#: Plot ID column in the visualization table -PLOT_ID = "plotId" -#: Plot name column in the visualization table -PLOT_NAME = "plotName" -#: Value for plot type 'simulation' in the visualization table -PLOT_TYPE_SIMULATION = "plotTypeSimulation" -#: Value for plot type 'data' in the visualization table -PLOT_TYPE_DATA = "plotTypeData" -#: X values column in the visualization table -X_VALUES = "xValues" -#: X offset column in the visualization table -X_OFFSET = "xOffset" -#: X label column in the visualization table -X_LABEL = "xLabel" -#: X scale column in the visualization table -X_SCALE = "xScale" -#: Y values column in the visualization table -Y_VALUES = "yValues" -#: Y offset column in the visualization table -Y_OFFSET = "yOffset" -#: Y label column in the visualization table -Y_LABEL = "yLabel" -#: Y scale column in the visualization table -Y_SCALE = "yScale" -#: Legend entry column in the visualization table -LEGEND_ENTRY = "legendEntry" - -#: Mandatory columns of visualization table -VISUALIZATION_DF_REQUIRED_COLS = [PLOT_ID] - -#: Optional columns of visualization table -VISUALIZATION_DF_OPTIONAL_COLS = [ - PLOT_NAME, - PLOT_TYPE_SIMULATION, - PLOT_TYPE_DATA, - X_VALUES, - X_OFFSET, - X_LABEL, - X_SCALE, - Y_VALUES, - Y_OFFSET, - Y_LABEL, - Y_SCALE, - LEGEND_ENTRY, - DATASET_ID, -] - -#: Visualization table columns -VISUALIZATION_DF_COLS = [ - *VISUALIZATION_DF_REQUIRED_COLS, - *VISUALIZATION_DF_OPTIONAL_COLS, -] - -#: Visualization table columns that contain subplot specifications -VISUALIZATION_DF_SUBPLOT_LEVEL_COLS = [ - PLOT_ID, - PLOT_NAME, - PLOT_TYPE_SIMULATION, - PLOT_TYPE_DATA, - X_LABEL, - X_SCALE, - Y_LABEL, - Y_SCALE, -] - -#: Visualization table columns that contain single plot specifications -VISUALIZATION_DF_SINGLE_PLOT_LEVEL_COLS = [ - X_VALUES, - X_OFFSET, - Y_VALUES, - Y_OFFSET, - LEGEND_ENTRY, - DATASET_ID, -] - -#: Plot type value in the visualization table for line plot -LINE_PLOT = "LinePlot" -#: Plot type value in the visualization table for bar plot -BAR_PLOT = "BarPlot" -#: Plot type value in the visualization table for scatter plot -SCATTER_PLOT = "ScatterPlot" -#: Supported plot types -PLOT_TYPES_SIMULATION = [LINE_PLOT, BAR_PLOT, SCATTER_PLOT] - -#: Supported xScales -X_SCALES = [LIN, LOG, LOG10] - -#: Supported yScales -Y_SCALES = [LIN, LOG, LOG10] - - -#: Plot type "data" value in the visualization table for mean and standard -# deviation -MEAN_AND_SD = "MeanAndSD" -#: Plot type "data" value in the visualization table for mean and standard -# error -MEAN_AND_SEM = "MeanAndSEM" -#: Plot type "data" value in the visualization table for replicates -REPLICATE = "replicate" -#: Plot type "data" value in the visualization table for provided noise values -PROVIDED = "provided" -#: Supported settings for handling replicates -PLOT_TYPES_DATA = [MEAN_AND_SD, MEAN_AND_SEM, REPLICATE, PROVIDED] - - # YAML #: PEtab version key in the YAML file FORMAT_VERSION = "format_version" @@ -388,8 +280,6 @@ SIMULATION = "simulation" #: Residual value column in the residual table RESIDUAL = "residual" -#: ??? -NOISE_VALUE = "noiseValue" #: separator for multiple parameter values (bounds, observableParameters, ...) PARAMETER_SEPARATOR = ";" diff --git a/petab/v2/lint.py b/petab/v2/lint.py index a8ea848e..3a3350e7 100644 --- a/petab/v2/lint.py +++ b/petab/v2/lint.py @@ -35,7 +35,6 @@ "CheckExperimentConditionsExist", "CheckAllParametersPresentInParameterTable", "CheckValidParameterInConditionOrParameterTable", - "CheckVisualizationTable", "CheckUnusedExperiments", "CheckObservablesDoNotShadowModelEntities", "CheckUnusedConditions", @@ -711,24 +710,6 @@ def run(self, problem: Problem) -> ValidationIssue | None: return None -class CheckVisualizationTable(ValidationTask): - """A task to validate the visualization table of a PEtab problem.""" - - def run(self, problem: Problem) -> ValidationIssue | None: - if problem.visualization_df is None: - return None - - from ..v1.visualize.lint import validate_visualization_df - - if validate_visualization_df(problem): - return ValidationIssue( - level=ValidationIssueSeverity.ERROR, - message="Visualization table is invalid.", - ) - - return None - - class CheckPriorDistribution(ValidationTask): """A task to validate the prior distribution of a PEtab problem.""" @@ -1039,7 +1020,6 @@ def get_placeholders( CheckUnusedExperiments(), CheckUnusedConditions(), # TODO: atomize checks, update to long condition table, re-enable - # CheckVisualizationTable(), # TODO validate mapping table CheckValidParameterInConditionOrParameterTable(), CheckAllParametersPresentInParameterTable(), diff --git a/petab/v2/petab1to2.py b/petab/v2/petab1to2.py index 5a5ac385..4b040df7 100644 --- a/petab/v2/petab1to2.py +++ b/petab/v2/petab1to2.py @@ -5,7 +5,6 @@ import re import shutil from contextlib import suppress -from itertools import chain from pathlib import Path from tempfile import TemporaryDirectory from urllib.parse import urlparse @@ -100,11 +99,9 @@ def petab_files_1to2(yaml_config: Path | str, output_dir: Path | str): parameter_df, get_dest_path(new_yaml_config.parameter_files[0]) ) - # copy files that don't need conversion - # (models, visualizations) - for file in chain( - (model.location for model in new_yaml_config.model_files.values()), - new_yaml_config.visualization_files, + # copy files that don't need conversion: models + for file in ( + model.location for model in new_yaml_config.model_files.values() ): _copy_file(get_src_path(file), Path(get_dest_path(file))) @@ -290,7 +287,6 @@ def _update_yaml(yaml_config: dict) -> dict: v1.C.CONDITION_FILES, v1.C.MEASUREMENT_FILES, v1.C.OBSERVABLE_FILES, - v1.C.VISUALIZATION_FILES, ): if file_type in problem: yaml_config[file_type] = problem[file_type] diff --git a/petab/v2/problem.py b/petab/v2/problem.py index 6c657cc3..7f49d279 100644 --- a/petab/v2/problem.py +++ b/petab/v2/problem.py @@ -24,7 +24,6 @@ validate_yaml_syntax, yaml, ) -from ..v1.core import concat_tables, get_visualization_df from ..v1.distributions import Distribution from ..v1.models.model import Model, model_factory from ..v1.yaml import get_path_prefix @@ -53,8 +52,6 @@ class Problem: - observable table - mapping table - Optionally, it may contain visualization tables. - See also :doc:`petab:v2/documentation_data_format`. """ @@ -67,8 +64,6 @@ def __init__( measurement_tables: list[core.MeasurementTable] = None, parameter_tables: list[core.ParameterTable] = None, mapping_tables: list[core.MappingTable] = None, - # TODO: remove - visualization_df: pd.DataFrame = None, config: ProblemConfig = None, ): from ..v2.lint import default_validation_tasks @@ -98,8 +93,6 @@ def __init__( core.ParameterTable(parameters=[]) ] - self.visualization_df = visualization_df - def __str__(self): model = f"with model ({self.model})" if self.model else "without model" @@ -262,15 +255,6 @@ def get_path(filename): else None ) - # TODO: remove in v2?! - visualization_files = [get_path(f) for f in config.visualization_files] - # If there are multiple tables, we will merge them - visualization_df = ( - concat_tables(visualization_files, get_visualization_df) - if visualization_files - else None - ) - observable_tables = ( [ core.ObservableTable.from_tsv(get_path(f)) @@ -298,7 +282,6 @@ def get_path(filename): measurement_tables=measurement_tables, parameter_tables=parameter_tables, mapping_tables=mapping_tables, - visualization_df=visualization_df, ) @staticmethod @@ -308,7 +291,6 @@ def from_dfs( experiment_df: pd.DataFrame = None, measurement_df: pd.DataFrame = None, parameter_df: pd.DataFrame = None, - visualization_df: pd.DataFrame = None, observable_df: pd.DataFrame = None, mapping_df: pd.DataFrame = None, config: ProblemConfig = None, @@ -322,7 +304,6 @@ def from_dfs( measurement_df: PEtab measurement table parameter_df: PEtab parameter table observable_df: PEtab observable table - visualization_df: PEtab visualization table mapping_df: PEtab mapping table model: The underlying model config: The PEtab problem configuration @@ -343,7 +324,6 @@ def from_dfs( measurement_tables=[measurement_table], parameter_tables=[parameter_table], mapping_tables=[mapping_table], - visualization_df=visualization_df, config=config, ) @@ -1227,8 +1207,7 @@ def model_dump(self, **kwargs) -> dict[str, Any]: 'measurement_files': [], 'model_files': {}, 'observable_files': [], - 'parameter_file': [], - 'visualization_files': []}, + 'parameter_file': []}, 'experiments': [], 'mappings': [], 'measurements': [], @@ -1307,7 +1286,6 @@ class ProblemConfig(BaseModel): condition_files: list[str | AnyUrl] = [] experiment_files: list[str | AnyUrl] = [] observable_files: list[str | AnyUrl] = [] - visualization_files: list[str | AnyUrl] = [] mapping_files: list[str | AnyUrl] = [] #: Extensions used by the problem.