Skip to content

Commit

Permalink
V0.2.0 and update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
paugier committed Feb 19, 2024
1 parent f804afc commit ca02030
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 89 deletions.
12 changes: 5 additions & 7 deletions doc/build-from-source.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,9 @@ Let us first present the tools used for Fluidimage development.
- [Transonic] is a pure Python package to accelerate modern Python-Numpy code with
different accelerators (in particular Pythran).

Fluidimage is built with [Meson]. We use [PDM] for Fluidimage development. [Pytest]
and [Nox] are used for testing. We use [Pythran] through [Transonic] to accelerate
some numerical kernels written in Python.
Fluidimage is built with [Meson]. We use [PDM] for Fluidimage development.
[Pytest] and [Nox] are used for testing. We use [Pythran] through [Transonic] to
accelerate some numerical kernels written in Python.

#### Standard Python from Python.org

Expand Down Expand Up @@ -249,10 +249,8 @@ Then, `pip` is available and previous commands should work.

### Run the tests

You can run some unit tests by running `make tests` (shortcut for
`fluidsim-test -v`) or `make tests_mpi` (shortcut for
`mpirun -np 2 fluidsim-test -v`). Alternatively, you can also run `pytest` from
the root directory or from any of the source directories.
You can run some unit tests by running `make tests`. Alternatively, you can also
run `pytest` from the root directory or from any of the source directories.

(pythranrc)=

Expand Down
113 changes: 33 additions & 80 deletions doc/install.md
Original file line number Diff line number Diff line change
@@ -1,102 +1,55 @@
# Installation

See our general advice
[on using Python](https://fluiddyn.readthedocs.io/en/latest/advice_on_Python.html) and
[on installing a good scientific Python environment](https://fluiddyn.readthedocs.io/en/latest/get_good_Python_env.html).
First, ensure that you have a recent Python installed, since Fluidimage requires
Python >= 3.9. Some issues regarding the installation of Python and Python
packages are discussed in
[the main documentation of the project](http://fluiddyn.readthedocs.org/en/latest/install.html).

## The simplest method (with conda)
Here, we describe installation methods that do not involve local compilation. One
can also install Fluidimage from source as described
[here](./build-from-source.md).

The simplest method to install FluidImage is to use `conda` (installed with miniconda)
and the conda-forge channel (activated with the command
`conda config --add channels conda-forge`).
## Install with pip

To just install FluidImage, you can run:
```{note}
```
conda install fluidimage
```

Alternativally, you can install FluidImage in a dedicated conda environment with:
We strongly advice to install Fluidimage in a virtual environment. See the
official guide [Install packages in a virtual environment using pip and
venv](https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/).
```
conda create -n env_fluidimage fluidimage
```

If you use an environment, you will need to activate it with
`conda activate env_fluidimage`.

## Slightly more complicated: with pip, from the package on PyPI or the repository

FluidImage depends on Python >= 3.6 and on Python packages that are today very simple to
install with pip or conda, namely numpy, scipy, matplotlib, h5py, scikit-image, pyfftw
and IPython. You should not care about these dependencies because they are going to be
installed automatically for you.

PyQt5 is used only for some graphical user interfaces, so you need to install it manually
if needed. This can be done with `pip install pyqt5` or `conda install pyqt`.

I would also advice to install Jupyterlab, which interacts nicely with FluidImage.

### To compile, or not to compile?

We choose to use the static Python compiler
[Pythran](https://github.com/serge-sans-paille/pythran) for some numerical functions. Our
microbenchmarks show that the performances are as good as what we are able to get with
Fortran or C++!

We don't upload "wheels" (package with already compiled binaries) on PyPI, so installing
with pip *usually* involves local compilation.

To disable Pythran compilation during build, one can set the environment variable
`DISABLE_PYTHRAN`.

If Pythran is used, you need a C++ compiler (we recommend clang). With conda, it's very
easy to install clang with `conda install clangdev`.

Finally, for better performance, Pythran needs a configuration file with something like
(see the [Pythran documentation](https://pythran.readthedocs.io/en/latest/MANUAL.html)):
Fluidimage can be installed without compilation with `pip`:

```sh
pip install pip -U
pip install fluidimage
```
[pythran]
complex_hook = True

[compiler]
CXX = clang++
CC = clang
```
### Optional dependencies

### Ready? Let's install with pip
Fluidimage has 2 sets of optional dependencies, which can be installed with
commands like `pip install fluidimage[opencv]` or
`pip install fluidimage[opencv, pims]`:

To install the last version of FluidImage uploaded to the Python Package Index:
- `opencv`: [OpenCV](https://opencv.org/) can be used for some algorithms,
- `pims`: [pims: Python Image Sequence](https://github.com/soft-matter/pims) is
used to read `.cine` files.

```
pip install fluidimage -U
```
## Install the conda-forge packages with conda or mamba

However, the project is in an active phase of development so it can be better to use the
last version (from the mercurial repository hosted on Heptapod). Moreover, like that, you
get all examples and tutorials! For FluidImage, we use the revision control software
Mercurial and the main repository is hosted in
<https://foss.heptapod.net/fluiddyn/fluidimage>, so you can get the source with the
command:
We recommend installing `conda` and `mamba` (using the \[conda-forge\] channel)
with the [miniforge installer](https://github.com/conda-forge/miniforge). Then,
one can run:

```sh
mamba install fluidimage
```
hg clone https://foss.heptapod.net/fluiddyn/fluidimage
```

If you are new with Mercurial and Heptapod, you can also read
[this short tutorial](http://fluiddyn.readthedocs.org/en/latest/mercurial_heptapod.html).

If you really can't use Mercurial, you can also just manually download the package from
[the Heptapod page](https://foss.heptapod.net/fluiddyn/fluidimage) or from
[the PyPI page](https://pypi.python.org/pypi/fluidimage).
One can also create a dedicated environment:

To install in development mode:

```
cd fluidimage
pip install -e .
```sh
mamba create -n env_fluidimage fluidimage
```

After the installation, it is a good practice to run the unit tests by running `pytest`
from the root directory.
The environment can then be activated with `conda activate env_fluidimage`.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ build-backend = 'mesonpy'

[project]
name = "fluidimage"
version = "0.2.0rc0"
version = "0.2.0"
description = "Fluid image processing with Python."
authors = [
{name = "Pierre Augier", email = "[email protected]"},
Expand Down
2 changes: 1 addition & 1 deletion try/surface_tracking/works/surface_tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ def sum_frame_from(self, path="./", fn=None):
else:
print("####" + path + "/" + fn)
film = pims.open(str(path) + "/" + fn)
return frame
return film

def get_file(self, path="./", fn=None):
"""read the files in path or a specified file if fn-arg is given"""
Expand Down

0 comments on commit ca02030

Please sign in to comment.