Skip to content

Commit

Permalink
Merge branch 'pr/1.4.5' into november-9th
Browse files Browse the repository at this point in the history
  • Loading branch information
mpvanderschelling authored Nov 9, 2023
2 parents a0980d3 + a474d15 commit a7b8d84
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion src/f3dasm/_src/experimentdata/experimentdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -666,9 +666,9 @@ def get_experiment_sample(self, index: int) -> ExperimentSample:
ExperimentSample
The ExperimentSample at the given index.
"""

output_experiment_sample_dict = self._output_data.get_data_dict(index)


dict_output = {k: (v, self.domain.output_space[k].to_disk)
for k, v in output_experiment_sample_dict.items()}

Expand All @@ -678,6 +678,29 @@ def get_experiment_sample(self, index: int) -> ExperimentSample:
jobnumber=index,
experimentdata_directory=self.path)

def get_experiment_samples(
self,
indices: Optional[Iterable[int]] = None) -> List[ExperimentSample]:
"""
Gets the experiment_samples at the given indices.
Parameters
----------
indices : Optional[Iterable[int]], optional
The indices of the experiment_samples to retrieve, by default None
If None, all experiment_samples are retrieved.
Returns
-------
List[ExperimentSample]
The ExperimentSamples at the given indices.
"""
if indices is None:
# Return a list of the iterator over ExperimentData
return list(self)

return [self.get_experiment_sample(index) for index in indices]

def _set_experiment_sample(self,
experiment_sample: ExperimentSample) -> None:
"""
Expand Down

0 comments on commit a7b8d84

Please sign in to comment.