@@ -30,7 +30,7 @@ def get_band_peak(model, band, select_highest=True, threshold=None,
3030
3131 Returns
3232 -------
33- 1d or 2d array
33+ peaks : 1d or 2d array
3434 Peak data. Each row is a peak, as [CF, PW, BW].
3535
3636 Examples
@@ -67,7 +67,7 @@ def get_band_peak_group(group, band, threshold=None, thresh_param='PW', attribut
6767
6868 Returns
6969 -------
70- 2d array
70+ peaks : 2d array
7171 Peak data. Each row is a peak, as [CF, PW, BW].
7272 Each row represents an individual model from the input object.
7373
@@ -101,6 +101,40 @@ def get_band_peak_group(group, band, threshold=None, thresh_param='PW', attribut
101101 threshold , thresh_param )
102102
103103
104+ def get_band_peak_event (event , band , threshold = None , thresh_param = 'PW' , attribute = 'peak_params' ):
105+ """Extract peaks from a band of interest from an event model object.
106+
107+ Parameters
108+ ----------
109+ event : SpectralTimeEventModel
110+ Object to extract peak data from.
111+ band : tuple of (float, float)
112+ Frequency range for the band of interest.
113+ Defined as: (lower_frequency_bound, upper_frequency_bound).
114+ select_highest : bool, optional, default: True
115+ Whether to return single peak (if True) or all peaks within the range found (if False).
116+ If True, returns the highest power peak within the search range.
117+ threshold : float, optional
118+ A minimum threshold value to apply.
119+ thresh_param : {'PW', 'BW'}
120+ Which parameter to threshold on. 'PW' is power and 'BW' is bandwidth.
121+ attribute : {'peak_params', 'gaussian_params'}
122+ Which attribute of peak data to extract data from.
123+
124+ Returns
125+ -------
126+ peaks : 3d array
127+ Array of peak data, organized as [n_events, n_time_windows, n_peak_params].
128+ """
129+
130+ peaks = np .zeros ([event .n_events , event .n_time_windows , 3 ])
131+ for ind in range (event .n_events ):
132+ peaks [ind , :, :] = get_band_peak_group (\
133+ event .get_group (ind , None , 'group' ), band , threshold , thresh_param , attribute )
134+
135+ return peaks
136+
137+
104138def get_band_peak_group_arr (peak_params , band , n_fits , threshold = None , thresh_param = 'PW' ):
105139 """Extract peaks within a given band of interest, from peaks from a group fit.
106140
0 commit comments