From 4f6caeba5db8522281c33b4713fe85728afe1113 Mon Sep 17 00:00:00 2001 From: Matthias Probst Date: Thu, 21 Mar 2024 10:57:33 +0100 Subject: [PATCH] version update --- codemeta.json | 2 +- setup.cfg | 2 +- synpivimage/gui/core.py | 2 +- synpivimage/io.py | 9 +++++---- synpivimage/utils.py | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/codemeta.json b/codemeta.json index 1689d9d..699ac4d 100644 --- a/codemeta.json +++ b/codemeta.json @@ -4,7 +4,7 @@ "license": "https://spdx.org/licenses/MIT", "codeRepository": "https://github.com/MatthiasProbst/synpivimage", "name": "synpivimage", - "version": "1.0.0a2", + "version": "1.0.0a3", "description": "Tool to build synthetic Particle Image Velocimetry (PIV) images", "applicationCategory": "Engineering", "programmingLanguage": [ diff --git a/setup.cfg b/setup.cfg index 9305906..182ab85 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = synpivimage -version = 1.0.0a2 +version = 1.0.0a3 author = Matthias Probst author_email = matthias.probst@kit.edu description = Tool to build synthetic Particle Image Velocimetry (PIV) images diff --git a/synpivimage/gui/core.py b/synpivimage/gui/core.py index 780013f..48685da 100644 --- a/synpivimage/gui/core.py +++ b/synpivimage/gui/core.py @@ -81,7 +81,7 @@ def __init__(self, root_dir): self.particle_image_diameter.setMinimum(0.5) self.particle_image_diameter.setMaximum(10) self.particle_image_diameter.setValue(2.5) - + self.laser_width.setMinimum(0) self.laser_width.setValue(2) self.laser_shape_factor.setMinimum(1) diff --git a/synpivimage/io.py b/synpivimage/io.py index 6e7ce3e..dd8bb33 100644 --- a/synpivimage/io.py +++ b/synpivimage/io.py @@ -74,7 +74,6 @@ def __enter__(self): image_dir.mkdir(parents=True, exist_ok=True) (image_dir / 'imgs').mkdir(parents=True, exist_ok=True) - (image_dir / 'particles').mkdir(parents=True, exist_ok=True) if self.camera: self.camera.save_jsonld(image_dir / 'camera.json') @@ -112,11 +111,13 @@ def write(self, index: int, img: np.ndarray, ab: Optional[Literal['A', 'B']] = N cv2.imwrite(str(img_filename), np.asarray(img)) if particles: - particle_filename = self.image_dir / 'particles' / f'particles_{index:06d}{ab}.json' - particles.save_jsonld(self.image_dir / 'particles' / f'particles_{index:06d}{ab}.json') + particle_dir = (self.image_dir / 'particles') + particle_dir.mkdir(parents=True, exist_ok=True) + particle_filename = particle_dir / f'particles_{index:06d}{ab}.json' + particles.save_jsonld(particle_dir / f'particles_{index:06d}{ab}.json') + self.particle_filenames.append(particle_filename) self.img_filenames.append(img_filename) - self.particle_filenames.append(particle_filename) return img_filename def writeA(self, index: int, img: np.ndarray, particles: Particles = None) -> pathlib.Path: diff --git a/synpivimage/utils.py b/synpivimage/utils.py index cb63716..1480dd1 100644 --- a/synpivimage/utils.py +++ b/synpivimage/utils.py @@ -136,7 +136,7 @@ def generate_particles(ppp: float, assert len(xe) == N + Nadd N += Nadd - + if N > N_max: raise ValueError(f'Number of particles exceeded maximum of {N_max}. ' f'Consider increasing the number of iterations or the particle size')