Closed PascalLesage closed 6 years ago
@cmutel I checked the behavior for LCA
with Indexer.__init__
starting at -1.
It behaves as hoped for:
>>>_, fp = create_presamples_package(
... [
... (np.array([42]).reshape(1, -1),
... [(('db', 'B'), ('db', 'A'), 'technosphere')],
... 'technosphere')
... ], seed='sequential'
... )
... lca = LCA({a:1}, presamples=[fp])
... lca.lci()
... print(lca.technosphere_matrix[lca.product_dict[('db', 'B')], lca.activity_dict[('db', 'A')]])
-42
Suppose I have a simple system with the technosphere matrix defined as:
I create a presample package like this:
I use
seed='sequential'
because I then want to calculate the correlation between this specific technosphere exchange and results.Because of the way
MonteCarloLCA
objects are usually manipulated, I end up including the second sample (index=1) first:To get what I really need, I have to do this:
The example on the GSA example notebook shows how to build up the arrays during Monte Carlo, but if the
seed
issequential
, this shouldn't be necessary: one simply needs to go in an read the presample array.One simple solution would be to change the way the
Indexer
is instantiated, from:to:
This generates the expected results: