Skip to content

Commit

Permalink
MNT Pull experiment from environment variable if not in YAML, and env…
Browse files Browse the repository at this point in the history
… var defined
  • Loading branch information
gadorlhiac committed Apr 10, 2024
1 parent d3d3395 commit 38dfb26
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lute/io/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class AnalysisHeader(BaseModel):
"LUTE Task Configuration",
description="Description of the configuration or experiment.",
)
experiment: str = Field("EXPX00000", description="Experiment.")
experiment: str = Field("", description="Experiment.")
run: Union[str, int] = Field("", description="Data acquisition run.")
date: str = Field("1970/01/01", description="Start date of analysis.")
lute_version: Union[float, str] = Field(
Expand Down Expand Up @@ -82,6 +82,13 @@ def validate_run(
return int(run_time.split("_")[0])
return run

@validator("experiment", always=True)
def validate_experiment(cls, experiment: str, values: Dict[str, Any]) -> str:
if experiment == "":
arp_exp: str = os.environ.get("EXPERIMENT", "EXPX00000")
return arp_exp
return experiment


class TaskParameters(BaseSettings):
"""Base class for models of task parameters to be validated.
Expand Down

0 comments on commit 38dfb26

Please sign in to comment.