pyyeti.cla.DR_Results.merge

DR_Results.merge(results_iter, rename_dict=None)[source]

Merge CLA results together into a larger DR_Results hierarchy.

Parameters:
  • results_iter (iterable) – Iterable of DR_Results items to merge. (Can be list, tuple, generator expression, or other Python iterable.)

  • rename_dict (dict; optional) – Used to rename entries in final self results structure. The key is old name and the value is the new name. See example below.

Returns:

events (list) – List of event names in the order provided by results_iter.

Notes

This routine is sort of an inverse of split(). The name of each event is extracted from the DR_Results data structure. The approach to get the name is as follows. Note that ‘SC_atm’ is just an example; this routine will simply use first element it finds. Let results be the current instance of DR_Results:

  1. If any element of results is a SimpleNamespace: event = results['SC_atm'].event

  2. Else, if any element from results is another DR_Results structure, then:

    1. If results['extreme'] exists: event = results['extreme']['SC_atm'].event

    2. Else event = ', '.join(key for key in results)

  3. Else, raise TypeError

Example usage:

# merge "liftoff" and "meco" results and rename the
# liftoff results from "LO" to "Liftoff":

from pyyeti import cla

results = cla.DR_Results()
results.merge(
    (
        cla.load(fn)
        for fn in [
            "../liftoff/results.pgz",
            "../meco/results.pgz",
        ]
    ),
    {"LO": "Liftoff"},
)
results.strip_hists()
results.form_extreme()
results["extreme"].rpttab()
cla.save("results.pgz", results)