@@ -81,7 +81,11 @@ def get_output(self) -> CNMF:
8181
8282 # TODO: Make the ``ixs`` parameter for spatial stuff optional
8383 @validate ('cnmf' )
84- def get_spatial_masks (self , ixs_components : np .ndarray , threshold : float = 0.01 ) -> np .ndarray :
84+ def get_spatial_masks (
85+ self ,
86+ ixs_components : Optional [np .ndarray ] = None ,
87+ threshold : float = 0.01
88+ ) -> np .ndarray :
8589 """
8690 Get binary masks of the spatial components at the given `ixs`
8791
@@ -90,7 +94,8 @@ def get_spatial_masks(self, ixs_components: np.ndarray, threshold: float = 0.01)
9094 Parameters
9195 ----------
9296 ixs_components: np.ndarray
93- numpy array containing integer indices for which you want spatial masks
97+ numpy array containing integer indices for which you want spatial masks.
98+ if `None` uses cnmf.estimates.idx_components
9499
95100 threshold: float
96101 threshold
@@ -107,6 +112,9 @@ def get_spatial_masks(self, ixs_components: np.ndarray, threshold: float = 0.01)
107112 if dims is None :
108113 dims = cnmf_obj .estimates .dims
109114
115+ if ixs_components is None :
116+ ixs_components = cnmf_obj .estimates .idx_components
117+
110118 masks = np .zeros (shape = (dims [0 ], dims [1 ], len (ixs_components )), dtype = bool )
111119
112120 for n , ix in enumerate (ixs_components ):
@@ -152,7 +160,7 @@ def get_spatial_contours(
152160 ----------
153161 ixs_components: np.ndarray
154162 indices for which to return spatial contours.
155- if `None` just returns according to cnmf.estimates.idx_components
163+ if `None` uses cnmf.estimates.idx_components
156164
157165 Returns
158166 -------
@@ -175,14 +183,19 @@ def get_spatial_contours(
175183 return coordinates , coms
176184
177185 @validate ('cnmf' )
178- def get_temporal_components (self , ixs_components : np .ndarray = None , add_background : bool = False ) -> np .ndarray :
186+ def get_temporal_components (
187+ self ,
188+ ixs_components : Optional [np .ndarray ] = None ,
189+ add_background : bool = False
190+ ) -> np .ndarray :
179191 """
180192 Get the temporal components for this CNMF item
181193
182194 Parameters
183195 ----------
184196 ixs_components: np.ndarray
185- indices for which to return temporal components, ``cnmf.estimates.C``
197+ indices for which to return temporal components, ``cnmf.estimates.C``.
198+ if `None` uses cnmf.estimates.idx_components
186199
187200 add_background: bool
188201 if ``True``, add the temporal background, basically ``cnmf.estimates.C + cnmf.estimates.f``
@@ -194,7 +207,7 @@ def get_temporal_components(self, ixs_components: np.ndarray = None, add_backgro
194207 cnmf_obj = self .get_output ()
195208
196209 if ixs_components is None :
197- ixs_components = np . arange ( 0 , cnmf_obj .estimates .C . shape [ 0 ])
210+ ixs_components = cnmf_obj .estimates .idx_components
198211
199212 C = cnmf_obj .estimates .C [ixs_components ]
200213 f = cnmf_obj .estimates .f
0 commit comments