Skip to content

Commit 8e9626c

Browse files
authored
Merge pull request #666 from VChristiaens/master
Bug fix for max ncomp allowed in PCA RDI or ARDI
2 parents b6b4470 + e4ae861 commit 8e9626c

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ help:
99
@echo "clean - remove artifacts"
1010

1111
pypi:
12+
rm dist/*
1213
python setup.py sdist bdist_wheel
1314
twine upload dist/*
1415

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ def resource(*args):
7474
'vip_hci.fm',
7575
'vip_hci.greedy',
7676
'vip_hci.invprob',
77-
'vip_hci.greedy',
7877
'vip_hci.metrics',
7978
'vip_hci.objects',
8079
'vip_hci.preproc',

vip_hci/psfsub/pca_fullfr.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -837,11 +837,15 @@ def _adi_rdi_pca(
837837
raise TypeError(msg)
838838

839839
if np.isscalar(ncomp):
840-
if isinstance(ncomp, int) and ncomp > n:
841-
ncomp = min(ncomp, n)
840+
if cube_ref is not None:
841+
nref = cube_ref.shape[0]
842+
else:
843+
nref = n
844+
if isinstance(ncomp, int) and ncomp > nref:
845+
ncomp = min(ncomp, nref)
842846
print(
843847
"Number of PCs too high (max PCs={}), using {} PCs "
844-
"instead.".format(n, ncomp)
848+
"instead.".format(nref, ncomp)
845849
)
846850
if mask_rdi is None:
847851
if source_xy is None:

0 commit comments

Comments
 (0)