pyyeti.cla.DR_Results.add_maxmin

DR_Results.add_maxmin(cat, mxmn, maxcase, mincase=None, mxmn_xvalue=None, domain=None)[source]

Add maximum and minimum values from an external source

Parameters:
  • cat (string) – Data recovery category, eg: ‘SC_atm’

  • mxmn (2d array_like) – 2 column matrix of [max, min]

  • maxcase (string or list of strings) – String or list of strings identifying the load case(s) for the maximum values.

  • mincase (string or list of strings or None; optional) – Analogous to maxcase for the minimum values or None. If None, it is a copy of the maxcase values.

  • mxmn_xvalue (2d array_like or None; optional) – 2 column matrix of [mx_xvalue, mn_xvalue]. Use None to not set the x-values (typically times or frequencies) of max/min values.

  • domain (string or None; optional) – Typically ‘time’ or ‘freq’, but can be any string or None. Use None to not define a domain.

Returns:

None

Notes

This routine is not normally needed. It is only here for situations where the results were calculated elsewhere but you want to use these tools (eg, for reports or doing comparisons). This routine does not check to see if cat already exists; if it does, it is overriden.

Examples

Here is a simple but complete example. CLA results are made up for an “ATM” and an “LTM” for 3 events:

>>> import numpy as np
>>> import pandas as pd
>>> from pyyeti import cla
>>>
>>> # make up some "external source" CLA results:
>>> events = ('Liftoff', 'Transonics', 'MECO')
>>> rows = {'ATM': 34, 'LTM': 29}
>>> ext_results = {i: {} for i in rows}
>>> t = np.arange(200)/200
>>> rng = np.random.default_rng()
>>> for event in events:
...     for drm, nrows in rows.items():
...         resp = rng.normal(size=(nrows, len(t)))
...         mxmn = cla.maxmin(resp, t)
...         ext_results[drm][event] = mxmn.ext
>>>
>>> # setup CLA parameters:
>>> mission = "Rocket / Spacecraft VLC"
>>> duf = 1.2
>>> suf = 1.0
>>>
>>> # defaults for data recovery
>>> defaults = dict(se=0,
...                 uf_reds=(1, 1, duf, suf))
>>> drdefs = cla.DR_Def(defaults)
>>>
>>> def _get_labels(name):
...     return [f'{name} Row {i+1:6d}'
...             for i in range(rows[name])]
>>>
>>> @cla.DR_Def.addcat
... def _():
...     name = 'ATM'
...     desc = 'S/C Internal Accelerations'
...     units = 'm/sec^2, rad/sec^2'
...     labels = _get_labels(name)
...     drfunc = 'no-func'
...     drdefs.add(**locals())
>>>
>>> @cla.DR_Def.addcat
... def _():
...     name = 'LTM'
...     desc = 'S/C Internal Loads'
...     units = 'N, N-m'
...     labels = _get_labels(name)
...     drfunc = 'no-func'
...     drdefs.add(**locals())
>>>
>>> # for checking, make a pandas DataFrame to summarize data
>>> # recovery definitions (but skip the excel file for this
>>> # demo)
>>> pd.options.display.max_colwidth = 25
>>> drdefs.excel_summary(None)
                                 ATM                       LTM
active                           yes                         -
desc        S/C Internal Accelera...        S/C Internal Loads
drfile                          None                         -
drfunc                       no-func                         -
filterval                      1e-06                         -
histlabels                      None                         -
histpv                          None                         -
histunits                       None                         -
ignorepv                        None                         -
labels      34: ['ATM Row      1'...  29: ['LTM Row      1'...
misc                            None                         -
se                                 0                         -
srsQs                           None                         -
srsconv                         None                         -
srsfrq                          None                         -
srslabels                       None                         -
srsopts                         None                         -
srspv                           None                         -
srsunits                        None                         -
uf_reds          4: (1, 1, 1.2, 1.0)                         -
units             m/sec^2, rad/sec^2                    N, N-m
>>>
>>> # prepare results data structure:
>>> DR = cla.DR_Event()
>>> DR.add(None, drdefs)
>>> results = cla.DR_Results()
>>> for event in events:
...     results[event] = DR.prepare_results(mission, event)
...     for drm in rows:
...         results[event].add_maxmin(
...             drm, ext_results[drm][event], event)
>>>
>>> # Done with setup; now we can use the standard cla tools:
>>> results.form_extreme()
>>> # To write an extreme 'Results.xlsx' file, uncomment the
>>> # following line:
>>> # results['extreme'].rpttab(excel='Results')