muse.utils#

muse.utils Package#

Functions#

add_history(ds, func_or_local_vars[, func])

Record a call in the dataset history and store its keyword inputs as attributes.

coord_as_unit(ds, name, target_unit, label)

Return coordinate name converted to target_unit.

jax_to_numpy(jax_array)

Convert a JAX array to a numpy.ndarray.

numpy_to_jax(numpy_array[, cuda_device])

Convert a numpy.ndarray to a JAX array.

numpy_to_torch(numpy_array[, cuda_device])

Convert a numpy.ndarray to a torch.Tensor.

require_unit(ds, name, label, *[, ...])

Validate that ds[name] exists and carries a usable astropy unit.

torch_to_numpy(torch_tensor)

Convert a torch.Tensor to a numpy.ndarray.

update_attrs(ds[, source])

Copy source attributes and apply explicit updates.

muse.utils.documentation Module#

Functions#

format_docstring(defaults_name, /, ...)

A function decorator that substitutes {placeholders} in the docstring with the attribute path and import-time value of fields on a defaults object from muse.variables.