|
14 | 14 | ################################################################################################### |
15 | 15 | ## APERIODIC PARAMETER CONVERTERS |
16 | 16 |
|
17 | | -# Null converter for aperiodic parameters |
| 17 | +## AP - Null converter |
18 | 18 | ap_null = AperiodicParamConverter( |
19 | 19 | parameter=None, |
20 | 20 | name='ap_null', |
|
26 | 26 | ################################################################################################### |
27 | 27 | ## PERIODIC PARAMETER CONVERTERS |
28 | 28 |
|
29 | | -# Null converter for periodic parameters |
| 29 | +## PE - Null converter |
30 | 30 | pe_null = PeriodicParamConverter( |
31 | 31 | parameter=None, |
32 | 32 | name='pe_null', |
|
35 | 35 | model.results.params.periodic._fit[peak_ind, model.modes.periodic.params.indices[param]] |
36 | 36 | ) |
37 | 37 |
|
| 38 | +## PE - PW |
| 39 | + |
| 40 | +pw_log_sub = PeriodicParamConverter( |
| 41 | + parameter='pw', |
| 42 | + name='log_sub', |
| 43 | + description='Convert peak height to be the log subtraction '\ |
| 44 | + 'of full model and aperiodic component.', |
| 45 | + function=lambda param, model, peak_ind : \ |
| 46 | + compute_peak_height(model, peak_ind, 'log', 'subtract'), |
| 47 | +) |
| 48 | + |
| 49 | +pw_log_div = PeriodicParamConverter( |
| 50 | + parameter='pw', |
| 51 | + name='log_div', |
| 52 | + description='Convert peak height to be the log division '\ |
| 53 | + 'of full model and aperiodic component.', |
| 54 | + function=lambda param, model, peak_ind : \ |
| 55 | + compute_peak_height(model, peak_ind, 'log', 'divide'), |
| 56 | +) |
| 57 | + |
| 58 | +pw_lin_sub = PeriodicParamConverter( |
| 59 | + parameter='pw', |
| 60 | + name='lin_sub', |
| 61 | + description='Convert peak height to be the linear subtraction '\ |
| 62 | + 'of full model and aperiodic component.', |
| 63 | + function=lambda param, model, peak_ind : \ |
| 64 | + compute_peak_height(model, peak_ind, 'linear', 'subtract'), |
| 65 | +) |
| 66 | + |
| 67 | +pw_lin_div = PeriodicParamConverter( |
| 68 | + parameter='pw', |
| 69 | + name='lin_div', |
| 70 | + description='Convert peak height to be the linear division '\ |
| 71 | + 'of full model and aperiodic component.', |
| 72 | + function=lambda param, model, peak_ind : \ |
| 73 | + compute_peak_height(model, peak_ind, 'linear', 'divide'), |
| 74 | +) |
| 75 | + |
| 76 | +## PE - BW |
| 77 | + |
| 78 | +bw_full_width = PeriodicParamConverter( |
| 79 | + parameter='bw', |
| 80 | + name='full_width', |
| 81 | + description='Convert peak bandwidth to be the full, '\ |
| 82 | + 'two-sided bandwidth of the peak.', |
| 83 | + function=lambda param, model, peak_ind : \ |
| 84 | + 2 * model.results.params.periodic._fit[\ |
| 85 | + peak_ind, model.modes.periodic.params.indices['bw']] |
| 86 | +) |
| 87 | + |
38 | 88 | ################################################################################################### |
39 | | -## PRE-DEFINED CONVERTERS |
| 89 | +## COLLECT ALL CONVERTERS |
40 | 90 |
|
| 91 | +# Null converters: extract the fit parameter, with no conversion applied |
| 92 | +NULL_CONVERTERS = { |
| 93 | + 'aperiodic' : ap_null, |
| 94 | + 'periodic' : pe_null, |
| 95 | +} |
| 96 | + |
| 97 | +# Collect converters by component & by paramter |
41 | 98 | CONVERTERS = { |
42 | 99 |
|
43 | 100 | 'aperiodic' : { |
44 | | - |
45 | 101 | 'offset' : {}, |
46 | | - |
47 | 102 | 'exponent' : {}, |
48 | | - |
49 | 103 | }, |
50 | 104 |
|
51 | 105 | 'periodic' : { |
52 | | - |
53 | 106 | 'cf' : {}, |
54 | | - |
55 | 107 | 'pw' : { |
56 | | - |
57 | | - 'log_sub' : PeriodicParamConverter( |
58 | | - parameter='pw', |
59 | | - name='log_sub', |
60 | | - description='Convert peak height to be the log subtraction '\ |
61 | | - 'of full model and aperiodic component.', |
62 | | - function=lambda param, model, peak_ind : \ |
63 | | - compute_peak_height(model, peak_ind, 'log', 'subtract'), |
64 | | - ), |
65 | | - |
66 | | - 'log_div' : PeriodicParamConverter( |
67 | | - parameter='pw', |
68 | | - name='log_div', |
69 | | - description='Convert peak height to be the log division '\ |
70 | | - 'of full model and aperiodic component.', |
71 | | - function=lambda param, model, peak_ind : \ |
72 | | - compute_peak_height(model, peak_ind, 'log', 'divide'), |
73 | | - ), |
74 | | - |
75 | | - 'lin_sub' : PeriodicParamConverter( |
76 | | - parameter='pw', |
77 | | - name='lin_sub', |
78 | | - description='Convert peak height to be the linear subtraction '\ |
79 | | - 'of full model and aperiodic component.', |
80 | | - function=lambda param, model, peak_ind : \ |
81 | | - compute_peak_height(model, peak_ind, 'linear', 'subtract'), |
82 | | - |
83 | | - ), |
84 | | - |
85 | | - 'lin_div' : PeriodicParamConverter( |
86 | | - parameter='pw', |
87 | | - name='lin_div', |
88 | | - description='Convert peak height to be the linear division '\ |
89 | | - 'of full model and aperiodic component.', |
90 | | - function=lambda param, model, peak_ind : \ |
91 | | - compute_peak_height(model, peak_ind, 'linear', 'divide'), |
92 | | - ), |
93 | | - |
| 108 | + 'log_sub' : pw_log_sub, |
| 109 | + 'log_div' : pw_log_div, |
| 110 | + 'lin_sub' : pw_lin_sub, |
| 111 | + 'lin_div' : pw_lin_div, |
94 | 112 | }, |
95 | | - |
96 | 113 | 'bw' : { |
97 | | - |
98 | | - 'full_width' : PeriodicParamConverter( |
99 | | - parameter='bw', |
100 | | - name='full_width', |
101 | | - description='Convert peak bandwidth to be the full, '\ |
102 | | - 'two-sided bandwidth of the peak.', |
103 | | - function=lambda param, model, peak_ind : \ |
104 | | - 2 * model.results.params.periodic._fit[\ |
105 | | - peak_ind, model.modes.periodic.params.indices['bw']] |
106 | | - ), |
107 | | - |
| 114 | + 'full_width' : bw_full_width, |
108 | 115 | }, |
109 | 116 | } |
110 | 117 | } |
111 | 118 |
|
112 | | -################################################################################################### |
113 | | -## COLLECT ALL CONVERTERS |
114 | | - |
115 | | -# Null converters: extract the fit parameter, with no conversion applied |
116 | | -NULL_CONVERTERS = { |
117 | | - 'aperiodic' : ap_null, |
118 | | - 'periodic' : pe_null, |
119 | | -} |
120 | | - |
121 | 119 | ################################################################################################### |
122 | 120 | ## SELECTOR & CHECKER FUNCTIONS |
123 | 121 |
|
|
0 commit comments