Skip to content

fragment_flows

CumulatingFlows

Bases: Exception

when a fragment includes multiple instances of the reference flow having consistent (i.e. not complementary) directions. Not handled in subfragment traversal bc no valid test case

FragmentFlow

Bases: object

A FragmentFlow is a an immutable record of a traversal query. essentially an enhanced NodeCache record which can be easily serialized to an antelope fragmentflow record.

A fragment traversal generates an array of FragmentFlow objects.

X "fragmentID": 8, - added by antelope X "fragmentStageID": 80,

f "fragmentFlowID": 167, f "name": "UO Local Collection", f "shortName": "Scenario", f "flowID": 371, f "direction": "Output", f "parentFragmentFlowID": 168, f "isBackground": false,

w "nodeWeight": 1.0,

t "nodeType": "Process", t "processID": 62,

  • "isConserved": true,
  • "flowPropertyMagnitudes": [ { "flowPropertyID": 23, "unit": "kg", "magnitude": 1.0 } ]

__eq__(other)

FragmentFlows are equal if they have the same fragment and termination. Formerly magnitude too but why? answer why: because if not, then two traversals from two different scenarios can appear equal answer why not: because of LciaResult issues, presumably- let's put this on the list for later

Parameters:

Name Type Description Default
other
required

Returns:

Type Description

__init__(fragment, magnitude, node_weight, term, is_conserved, match_ev=None, match_term=None, flow_conversion=1.0)

Parameters:

Name Type Description Default
fragment
required
magnitude
required
node_weight

flow (or balance) magnitude * flow conversion / anchor inflow magnitude

required
term
required
is_conserved
required
match_ev
None
match_term
None
flow_conversion

[1.0] stored in the FragmentFlow for information purposes only. Negative value indicates a direction change at the anchor (driven anchor)

1.0

aggregate_subfragments(subfrags, scenarios=None)

We need to save the full traversal specification (

Parameters:

Name Type Description Default
subfrags
required
scenarios
None

Returns:

Type Description

from_process_inventory(query, process, ref_flow, elementary=False, exterior=False) classmethod

expands the named process's inventory into a list of FragmentFlows amenable to LCIA computation.

generate FragmentFlows of the process's intermediate exchanges. the ensuing list should be suitable to feed directly into frag_flow_lcia() to generate a contribution analysis

Parameters:

Name Type Description Default
query

only requires .get(), so an implementation will work fine

required
process
required
ref_flow
required
elementary

[False] if True, also generate FFs for elementary exchanges (these will otherwise get computed via unobserved_exchanges()

False
exterior

[False] if True, also generate FFs for non-elementary exterior exchanges

False

Returns:

Type Description

screen_name(length=80)

auto-compact for display

Returns:

Type Description

FragmentInventoryDeprecated

Bases: Exception

The "inventory" term for fragments is deprecated. "unit_inventory" is now "unit_flows" and "inventory" is what it has always meant: "cutoffs". And the old "cutoffs" is gone because it literally never worked.

frag_flow_lcia(fragmentflows, quantity_ref, scenario=None, **kwargs)

Recursive function to compute LCIA of a traversal record contained in a set of Fragment Flows. Note: refresh is no longer supported during traversal

Parameters:

Name Type Description Default
fragmentflows
required
quantity_ref
required
scenario

necessary if any remote traversals are required

None
ignore_uncached

[True] whether to allow zero scores for un-cached, un-computable fragments

required

Returns:

Type Description