API Reference

This section documents the public API of TRAILS.

Core classes

Core workflows

LCIA utilities

Temporal distributions

class trails.temporal_distributions.TemporalExchange(distribution: int, loc: float | None, scale: float | None, offset_min: int, offset_max: int, amount_source: str = 'port', offsets: Sequence[int] | None = None, weights: Sequence[float] | None = None)[source]

Metadata for a single temporally-distributed exchange.

  • param distribution:

    Integer code for the distribution shape.

  • 1: discrete (all mass at loc)

  • 2: lognormal

  • 3: normal

  • 4: uniform

  • 5: triangular

  • 6: discrete empirical (explicit offsets + weights)

Parameters:
  • loc – Location parameter (mean, median, or mode depending on distribution).

  • scale – Scale parameter (stddev for normal, sigma for lognormal).

  • offset_min – Minimum integer offset (inclusive).

  • offset_max – Maximum integer offset (inclusive).

  • amount_source – Source of the amount for each pulse year.

amount_source: str = 'port'
distribution: int
loc: float | None
offset_max: int
offset_min: int
offsets: Sequence[int] | None = None
scale: float | None
weights: Sequence[float] | None = None
class trails.temporal_distributions.TemporalDistribution(tex: TemporalExchange)[source]

Turn a TemporalExchange into discrete (offset, weight) pairs.

iter_offsets_and_weights(debug: bool = False) Iterable[Tuple[int, float]][source]

Iter offsets and weights.

Parameters:

debug (bool) – Value for debug.

Yields:

Yielded values.

Returns:

Return value.

Return type:

Iterable[Tuple[int, float]]

Plotting

FaIR integration