Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated README, CI tests and requirements to drop support to 3.7 but include support to 3.11 #610

Merged
merged 7 commits into from
Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11"]
group: [1, 2, 3]

steps:
Expand Down
95 changes: 40 additions & 55 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,16 @@ VIP - Vortex Image Processing package
Introduction
------------

``VIP`` is a python package for high-contrast imaging of exoplanets and circumstellar disks.
``VIP`` is compatible with Python 3.7, 3.8 and 3.9 (Python 2 compatibility dropped with ``VIP`` 0.9.9).
VIP is a python package for high-contrast imaging of exoplanets and circumstellar disks.
VIP is compatible with Python 3.8, 3.9, 3.10 and 3.11 (Python 2 compatibility dropped with VIP 0.9.9, and Python 3.7 compatibility dropped with VIP 1.4.3).

The goal of ``VIP`` is to integrate open-source, efficient, easy-to-use and
The goal of VIP is to integrate open-source, efficient, easy-to-use and
well-documented implementations of high-contrast image processing algorithms to
the interested scientific community. The main repository of ``VIP`` resides on
the interested scientific community. The main repository of VIP resides on
`GitHub <https://github.com/vortex-exoplanet/VIP>`_, the standard for scientific
open source code distribution, using Git as a version control system.

Most of ``VIP``'s functionalities are mature but
Most of VIP's functionalities are mature but
it does not mean it is free from bugs. The code is continuously evolving and
therefore feedback/contributions are greatly appreciated. Please refer to `these instructions <https://vip.readthedocs.io/en/latest/Contact.html>`_ if you want to report
a bug, ask a question, suggest a new functionality or contribute to the code (the latter is particularly welcome)!
Expand All @@ -69,12 +69,12 @@ a bug, ask a question, suggest a new functionality or contribute to the code (th

Documentation
-------------
The documentation for ``VIP`` can be found here: http://vip.readthedocs.io.
The documentation for VIP can be found here: http://vip.readthedocs.io.


Jupyter notebook tutorial
-------------------------
Tutorials, in the form of Jupyter notebooks, showcasing ``VIP``'s usage and
Tutorials, in the form of Jupyter notebooks, showcasing VIP's usage and
other resources such as test datasets are available in the
``VIP-extras`` `repository <https://github.com/vortex-exoplanet/VIP_extras>`_.
**In order to execute the notebook tutorials, you will have to download or clone the VIP-extras repository, and open each tutorial locally with jupyter notebook.**
Expand All @@ -97,53 +97,52 @@ TL;DR setup guide
Installation and dependencies
-----------------------------
The benefits of using a Python package manager (distribution), such as
(ana)conda or Canopy, are many. Mainly, it brings easy and robust package
(ana)conda, are many. Mainly, it brings easy and robust package
management and avoids messing up with your system's default python. An
alternative is to use package managers like apt-get for Ubuntu or
Homebrew/MacPorts/Fink for macOS. We recommend using
`Miniconda <https://conda.io/miniconda>`_.

``VIP`` depends on existing packages from the Python ecosystem, such as
VIP depends on existing packages from the Python ecosystem, such as
``numpy``, ``scipy``, ``matplotlib``, ``pandas``, ``astropy``, ``scikit-learn``,
``scikit-image``, ``photutils`` and others. There are different ways of
installing ``VIP`` suitable for different scenarios.
installing VIP suitable for different scenarios.


Using pip
^^^^^^^^^
The easiest way to install ``VIP`` is through the Python Package Index, aka
`PyPI <https://pypi.org/>`_, with the ``pip`` package manager. Simply run:
Before installing the package, it is **highly recommended to create a dedicated
conda environment** to not mess up with the package versions in your base
environment. This can be done easily with (replace ``vipenv`` by the name you want
for your environment):

.. code-block:: bash

$ pip install vip_hci

With ``pip`` you can easily uninstall, upgrade or install a specific version of
``VIP``. For upgrading the package run:
$ conda create -n vipenv python=3.10 ipython

.. code-block:: bash
.. note::
Installing ipython while creating the environment, as in the example above, will
avoid a commonly reported issue which stems from trying to import VIP from
within a base python2.7 ipython console.

$ pip install --upgrade vip_hci

Alternatively, you can use ``pip install`` and point to the GitHub repo:
For users (not planning to contribute):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Once within your new environment, the easiest way to install VIP is
through the Python Package Index, aka `PyPI <https://pypi.org/>`_, with
the ``pip`` package manager. Simply run:

.. code-block:: bash

$ pip install git+https://github.com/vortex-exoplanet/VIP.git
$ pip install vip_hci

Using the setup.py file
^^^^^^^^^^^^^^^^^^^^^^^
You can download ``VIP`` from its GitHub repository as a zip file. A ``setup.py``
file (setuptools) is included in the root folder of ``VIP``. Enter the package's
root folder and run:
With ``pip`` you can easily uninstall, upgrade or install a specific version of
VIP. For upgrading the package, run:

.. code-block:: bash

$ python setup.py install
$ pip install --upgrade vip_hci


Using Git
^^^^^^^^^
For potential contributors:
^^^^^^^^^^^^^^^^^^^^^^^^^^^
If you plan to contribute or experiment with the code you need to make a
fork of the repository (click on the fork button in the top right corner) and
clone it:
Expand All @@ -159,26 +158,13 @@ functionalities by cloning the repository (but will not be able to contribute):

$ git clone https://github.com/vortex-exoplanet/VIP.git

Before installing the package, it is highly recommended to create a dedicated
conda environment to not mess up with the package versions in your base
environment. This can be done easily with (replace vipenv by the name you want
for your environment):

.. code-block:: bash

$ conda create -n vipenv python=3.9 ipython

Note: installing ipython while creating the environment with the above line will
avoid a commonly reported issue which stems from trying to import VIP from
within a base python2.7 ipython console.

To install VIP, simply cd into the VIP directory and run the setup file
in 'develop' mode:
To install VIP, then simply cd into your local VIP directory and run the installation in editable mode:

.. code-block:: bash

$ cd VIP
$ python setup.py develop
$ pip install -e .

If cloned from your fork, make sure to link your VIP directory to the upstream
source, to be able to easily update your local copy when a new version comes
Expand All @@ -194,26 +180,25 @@ also install the optional dependencies listed below.

Optional dependencies
^^^^^^^^^^^^^^^^^^^^^
The following dependencies are not automatically installed upon installation of ``VIP`` but may significantly improve your experience:
The following dependencies are not automatically installed upon installation of VIP but may significantly improve your experience:

- ``VIP`` contains a class ``vip_hci.vip_ds9`` that enables, through ``pyds9``, the interaction with a DS9 window (displaying numpy arrays, controlling the display options, etc). To enable this feature, ``pyds9`` must be installed from the latest development version: ``pip install git+git://github.com/ericmandel/pyds9.git#egg=pyds9``
- ``VIP`` image operations (e.g. shifts, rotations, scaling) can be performed using ``OpenCV`` instead of the default FFT-based methods. While flux are less well preserved, ``OpenCV`` offers a significant speed improvement (up to a factor 50x), in particular for image rotations, which can be useful to get quick results. Installation: ``pip install opencv-python``.
- VIP contains a class ``vip_hci.vip_ds9`` that enables, through ``pyds9``, the interaction with a DS9 window (displaying numpy arrays, controlling the display options, etc). To enable this feature, ``pyds9`` must be installed from the latest development version: ``pip install git+git://github.com/ericmandel/pyds9.git#egg=pyds9``
- VIP image operations (e.g. shifts, rotations, scaling) can be performed using ``OpenCV`` instead of the default FFT-based methods. While flux are less well preserved, ``OpenCV`` offers a significant speed improvement (up to a factor 50x), in particular for image rotations, which can be useful to get quick results. Installation: ``pip install opencv-python``.
- Also, you can install the Intel Math Kernel Library (``mkl``) optimizations (provided that you have a recent version of ``conda``) or ``openblas`` libraries. Either of them can be installed with ``conda install``.
- ``VIP`` offers the possibility of computing SVDs on GPU by using ``CuPy`` (starting from version 0.8.0) or ``PyTorch`` (from version 0.9.2). These remain as optional requirements, to be installed by the user, as well as a proper CUDA environment (and a decent GPU card).
- VIP offers the possibility of computing SVDs on GPU by using ``CuPy`` (starting from version 0.8.0) or ``PyTorch`` (from version 0.9.2). These remain as optional requirements, to be installed by the user, as well as a proper CUDA environment (and a decent GPU card).
- Finally, bad pixel correction routines can be optimised with ``Numba``, which converts some Python code, particularly ``NumPy``, into fast machine code. A factor up to ~50x times speed improvement can be obtained on large images compared to NumPy. Numba can be installed with ``conda install numba``.


Loading VIP
^^^^^^^^^^^
Finally, start Python (or IPython or a Jupyter notebook if you prefer) and check
that you are able to import ``VIP``:
that you are able to import VIP:

.. code-block:: python

import vip_hci as vip

If everything went fine with the installation, you will see a welcome message.
Now you can start finding exoplanets!
If everything went fine with the installation, you should not get any error message upon importation, and you can start finding exoplanets!


Image conventions
Expand Down Expand Up @@ -242,13 +227,13 @@ If you wish to be kept informed about major VIP updates and on-going/future deve
Attribution
-----------

``VIP`` started as the effort of `Carlos Alberto Gomez Gonzalez <https://github.com/carlos-gg>`_,
VIP started as the effort of `Carlos Alberto Gomez Gonzalez <https://github.com/carlos-gg>`_,
a former PhD student of `PSILab <https://sites.google.com/site/olivierabsil/psilab>`_
(ULiege, Belgium), who has led the development of VIP from 2015 to 2020.
Maintenance and current development is now led by `Valentin Christiaens <https://github.com/VChristiaens>`_.
VIP benefitted from contributions made by collaborators from several teams, including: Ralf Farkas, Julien Milli, Olivier Wertz, Henry Ngo, Alan Rainot, Gary Ruane, Corentin Doco, Miles Lucas, Gilles Orban de Xivry, Lewis Picker, Faustine Cantalloube, Iain Hammond, Christian Delacroix, Arthur Vigan, Dimitri Mawet and Olivier Absil.
More details about the respective contributions are available `here <https://github.com/vortex-exoplanet/VIP/graphs/contributors?from=2015-07-26&to=2022-03-29&type=a>`_.

Please cite `Gomez Gonzalez et al. (2017) <https://ui.adsabs.harvard.edu/abs/2017AJ....154....7G/abstract>`_ and `Christiaens et al. (2023) <https://ui.adsabs.harvard.edu/abs/2023JOSS....8.4774C/abstract>`_ whenever
you publish data reduced with ``VIP`` (Astrophysics Source Code Library reference `ascl:1603.003`).
you publish data reduced with VIP (Astrophysics Source Code Library reference `ascl:1603.003`).
In addition, please cite the relevant publication(s) for the algorithms you use within VIP (usually mentioned in the documentation, e.g. `Marois et al. 2006 <https://ui.adsabs.harvard.edu/abs/2006ApJ...641..556M/abstract>`_ for median-ADI).
5 changes: 2 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ emcee==2.2.1
nestle
corner
pandas
matplotlib<=3.4.3
matplotlib
psutil
pyprind
munch
nbsphinx
hciplot>=0.2.4
typing
dataclass_builder
urllib3 < 2.0
dataclass_builder
2 changes: 1 addition & 1 deletion vip_hci/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "1.4.2"
__version__ = "1.4.3"


from . import preproc
Expand Down
7 changes: 1 addition & 6 deletions vip_hci/config/utils_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import numpy as np

import itertools as itt
from inspect import getargspec, signature, Parameter
from inspect import signature, Parameter
from functools import wraps
import multiprocessing
from vip_hci import __version__
Expand Down Expand Up @@ -246,11 +246,6 @@ def wrapper(self, *args, **kwargs):

# get the kwargs the fkt sees. Note that this is a combination of
# the *default* kwargs and the kwargs *passed* by the user
"""Note : this is deprecated for a while now, and signature should be
the only way to do this task. See below."""
# a = getargspec(fkt)
# all_kwargs = dict(zip(a.args[-len(a.defaults):], a.defaults))
# all_kwargs.update(kwargs)
sig = signature(fkt)
params = sig.parameters
all_kwargs = {
Expand Down
17 changes: 9 additions & 8 deletions vip_hci/metrics/detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,8 @@ def print_abort():
xx_final = np.array(xx_final)
yy_out = np.array(yy_out)
xx_out = np.array(xx_out)
table = pn.DataFrame({'y': yy_final.tolist(), 'x': xx_final.tolist(), 'px_snr': snr_final})
table = pn.DataFrame(
{'y': yy_final.tolist(), 'x': xx_final.tolist(), 'px_snr': snr_final})

if plot:
coords = tuple(zip(xx_out.tolist() + xx_final.tolist(),
Expand Down Expand Up @@ -440,12 +441,12 @@ def peak_coordinates(obj_tmp, fwhm, approx_peak=None, search_box=None,
med_filt_tmp = frame_filter_lowpass(obj_tmp, 'median',
median_size=int(fwhm))
if approx_peak is None:
ind_max = np.unravel_index(med_filt_tmp.argmax(),
ind_max = np.unravel_index(np.nanargmax(med_filt_tmp),
med_filt_tmp.shape)
else:
sbox = med_filt_tmp[approx_peak[0]-sbox_y:approx_peak[0]+sbox_y+1,
approx_peak[1]-sbox_x:approx_peak[1]+sbox_x+1]
ind_max_sbox = np.unravel_index(sbox.argmax(), sbox.shape)
ind_max_sbox = np.unravel_index(np.nanargmax(sbox), sbox.shape)
ind_max = (approx_peak[0]-sbox_y+ind_max_sbox[0],
approx_peak[1]-sbox_x+ind_max_sbox[1])

Expand All @@ -462,23 +463,23 @@ def peak_coordinates(obj_tmp, fwhm, approx_peak=None, search_box=None,
med_filt_tmp[zz] = frame_filter_lowpass(obj_tmp[zz], 'median',
median_size=int(fwhm[zz]))
if approx_peak is None:
ind_ch_max[zz] = np.unravel_index(med_filt_tmp[zz].argmax(),
ind_ch_max[zz] = np.unravel_index(np.nanargmax(med_filt_tmp[zz]),
med_filt_tmp[zz].shape)
else:
sbox[zz] = med_filt_tmp[zz, approx_peak[0]-sbox_y:
approx_peak[0]+sbox_y+1,
approx_peak[1]-sbox_x:
approx_peak[1]+sbox_x+1]
ind_max_sbox = np.unravel_index(sbox[zz].argmax(),
ind_max_sbox = np.unravel_index(np.nanargmax(sbox[zz]),
sbox[zz].shape)
ind_ch_max[zz] = (approx_peak[0]-sbox_y+ind_max_sbox[0],
approx_peak[1]-sbox_x+ind_max_sbox[1])

if approx_peak is None:
ind_max = np.unravel_index(med_filt_tmp.argmax(),
ind_max = np.unravel_index(np.nanargmax(med_filt_tmp),
med_filt_tmp.shape)
else:
ind_max_tmp = np.unravel_index(sbox.argmax(),
ind_max_tmp = np.unravel_index(np.nanargmax(sbox),
sbox.shape)
ind_max = (ind_max_tmp[0]+approx_peak[0]-sbox_y,
ind_max_tmp[1]+approx_peak[1]-sbox_x)
Expand Down Expand Up @@ -561,4 +562,4 @@ def mask_sources(mask, ap_rad):
rad_arr = dist_matrix(ny, cx=s_coords[1][s], cy=s_coords[0][s])
mask_out[np.where(rad_arr < ap_rad)] = 0

return mask_out
return mask_out