From c5296f4ddaf3c6c6869abcd408fdb3794b94e5c4 Mon Sep 17 00:00:00 2001 From: Talon Chandler Date: Tue, 18 Feb 2025 12:02:14 -0800 Subject: [PATCH] black versioning --- .github/workflows/pr.yml | 2 +- .pre-commit-config.yaml | 2 +- pyproject.toml | 2 +- waveorder/models/inplane_oriented_thick_pol3d.py | 2 +- waveorder/models/isotropic_thin_3d.py | 16 ++++++++-------- waveorder/optics.py | 4 +--- waveorder/stokes.py | 1 + waveorder/waveorder_reconstructor.py | 8 ++------ 8 files changed, 16 insertions(+), 21 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 5f384709..16645e0c 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -26,7 +26,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install black + pip install black==25.1.0 - name: Check code styling with Black run: | black --diff -S -t py310 waveorder diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0157e415..29907895 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,6 +29,6 @@ repos: # args: [--ignore, "E203,W503", --min-python-version, '3.10'] # additional_dependencies: [flake8-typing-imports==1.12.0] - repo: https://github.com/psf/black - rev: 23.3.0 + rev: 25.1.0 hooks: - id: black diff --git a/pyproject.toml b/pyproject.toml index f1295aac..a9f2c685 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,7 +55,7 @@ dependencies = [ dynamic = ["version"] [project.optional-dependencies] -dev = ["pytest", "pytest-cov", "black", "flake8"] +dev = ["pytest", "pytest-cov", "black==25.1.0"] examples = ["napari[all]", "jupyter"] [project.urls] diff --git a/waveorder/models/inplane_oriented_thick_pol3d.py b/waveorder/models/inplane_oriented_thick_pol3d.py index d7771d66..52ccb9dd 100644 --- a/waveorder/models/inplane_oriented_thick_pol3d.py +++ b/waveorder/models/inplane_oriented_thick_pol3d.py @@ -8,7 +8,7 @@ def generate_test_phantom( - yx_shape: Tuple[int, int] + yx_shape: Tuple[int, int], ) -> Tuple[Tensor, Tensor, Tensor, Tensor]: star, theta, _ = util.generate_star_target(yx_shape, blur_px=0.1) retardance = 0.25 * star diff --git a/waveorder/models/isotropic_thin_3d.py b/waveorder/models/isotropic_thin_3d.py index 9719676c..75e748a0 100644 --- a/waveorder/models/isotropic_thin_3d.py +++ b/waveorder/models/isotropic_thin_3d.py @@ -76,15 +76,15 @@ def calculate_transfer_function( ) for z in range(len(z_position_list)): - absorption_2d_to_3d_transfer_function_out[ - z - ] = sampling.nd_fourier_central_cuboid( - absorption_2d_to_3d_transfer_function[z], yx_shape + absorption_2d_to_3d_transfer_function_out[z] = ( + sampling.nd_fourier_central_cuboid( + absorption_2d_to_3d_transfer_function[z], yx_shape + ) ) - phase_2d_to_3d_transfer_function_out[ - z - ] = sampling.nd_fourier_central_cuboid( - phase_2d_to_3d_transfer_function[z], yx_shape + phase_2d_to_3d_transfer_function_out[z] = ( + sampling.nd_fourier_central_cuboid( + phase_2d_to_3d_transfer_function[z], yx_shape + ) ) return ( diff --git a/waveorder/optics.py b/waveorder/optics.py index a0e5848f..46204517 100644 --- a/waveorder/optics.py +++ b/waveorder/optics.py @@ -261,9 +261,7 @@ def generate_vector_source_defocus_pupil( y_broadcast = torch.broadcast_to(y_frequencies[None, :, :], freq_shape) x_broadcast = torch.broadcast_to(x_frequencies[None, :, :], freq_shape) - z_broadcast = np.sqrt( - wavelength ** (-2) - x_broadcast**2 - y_broadcast**2 - ) + z_broadcast = np.sqrt(wavelength ** (-2) - x_broadcast**2 - y_broadcast**2) # Calculate rotation matrix rotations = rotation_matrix( diff --git a/waveorder/stokes.py b/waveorder/stokes.py index 4ca0913d..136eb2e0 100644 --- a/waveorder/stokes.py +++ b/waveorder/stokes.py @@ -46,6 +46,7 @@ >>> stokes_after_adr(*adr_params) # * expands along the first axis """ + import numpy as np import torch diff --git a/waveorder/waveorder_reconstructor.py b/waveorder/waveorder_reconstructor.py index 14e54a89..e6d95146 100644 --- a/waveorder/waveorder_reconstructor.py +++ b/waveorder/waveorder_reconstructor.py @@ -737,9 +737,7 @@ def inclination_recon_setup(self, inc_recon): wave_vec_norm_x = self.lambda_illu * self.fxx wave_vec_norm_y = self.lambda_illu * self.fyy wave_vec_norm_z = ( - np.maximum( - 0, 1 - wave_vec_norm_x**2 - wave_vec_norm_y**2 - ) + np.maximum(0, 1 - wave_vec_norm_x**2 - wave_vec_norm_y**2) ) ** (0.5) incident_theta = np.arctan2( @@ -4023,9 +4021,7 @@ def Fluor_anisotropy_recon(self, S1_stack, S2_stack): S1_stack = cp.array(S1_stack) S2_stack = cp.array(S2_stack) - anisotropy = cp.asnumpy( - 0.5 * cp.sqrt(S1_stack**2 + S2_stack**2) - ) + anisotropy = cp.asnumpy(0.5 * cp.sqrt(S1_stack**2 + S2_stack**2)) orientation = cp.asnumpy( (0.5 * cp.arctan2(S2_stack, S1_stack)) % np.pi )