imas.backends.imas_core.al_context.ALContext

class imas.backends.imas_core.al_context.ALContext(ctx: int)

Bases: object

Helper class that wraps Access Layer contexts.

Provides:

  • Object oriented wrappers around AL lowlevel methods which require a context

  • Context managers for creating and automatically ending AL actions

__init__(ctx: int)

Construct a new ALContext object

Parameters:
ctx: int

Context identifier returned by the AL

Methods

__init__(ctx)

Construct a new ALContext object

arraystruct_action(path, timebase, size)

Begin a new arraystruct action for use in a with context.

close()

Close this ALContext.

delete_data(path)

Call ual_delete_data with this context.

global_action(path, rwmode[, datapath])

Begin a new global action for use in a with context.

list_all_occurrences(ids_name)

List all occurrences of this IDS.

read_data(path, timebasepath, datatype, dim)

Call ual_read_data with this context.

slice_action(path, rwmode, time_requested, ...)

Begin a new slice action for use in a with context.

timerange_action(path, rwmode, tmin, tmax, ...)

Begin a new timerange action for use in a with context.

write_data(path, timebasepath, data)

Call ual_write_data with this context.

Attributes

ctx

Context identifier

arraystruct_action(path: str, timebase: str, size: int) ALArrayStructContext

Begin a new arraystruct action for use in a with context.

Parameters:
path: str

relative access layer path within this context

timebase: str

path to the timebase for this coordinate (an empty string for non-dynamic array of structures)

size: int

the size of the array of structures (only relevant when writing data)

Returns:

The created context.

close()

Close this ALContext.

ctx

Context identifier

delete_data(path: str) None

Call ual_delete_data with this context.

global_action(path: str, rwmode: int, datapath: str = '') ALContext

Begin a new global action for use in a with context.

Parameters:
path: str

access layer path for this global action: <idsname>[/<occurrence>]

rwmode: int

read-only or read-write operation mode: READ_OP/WRITE_OP

datapath: str = ''

used by UDA backend to fetch only part of the data.

Returns:

The created context.

list_all_occurrences(ids_name: str) list[int]

List all occurrences of this IDS.

read_data(path: str, timebasepath: str, datatype: int, dim: int) Any

Call ual_read_data with this context.

slice_action(path: str, rwmode: int, time_requested: float, interpolation_method: int) ALContext

Begin a new slice action for use in a with context.

Parameters:
path: str

access layer path for this global action: <idsname>[/<occurrence>]

rwmode: int

read-only or read-write operation mode: READ_OP/WRITE_OP

time_requested: float

time-point requested. Use UNDEFINED_TIME for put_slice.

interpolation_method: int

interpolation method to use: CLOSEST_INTERP, LINEAR_INTERP or PREVIOUS_INTERP for get_slice; UNDEFINED_INTERP for put_slice.

Returns:

The created context.

timerange_action(path: str, rwmode: int, tmin: float, tmax: float, dtime: ndarray | None, interpolation_method: int) ALContext

Begin a new timerange action for use in a with context.

write_data(path: str, timebasepath: str, data: Any) None

Call ual_write_data with this context.


Last update: 2026-01-28