traveler.skims.omx.OmxSkims#

class traveler.skims.omx.OmxSkims(filenames, *, include=None, exclude=None, time_periods=('EA', 'AM', 'MD', 'PM', 'EV'), time_period_sep='__', zones=None, mark='TAZ', raw_array_type='jax')[source]#

Bases: object

Initialize OmxSkims with one or more OMX filenames.

Parameters:
  • filenames (path-like or sequence of path-like) – OMX file or files to load. Later files replace duplicate matrix names from earlier files.

  • include (list of str, optional) – Regular-expression filters for matrix names. Include matches take precedence over exclude matches.

  • exclude (list of str, optional) – Regular-expression filters for matrix names. Include matches take precedence over exclude matches.

  • time_periods (sequence of str, optional) – Ordered suffixes used to group time-dependent matrices.

  • time_period_sep (str, optional) – Separator between a grouped matrix name and its time-period suffix.

  • zones (array-like, optional) – Zone values defining the square subset loaded from each matrix.

  • mark (str, optional) – Category mark assigned to the origin and destination coordinates.

  • raw_array_type ({"jax", "numpy"}, optional) – Concrete representation for loaded matrix arrays.

Raises:
  • TypeError – If raw_array_type is unsupported.

  • ValueError – If no OMX files are supplied or the requested zones or matrices are incompatible with the source files.

Methods#

to_dataset(*[, dim_names])

Convert the loaded skims to an xarray dataset.

to_jax([name, cls])

Create a JAX dataset from the loaded skim arrays.

to_jax_arrays_3d()

Load selected OMX matrices into grouped array objects.