Skip to content

Commit 958d191

Browse files
committed
more coherent naming
1 parent 1392112 commit 958d191

File tree

5 files changed

+119
-123
lines changed

5 files changed

+119
-123
lines changed

petab/v2/C.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,25 +147,25 @@
147147

148148
# OBSERVABLES
149149

150-
#: Observable name column in the observables table
150+
#: Observable name column in the observable table
151151
OBSERVABLE_NAME = "observableName"
152-
#: Observable formula column in the observables table
152+
#: Observable formula column in the observable table
153153
OBSERVABLE_FORMULA = "observableFormula"
154-
#: Noise formula column in the observables table
154+
#: Noise formula column in the observable table
155155
NOISE_FORMULA = "noiseFormula"
156-
#: Observable transformation column in the observables table
156+
#: Observable transformation column in the observable table
157157
OBSERVABLE_TRANSFORMATION = "observableTransformation"
158-
#: Noise distribution column in the observables table
158+
#: Noise distribution column in the observable table
159159
NOISE_DISTRIBUTION = "noiseDistribution"
160160

161-
#: Mandatory columns of observables table
161+
#: Mandatory columns of observable table
162162
OBSERVABLE_DF_REQUIRED_COLS = [
163163
OBSERVABLE_ID,
164164
OBSERVABLE_FORMULA,
165165
NOISE_FORMULA,
166166
]
167167

168-
#: Optional columns of observables table
168+
#: Optional columns of observable table
169169
OBSERVABLE_DF_OPTIONAL_COLS = [
170170
OBSERVABLE_NAME,
171171
OBSERVABLE_TRANSFORMATION,
@@ -378,7 +378,7 @@
378378

379379
#: Simulated value column in the simulation table
380380
SIMULATION = "simulation"
381-
#: Residual value column in the residuals table
381+
#: Residual value column in the residual table
382382
RESIDUAL = "residual"
383383
#: ???
384384
NOISE_VALUE = "noiseValue"

petab/v2/core.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@
3030

3131
__all__ = [
3232
"Observable",
33-
"ObservablesTable",
33+
"ObservableTable",
3434
"ObservableTransformation",
3535
"NoiseDistribution",
3636
"Change",
3737
"Condition",
38-
"ConditionsTable",
38+
"ConditionTable",
3939
"ExperimentPeriod",
4040
"Experiment",
41-
"ExperimentsTable",
41+
"ExperimentTable",
4242
"Measurement",
4343
"MeasurementTable",
4444
"Mapping",
@@ -240,7 +240,7 @@ def noise_placeholders(self) -> set[sp.Symbol]:
240240
return self._placeholders("noise")
241241

242242

243-
class ObservablesTable(BaseModel):
243+
class ObservableTable(BaseModel):
244244
"""PEtab observables table."""
245245

246246
#: List of observables.
@@ -254,7 +254,7 @@ def __getitem__(self, observable_id: str) -> Observable:
254254
raise KeyError(f"Observable ID {observable_id} not found")
255255

256256
@classmethod
257-
def from_df(cls, df: pd.DataFrame) -> ObservablesTable:
257+
def from_df(cls, df: pd.DataFrame) -> ObservableTable:
258258
"""Create an ObservablesTable from a DataFrame."""
259259
if df is None:
260260
return cls(observables=[])
@@ -293,7 +293,7 @@ def to_df(self) -> pd.DataFrame:
293293
return pd.DataFrame(records).set_index([C.OBSERVABLE_ID])
294294

295295
@classmethod
296-
def from_tsv(cls, file_path: str | Path) -> ObservablesTable:
296+
def from_tsv(cls, file_path: str | Path) -> ObservableTable:
297297
"""Create an ObservablesTable from a TSV file."""
298298
df = pd.read_csv(file_path, sep="\t")
299299
return cls.from_df(df)
@@ -303,13 +303,13 @@ def to_tsv(self, file_path: str | Path) -> None:
303303
df = self.to_df()
304304
df.to_csv(file_path, sep="\t", index=True)
305305

306-
def __add__(self, other: Observable) -> ObservablesTable:
306+
def __add__(self, other: Observable) -> ObservableTable:
307307
"""Add an observable to the table."""
308308
if not isinstance(other, Observable):
309309
raise TypeError("Can only add Observable to ObservablesTable")
310-
return ObservablesTable(observables=self.observables + [other])
310+
return ObservableTable(observables=self.observables + [other])
311311

312-
def __iadd__(self, other: Observable) -> ObservablesTable:
312+
def __iadd__(self, other: Observable) -> ObservableTable:
313313
"""Add an observable to the table in place."""
314314
if not isinstance(other, Observable):
315315
raise TypeError("Can only add Observable to ObservablesTable")
@@ -321,7 +321,7 @@ class Change(BaseModel):
321321
"""A change to the model or model state.
322322
323323
A change to the model or model state, corresponding to an individual
324-
row of the PEtab conditions table.
324+
row of the PEtab condition table.
325325
326326
>>> Change(
327327
... target_id="k1",
@@ -400,7 +400,7 @@ def __iadd__(self, other: Change) -> Condition:
400400
return self
401401

402402

403-
class ConditionsTable(BaseModel):
403+
class ConditionTable(BaseModel):
404404
"""PEtab conditions table."""
405405

406406
#: List of conditions.
@@ -414,7 +414,7 @@ def __getitem__(self, condition_id: str) -> Condition:
414414
raise KeyError(f"Condition ID {condition_id} not found")
415415

416416
@classmethod
417-
def from_df(cls, df: pd.DataFrame) -> ConditionsTable:
417+
def from_df(cls, df: pd.DataFrame) -> ConditionTable:
418418
"""Create a ConditionsTable from a DataFrame."""
419419
if df is None or df.empty:
420420
return cls(conditions=[])
@@ -446,7 +446,7 @@ def to_df(self) -> pd.DataFrame:
446446
)
447447

448448
@classmethod
449-
def from_tsv(cls, file_path: str | Path) -> ConditionsTable:
449+
def from_tsv(cls, file_path: str | Path) -> ConditionTable:
450450
"""Create a ConditionsTable from a TSV file."""
451451
df = pd.read_csv(file_path, sep="\t")
452452
return cls.from_df(df)
@@ -456,13 +456,13 @@ def to_tsv(self, file_path: str | Path) -> None:
456456
df = self.to_df()
457457
df.to_csv(file_path, sep="\t", index=False)
458458

459-
def __add__(self, other: Condition) -> ConditionsTable:
459+
def __add__(self, other: Condition) -> ConditionTable:
460460
"""Add a condition to the table."""
461461
if not isinstance(other, Condition):
462462
raise TypeError("Can only add Conditions to ConditionsTable")
463-
return ConditionsTable(conditions=self.conditions + [other])
463+
return ConditionTable(conditions=self.conditions + [other])
464464

465-
def __iadd__(self, other: Condition) -> ConditionsTable:
465+
def __iadd__(self, other: Condition) -> ConditionTable:
466466
"""Add a condition to the table in place."""
467467
if not isinstance(other, Condition):
468468
raise TypeError("Can only add Conditions to ConditionsTable")
@@ -548,14 +548,14 @@ def __iadd__(self, other: ExperimentPeriod) -> Experiment:
548548
return self
549549

550550

551-
class ExperimentsTable(BaseModel):
551+
class ExperimentTable(BaseModel):
552552
"""PEtab experiments table."""
553553

554554
#: List of experiments.
555555
experiments: list[Experiment]
556556

557557
@classmethod
558-
def from_df(cls, df: pd.DataFrame) -> ExperimentsTable:
558+
def from_df(cls, df: pd.DataFrame) -> ExperimentTable:
559559
"""Create an ExperimentsTable from a DataFrame."""
560560
if df is None:
561561
return cls(experiments=[])
@@ -589,7 +589,7 @@ def to_df(self) -> pd.DataFrame:
589589
)
590590

591591
@classmethod
592-
def from_tsv(cls, file_path: str | Path) -> ExperimentsTable:
592+
def from_tsv(cls, file_path: str | Path) -> ExperimentTable:
593593
"""Create an ExperimentsTable from a TSV file."""
594594
df = pd.read_csv(file_path, sep="\t")
595595
return cls.from_df(df)
@@ -599,13 +599,13 @@ def to_tsv(self, file_path: str | Path) -> None:
599599
df = self.to_df()
600600
df.to_csv(file_path, sep="\t", index=False)
601601

602-
def __add__(self, other: Experiment) -> ExperimentsTable:
602+
def __add__(self, other: Experiment) -> ExperimentTable:
603603
"""Add an experiment to the table."""
604604
if not isinstance(other, Experiment):
605605
raise TypeError("Can only add Experiment to ExperimentsTable")
606-
return ExperimentsTable(experiments=self.experiments + [other])
606+
return ExperimentTable(experiments=self.experiments + [other])
607607

608-
def __iadd__(self, other: Experiment) -> ExperimentsTable:
608+
def __iadd__(self, other: Experiment) -> ExperimentTable:
609609
"""Add an experiment to the table in place."""
610610
if not isinstance(other, Experiment):
611611
raise TypeError("Can only add Experiment to ExperimentsTable")

0 commit comments

Comments
 (0)