Closed PascalLesage closed 5 years ago
Seems reasonable. We didn't do this before specifically because we didn't want parameter names to be overridden, but if there is a use case, then that is fine.
Hard to tell about the right architecture without coding something up and seeing how easy it is to write tests, but I think this should be optional behaviour, which means either new functions or classes. The metadata mentioned will be generated on demand, as it seems to me that this is a corner case (much more useful is the consolidated dictionary).
The
PackagesDataLoader
will load all data from an iterable of presample package dirpaths.When multiple presample package dirpaths contain data for the same matrix elements, only the last data will be used. This allows a baseline model to be updated with new values by passing the baseline presample package first and the new values presamples package after in the list of dirpaths. This is expected behaviour and one of the strengths of presamples.
HOWEVER, for parameter data, there is no "consolidation" of parameter data. Parameter data from different packages are all accessible through their own
IndexedParametersMapping
object. Parameters in differentIndexedParametersMapping
objects with the same names coexist and do not influence each other.What is missing is:
PackagesDataLoader
method to return all parameter values from allIndexedParametersMapping
objects, for a given index value.To illustrate simply, let's say we wanted to return a dict with {param_name: sample}. This simple dict comprehension would do the trick (
self
refers to aPackagesDataLoader
object:Perhaps the best place for this would be in the
parameters
property (in which case what is presently stored in theparameters
property would need to be renamed to e.g.index_parameter_mappings
).However, we should think about whether we want to make this richer: