@@ -97,17 +97,51 @@ def get_snippets(
9797 indices = None ,
9898 segment_index : Union [int , None ] = None ,
9999 channel_ids : Union [list , None ] = None ,
100- return_scaled = False ,
100+ return_scaled : bool | None = None ,
101+ return_in_uV : bool = False ,
101102 ):
103+ """
104+ Return the snippets, optionally for a subset of samples and/or channels
105+
106+ Parameters
107+ ----------
108+ indices : list[int], default: None
109+ Indices of the snippets to return. If None, all snippets are returned.
110+ segment_index : Union[int, None], default: None
111+ The segment index to get snippets from. If snippets is multi-segment, it is required.
112+ channel_ids : Union[list, None], default: None
113+ The channel ids. If None, all channels are used.
114+ return_scaled : bool | None, default: None
115+ DEPRECATED. Use return_in_uV instead.
116+ If True and the snippets has scaling (gain_to_uV and offset_to_uV properties),
117+ snippets are scaled to uV
118+ return_in_uV : bool, default: False
119+ If True and the snippets has scaling (gain_to_uV and offset_to_uV properties),
120+ snippets are scaled to uV
121+
122+ Returns
123+ -------
124+ np.array
125+ The snippets (num_snippets, num_samples, num_channels)
126+ """
102127 segment_index = self ._check_segment_index (segment_index )
103128 spts = self ._snippets_segments [segment_index ]
104129 channel_indices = self .ids_to_indices (channel_ids , prefer_slice = True )
105130 wfs = spts .get_snippets (indices , channel_indices = channel_indices )
106131
107- if return_scaled :
132+ # Handle deprecated return_scaled parameter
133+ if return_scaled is not None :
134+ warn (
135+ "`return_scaled` is deprecated and will be removed in a future version. Use `return_in_uV` instead." ,
136+ category = DeprecationWarning ,
137+ stacklevel = 2 ,
138+ )
139+ return_in_uV = return_scaled
140+
141+ if return_in_uV :
108142 if not self .has_scaleable_traces ():
109143 raise ValueError (
110- "These snippets do not support return_scaled =True (need gain_to_uV and offset_" "to_uV properties)"
144+ "These snippets do not support return_in_uV =True (need gain_to_uV and offset_" "to_uV properties)"
111145 )
112146 else :
113147 gains = self .get_property ("gain_to_uV" )
@@ -123,13 +157,49 @@ def get_snippets_from_frames(
123157 start_frame : Union [int , None ] = None ,
124158 end_frame : Union [int , None ] = None ,
125159 channel_ids : Union [list , None ] = None ,
126- return_scaled = False ,
160+ return_scaled : bool | None = None ,
161+ return_in_uV : bool = False ,
127162 ):
163+ """
164+ Return the snippets from frames, optionally for a subset of samples and/or channels
165+
166+ Parameters
167+ ----------
168+ segment_index : Union[int, None], default: None
169+ The segment index to get snippets from. If snippets is multi-segment, it is required.
170+ start_frame : Union[int, None], default: None
171+ The start frame. If None, 0 is used.
172+ end_frame : Union[int, None], default: None
173+ The end frame. If None, the number of samples in the segment is used.
174+ channel_ids : Union[list, None], default: None
175+ The channel ids. If None, all channels are used.
176+ return_scaled : bool | None, default: None
177+ DEPRECATED. Use return_in_uV instead.
178+ If True and the snippets has scaling (gain_to_uV and offset_to_uV properties),
179+ snippets are scaled to uV
180+ return_in_uV : bool, default: False
181+ If True and the snippets has scaling (gain_to_uV and offset_to_uV properties),
182+ snippets are scaled to uV
183+
184+ Returns
185+ -------
186+ np.array
187+ The snippets (num_snippets, num_samples, num_channels)
188+ """
128189 segment_index = self ._check_segment_index (segment_index )
129190 spts = self ._snippets_segments [segment_index ]
130191 indices = spts .frames_to_indices (start_frame , end_frame )
131192
132- return self .get_snippets (indices , channel_ids = channel_ids , return_scaled = return_scaled )
193+ # Handle deprecated return_scaled parameter
194+ if return_scaled is not None :
195+ warn (
196+ "`return_scaled` is deprecated and will be removed in a future version. Use `return_in_uV` instead." ,
197+ category = DeprecationWarning ,
198+ stacklevel = 2 ,
199+ )
200+ return_in_uV = return_scaled
201+
202+ return self .get_snippets (indices , channel_ids = channel_ids , return_in_uV = return_in_uV )
133203
134204 def _save (self , format = "binary" , ** save_kwargs ):
135205 raise NotImplementedError
0 commit comments