Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 81 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,45 +18,89 @@ jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.14"
- name: Run pre-commit
run: |
pip install pre-commit
pre-commit run --files src/**/*.py
- uses: actions/checkout@main
- uses: actions/setup-python@main
with:
python-version: "3.14"
cache: pip
- name: Run pre-commit
run: |
pip install pre-commit
pre-commit run --files $(git ls-files "*.py")

no_object_checks:
needs: pre-commit
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version:
- "3.11"
- "3.12"
- "3.13"
- "3.14"
python-version: ["3.11", "3.12", "3.13", "3.14"]
group: [1, 2, 3]

steps:
- uses: actions/checkout@v6
- uses: actions/checkout@main
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
uses: actions/setup-python@main
with:
python-version: ${{ matrix.python-version }}
cache: pip

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --editable . --group dev
- name: Test with pytest

- name: Test with pytest + coverage
if: matrix.python-version == '3.14'
run: |
coverage run --source src -m pytest tests/pre_3_10 --splits 3 --group ${{ matrix.group }}
coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v6
coverage run --source src --parallel-mode -m pytest tests/pre_3_10 --splits 3 --group ${{ matrix.group }}

- name: Test with pytest
if: matrix.python-version != '3.14'
run: pytest tests/pre_3_10 --splits 3 --group ${{ matrix.group }}

# upload each coverage shard file for combining later
- name: Upload coverage shard
if: matrix.python-version == '3.14'
uses: actions/upload-artifact@main
with:
name: coverage-no-objects-group-${{ matrix.group }}
path: .coverage.*
include-hidden-files: true

# combine the three shards before uploading to codecov
coverage_no_objects:
needs: no_object_checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main

- uses: actions/setup-python@main
with:
python-version: "3.14"
cache: pip

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --editable . --group dev

- name: Download coverage shards
uses: actions/download-artifact@main
with:
pattern: coverage-no-objects-group-*
merge-multiple: true

- name: Combine and export coverage
run: |
coverage combine
coverage xml

- name: Upload to Codecov
uses: codecov/codecov-action@main
with:
flags: no_objects # distinguishes this suite in the Codecov UI
token: ${{ secrets.CODECOV_TOKEN }}

objects_check:
needs: pre-commit
Expand All @@ -67,19 +111,31 @@ jobs:
python-version: ["3.11", "3.12", "3.13", "3.14"]

steps:
- uses: actions/checkout@v6
- uses: actions/checkout@main
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
uses: actions/setup-python@main
with:
python-version: ${{ matrix.python-version }}
cache: pip

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --editable . --group dev
- name: Test with pytest

- name: Test with pytest + coverage
if: matrix.python-version == '3.14'
run: |
coverage run --source=src/vip_hci/objects/ -m pytest tests/post_3_10
coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v6

- name: Test with pytest
if: matrix.python-version != '3.14'
run: pytest tests/post_3_10

- name: Upload to Codecov
if: matrix.python-version == '3.14'
uses: codecov/codecov-action@main
with:
flags: objects
token: ${{ secrets.CODECOV_TOKEN }}
592 changes: 198 additions & 394 deletions .test_durations

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ test:
pre-commit install-hooks
pre-commit install
pre-commit run --files src/**/*.py
coverate run -m pytest
coverage run -m pytest
coverage xml
rm confi_hist.pdf
rm confi_hist_gaussfit.pdf
Expand Down
8 changes: 4 additions & 4 deletions helpers/update_docs_rst_from_README.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

with open("../README.rst") as f_r:
readme = f_r.readlines()
str_titles = ['TL;DR',
str_titles = ['TL;DR',
'Installation and dependencies',
'Image conventions',
'Contact',
'Attribution',
'THE END']
titles_occ = [0,0,0,1,0,0]
w_titles = ['TLDR',
w_titles = ['TLDR',
'Installation-and-dependencies',
'Image-conventions',
'Contact',
Expand All @@ -37,6 +37,6 @@
stop_write=True
else:
continue


print("successfully converted README into documentation rst files.")
17 changes: 15 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools>=42", "wheel"]
requires = ["setuptools>=64"]
build-backend = "setuptools.build_meta"

[project]
Expand All @@ -26,7 +26,6 @@ classifiers = [
"Programming Language :: Python :: 3.14",
"Topic :: Scientific/Engineering :: Astronomy",
]
urls.Homepage = "https://github.com/vortex-exoplanet/VIP"
dependencies = [
"astropy>=5.0.0",
"corner>=2.2.1",
Expand All @@ -45,6 +44,10 @@ dependencies = [
"scikit-learn>=1.0.2",
]

[project.urls]
Homepage = "https://github.com/vortex-exoplanet/VIP"
Issues = "https://github.com/vortex-exoplanet/VIP/issues"

[dependency-groups]
dev = [
"coverage>=7.10.0",
Expand All @@ -67,3 +70,13 @@ dev = [
"sphinx_rtd_theme",
"jupyter_sphinx",
]

[tool.setuptools.packages.find]
where = ["src"]

[tool.setuptools.package-data]
"vip_hci" = ["py.typed"]

[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "-v --tb=short"
4 changes: 2 additions & 2 deletions src/vip_hci/config/paramenum.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,13 +316,13 @@ class OptMethod(str, Enum):

* ``LSQ``

* ``ROBUST``
* ``L1``
"""

NO = "no"
TOTAL = "total"
LSQ = "lsq"
ROBUST = "robust"
L1 = "l1"


class VarEstim(str, Enum):
Expand Down
2 changes: 1 addition & 1 deletion src/vip_hci/fm/fakecomp.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def cube_inject_companions(array, psf_template, angle_list, flevel, rad_dists,
Number of CPUs to use for multiprocessing. If None, will be
automatically set to half the number of available CPUs.
copy_array: bool, optional
Default is True. If False, ``array`` is not copied before injection. This is intended for
Default is True. If False, ``array`` is not copied before injection. This is intended for
computing performance when ``array`` can be modified.

Returns
Expand Down
1 change: 1 addition & 0 deletions src/vip_hci/fm/fakedisk.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def cube_inject_fakedisk(
"""
if not fakedisk.ndim == 2:
raise TypeError("Fakedisk is not a frame or a 2d array.")
angle_list = np.asarray(angle_list)
if not angle_list.ndim == 1:
raise TypeError("Input parallactic angle is not a 1d array")

Expand Down
2 changes: 1 addition & 1 deletion src/vip_hci/fm/negfc_fmerit.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def chisquare(
imlib=imlib_sh,
interpolation=interpolation,
transmission=transmission,
radial_gradient=radial_gradient,
radial_gradient=radial_gradient,
verbose=False
)

Expand Down
20 changes: 10 additions & 10 deletions src/vip_hci/greedy/ipca_fullfr.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,20 +146,20 @@ def ipca(*all_args: List, **all_kwargs: dict):
but has no additional options for the extraction of circumstellar signal
at each iteration (all signals > 0 are considered). Installation of the
GreeDS package is required for this option.
- If 'Christiaens24': Same as 'Juillard23' but not in Torch, and with
- If 'Christiaens24': Same as 'Juillard23' but not in Torch, and with
the extra parameters ``thr`` and ``ncomp_step`` available.
ncomp : int or tuple/list of 2 or 3 int, optional
How many PCs are used as a lower-dimensional subspace to project the
target frames.
- if mode is None:
* strategy in {'ADI', 'RDI', 'ARDI'} and no ``mask_rdi`` provided:
an int must be provided, ``ncomp`` is the fixed number of PCs to use

* strategy in {'RADI' , 'RARDI'} and no ``mask_rdi`` is provided:
an int or a tuple/list of 2 int is accepted. In the latter case, the
first value is used for IPCA-RDI, and the second for IPCA-ADI for
the remaining iterations after the former converged.

* strategy in {'ADI', 'RDI', 'ARDI} and ``mask_rdi`` is provided: an
int or a tuple/list of 2 int can be provided. In the latter case,
the first value is used for PCA-data imputation at the first
Expand All @@ -170,12 +170,12 @@ def ipca(*all_args: List, **all_kwargs: dict):
the first value is used for PCA-data imputation at the first
iteration, the second for IPCA-RDI,and the third for IPCA-ADI for
the remaining iterations after the former converged.

- if mode is not None:
ncomp should correspond to the maximum number of principal
components to be tested. The first ncomp will be ``ncomp_start``
and the increment will be ``ncomp_step``.

ncomp_start: int, opt
For incremental versions of iterative PCA (i.e. if mode is 'Juillard23'
or 'Christiaens24'), this is the number of principal components at the
Expand All @@ -188,10 +188,10 @@ def ipca(*all_args: List, **all_kwargs: dict):
Number of iterations for the iterative PCA.
- if mode is None:
total number of iterations

- if mode is 'Juillard23', or 'Christiaens24':
iterations per tested ncomp.

strategy: str {'ADI, 'RDI', 'ARDI', 'RADI', 'RARDI''}, opt
Whether to do iterative ADI only ('ADI'), iterative RDI only ('RDI'),
iterative ADI and RDI together ('ARDI', i.e. with a combined PCA
Expand All @@ -201,7 +201,7 @@ def ipca(*all_args: List, **all_kwargs: dict):
'ARDI', 'RADI' and 'RARDI'.
thr: float or 'auto', opt
Minimum threshold used to identify significant signals in the PCA image
obtained at each iteration, according to ``thr_mode``.
obtained at each iteration, according to ``thr_mode``.
thr_mode: str {'STIM', 'abs'}, opt
How the threshold is expressed: whether based on the STIM map ('STIM')
or expressed as absolute pixel intensity threshold ('abs'). The optimal
Expand Down Expand Up @@ -615,9 +615,9 @@ def _blurring_3d(array, mask_center_sz, fwhm_sz=2):
pca_params['ncomp'] = final_ncomp[0]
pca_params['cube'] = cube_tmp
pca_params['cube_ref'] = cube_ref_tmp

res = pca(**pca_params, **rot_options)

frame = res[0]
residuals_cube = res[-2]
residuals_cube_ = res[-1]
Expand Down
2 changes: 1 addition & 1 deletion src/vip_hci/invprob/andromeda.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def andromeda(*all_args: List, **all_kwargs: dict):
by ``roa * annuli_width``.
``roa`` is forced to ``1`` when ``opt_method="no"`` is chosen.
IDL parameter: ``RATIO_OPT_AREA_INPUT``
opt_method : {'no', 'total', 'lsq', 'robust'}, optional
opt_method : {'no', 'total', 'lsq', 'l1'}, optional
Method used to balance for the flux difference that exists between the
two subtracted annuli in an optimal way during ADI.
IDL parameter: ``OPT_METHOD_ANG_INPUT``
Expand Down
9 changes: 5 additions & 4 deletions src/vip_hci/invprob/utils_andro.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@


import numpy as np
from astropy.stats import median_absolute_deviation


def robust_std(x):
Expand All @@ -32,8 +33,8 @@ def robust_std(x):
based on ``LibAndromeda/robust_stddev.pro`` v1.1 2016/02/16

"""
median_absolute_deviation = np.median(np.abs(x - np.median(x)))
return median_absolute_deviation / 0.6745
mad = median_absolute_deviation(x)
return mad / 0.6745


def idl_round(x):
Expand Down Expand Up @@ -84,7 +85,7 @@ def idl_where(array_expression):
returns ``[]``, which is more "pythonic".

"""
res = np.array([i for i, e in enumerate(array_expression.flatten()) if e])
res = np.flatnonzero(array_expression)
return res


Expand Down Expand Up @@ -285,7 +286,7 @@ def calc_psf_shift_subpix(psf, precision):

"""
n = psf.shape[0]
psf_cube = np.zeros((precision+1, precision+1, n, n))
psf_cube = np.empty((precision+1, precision+1, n, n))

for i_column in range(precision+1):
decalx = i_column/precision
Expand Down
Loading
Loading