cherab.imas.ids.common.get_ids_time_sliceΒΆ

cherab.imas.ids.common.get_ids_time_slice(entry: DBEntry, ids_name: str, time: float = 0, occurrence: int = 0, time_threshold: float = inf) IDSToplevelSourceΒΆ

Get a time slice of the specified IDS from the given IMAS entry.

Note

If the get_slice method is not implemented for the given IMAS entry URI, this function will fall back to using the get method and return the entire IDS.

Parameters:
entry: DBEntryΒΆ

The IMAS entry. The entry must be opened in read mode.

ids_name: strΒΆ

The name of the IDS.

time: float = 0ΒΆ

The time in seconds of the requested time slice, by default is 0.

occurrence: int = 0ΒΆ

The occurrence of the IDS, by default is 0.

time_threshold: float = infΒΆ

The maximum allowed time difference in seconds between the actual time of the nearest time slice and the given time, by default is infinity.

Returns:

The requested IDS time slice.

Return type:

IDSToplevel

Raises:
  • ValueError – If time or time_threshold is negative.

  • RuntimeError – If the requested IDS is empty.

  • RuntimeError – If the time difference between the actual time of the nearest time slice and the given time exceeds the specified threshold.

Examples

from imas import DBEntry
from cherab.imas.ids.common import get_ids_time_slice

with DBEntry(
    "imas://uda.iter.org/uda?path=/work/imas/shared/imasdb/ITER/3/123072/3&backend=hdf5",
    "r",
) as entry:
    ids = get_ids_time_slice(entry, "equilibrium", time=0.0)