Skip to content

Commit

Permalink
Merge branch 'topic/default/new_fluiddyn' into 'branch/default'
Browse files Browse the repository at this point in the history
Use fluiddyn 0.6.0

See merge request fluiddyn/fluidimage!70
  • Loading branch information
paugier committed Mar 4, 2024
2 parents 53f06a0 + 9f85837 commit cfdc8c8
Show file tree
Hide file tree
Showing 28 changed files with 358 additions and 296 deletions.
2 changes: 1 addition & 1 deletion .hgignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ image_samples/4th_PIV-Challenge_Case_E/E_Calibration_Images/Camera_0*/calib*.npz
image_samples/Milestone/Images_many*

image_samples/Karman/Images.civ/*
image_samples/Karman/Images.*_example*
image_samples/*/Images.*_example*

.coverage/*

Expand Down
16 changes: 13 additions & 3 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,26 @@
See also the
[unreleased changes](https://foss.heptapod.net/fluiddyn/fluidimage/-/compare/0.3.0...branch%2Fdefault).

## [0.3.0] (unpublished)
## [0.3.0] (2024-03-04)

This will be a big breaking release.
```{warning}
This version contains incompatible API changes documented here.
```

### Removed

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

### Changed

- Better default for `params.series.str_subset` (`"pairs"` for PIV),
`params.series.ind_start` (`"first"`), `params.preproc.series.str_subset` (`"all1by1"`)
and `params.preproc.series.ind_first` (`"first"`).

### Added

- Module {mod}`fluidimage.piv` to import the PIV classes `Work` and `Topology`.
Expand Down
1 change: 0 additions & 1 deletion doc/examples/im2im_parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
params.args_init = ((1024, 2048), "clip")

params.images.path = "../../image_samples/Jet/Images/c*"
params.images.str_subset = "60:,:"

params.saving.postfix = "im2im_example"
params.saving.how = "recompute"
Expand Down
1 change: 0 additions & 1 deletion doc/examples/optflow_parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
params = Topology.create_default_params()

params.series.path = get_path_image_samples() / "Karman/Images"
params.series.ind_start = 1
params.series.ind_step = 2

# params.features._print_doc()
Expand Down
1 change: 0 additions & 1 deletion doc/examples/piv_parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
params = Topology.create_default_params()

params.series.path = get_path_image_samples() / "Karman/Images"
params.series.ind_start = 1
params.series.ind_step = 2

params.piv0.shape_crop_im0 = 32
Expand Down
1 change: 0 additions & 1 deletion doc/examples/preproc_parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

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

p_tools = params.preproc.tools

Expand Down
13 changes: 4 additions & 9 deletions doc/tutorials/tuto_piv.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jupytext:
format_version: 0.13
jupytext_version: 1.16.1
kernelspec:
display_name: Python 3
display_name: Python 3 (ipykernel)
language: python
name: python3
---
Expand All @@ -29,9 +29,7 @@ path_src = get_path_image_samples() / "Karman/Images"
postfix = "doc_piv_ipynb"
```

```{raw-cell}
We first import the class :class:`fluidimage.topologies.piv.TopologyPIV`.
```
We first import the class {class}`fluidimage.topologies.piv.TopologyPIV`.

```{code-cell} ipython3
from fluidimage.piv import Topology
Expand Down Expand Up @@ -59,7 +57,6 @@ We can of course modify these parameters. An error will be raised if we accident

```{code-cell} ipython3
params.series.path = str(path_src)
params.series.ind_start = 1
params.piv0.shape_crop_im0 = 64
params.multipass.number = 2
Expand All @@ -69,9 +66,7 @@ params.saving.how = 'recompute'
params.saving.postfix = postfix
```

```{raw-cell}
In order to run the PIV computation, we have to instanciate an object of the class :class:`fluidimage.topologies.piv.TopologyPIV`.
```
In order to run the PIV computation, we have to instanciate an object of the class {class}`fluidimage.topologies.piv.TopologyPIV`.

```{code-cell} ipython3
topology = Topology(params)
Expand Down Expand Up @@ -153,7 +148,7 @@ with h5py.File("piv_01-02.h5", "r") as file:
```

```{raw-cell}
Moreover, the final result of this PIV computation can also be manipulated and visualized using :class:`fluidimage.postproc.vector_field.VectorFieldOnGrid`:
Moreover, the final result of this PIV computation can also be manipulated and visualized using {class}`fluidimage.postproc.vector_field.VectorFieldOnGrid`:
```

```{code-cell} ipython3
Expand Down
357 changes: 184 additions & 173 deletions pdm.lock

Large diffs are not rendered by default.

105 changes: 87 additions & 18 deletions pixi.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ test = "export OMP_NUM_THREADS=1 && pytest src -v"
[dependencies]
python = ">=3.9,<3.11"
numpy = ">=1.26.3"
transonic = ">=0.6.1,<0.7"
fluiddyn = ">=0.5.4,<0.6"
transonic = ">=0.6.1"
fluiddyn = ">=0.6.0"
h5netcdf = ">=1.3.0"
h5py = ">=3.10.0"
matplotlib = ">=3.3"
Expand Down
6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ dependencies = [
"h5py",
"h5netcdf",
"transonic>=0.6.2",
"fluiddyn",
"fluiddyn >=0.6.0",
"pyfftw >= 0.10.4",
"imageio",
"scikit-image >= 0.12.3",
Expand Down Expand Up @@ -171,3 +171,7 @@ extend-exclude = "/(__pythran__|__python__|__numba__|build|doc/_build|\\.ipynb_c
profile = "black"
line_length = 82
src_paths = ["src", "doc"]


[tool.pytest.ini_options]
addopts = "--pdbcls=IPython.terminal.debugger:TerminalPdb"
40 changes: 12 additions & 28 deletions src/fluidimage/data_objects/piv.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,35 +33,19 @@
from .display_piv import DisplayPIV


def get_str_index(serie, i, index):
if serie._from_movies and i == serie.nb_indices - 1:
return str(index)

if serie._index_types[i] == "digit":
code_format = "{:0" + str(serie._index_lens[i]) + "d}"
str_index = code_format.format(index)
elif serie._index_types[i] == "alpha":
if index > 25:
raise ValueError('"alpha" index larger than 25.')

str_index = chr(ord("a") + index)
else:
raise Exception('The type should be "digit" or "alpha".')

return str_index


def get_name_piv(serie, prefix="piv"):
index_slices = serie.get_index_slices()
slicing_tuples = serie.get_slicing_tuples()
str_indices = ""
for i, inds in enumerate(index_slices):
for idim, inds in enumerate(slicing_tuples):
index = inds[0]
str_index = get_str_index(serie, i, index)
str_index = serie.get_str_for_name_from_idim_idx(idim, index)
if len(inds) > 1:
str_index += "-" + get_str_index(serie, i, inds[1] - 1)
str_index += "-" + serie.get_str_for_name_from_idim_idx(
idim, inds[1] - 1
)

if i > 1:
str_indices += serie._index_separators[i - 1]
if idim > 1:
str_indices += serie.get_index_separators[idim - 1]
str_indices += str_index

name = prefix + "_" + str_indices + ".h5"
Expand Down Expand Up @@ -789,12 +773,12 @@ def _get_name(self, kind):

serie = self.couple.serie

str_ind0 = serie._compute_strindices_from_indices(
*[inds[0] for inds in serie.get_index_slices()]
str_ind0 = serie.compute_str_indices_from_indices(
*[inds[0] for inds in serie.get_slicing_tuples()]
)

str_ind1 = serie._compute_strindices_from_indices(
*[inds[1] - 1 for inds in serie.get_index_slices()]
str_ind1 = serie.compute_str_indices_from_indices(
*[inds[1] - 1 for inds in serie.get_slicing_tuples()]
)

name = "piv_" + serie.base_name + str_ind0 + "-" + str_ind1 + "_light.h5"
Expand Down
Loading

0 comments on commit cfdc8c8

Please sign in to comment.