Skip to content

Commit 36c5ca8

Browse files
committed
update example
1 parent 8ae0d86 commit 36c5ca8

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

examples/models/plot_model_component_relationships.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
from specparam.plts.utils import check_ax
2929

3030
def plot_peak_height(model, peak_ind, spacing, operation, ax=None):
31-
"""Annotat plot by drawing the computed peak height."""
31+
"""Annotate plot by drawing the computed peak height."""
3232

3333
# Get the frequency value of the data closest to the specified peak
3434
f_ind = nearest_ind(model.data.freqs,
@@ -204,31 +204,33 @@ def plot_peak_height(model, peak_ind, spacing, operation, ax=None):
204204

205205
###################################################################################################
206206
#
207-
# As expected, we can see that the four differet combinations of spacing and operation can
207+
# As expected, we can see that the four different combinations of spacing and operation can
208208
# lead to 4 different answers for the peak height.
209209
#
210-
# We can also go one step further, and examing (un)logging the results.
210+
# We can also go one step further, and examine (un)logging the results, to explore if
211+
# changing the spacing of the computed results aligns with any of the original calculations.
211212
#
212213

213214
###################################################################################################
214215

215-
# Check logging / unlogging measures: lines up with above
216+
# Check logging / unlogging measures: un-logged log sub is same as linear division
216217
print('Unlog log sub : {:+08.4f}'.format(unlog(peak_heights['log_sub'])))
217-
print('Log of lin div : {:+08.4f}'.format(np.log10(peak_heights['lin_div'])))
218218

219219
###################################################################################################
220220

221-
# Check logging / unlogging measures: does not line up with above
222-
print('Unlog log div : {:+08.4f}'.format(unlog(peak_heights['log_div'])))
223-
print('Log of lin sub : {:+08.4f}'.format(np.log10(peak_heights['lin_sub'])))
221+
# Check logging / unlogging measures: logged linear-division is the same as log subtraction
222+
print('Log of lin div : {:+08.4f}'.format(np.log10(peak_heights['lin_div'])))
224223

225224
###################################################################################################
226225
#
227-
# As expected, unlogging the log-subtraction is equivalent to the linear division, and
228-
# (vice-versa) logging the linear division is equivalent to the log-subtraction.
226+
# In the above examples we see that changing the spacing of some results does line up with
227+
# some of the previously computed estimates. As expected based on the log rules, unlogging
228+
# the log-subtraction is equivalent to the linear division, and (vice-versa) logging the
229+
# linear division is equivalent to the log-subtraction.
229230
#
230-
# However, unlogging the log-division or logging the linear-subtraction do not lead to
231-
# answers that align with any of the previous measures.
231+
# This also means that you cannot convert directly between spacing keeping the same operation,
232+
# for example, you cannot convert to the linear-subtraction result by unlogging
233+
# the log-subtraction result.
232234
#
233235
# To summarize:
234236
#

0 commit comments

Comments
 (0)