Skip to content

Commit

Permalink
Remove get_dataset_definition_by_name
Browse files Browse the repository at this point in the history
Rewrite metadata transfer to go by index
  • Loading branch information
samantha-ho committed Nov 18, 2024
1 parent 6ebb128 commit a67649a
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions src/qcodes/dataset/measurement_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,6 @@ class DataSetDefinition:
generated by this definition"""


def get_dataset_definition_by_name(
dataset_definitions: Sequence[DataSetDefinition], name: str
) -> DataSetDefinition:
candidate_defs = [
dataset_def for dataset_def in dataset_definitions if dataset_def.name == name
]
if len(candidate_defs) == 0:
raise ValueError(f"No DataSetDefinition with name {name} was found in the list")
elif len(candidate_defs) > 1:
raise ValueError(
f"Expected only one dataset definition with name {name} found {len(candidate_defs)}"
)

return candidate_defs[0]


def setup_measurement_instances(
dataset_definitions: Sequence[DataSetDefinition],
override_experiment: Experiment | None = None,
Expand Down Expand Up @@ -126,10 +110,8 @@ def datasaver_builder(
stack.enter_context(measurement.run(parent_span=datasaver_builder_span))
for measurement in measurement_instances
]
for datasaver in datasavers:
ds_def = get_dataset_definition_by_name(
dataset_definitions, name=datasaver.dataset.name
)
for i, datasaver in enumerate(datasavers):
ds_def = dataset_definitions[i]
if ds_def.metadata is not None:
for key, value in ds_def.metadata.items():
datasaver.dataset.add_metadata(tag=key, metadata=value)

Check warning on line 117 in src/qcodes/dataset/measurement_extensions.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/dataset/measurement_extensions.py#L116-L117

Added lines #L116 - L117 were not covered by tests
Expand Down

0 comments on commit a67649a

Please sign in to comment.