Skip to content

anchors

Anchor

Bases: object

An anchor is the distal partner to an exchange.

flow_conversion property

express the parent's flow in terms of the quantity of the term flow. There are two ways to do this, each case involving the quantity relation on either the parent flow or the term flow, between the two quantities (parent flow's r.q. is the reference quantity; term flow's r.q. is the query quantity).

In each case, we want the flow's native term manager to perform the conversion using ITS OWN canonical quantities. The assumption is that the parent flow's r.q. is tied to our local LciaEngine, while the term flow's r.q. could be either local or remote.

The QuantityRef.quantity_relation() implicitly assumes that the invoking quantity is the QUERY quantity, so the "forward" (natural parent->node) direction uses the remote flow's r.q. - but we do the "reverse" direction first because it's local.

how to deal with scenario cfs? tbd problem is, the term doesn't know its own scenario

Returns:

Type Description

float = amount in term_flow ref qty that corresponds to a unit of fragment flow's ref qty

is_context property

termination is a context

Returns:

Type Description

is_emission property

Pending context refactor

Returns:

Type Description

is_frag property

Termination is a fragment

Returns:

Type Description

is_subfrag property

Termination is a non-self fragment.

Returns:

Type Description

__init__(parent, anchor_node, anchor_flow=None, descend=None)

An anchor can be one of the following five types: - null: a cut-off. The fragment is an input/output of the spanner - foreground: the fragment is its own anchor. - process: the fragment is anchored to a process with inventory - sub-fragment: the fragment is anchored to another spanner - context: the fragment is an exchange with a context

Parameters:

Name Type Description Default
parent
required
anchor_node
required
anchor_flow
None
descend
None

__str__()

This is repeated at least once in the Anchor model

Returns:

Type Description

'---:' = fragment I/O '-O ' = foreground node '-* ' = process '-# ' - sub-fragment (aggregate) '-#::' - sub-fragment (descend) '-B ' - terminated background '--C ' - cut-off background '--? ' - ungrounded catalog ref

compute_unit_score(quantity_ref, refresh=False, **kwargs)

four different ways to do this. 0- we are a subfragment-- no direct impacts unless non-descend, which is caught earlier 1- parent is bg: ask catalog to give us bg_lcia (process or fragment) 2- get fg lcia for unobserved exchanges

If

Parameters:

Name Type Description Default
quantity_ref
required
refresh
False

Returns:

Type Description

score_cache(quantity=None, refresh=False, **kwargs)

only process-terminations are cached remote fragments that come back via the API can have cached scores as well, but local subfragments should not get cached.

Parameters:

Name Type Description Default
quantity
None
refresh

If True, re-compute unit score even if it is already present in the cache.

False
kwargs
{}

Returns:

Type Description

unobserved_exchanges()

Generator which yields exchanges from the term node's inventory that are not found among the child flows, for LCIA purposes

Challenge here going forward: we made some kind of normative decision early on that terminations do not know their own scenarios, that the fragment maps scenario to termination. The problem is that now terminations cannot themselves carry out traversal on the term_node because they don't know what scenarios to pass.

The upshot is that we cannot meaningfully compute "unobserved exchanges" for subfragments, since we don't know our scenario.

Returns:

Type Description

UnCachedScore

Bases: Exception

means that we have an LCIA-only node whose score has not been set for the requested LCIA method