Skip to content

Commit 25bb7f3

Browse files
committed
Added option for scaling to be a tuple of 2 values for PCA-SADI in 2 steps
1 parent daec49d commit 25bb7f3

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

vip_hci/psfsub/pca_fullfr.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,11 @@ def pca(*all_args: List, **all_kwargs: dict):
241241
242242
svd_mode : Enum, see `vip_hci.config.paramenum.SvdMode`
243243
Switch for the SVD method/library to be used.
244-
scaling : Enum, see `vip_hci.config.paramenum.Scaling`
244+
scaling : Enum, or tuple of Enum, see `vip_hci.config.paramenum.Scaling`
245245
Pixel-wise scaling mode using ``sklearn.preprocessing.scale``
246-
function. If set to None, the input matrix is left untouched.
246+
function. If set to None, the input matrix is left untouched. In the
247+
case of PCA-SADI in 2 steps, this can be a tuple of 2 values,
248+
corresponding to the scaling for each of the 2 steps of PCA.
247249
mask_center_px : None or int
248250
If None, no masking is done. If an integer > 1 then this value is the
249251
radius of the circular mask.
@@ -1197,6 +1199,9 @@ def _adimsdi_doublepca(
11971199
raise ValueError("Scaling factors vector has wrong length")
11981200
scale_list = check_scal_vector(scale_list)
11991201

1202+
if type(scaling) is not tuple:
1203+
scaling = (scaling, scaling)
1204+
12001205
if verbose:
12011206
print("{} spectral channels in IFS cube".format(z))
12021207
if ncomp_ifs is None:
@@ -1215,7 +1220,7 @@ def _adimsdi_doublepca(
12151220
iterable(range(n)),
12161221
ncomp_ifs,
12171222
scale_list,
1218-
scaling,
1223+
scaling[0],
12191224
mask_center_px,
12201225
svd_mode,
12211226
imlib2,
@@ -1268,7 +1273,7 @@ def _adimsdi_doublepca(
12681273
residuals_cube_channels,
12691274
None,
12701275
ncomp_adi,
1271-
scaling,
1276+
scaling[1],
12721277
mask_center_px,
12731278
svd_mode,
12741279
verbose,
@@ -1297,7 +1302,7 @@ def _adimsdi_doublepca(
12971302
residuals_cube_channels,
12981303
None,
12991304
ncomp_adi,
1300-
scaling,
1305+
scaling[1],
13011306
mask_center_px,
13021307
svd_mode,
13031308
verbose,

0 commit comments

Comments
 (0)