Add 'type' field to ExperimentParametersModel
This commit introduces a new 'type' field in the ExperimentParametersModel schema and updates the associated code in `sample.py` to include this field during object creation. Additionally, unnecessary lines and redundant code in `testfunctions.ipynb` have been removed for better readability and maintainability.
This commit is contained in:
@ -272,6 +272,7 @@ class ExperimentParameters(Base):
|
||||
__tablename__ = "experiment_parameters"
|
||||
id = Column(Integer, primary_key=True, index=True, autoincrement=True)
|
||||
run_number = Column(Integer, nullable=False)
|
||||
type = Column(String(255), nullable=False)
|
||||
beamline_parameters = Column(JSON, nullable=True)
|
||||
dataset = Column(JSON, nullable=True)
|
||||
sample_id = Column(Integer, ForeignKey("samples.id"), nullable=False)
|
||||
|
@ -334,6 +334,7 @@ def create_experiment_parameters_for_sample(
|
||||
# stored as JSON.
|
||||
new_exp = ExperimentParametersModel(
|
||||
run_number=new_run_number,
|
||||
type=exp_params.type,
|
||||
beamline_parameters=exp_params.beamline_parameters.dict()
|
||||
if exp_params.beamline_parameters
|
||||
else None,
|
||||
|
@ -906,6 +906,7 @@ class Datasets(BaseModel):
|
||||
|
||||
class ExperimentParametersBase(BaseModel):
|
||||
run_number: int
|
||||
type: str
|
||||
beamline_parameters: Optional[BeamlineParameters] = None
|
||||
dataset: Optional[Datasets] = None
|
||||
sample_id: int
|
||||
|
Reference in New Issue
Block a user