Skip to content

No good way to get PresamplePackages in correct order from Campaign #43

@PascalLesage

Description

@PascalLesage

Multiple presample packages can be passed to e.g. MonteCarloLCA
If an element (a parameter, a matrix index) is part of more than one package, the value in the package that is later in the list is the one that is used.
Knowing this, there should be a way to generate a list of presample resources from campaign that is ordered thus:

  • Ordered resources from oldest parent
  • Ordered resources from second oldest parent
    ...
  • Ordered resources from direct parent
  • Ordered resources from self.

Currently, Campaign.ancestors will list ancestors in the reverse of the desired order (from direct parent to furthest ancestor). It also does not list presample resources, just campaigns.

The solution should be a class method that looks something like this:

def get_all_resources_in_proper_order(self):    
    ancestors = list(self.ancestors)
    ancestors.reverse()
    resources = [p.path for ancestor in ancestors for p in ancestor.packages]
    try:
        resources.append(*[p.path for p in self.packages])
    except:
        pass
    return resources

@cmutel I tag you in case this is already implemented somewhere and I just can't find it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions