yasfpy.coupling.env#

Environment-variable helpers for coupling backends.

These helpers centralize parsing/normalization of environment variables used to control coupling backend behavior (GPU strategy selection, chunk sizes, experimental toggles).

Notes

These are intentionally forgiving: invalid inputs fall back to defaults rather than raising, to keep CLI and batch runs robust.

Functions#

parse_bool_env(name, *, default)

Parse a boolean environment variable.

parse_int_env(name, *, default[, minimum])

Parse an integer environment variable with a lower bound.

normalize_gpu_strategy(value)

Normalize the GPU coupling strategy selector.

normalize_multi_wavelength_mode(value)

Normalize the multi-wavelength GPU execution mode selector.

Module Contents#

yasfpy.coupling.env.parse_bool_env(name, *, default)#

Parse a boolean environment variable.

Parameters:
  • name – Environment variable name.

  • default – Default value used when the variable is unset or invalid.

Returns:

Parsed boolean value.

Return type:

bool

yasfpy.coupling.env.parse_int_env(name, *, default, minimum=1)#

Parse an integer environment variable with a lower bound.

Parameters:
  • name – Environment variable name.

  • default – Default value used when the variable is unset or invalid.

  • minimum – Lower bound enforced on the returned value.

Returns:

Parsed integer value (at least minimum).

Return type:

int

yasfpy.coupling.env.normalize_gpu_strategy(value)#

Normalize the GPU coupling strategy selector.

Parameters:

value – A raw environment variable value.

Returns:

One of {'auto', 'thread_row', 'block_row'}.

Return type:

str

yasfpy.coupling.env.normalize_multi_wavelength_mode(value)#

Normalize the multi-wavelength GPU execution mode selector.

Parameters:

value – A raw environment variable value.

Returns:

One of {'auto', 'atomic', 'per_wavelength', 'per_wavelength_chunked'}.

Return type:

str