diff --git a/CHANGES.md b/CHANGES.md index 1f9578d4..04eb1347 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,7 +1,14 @@ # Release notes See also the -[unreleased changes](https://foss.heptapod.net/fluiddyn/fluidimage/-/compare/0.4.5...branch%2Fdefault). +[unreleased changes](https://foss.heptapod.net/fluiddyn/fluidimage/-/compare/0.5.0...branch%2Fdefault). + +## [0.5.0] (2024-05-0?) + +- UVmat compatibility (launching in "local" mode). +- Change defaults and exact meaning for parameters. `params.multipass.smoothing_coef` + (=2) and `params.multipass.threshold_tps` (=1.5). +- PIV saving: use float32 and save "smooth" displacement fields. ## [0.4.6] (2024-04-20) @@ -203,3 +210,4 @@ This version contains incompatible API changes documented here. [0.4.4]: https://foss.heptapod.net/fluiddyn/fluidimage/-/compare/0.4.3...0.4.4 [0.4.5]: https://foss.heptapod.net/fluiddyn/fluidimage/-/compare/0.4.4...0.4.5 [0.4.6]: https://foss.heptapod.net/fluiddyn/fluidimage/-/compare/0.4.5...0.4.6 +[0.5.0]: https://foss.heptapod.net/fluiddyn/fluidimage/-/compare/0.4.6...0.5.0 diff --git a/doc/autosum.rst b/doc/autosum.rst index 1975abf1..446bd416 100644 --- a/doc/autosum.rst +++ b/doc/autosum.rst @@ -1,6 +1,8 @@ API reference ------------- +Fluidimage contains the following subpackages + .. autosummary:: :toctree: _generated/ @@ -9,13 +11,29 @@ API reference fluidimage.data_objects fluidimage.works fluidimage.calcul - fluidimage.bos - fluidimage.optical_flow - fluidimage.piv - fluidimage.preproc - fluidimage.image2image fluidimage.calibration fluidimage.reconstruct fluidimage.postproc fluidimage.util fluidimage.gui + +We have also few utility modules: + +.. autosummary:: + :toctree: _generated/ + + fluidimage.config + fluidimage.run_from_xml + fluidimage.synthetic + fluidimage.uvmat + +Finally, there are few modules to improve the API for common processing: + +.. autosummary:: + :toctree: _generated/ + + fluidimage.bos + fluidimage.optical_flow + fluidimage.piv + fluidimage.preproc + fluidimage.image2image diff --git a/pixi.toml b/pixi.toml index 75eef6dd..380713ff 100644 --- a/pixi.toml +++ b/pixi.toml @@ -7,7 +7,7 @@ platforms = ["linux-64", "win-64", "osx-64", "osx-arm64"] # use as `pixi run install-editable` install-dependencies = "pixi install" install-editable = {cmd = "pip install -e . -v --no-build-isolation --no-deps", depends_on = ["install-dependencies"]} -test = "export OMP_NUM_THREADS=1 && pytest src -v" +test = "export OMP_NUM_THREADS=1 && pytest src -v -s" [dependencies] python = ">=3.9,<3.11" diff --git a/pyproject.toml b/pyproject.toml index fe1a6804..01cb0ac2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ build-backend = 'mesonpy' [project] name = "fluidimage" -version = "0.4.6" +version = "0.5.0" description = "Fluid image processing with Python." authors = [ {name = "Pierre Augier", email = "pierre.augier@legi.cnrs.fr"}, diff --git a/src/fluidimage/config.py b/src/fluidimage/config.py index 6ef94a5d..a8161e23 100644 --- a/src/fluidimage/config.py +++ b/src/fluidimage/config.py @@ -1,15 +1,19 @@ +"""Handle Fluidimage configuration""" + import os from configparser import ConfigParser def get_config(): + """Get configuration from .fluidimagerc""" config = ConfigParser() home = os.path.expanduser("~") path_config = os.path.join(home, ".fluidimagerc") - if os.path.exists(path_config): - config.read(path_config) + if not os.path.exists(path_config): + return {} + config.read(path_config) config_dict = {} for section in config.sections(): diff --git a/src/fluidimage/executors/base.py b/src/fluidimage/executors/base.py index 3231c858..9490a86a 100644 --- a/src/fluidimage/executors/base.py +++ b/src/fluidimage/executors/base.py @@ -453,6 +453,7 @@ def handler_signals(signal_number, stack): signal.signal(12, handler_signals) self._start_processes() + self.nb_processes = len(self.processes) self._wait_for_all_processes() self._finalize_compute() diff --git a/src/fluidimage/synthetic.py b/src/fluidimage/synthetic.py index b62037fd..af4ca158 100644 --- a/src/fluidimage/synthetic.py +++ b/src/fluidimage/synthetic.py @@ -1,3 +1,5 @@ +"""Production of synthetic images""" + import numpy as np @@ -9,6 +11,7 @@ def make_synthetic_images( epsilon=0.0, part_size=np.sqrt(1 / 0.5), ): + """Produce synthetic images for testing PIV""" ny, nx = tuple(shape_im0) displacement_x, displacement_y = tuple(displacements) diff --git a/src/fluidimage/topologies/piv.py b/src/fluidimage/topologies/piv.py index 1ff84dee..51599e49 100644 --- a/src/fluidimage/topologies/piv.py +++ b/src/fluidimage/topologies/piv.py @@ -244,9 +244,14 @@ def make_text_at_exit(self, time_since_start): except AttributeError: nb_results = None if nb_results is not None and nb_results > 0: + try: + num_processes = self.executor.nb_processes + except AttributeError: + num_processes = self.executor.nb_max_workers + num_cores_used = min(nb_cores, num_processes) txt += ( f" ({nb_results} piv fields, {time_since_start / nb_results:.2f} s/field," - f" {time_since_start * nb_cores / nb_results:.2f} s.CPU/field)." + f" {time_since_start * num_cores_used / nb_results:.2f} s.CPU/field)." ) else: txt += "."