pyyeti.cla.DR_Results.split¶
- DR_Results.split()[source]¶
Split results apart into a new
DR_Resultsstructure- Returns:
results (
DR_Resultsinstance) – This is a new, two-level instance ofDR_Results(each entry value is a base-level instance ofDR_Results). For example, if:self['SC_atm'].cases == ['ff1', 'ff2', 'ff3']
then results would have:
results['ff1']['SC_atm'].cases = ['ff1'] results['ff2']['SC_atm'].cases = ['ff2'] results['ff3']['SC_atm'].cases = ['ff3']
Notes
This routine is sort of an inverse of
merge(). Splitting allows easy comparisons of one sub-case to another. It also allows the deletion of some cases: split the results, delete the entries you don’t want, re-merge the results back together, and form a new set of extreme values (withform_extreme()).To illustrate what this routine does, consider this ‘SC_ifa’ entry in an initial results structure. In this case, the CLA event is “Stage 1 / Stage 2 Separation” and there are 3 stage one / stage two separation cases.
PP(results[‘SC_ifa’]):
<class 'types.SimpleNamespace'>[n=16] .cases : [n=3]: ['Sep 1', 'Sep 2', 'Sep 3'] .domain : 'time' .drminfo: <class 'types.SimpleNamespace'>[n=20] .event : 'Stage 1 / Stage 2 Separation' .ext : float64 ndarray: (12, 2) .ext_x : None .hist : float64 ndarray: (3, 12, 10001) .maxcase: None .mx_x : float64 ndarray: (12, 3) .mincase: None .mn_x : float64 ndarray: (12, 3) .mission: 'Rocket / Spacecraft VLC' .mn : float64 ndarray: (12, 3) .mx : float64 ndarray: (12, 3) .srs : <class 'types.SimpleNamespace'>[n=5] .ext : <class 'dict'>[n=2] 25: float64 ndarray: (12, 990) 50: float64 ndarray: (12, 990) .frq : float64 ndarray: (990,) .srs : <class 'dict'>[n=2] 25: float64 ndarray: (3, 12, 990) 50: float64 ndarray: (3, 12, 990) .type : 'eqsine' .units: 'G, rad/sec^2' .time : float32 ndarray: (10001,)This routine would return a new structure with the three cases split up into three events. For example,
sp_res = results.split(), would give the following. Note that there would typically be more categories than just ‘SC_ifa’, and they would all be split in the same way.sp_res['Sep 1']['SC_ifa'] sp_res['Sep 2']['SC_ifa'] sp_res['Sep 3']['SC_ifa']
And
sp_res['Sep 2']['SC_ifa']would be (notice the 3’s become 1’s):<class 'types.SimpleNamespace'>[n=16] .cases : [n=1]: ['Sep 2'] .domain : 'time' .drminfo: <class 'types.SimpleNamespace'>[n=20] .event : 'Sep 2' .ext : float64 ndarray: (12, 2) .ext_x : None .hist : float64 ndarray: (1, 12, 10001) .maxcase: None .mx_x : float64 ndarray: (12, 1) .mincase: None .mn_x : float64 ndarray: (12, 1) .mission: 'Rocket / Spacecraft VLC' .mn : float64 ndarray: (12, 1) .mx : float64 ndarray: (12, 1) .srs : <class 'types.SimpleNamespace'>[n=5] .ext : <class 'dict'>[n=2] 25: float64 ndarray: (12, 990) 50: float64 ndarray: (12, 990) .frq : float64 ndarray: (990,) .srs : <class 'dict'>[n=2] 25: float64 ndarray: (1, 12, 990) 50: float64 ndarray: (1, 12, 990) .type : 'eqsine' .units: 'G, rad/sec^2' .time : float32 ndarray: (10001,)Example usage 1:
# compare sub-cases 'MECO 1' and 'MECO 10': sp = results.split() sp['MECO 1'].rptpct( sp['MECO 10'], names=('MECO 1', 'MECO 10'), direc='m1_vs_m10')
Example usage 2:
# delete case 'MECO 15' from the results and form a new # set of statistical extreme results: from pyyeti.stats import ksingle # split results and delete 'MECO 15': sp = results.split() del sp['MECO 15'] # merge remaining cases back together: new_res = cla.DR_Results() new_res.merge(sp.values()) # form non-statistical extrema (completes the merge): new_res.form_extreme() # change to statistical extrema: ncases = len(new_res['extreme'].cases) new_res['extreme'].calc_stat_ext( stats.ksingle(0.99, 0.90, ncases)) # compare new extrema to original: new_res['extreme'].rptpct( results, names=('W/O MECO 15', 'Original'), direc='no_m15_vs_all')
- Raises:
TypeError – When
self[cat]is not a SimpleNamespace. This usually happens when self is a multiple levelDR_Resultsinstance. In that case, instead ofres.split(), try something likeres[event].split().