Skip to content

Commit

Permalink
Fix the documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
paugier committed Feb 22, 2024
1 parent b7b499f commit a084c61
Show file tree
Hide file tree
Showing 18 changed files with 63 additions and 23 deletions.
17 changes: 17 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,23 @@
See also the
[unreleased changes](https://foss.heptapod.net/fluiddyn/fluidimage/-/compare/0.2.0...branch%2Fdefault).

## [0.3.9] (unpublished)

This will be a big breaking release.

### Removed

- `strcouple` is replaced by `str_subset`.
- `from fluidimage.preproc import PreprocBase` has to be replaced by
`from fluidimage.preproc import Work`.

### Added

- Module {mod}`fluidimage.piv` to import the PIV class `Work` and `Topology`.
- The work classes {class}`fluidimage.piv.Work` and {class}`fluidimage.preproc.Work`
now have parameters in `params.series` and a method
{func}`fluidimage.work.BaseWorkFromSerie.process_1_serie`.

## [0.2.0] (2024-02-19)

- Python >=3.9,<3.12
Expand Down
3 changes: 2 additions & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
"**.ipynb_checkpoints",
"_jupyter_cache",
"ipynbslides",
"**/.pytest_cache",
]

# The reST default role (used for this markup: `text`) to use for all
Expand Down Expand Up @@ -139,7 +140,7 @@
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
# html_theme_options = {}
html_theme_options = {"navigation_with_keys": False}

# Add any paths that contain custom themes here, relative to this directory.
# html_theme_path = []
Expand Down
2 changes: 1 addition & 1 deletion doc/examples/piv_cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cluster. We need a script for the computation and a script to submit the job.
We call the script for the computation `piv_complete.py`. For idempotent job,
it is important to set `params.saving.how = 'complete'`.

```{literalinclude} piv_complete.py
```{literalinclude} piv_with_topo_complete.py
```

The submission script is quite simple:
Expand Down
2 changes: 1 addition & 1 deletion doc/examples/preproc.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ standard preprocessing to images.
### Preprocessing one serie

To find the good parameter, you can use the class
{class}`fluidimage.preproc.base.PreprocBase` (see also
{class}`fluidimage.work.preproc.Work` (see also
{mod}`fluidimage.preproc`).

```{literalinclude} preproc_try_params.py
Expand Down
9 changes: 5 additions & 4 deletions doc/examples/preproc_with_topology.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from fluidimage import get_path_image_samples
from fluidimage.topologies.preproc import TopologyPreproc
from fluidimage.preproc import Topology

params = TopologyPreproc.create_default_params()
params = Topology.create_default_params()

params.preproc.series.path = get_path_image_samples() / "Jet/Images"
params.preproc.series.str_subset = "i+60:i+62, 0"
params.preproc.series.str_subset = "i,:"
params.preproc.series.ind_start = 60

print("Available preprocessing tools: ", params.preproc.tools.available_tools)
params.preproc.tools.sequence = [
Expand All @@ -25,7 +26,7 @@
params.preproc.tools.global_threshold.enable = True
params.preproc.tools.global_threshold.minima = 0.0

topology = TopologyPreproc(params, logging_level="info")
topology = Topology(params, logging_level="info", nb_max_workers=4)

# Compute in parallel
topology.compute()
Expand Down
4 changes: 3 additions & 1 deletion src/fluidimage/preproc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
:toctree:
toolbox
image2image
_toolbox_cv
_toolbox_py
io
"""

Expand Down
7 changes: 4 additions & 3 deletions src/fluidimage/preproc/_toolbox_cv.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"""Preprocess toolbox (:mod:`fluidimage.pre_proc._toolbox_cv`)
==============================================================
"""Preprocess toolbox
=====================
A toolbox for preprocessing images. Based on OpenCV library.
cf. http://www.opencv.org.cn/opencvdoc/2.3.2/html/modules/imgproc/doc/filtering.html
.. currentmodule:: fluidimage.pre_proc._toolbox_cv
.. currentmodule:: fluidimage.preproc._toolbox_cv
Provides:
Expand Down
5 changes: 3 additions & 2 deletions src/fluidimage/preproc/_toolbox_py.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Preprocess toolbox (:mod:`fluidimage.preproc._toolbox_py`)
==========================================================
"""Preprocess toolbox
=====================
A toolbox for preprocessing images.
Utilizes functions available from `scipy.ndimage` and `skimage` packages.
cf. http://www.scipy-lectures.org/advanced/image_processing/
Expand Down
4 changes: 2 additions & 2 deletions src/fluidimage/preproc/io.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Handles I/O of images to tools(:mod:`fluidimage.preproc.io`)
===============================================================
"""Handles I/O of images to tools
=================================
Provides decorators to handle input and output of images for tools/functions in
:mod:`fluidimage.preproc.toolbox`.
Expand Down
4 changes: 2 additions & 2 deletions src/fluidimage/preproc/toolbox.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Preprocess toolbox (:mod:`fluidimage.preproc.toolbox`)
=========================================================
"""Preprocess toolbox
=====================
A toolbox of filters which operate on a single image (numpy array).
cf. http://www.scipy-lectures.org/advanced/image_processing/
Expand Down
4 changes: 3 additions & 1 deletion src/fluidimage/topologies/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,14 @@ class TopologyBase:
"""

_short_name = "base"

@classmethod
def _add_default_params_saving(cls, params):

params._set_child(
"saving",
attribs={"path": None, "how": "ask", "postfix": "piv"},
attribs={"path": None, "how": "ask", "postfix": cls._short_name},
doc="""Saving of the results.
path : None or str
Expand Down
4 changes: 3 additions & 1 deletion src/fluidimage/topologies/bos.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ class TopologyBOS(TopologyBase):
"""

_short_name = "bos"

@classmethod
def create_default_params(cls):
"""Class method returning the default parameters.
Expand Down Expand Up @@ -102,7 +104,7 @@ def create_default_params(cls):
"""
)

TopologyBase._add_default_params_saving(params)
super()._add_default_params_saving(params)
params.saving.postfix = "bos"

WorkPIV._complete_params_with_default(params)
Expand Down
2 changes: 2 additions & 0 deletions src/fluidimage/topologies/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ class TopologyExample(TopologyBase):
"""

_short_name = "example"

@classmethod
def create_default_params(cls):
params = dict(
Expand Down
2 changes: 2 additions & 0 deletions src/fluidimage/topologies/image2image.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ class TopologyImage2Image(TopologyBase):
"""

_short_name = "im2im"

@classmethod
def create_default_params(cls):
"""Class method returning the default parameters.
Expand Down
2 changes: 1 addition & 1 deletion src/fluidimage/topologies/optical_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class TopologyOpticalFlow(TopologyPIV):
"""Optical flow topology (Lukas Kanade method)"""

WorkVelocimetry = WorkOpticalFlow
_short_name = "optflow"

@classmethod
def create_default_params(cls):
Expand All @@ -34,7 +35,6 @@ def create_default_params(cls):
"""

params = super().create_default_params()
params.saving.postfix = "optflow"
return params


Expand Down
4 changes: 3 additions & 1 deletion src/fluidimage/topologies/piv.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ class TopologyPIV(TopologyBase):
"""

_short_name = "piv"

WorkVelocimetry = WorkPIV

@classmethod
Expand All @@ -64,7 +66,7 @@ def create_default_params(cls):
"""
params = ParamContainer(tag="params")

TopologyBase._add_default_params_saving(params)
super()._add_default_params_saving(params)

cls.WorkVelocimetry._complete_params_with_default(params)

Expand Down
7 changes: 6 additions & 1 deletion src/fluidimage/topologies/preproc.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ class TopologyPreproc(TopologyBase):
"""

_short_name = "pre"

@classmethod
def create_default_params(cls, backend="python"):
"""Class method returning the default parameters.
Expand Down Expand Up @@ -120,7 +122,7 @@ def create_default_params(cls, backend="python"):
"""
)

TopologyBase._add_default_params_saving(params.preproc)
super()._add_default_params_saving(params.preproc)

params.preproc.saving._set_attribs(
{
Expand Down Expand Up @@ -332,6 +334,9 @@ def fill_subsets_of_names_and_paths(
for name, path in subset.get_name_path_arrays():
queue_paths[name] = path

print(f"{queue_subsets_of_names = }")
print(f"{queue_paths}")

def make_subsets(self, input_queues: Tuple[Dict], output_queue: Dict) -> bool:
"""Create the subsets of images"""
queue_subsets_of_names, queue_arrays = input_queues
Expand Down
4 changes: 3 additions & 1 deletion src/fluidimage/topologies/surface_tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ class TopologySurfaceTracking(TopologyBase):
"""

_short_name = "surf"

@classmethod
def create_default_params(cls):
"""Class method returning the default parameters."""
Expand Down Expand Up @@ -99,7 +101,7 @@ def create_default_params(cls):
"""
)

TopologyBase._add_default_params_saving(params)
super()._add_default_params_saving(params)

params._set_internal_attr(
"_value_text",
Expand Down

0 comments on commit a084c61

Please sign in to comment.