pyyeti.cla.DR_Results.init_extreme_cat¶
- static DR_Results.init_extreme_cat(cases, oldcat, ext_name='Envelope', domain='X-Value')[source]¶
Initialize an “extrema” data recovery category
- Parameters:
cases (list) – List of strings, each naming a column for the .mx and .mn members.
oldcat (SimpleNamespace) – Results data structure with attributes .ext, .mx, etc (see example in
DR_Results). Only used for determining sizing information.ext_name (string; optional) – Name to use for extreme results (stored in, for example,
self['extreme']['SC_atm'].event)domain (string or None; optional) – Typically ‘time’ or ‘freq’, but can be any string or None. Use None to not define a domain.
- Returns:
newcat (SimpleNamespace) – New results data structure with attributes .ext, .mx, etc (see example in
DR_Results).The .cases attribute is set to the input cases and the .event attribute is set to the input ext_name.
.drminfo is a copy of the one in oldcat.
.mission is a reference to the one in oldcat.
The .ext, .ext_x, .maxcase, .mincase attributes are all set to None.
The .mx, .mn, .mx_x, .mn_x. .srs.srs (if present) are all filled with
np.nan.The .srs.ext dictionary is a deep copy of the one in oldcat.
Notes
This is normally called indirectly via the
form_extreme()routine. However, it can also be handy when implementing combination equations, for example.Here is an example combination equation implementation. Both ss and noise are instances of the
DR_Resultsand those analyses are complete. The combination equation is simply to add the peaks of these two components:comb = cla.DR_Results() for cat, ss_sns in ss.items(): sns = comb.init_extreme_cat( ['ss', 'noise'], ss_sns, domain='combination') ssext = ss[cat].mx noiseext = abs(noise[cat].ext).max(axis=1)[:, None] sns.mx = np.column_stack((ssext, noise[cat].mx)) sns.mn = np.column_stack((ssext, noise[cat].mn)) sns.ext = np.column_stack((ssext+noiseext, ssext-noiseext)) sns.maxcase = ['Combination']*ssext.shape[0] sns.mincase = sns.maxcase # srs: if getattr(sns, 'srs', None): _srs = sns.srs for Q, ss_srs in ss[cat].srs.ext.items(): _srs.srs[Q][0] = ss_srs _srs.srs[Q][1] = noise[cat].srs.ext[Q] _srs.ext[Q][:] = _srs.srs[Q].sum(axis=0) comb[cat] = sns