From a74130d0ffc58ab50469ad7adb1e0ff6db2de805 Mon Sep 17 00:00:00 2001 From: Sylwester Arabas Date: Sun, 28 Jan 2024 04:45:28 +0100 Subject: [PATCH 1/5] code formatting changes to compy with black v24.1 --- .pre-commit-config.yaml | 6 +++--- PySDM/attributes/chemistry/__init__.py | 1 + PySDM/attributes/chemistry/acidity.py | 1 + PySDM/attributes/chemistry/concentration.py | 1 + .../chemistry/hydrogen_ion_concentration.py | 1 + PySDM/attributes/ice/__init__.py | 1 + PySDM/attributes/ice/cooling_rate.py | 1 + PySDM/attributes/ice/freezing_temperature.py | 1 + PySDM/attributes/ice/immersed_surface_area.py | 1 + PySDM/attributes/impl/__init__.py | 1 + PySDM/attributes/impl/base_attribute.py | 1 + PySDM/attributes/impl/cell_attribute.py | 1 + PySDM/attributes/impl/derived_attribute.py | 1 + PySDM/attributes/impl/dummy_attribute.py | 1 + PySDM/attributes/impl/extensive_attribute.py | 1 + PySDM/attributes/impl/intensive_attribute.py | 1 + PySDM/attributes/impl/mapper.py | 7 ++++--- PySDM/attributes/impl/maximum_attribute.py | 1 + PySDM/attributes/impl/mole_amount.py | 1 + PySDM/attributes/isotopes/__init__.py | 1 + PySDM/attributes/isotopes/delta.py | 1 + .../attributes/isotopes/moles_light_isotopes.py | 1 + PySDM/attributes/numerics/__init__.py | 1 + PySDM/attributes/numerics/cell_id.py | 1 + PySDM/attributes/numerics/cell_origin.py | 1 + PySDM/attributes/numerics/position_in_cell.py | 1 + PySDM/attributes/physics/__init__.py | 1 + PySDM/attributes/physics/area.py | 1 + .../physics/critical_supersaturation.py | 1 + PySDM/attributes/physics/critical_volume.py | 1 + PySDM/attributes/physics/dry_radius.py | 1 + PySDM/attributes/physics/dry_volume.py | 1 + .../physics/equilibrium_supersaturation.py | 1 + PySDM/attributes/physics/heat.py | 1 + PySDM/attributes/physics/hygroscopicity.py | 1 + PySDM/attributes/physics/mass.py | 1 + PySDM/attributes/physics/multiplicities.py | 1 + PySDM/attributes/physics/radius.py | 1 + PySDM/attributes/physics/temperature.py | 1 + PySDM/attributes/physics/terminal_velocity.py | 1 + PySDM/attributes/physics/volume.py | 1 + PySDM/backends/__init__.py | 1 + .../backends/impl_common/freezing_attributes.py | 1 + PySDM/backends/impl_common/index.py | 1 + PySDM/backends/impl_common/indexed_storage.py | 1 + PySDM/backends/impl_common/storage_utils.py | 1 - PySDM/backends/impl_numba/conf.py | 1 + .../impl_numba/methods/chemistry_methods.py | 9 +++++---- .../impl_numba/methods/collisions_methods.py | 9 ++++++--- .../impl_numba/methods/condensation_methods.py | 7 ++++--- .../impl_numba/methods/displacement_methods.py | 1 + .../impl_numba/methods/freezing_methods.py | 1 + .../backends/impl_numba/methods/index_methods.py | 1 + .../impl_numba/methods/isotope_methods.py | 1 + .../impl_numba/methods/moments_methods.py | 1 + .../backends/impl_numba/methods/pair_methods.py | 1 + .../impl_numba/methods/physics_methods.py | 1 + .../methods/terminal_velocity_methods.py | 1 + PySDM/backends/impl_numba/random.py | 1 + PySDM/backends/impl_numba/storage.py | 1 + PySDM/backends/impl_numba/storage_impl.py | 1 + .../scipy_ode_condensation_solver.py | 1 + PySDM/backends/impl_numba/warnings.py | 1 + PySDM/backends/impl_thrust_rtc/bisection.py | 1 + PySDM/backends/impl_thrust_rtc/conf.py | 1 + .../methods/collisions_methods.py | 1 + .../methods/condensation_methods.py | 1 + .../methods/displacement_methods.py | 1 + .../impl_thrust_rtc/methods/freezing_methods.py | 1 + .../impl_thrust_rtc/methods/index_methods.py | 1 + .../impl_thrust_rtc/methods/isotope_methods.py | 1 + .../impl_thrust_rtc/methods/moments_methods.py | 1 + .../impl_thrust_rtc/methods/pair_methods.py | 1 + .../impl_thrust_rtc/methods/physics_methods.py | 1 + .../methods/terminal_velocity_methods.py | 1 + .../methods/thrust_rtc_backend_methods.py | 1 + PySDM/backends/impl_thrust_rtc/nice_thrust.py | 1 + PySDM/backends/impl_thrust_rtc/random.py | 1 + PySDM/backends/impl_thrust_rtc/storage.py | 1 + .../impl_thrust_rtc/test_helpers/cpp2python.py | 1 + .../test_helpers/fake_thrust_rtc.py | 1 + .../impl_thrust_rtc/test_helpers/flag.py | 1 - PySDM/builder.py | 9 +++++---- PySDM/dynamics/__init__.py | 1 + PySDM/dynamics/aqueous_chemistry.py | 1 + PySDM/dynamics/collisions/__init__.py | 1 + .../collisions/breakup_efficiencies/__init__.py | 1 + .../breakup_fragmentations/__init__.py | 1 + .../breakup_fragmentations/expon_frag.py | 1 + .../breakup_fragmentations/exponential.py | 1 + .../breakup_fragmentations/feingold1988.py | 1 + .../breakup_fragmentations/gaussian.py | 1 + .../breakup_fragmentations/impl/__init__.py | 1 + .../breakup_fragmentations/lowlist82.py | 1 + .../collisions/breakup_fragmentations/slams.py | 1 + .../breakup_fragmentations/straub2010.py | 1 + .../coalescence_efficiencies/__init__.py | 1 + .../coalescence_efficiencies/berry1967.py | 1 + .../coalescence_efficiencies/lowlist1982.py | 1 + .../coalescence_efficiencies/straub2010.py | 1 + PySDM/dynamics/collisions/collision.py | 1 + .../collisions/collision_kernels/__init__.py | 1 + .../collisions/collision_kernels/electric.py | 1 + .../collisions/collision_kernels/geometric.py | 1 + .../collisions/collision_kernels/golovin.py | 1 + .../collision_kernels/impl/parameterized.py | 1 - PySDM/dynamics/condensation.py | 1 + PySDM/dynamics/displacement.py | 9 ++++++--- PySDM/dynamics/freezing.py | 1 + PySDM/dynamics/impl/chemistry_utils.py | 1 + .../dynamics/impl/random_generator_optimizer.py | 1 + PySDM/dynamics/relaxed_velocity.py | 1 + PySDM/dynamics/terminal_velocity/__init__.py | 1 + .../terminal_velocity/gunn_and_kinzer.py | 1 + .../dynamics/terminal_velocity/rogers_and_yau.py | 1 + PySDM/environments/__init__.py | 1 + PySDM/environments/box.py | 1 + PySDM/environments/impl/moist.py | 1 + PySDM/environments/parcel.py | 1 + PySDM/exporters/__init__.py | 1 + PySDM/exporters/netcdf_exporter.py | 1 + PySDM/exporters/vtk_exporter.py | 1 + PySDM/formulae.py | 1 + PySDM/impl/arakawa_c.py | 1 + PySDM/impl/mesh.py | 1 + PySDM/impl/particle_attributes.py | 1 + PySDM/impl/particle_attributes_factory.py | 1 + PySDM/impl/wall_timer.py | 1 + PySDM/initialisation/__init__.py | 1 + .../aerosol_composition/__init__.py | 1 + .../initialisation/discretise_multiplicities.py | 1 + PySDM/initialisation/equilibrate_wet_radii.py | 1 + .../initialisation/sampling/spatial_sampling.py | 1 + .../initialisation/sampling/spectral_sampling.py | 1 + .../sampling/spectro_glacial_sampling.py | 1 + PySDM/initialisation/spectra/__init__.py | 1 + PySDM/initialisation/spectra/exponential.py | 1 + PySDM/initialisation/spectra/gamma.py | 1 + PySDM/initialisation/spectra/gaussian.py | 1 + PySDM/initialisation/spectra/lognormal.py | 1 + PySDM/initialisation/spectra/sum.py | 1 + PySDM/initialisation/spectra/top_hat.py | 1 + PySDM/particulator.py | 1 + PySDM/physics/__init__.py | 1 + .../physics/condensation_coordinate/__init__.py | 1 + PySDM/physics/condensation_coordinate/volume.py | 1 + .../condensation_coordinate/volume_logarithm.py | 1 + PySDM/physics/constants.py | 1 + PySDM/physics/constants_defaults.py | 1 + PySDM/physics/diffusion_kinetics/__init__.py | 1 + .../physics/diffusion_kinetics/fuchs_sutugin.py | 1 + .../diffusion_kinetics/lowe_et_al_2019.py | 1 + .../pruppacher_and_klett_2005.py | 1 + PySDM/physics/diffusion_thermics/__init__.py | 1 + .../diffusion_thermics/lowe_et_al_2019.py | 1 + .../seinfeld_and_pandis_2010.py | 1 + .../diffusion_thermics/tracy_welch_porter.py | 1 + PySDM/physics/dimensional_analysis.py | 1 + PySDM/physics/drop_growth/__init__.py | 1 + PySDM/physics/fragmentation_function/__init__.py | 1 + .../physics/fragmentation_function/expon_frag.py | 1 + .../fragmentation_function/feingold1988.py | 1 + .../physics/fragmentation_function/lowlist82.py | 1 + .../fragmentation_function/straub2010nf.py | 1 - .../freezing_temperature_spectrum/__init__.py | 1 + .../freezing_temperature_spectrum/bigg_1953.py | 1 + .../niemand_et_al_2012.py | 1 + .../__init__.py | 1 + .../heterogeneous_ice_nucleation_rate/abifm.py | 1 + .../constant.py | 1 + PySDM/physics/hydrostatics/__init__.py | 1 + PySDM/physics/hydrostatics/default.py | 1 + PySDM/physics/hygroscopicity/__init__.py | 1 + PySDM/physics/hygroscopicity/kappa_koehler.py | 1 + .../kappa_koehler_leading_terms.py | 1 + PySDM/physics/impl/__init__.py | 1 + .../__init__.py | 1 + .../bolot_et_al_2013.py | 1 + .../graf_phd_2017.py | 1 + .../horita_and_wesolowski_1994.py | 1 + .../majoube_1970.py | 1 + .../majoube_1971.py | 1 + .../merlivat_and_nief_1967.py | 1 + .../pierchala_et_al_2022.py | 1 + .../van_hook_1968.py | 1 + .../__init__.py | 1 + .../barkan_and_luz_2007.py | 1 + .../physics/isotope_ratio_evolution/__init__.py | 1 + PySDM/physics/latent_heat/__init__.py | 1 + PySDM/physics/latent_heat/lowe2019.py | 1 + PySDM/physics/particle_advection/__init__.py | 1 + .../particle_shape_and_density/__init__.py | 1 + .../particle_shape_and_density/liquid_spheres.py | 1 + .../mixed_phase_spheres.py | 1 + .../saturation_vapour_pressure/__init__.py | 1 + .../august_roche_magnus.py | 1 + .../murphy_koop_2005.py | 1 + PySDM/physics/state_variable_triplet/__init__.py | 1 + .../state_variable_triplet/libcloudphplusplus.py | 1 + PySDM/physics/surface_tension/__init__.py | 1 + .../compressed_film_ovadnevaite.py | 1 + .../surface_tension/compressed_film_ruehl.py | 1 + .../surface_tension/szyszkowski_langmuir.py | 1 + PySDM/physics/trivia.py | 1 + PySDM/physics/ventilation/__init__.py | 1 + PySDM/products/__init__.py | 1 + .../products/ambient_thermodynamics/__init__.py | 1 + .../ambient_dry_air_density.py | 1 + .../ambient_dry_air_potential_temperature.py | 1 + .../ambient_thermodynamics/ambient_pressure.py | 1 + .../ambient_relative_humidity.py | 1 + .../ambient_temperature.py | 1 + .../ambient_water_vapour_mixing_ratio.py | 1 + PySDM/products/aqueous_chemistry/__init__.py | 1 + PySDM/products/aqueous_chemistry/acidity.py | 1 + .../aqueous_chemistry/aqueous_mass_spectrum.py | 1 + .../aqueous_chemistry/aqueous_mole_fraction.py | 1 + .../aqueous_chemistry/gaseous_mole_fraction.py | 1 + .../total_dry_mass_mixing_ratio.py | 1 + PySDM/products/collision/collision_rates.py | 1 + .../collision/collision_timestep_mean.py | 1 + .../products/collision/collision_timestep_min.py | 1 + PySDM/products/condensation/__init__.py | 1 + .../products/condensation/activable_fraction.py | 1 + .../condensation/condensation_timestep.py | 1 + PySDM/products/condensation/event_rates.py | 1 + .../condensation/peak_supersaturation.py | 1 + PySDM/products/displacement/__init__.py | 1 + .../displacement/averaged_terminal_velocity.py | 1 + .../displacement/flow_velocity_component.py | 1 + .../products/displacement/max_courant_number.py | 1 + .../displacement/surface_precipitation.py | 1 + PySDM/products/freezing/__init__.py | 1 + PySDM/products/freezing/cooling_rate.py | 1 + .../freezing/freezable_specific_concentration.py | 1 + .../freezing/frozen_particle_concentration.py | 1 + .../freezing/ice_nuclei_concentration.py | 1 + PySDM/products/freezing/ice_water_content.py | 1 + .../total_unfrozen_immersed_surface_area.py | 1 + PySDM/products/housekeeping/__init__.py | 1 + PySDM/products/housekeeping/dynamic_wall_time.py | 1 + .../products/housekeeping/parcel_displacement.py | 1 + .../super_droplet_count_per_gridbox.py | 1 + PySDM/products/housekeeping/time.py | 1 + PySDM/products/housekeeping/timers.py | 1 + PySDM/products/impl/__init__.py | 1 + .../products/impl/activation_filtered_product.py | 1 + PySDM/products/impl/moist_environment_product.py | 1 + PySDM/products/impl/moment_product.py | 1 + PySDM/products/impl/product.py | 1 + PySDM/products/impl/rate_product.py | 1 + PySDM/products/impl/spectrum_moment_product.py | 1 + PySDM/products/size_spectral/__init__.py | 1 + PySDM/products/size_spectral/arbitrary_moment.py | 1 + PySDM/products/size_spectral/effective_radius.py | 1 + PySDM/products/size_spectral/mean_radius.py | 1 + .../size_spectral/mean_radius_activated.py | 1 + .../size_spectral/number_size_spectrum.py | 1 + .../size_spectral/particle_concentration.py | 1 + .../size_spectral/particle_size_spectrum.py | 1 + ...le_volume_versus_radius_logarithm_spectrum.py | 1 + ...s_binned_number_averaged_terminal_velocity.py | 1 + .../size_spectral/size_standard_deviation.py | 1 + .../total_particle_concentration.py | 1 + .../total_particle_specific_concentration.py | 1 + .../products/size_spectral/water_mixing_ratio.py | 1 + .../Alpert_and_Knopf_2016/__init__.py | 1 + .../Arabas_and_Shima_2017/__init__.py | 1 + .../PySDM_examples/Arabas_et_al_2015/settings.py | 5 +---- .../PySDM_examples/Arabas_et_al_2023/__init__.py | 1 + .../PySDM_examples/Arabas_et_al_2023/plots.py | 8 +++++--- .../PySDM_examples/Bartman_et_al_2021/label.py | 10 +++++----- examples/PySDM_examples/Berry_1967/__init__.py | 1 + .../PySDM_examples/Bieli_et_al_2022/__init__.py | 1 + .../PySDM_examples/Bolot_et_al_2013/__init__.py | 1 + .../Ervens_and_Feingold_2012/__init__.py | 1 + .../Ervens_and_Feingold_2012/settings.py | 4 +--- .../Kreidenweis_et_al_2003/settings.py | 12 +++++++----- .../Merlivat_and_Nief_1967/__init__.py | 1 + .../Niedermeier_et_al_2014/__init__.py | 1 + .../Niedermeier_et_al_2014/simulation.py | 8 +++++--- .../Pierchala_et_al_2022/__init__.py | 1 + .../PySDM_examples/Pyrcel/profile_plotter.py | 10 +++++----- .../Shipway_and_Hill_2012/settings.py | 4 ++-- .../PySDM_examples/Srivastava_1982/__init__.py | 1 + .../PySDM_examples/Srivastava_1982/example.py | 8 ++++---- .../PySDM_examples/Srivastava_1982/simulation.py | 6 +++--- .../Szumowski_et_al_1998/gui_viewer.py | 16 +++++++++------- .../Szumowski_et_al_1998/simulation.py | 10 +++++----- .../PySDM_examples/Van_Hook_1968/__init__.py | 1 + examples/PySDM_examples/__init__.py | 1 + .../deJong_Mackay_et_al_2023/__init__.py | 1 + examples/PySDM_examples/utils/__init__.py | 1 + examples/PySDM_examples/utils/notebook_vars.py | 1 + setup.py | 1 + .../dejong_and_mackay_et_al_2023/test_fig_7.py | 16 ++++++++++------ .../box/partmc/test_dry_wet_equilibration.py | 1 + .../box/shima_et_al_2009/test_lwc_constant.py | 1 + tests/smoke_tests/conftest.py | 1 + .../no_env/pierchala_et_al_2022/test_fig_3.py | 3 ++- .../no_env/pierchala_et_al_2022/test_fig_4.py | 3 ++- .../pierchala_et_al_2022/test_supplement.py | 1 + .../parcel/graf_et_al_2019/test_fig_4.py | 3 ++- .../parcel/graf_et_al_2019/test_table_1.py | 3 ++- tests/unit_tests/attributes/test_isotopes.py | 1 + .../unit_tests/backends/test_isotope_methods.py | 1 + .../condensation/test_parcel_sanity_checks.py | 1 + .../dynamics/test_isotopic_fractionation.py | 1 + .../test_hygroscopicity_fierce_diagrams.py | 1 + .../physics/test_isotope_ratio_evolution.py | 1 + .../products/test_concentration_product.py | 6 +++--- tests/unit_tests/test_imports.py | 1 + 312 files changed, 389 insertions(+), 89 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7e64bab52..a6e92c538 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,17 +4,17 @@ default_stages: [commit] repos: - repo: https://github.com/psf/black - rev: 23.1.0 + rev: 24.1.0 hooks: - id: black - repo: https://github.com/timothycrosley/isort - rev: 5.12.0 + rev: 5.13.2 hooks: - id: isort - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer diff --git a/PySDM/attributes/chemistry/__init__.py b/PySDM/attributes/chemistry/__init__.py index ffa412612..291a21654 100644 --- a/PySDM/attributes/chemistry/__init__.py +++ b/PySDM/attributes/chemistry/__init__.py @@ -1,6 +1,7 @@ """ attributes used by the `PySDM.dynamics.aqueous_chemistry` dynamic """ + from .acidity import Acidity from .concentration import make_concentration_factory from .hydrogen_ion_concentration import HydrogenIonConcentration diff --git a/PySDM/attributes/chemistry/acidity.py b/PySDM/attributes/chemistry/acidity.py index e1ca57fd0..da45bf3e5 100644 --- a/PySDM/attributes/chemistry/acidity.py +++ b/PySDM/attributes/chemistry/acidity.py @@ -1,6 +1,7 @@ """ pH calculated by finding equilibrium hydrogen ion concentration """ + from PySDM.attributes.impl.intensive_attribute import DerivedAttribute from PySDM.backends.impl_numba.methods.chemistry_methods import _conc from PySDM.dynamics.impl.chemistry_utils import AQUEOUS_COMPOUNDS diff --git a/PySDM/attributes/chemistry/concentration.py b/PySDM/attributes/chemistry/concentration.py index 6e8570fd4..6b7c0c235 100644 --- a/PySDM/attributes/chemistry/concentration.py +++ b/PySDM/attributes/chemistry/concentration.py @@ -1,6 +1,7 @@ """ concentrations (intensive, derived attributes) """ + from PySDM.attributes.impl.intensive_attribute import IntensiveAttribute diff --git a/PySDM/attributes/chemistry/hydrogen_ion_concentration.py b/PySDM/attributes/chemistry/hydrogen_ion_concentration.py index 995d0a935..6da2b9494 100644 --- a/PySDM/attributes/chemistry/hydrogen_ion_concentration.py +++ b/PySDM/attributes/chemistry/hydrogen_ion_concentration.py @@ -1,6 +1,7 @@ """ hydrogen ion concentration derived from pH """ + from PySDM.attributes.impl.derived_attribute import DerivedAttribute diff --git a/PySDM/attributes/ice/__init__.py b/PySDM/attributes/ice/__init__.py index 22cc324a3..962b3e78e 100644 --- a/PySDM/attributes/ice/__init__.py +++ b/PySDM/attributes/ice/__init__.py @@ -1,6 +1,7 @@ """ attributes used by the `PySDM.dynamics.freezing.Freezing` dynamic """ + from .cooling_rate import CoolingRate from .freezing_temperature import FreezingTemperature from .immersed_surface_area import ImmersedSurfaceArea diff --git a/PySDM/attributes/ice/cooling_rate.py b/PySDM/attributes/ice/cooling_rate.py index feddf25b4..17ddfdbab 100644 --- a/PySDM/attributes/ice/cooling_rate.py +++ b/PySDM/attributes/ice/cooling_rate.py @@ -3,6 +3,7 @@ temperatures divided by the timestep (i.e. equals zero if particle has not moved to a different cell since the last timestep) """ + import numpy as np from PySDM.attributes.impl import DerivedAttribute diff --git a/PySDM/attributes/ice/freezing_temperature.py b/PySDM/attributes/ice/freezing_temperature.py index b57a4aca9..9f5faf8e6 100644 --- a/PySDM/attributes/ice/freezing_temperature.py +++ b/PySDM/attributes/ice/freezing_temperature.py @@ -2,6 +2,7 @@ particle freezing temperature (assigned at initialisation, modified through collisions only, used in singular regime) """ + from PySDM.attributes.impl import MaximumAttribute diff --git a/PySDM/attributes/ice/immersed_surface_area.py b/PySDM/attributes/ice/immersed_surface_area.py index 313b459ef..dbd922e31 100644 --- a/PySDM/attributes/ice/immersed_surface_area.py +++ b/PySDM/attributes/ice/immersed_surface_area.py @@ -2,6 +2,7 @@ immersed INP surface area (assigned at initialisation, modified through collisions only, used in time-dependent regime) """ + from ..impl import ExtensiveAttribute diff --git a/PySDM/attributes/impl/__init__.py b/PySDM/attributes/impl/__init__.py index 4ecc42428..f55cb4eee 100644 --- a/PySDM/attributes/impl/__init__.py +++ b/PySDM/attributes/impl/__init__.py @@ -1,6 +1,7 @@ """ common code intended for use from within attribute classes (not in user code) """ + from .attribute import Attribute from .base_attribute import BaseAttribute from .cell_attribute import CellAttribute diff --git a/PySDM/attributes/impl/base_attribute.py b/PySDM/attributes/impl/base_attribute.py index 75f19e7e6..5027be06e 100644 --- a/PySDM/attributes/impl/base_attribute.py +++ b/PySDM/attributes/impl/base_attribute.py @@ -2,6 +2,7 @@ logic around `PySDM.attributes.impl.base_attribute.BaseAttribute` - the parent class for non-derived attributes """ + from .attribute import Attribute diff --git a/PySDM/attributes/impl/cell_attribute.py b/PySDM/attributes/impl/cell_attribute.py index 21e28900d..dd62d7a82 100644 --- a/PySDM/attributes/impl/cell_attribute.py +++ b/PySDM/attributes/impl/cell_attribute.py @@ -2,6 +2,7 @@ logic around `PySDM.attributes.impl.cell_attribute.CellAttribute` - the parent class for grid-particle mapping attributes """ + from .base_attribute import BaseAttribute diff --git a/PySDM/attributes/impl/derived_attribute.py b/PySDM/attributes/impl/derived_attribute.py index b68421fa3..bee08a6e4 100644 --- a/PySDM/attributes/impl/derived_attribute.py +++ b/PySDM/attributes/impl/derived_attribute.py @@ -2,6 +2,7 @@ logic around `PySDM.attributes.impl.derived_attribute.DerivedAttribute` - the parent class for all derived attributes """ + from .attribute import Attribute diff --git a/PySDM/attributes/impl/dummy_attribute.py b/PySDM/attributes/impl/dummy_attribute.py index 9f442d422..7702cbdcb 100644 --- a/PySDM/attributes/impl/dummy_attribute.py +++ b/PySDM/attributes/impl/dummy_attribute.py @@ -1,5 +1,6 @@ """ logic around `PySDM.attributes.impl.dummy_attribute.DummyAttribute` - parent class for do-nothing attributes """ + import warnings import numpy as np diff --git a/PySDM/attributes/impl/extensive_attribute.py b/PySDM/attributes/impl/extensive_attribute.py index 30214c936..e729e33e2 100644 --- a/PySDM/attributes/impl/extensive_attribute.py +++ b/PySDM/attributes/impl/extensive_attribute.py @@ -2,6 +2,7 @@ logic around `PySDM.attributes.impl.extensive_attribute.ExtensiveAttribute` - parent class for all extensive attributes """ + from .base_attribute import BaseAttribute diff --git a/PySDM/attributes/impl/intensive_attribute.py b/PySDM/attributes/impl/intensive_attribute.py index 77eeb4153..12dccaa76 100644 --- a/PySDM/attributes/impl/intensive_attribute.py +++ b/PySDM/attributes/impl/intensive_attribute.py @@ -2,6 +2,7 @@ logic around `PySDM.attributes.impl.intensive_attribute.IntensiveAttribute` - parent class for all intensive attributes """ + from .derived_attribute import DerivedAttribute diff --git a/PySDM/attributes/impl/mapper.py b/PySDM/attributes/impl/mapper.py index 2a0267880..b6798f360 100644 --- a/PySDM/attributes/impl/mapper.py +++ b/PySDM/attributes/impl/mapper.py @@ -1,6 +1,7 @@ """ attribute name-class mapping logic (each new attribute must be added here) """ + from functools import partial from PySDM.attributes.chemistry import ( @@ -54,9 +55,9 @@ and formulae.surface_tension.__name__ == Constant.__name__ else DryVolumeOrganic ), - "dry volume": lambda dynamics, formulae: DryVolumeDynamic - if "AqueousChemistry" in dynamics - else DryVolume, + "dry volume": lambda dynamics, formulae: ( + DryVolumeDynamic if "AqueousChemistry" in dynamics else DryVolume + ), "dry volume organic fraction": lambda dynamics, formulae: ( make_dummy_attribute_factory("dry volume organic fraction") if "Condensation" in dynamics diff --git a/PySDM/attributes/impl/maximum_attribute.py b/PySDM/attributes/impl/maximum_attribute.py index 8523e7445..19ef87762 100644 --- a/PySDM/attributes/impl/maximum_attribute.py +++ b/PySDM/attributes/impl/maximum_attribute.py @@ -4,6 +4,7 @@ value is set to maximum of values of colliding particle (e.g., freezing temperature in singular immersion freezing) """ + from .base_attribute import BaseAttribute diff --git a/PySDM/attributes/impl/mole_amount.py b/PySDM/attributes/impl/mole_amount.py index c36facc48..657a4498f 100644 --- a/PySDM/attributes/impl/mole_amount.py +++ b/PySDM/attributes/impl/mole_amount.py @@ -1,6 +1,7 @@ """ mole amounts (extensive, base attributes) """ + from PySDM.attributes.impl.extensive_attribute import ExtensiveAttribute diff --git a/PySDM/attributes/isotopes/__init__.py b/PySDM/attributes/isotopes/__init__.py index d7a1b9876..4f57d00bf 100644 --- a/PySDM/attributes/isotopes/__init__.py +++ b/PySDM/attributes/isotopes/__init__.py @@ -1,4 +1,5 @@ """ isotopic fractionation related attributes """ + from .moles_light_isotopes import Moles1H, Moles16O, MolesLightWater diff --git a/PySDM/attributes/isotopes/delta.py b/PySDM/attributes/isotopes/delta.py index 6f3902863..fdd0a0360 100644 --- a/PySDM/attributes/isotopes/delta.py +++ b/PySDM/attributes/isotopes/delta.py @@ -2,6 +2,7 @@ per-droplet isotopic ratio of heavy-to-light isotope number concentrations expressed vs the VSMOW reference in SI units (i.e., not per mille) """ + from PySDM.attributes.impl.derived_attribute import DerivedAttribute diff --git a/PySDM/attributes/isotopes/moles_light_isotopes.py b/PySDM/attributes/isotopes/moles_light_isotopes.py index 24d6db349..35253d3fc 100644 --- a/PySDM/attributes/isotopes/moles_light_isotopes.py +++ b/PySDM/attributes/isotopes/moles_light_isotopes.py @@ -20,6 +20,7 @@ moles_1H = 2 * (moles_H2O + moles_17O + moles_18O) + moles_2H + moles_3H moles_16O = .5 * (moles_2H + moles_3H) + moles_H2O """ + from PySDM.attributes.impl import DerivedAttribute diff --git a/PySDM/attributes/numerics/__init__.py b/PySDM/attributes/numerics/__init__.py index 23d2edd76..e483a8796 100644 --- a/PySDM/attributes/numerics/__init__.py +++ b/PySDM/attributes/numerics/__init__.py @@ -1,6 +1,7 @@ """ attributes used for tracking cell-particle mapping in multi-dimensional simulations """ + from .cell_id import CellID from .cell_origin import CellOrigin from .position_in_cell import PositionInCell diff --git a/PySDM/attributes/numerics/cell_id.py b/PySDM/attributes/numerics/cell_id.py index 44cb14022..f7d89aa99 100644 --- a/PySDM/attributes/numerics/cell_id.py +++ b/PySDM/attributes/numerics/cell_id.py @@ -1,6 +1,7 @@ """ grid cell id attribute """ + from PySDM.attributes.impl.cell_attribute import CellAttribute diff --git a/PySDM/attributes/numerics/cell_origin.py b/PySDM/attributes/numerics/cell_origin.py index c751266a7..0dceb661b 100644 --- a/PySDM/attributes/numerics/cell_origin.py +++ b/PySDM/attributes/numerics/cell_origin.py @@ -1,6 +1,7 @@ """ grid-cell origin (multi-dimensional) """ + from PySDM.attributes.impl.cell_attribute import CellAttribute diff --git a/PySDM/attributes/numerics/position_in_cell.py b/PySDM/attributes/numerics/position_in_cell.py index a157b6cbd..c52b8b195 100644 --- a/PySDM/attributes/numerics/position_in_cell.py +++ b/PySDM/attributes/numerics/position_in_cell.py @@ -1,6 +1,7 @@ """ position-within-cell attribute (multi-dimensional, values normalised to one) """ + from PySDM.attributes.impl.cell_attribute import CellAttribute diff --git a/PySDM/attributes/physics/__init__.py b/PySDM/attributes/physics/__init__.py index 09d981571..e02dc2b01 100644 --- a/PySDM/attributes/physics/__init__.py +++ b/PySDM/attributes/physics/__init__.py @@ -1,6 +1,7 @@ """ attributes carrying information on particle physical properties """ + from .area import Area from .critical_supersaturation import CriticalSupersaturation from .critical_volume import CriticalVolume, WetToCriticalVolumeRatio diff --git a/PySDM/attributes/physics/area.py b/PySDM/attributes/physics/area.py index 7c9f676e7..b631d7799 100644 --- a/PySDM/attributes/physics/area.py +++ b/PySDM/attributes/physics/area.py @@ -1,6 +1,7 @@ """ particle wet radius (calculated from the volume) """ + from PySDM.attributes.impl.derived_attribute import DerivedAttribute diff --git a/PySDM/attributes/physics/critical_supersaturation.py b/PySDM/attributes/physics/critical_supersaturation.py index 7100aa253..461771d86 100644 --- a/PySDM/attributes/physics/critical_supersaturation.py +++ b/PySDM/attributes/physics/critical_supersaturation.py @@ -1,6 +1,7 @@ """ kappa-Koehler critical supersaturation calculated for actual environment temperature """ + from PySDM.attributes.impl.derived_attribute import DerivedAttribute diff --git a/PySDM/attributes/physics/critical_volume.py b/PySDM/attributes/physics/critical_volume.py index 8ebd9c660..f43d6dcc5 100644 --- a/PySDM/attributes/physics/critical_volume.py +++ b/PySDM/attributes/physics/critical_volume.py @@ -1,6 +1,7 @@ """ critical wet volume (kappa-Koehler, computed using actual temperature) """ + from PySDM.attributes.impl.derived_attribute import DerivedAttribute diff --git a/PySDM/attributes/physics/dry_radius.py b/PySDM/attributes/physics/dry_radius.py index d42a3bc8f..5a3343ae5 100644 --- a/PySDM/attributes/physics/dry_radius.py +++ b/PySDM/attributes/physics/dry_radius.py @@ -1,6 +1,7 @@ """ particle dry radius computed from dry volume """ + from PySDM.attributes.impl.derived_attribute import DerivedAttribute diff --git a/PySDM/attributes/physics/dry_volume.py b/PySDM/attributes/physics/dry_volume.py index 26422d0e5..85468e711 100644 --- a/PySDM/attributes/physics/dry_volume.py +++ b/PySDM/attributes/physics/dry_volume.py @@ -1,6 +1,7 @@ """ particle dry volume (subject to evolution due to collisions or aqueous chemistry) """ + from PySDM.attributes.impl.derived_attribute import DerivedAttribute from PySDM.attributes.impl.extensive_attribute import ExtensiveAttribute diff --git a/PySDM/attributes/physics/equilibrium_supersaturation.py b/PySDM/attributes/physics/equilibrium_supersaturation.py index 2ee1c6bad..1a9b2270a 100644 --- a/PySDM/attributes/physics/equilibrium_supersaturation.py +++ b/PySDM/attributes/physics/equilibrium_supersaturation.py @@ -1,6 +1,7 @@ """ kappa-Koehler equilibrium supersaturation calculated for actual environment temperature """ + from PySDM.attributes.impl.derived_attribute import DerivedAttribute diff --git a/PySDM/attributes/physics/heat.py b/PySDM/attributes/physics/heat.py index 3450d468c..1f3c03f71 100644 --- a/PySDM/attributes/physics/heat.py +++ b/PySDM/attributes/physics/heat.py @@ -1,6 +1,7 @@ """ particle heat content (test-use only for now, exemplifying intensive/extensive attribute logic) """ + from PySDM.attributes.impl.extensive_attribute import ExtensiveAttribute diff --git a/PySDM/attributes/physics/hygroscopicity.py b/PySDM/attributes/physics/hygroscopicity.py index 6c7046676..f97452820 100644 --- a/PySDM/attributes/physics/hygroscopicity.py +++ b/PySDM/attributes/physics/hygroscopicity.py @@ -3,6 +3,7 @@ the `PySDM.attributes.physics.hygroscopicity.KappaTimesDryVolume` base attribute and the derived `PySDM.attributes.physics.hygroscopicity.Kappa` attribute """ + from ..impl.derived_attribute import DerivedAttribute from ..impl.extensive_attribute import ExtensiveAttribute diff --git a/PySDM/attributes/physics/mass.py b/PySDM/attributes/physics/mass.py index 44acc5e87..54a926b34 100644 --- a/PySDM/attributes/physics/mass.py +++ b/PySDM/attributes/physics/mass.py @@ -3,6 +3,7 @@ in simulation involving mixed-phase clouds, positive values correspond to liquid water and negative values to ice """ + from PySDM.attributes.impl import ExtensiveAttribute diff --git a/PySDM/attributes/physics/multiplicities.py b/PySDM/attributes/physics/multiplicities.py index b71d86248..f4d030521 100644 --- a/PySDM/attributes/physics/multiplicities.py +++ b/PySDM/attributes/physics/multiplicities.py @@ -2,6 +2,7 @@ super-particle multiplicity (aka weighting factor) - the number of real-world particles represented in the simulation with a given super particle """ + import numpy as np from PySDM.attributes.impl.base_attribute import BaseAttribute diff --git a/PySDM/attributes/physics/radius.py b/PySDM/attributes/physics/radius.py index 91fa799c0..3dad44ee8 100644 --- a/PySDM/attributes/physics/radius.py +++ b/PySDM/attributes/physics/radius.py @@ -1,6 +1,7 @@ """ particle wet radius (calculated from the volume) """ + from PySDM.attributes.impl.derived_attribute import DerivedAttribute diff --git a/PySDM/attributes/physics/temperature.py b/PySDM/attributes/physics/temperature.py index 288a1b14f..270a1e479 100644 --- a/PySDM/attributes/physics/temperature.py +++ b/PySDM/attributes/physics/temperature.py @@ -1,6 +1,7 @@ """ particle temperature (test-use only for now, exemplifying intensive/extensive attribute logic) """ + from PySDM.attributes.impl.intensive_attribute import IntensiveAttribute diff --git a/PySDM/attributes/physics/terminal_velocity.py b/PySDM/attributes/physics/terminal_velocity.py index 83ee287b2..0caeb10d0 100644 --- a/PySDM/attributes/physics/terminal_velocity.py +++ b/PySDM/attributes/physics/terminal_velocity.py @@ -1,6 +1,7 @@ """ particle terminal velocity (used for collision probability and particle displacement) """ + from PySDM.attributes.impl.derived_attribute import DerivedAttribute diff --git a/PySDM/attributes/physics/volume.py b/PySDM/attributes/physics/volume.py index 3c9c4f786..2cf66b0e4 100644 --- a/PySDM/attributes/physics/volume.py +++ b/PySDM/attributes/physics/volume.py @@ -3,6 +3,7 @@ in simulation involving mixed-phase clouds, positive values correspond to liquid water and negative values to ice """ + from PySDM.attributes.impl import DerivedAttribute diff --git a/PySDM/backends/__init__.py b/PySDM/backends/__init__.py index 0cfdfefbe..5ae841d26 100644 --- a/PySDM/backends/__init__.py +++ b/PySDM/backends/__init__.py @@ -2,6 +2,7 @@ Backend classes: CPU=`PySDM.backends.numba.Numba` and GPU=`PySDM.backends.thrust_rtc.ThrustRTC` """ + import ctypes import os import sys diff --git a/PySDM/backends/impl_common/freezing_attributes.py b/PySDM/backends/impl_common/freezing_attributes.py index 71942eaf5..d94f6d48d 100644 --- a/PySDM/backends/impl_common/freezing_attributes.py +++ b/PySDM/backends/impl_common/freezing_attributes.py @@ -1,6 +1,7 @@ """ groups of attributes used in either singular or time-dependent immmersion freezing regimes """ + from collections import namedtuple diff --git a/PySDM/backends/impl_common/index.py b/PySDM/backends/impl_common/index.py index 891ec221b..16a4bbfbb 100644 --- a/PySDM/backends/impl_common/index.py +++ b/PySDM/backends/impl_common/index.py @@ -1,6 +1,7 @@ """ permutation-defining Index class (can be shared between multiple IndexedStorage instances) """ + import numpy as np from .storage_utils import StorageSignature diff --git a/PySDM/backends/impl_common/indexed_storage.py b/PySDM/backends/impl_common/indexed_storage.py index e8def2569..673bd5f9d 100644 --- a/PySDM/backends/impl_common/indexed_storage.py +++ b/PySDM/backends/impl_common/indexed_storage.py @@ -1,6 +1,7 @@ """ attribute storage class featuring particle permutation logic """ + from .storage_utils import StorageSignature diff --git a/PySDM/backends/impl_common/storage_utils.py b/PySDM/backends/impl_common/storage_utils.py index c3f7b9fa5..3b24e6be7 100644 --- a/PySDM/backends/impl_common/storage_utils.py +++ b/PySDM/backends/impl_common/storage_utils.py @@ -2,7 +2,6 @@ common code for storage classes """ - from abc import abstractmethod from collections import namedtuple from typing import Type diff --git a/PySDM/backends/impl_numba/conf.py b/PySDM/backends/impl_numba/conf.py index f1662d297..889d104f5 100644 --- a/PySDM/backends/impl_numba/conf.py +++ b/PySDM/backends/impl_numba/conf.py @@ -1,6 +1,7 @@ """ default settings for Numba just-in-time compilation """ + import os import platform import warnings diff --git a/PySDM/backends/impl_numba/methods/chemistry_methods.py b/PySDM/backends/impl_numba/methods/chemistry_methods.py index 61f828649..6ecbb0381 100644 --- a/PySDM/backends/impl_numba/methods/chemistry_methods.py +++ b/PySDM/backends/impl_numba/methods/chemistry_methods.py @@ -1,6 +1,7 @@ """ CPU implementation of backend methods for aqueous chemistry """ + from collections import namedtuple import numba @@ -294,10 +295,10 @@ def chem_recalculate_cell_data( ): for i in range(len(temperature)): for key in equilibrium_consts: - equilibrium_consts[key].data[ - i - ] = self.EQUILIBRIUM_CONST.EQUILIBRIUM_CONST[key].at( - temperature.data[i] + equilibrium_consts[key].data[i] = ( + self.EQUILIBRIUM_CONST.EQUILIBRIUM_CONST[key].at( + temperature.data[i] + ) ) for key in kinetic_consts: kinetic_consts[key].data[i] = self.KINETIC_CONST.KINETIC_CONST[key].at( diff --git a/PySDM/backends/impl_numba/methods/collisions_methods.py b/PySDM/backends/impl_numba/methods/collisions_methods.py index aba8bd698..e6bf5c41d 100644 --- a/PySDM/backends/impl_numba/methods/collisions_methods.py +++ b/PySDM/backends/impl_numba/methods/collisions_methods.py @@ -1,6 +1,7 @@ """ CPU implementation of backend methods for particle collisions """ + # pylint: disable=too-many-lines import numba import numpy as np @@ -1174,9 +1175,11 @@ def _parallel_counting_sort_by_cell_id_and_update_cell_start( for t in numba.prange(thread_num): # pylint: disable=not-an-iterable for i in range( - (t + 1) * length // thread_num - 1 - if t < thread_num - 1 - else length - 1, + ( + (t + 1) * length // thread_num - 1 + if t < thread_num - 1 + else length - 1 + ), t * length // thread_num - 1, -1, ): diff --git a/PySDM/backends/impl_numba/methods/condensation_methods.py b/PySDM/backends/impl_numba/methods/condensation_methods.py index cf3927d0e..89eb0572d 100644 --- a/PySDM/backends/impl_numba/methods/condensation_methods.py +++ b/PySDM/backends/impl_numba/methods/condensation_methods.py @@ -1,6 +1,7 @@ """ CPU implementation of backend methods for water condensation/evaporation """ + import math from functools import lru_cache @@ -163,9 +164,9 @@ def _condensation( counter_n_ripening[cell_id] = n_ripening RH_max[cell_id] = RH_max_in_cell success[cell_id] = success_in_cell - predicted_water_vapour_mixing_ratio[ - cell_id - ] = water_vapour_mixing_ratio_new + predicted_water_vapour_mixing_ratio[cell_id] = ( + water_vapour_mixing_ratio_new + ) pthd[cell_id] = thd_new @staticmethod diff --git a/PySDM/backends/impl_numba/methods/displacement_methods.py b/PySDM/backends/impl_numba/methods/displacement_methods.py index 1d6b1c922..454e61785 100644 --- a/PySDM/backends/impl_numba/methods/displacement_methods.py +++ b/PySDM/backends/impl_numba/methods/displacement_methods.py @@ -1,6 +1,7 @@ """ CPU implementation of backend methods for particle displacement (advection and sedimentation) """ + import numba from PySDM.backends.impl_numba import conf diff --git a/PySDM/backends/impl_numba/methods/freezing_methods.py b/PySDM/backends/impl_numba/methods/freezing_methods.py index e65a8c2f9..d3037ff7b 100644 --- a/PySDM/backends/impl_numba/methods/freezing_methods.py +++ b/PySDM/backends/impl_numba/methods/freezing_methods.py @@ -1,6 +1,7 @@ """ CPU implementation of backend methods for freezing (singular and time-dependent immersion freezing) """ + import numba import numpy as np diff --git a/PySDM/backends/impl_numba/methods/index_methods.py b/PySDM/backends/impl_numba/methods/index_methods.py index 60d496498..119be41a4 100644 --- a/PySDM/backends/impl_numba/methods/index_methods.py +++ b/PySDM/backends/impl_numba/methods/index_methods.py @@ -1,6 +1,7 @@ """ CPU implementation of shuffling and sorting backend methods """ + import numba from PySDM.backends.impl_common.backend_methods import BackendMethods diff --git a/PySDM/backends/impl_numba/methods/isotope_methods.py b/PySDM/backends/impl_numba/methods/isotope_methods.py index d83421d1a..eed4039da 100644 --- a/PySDM/backends/impl_numba/methods/isotope_methods.py +++ b/PySDM/backends/impl_numba/methods/isotope_methods.py @@ -1,6 +1,7 @@ """ CPU implementation of isotope-relates backend methods """ + from functools import cached_property import numba diff --git a/PySDM/backends/impl_numba/methods/moments_methods.py b/PySDM/backends/impl_numba/methods/moments_methods.py index bba01f58f..cb3f00072 100644 --- a/PySDM/backends/impl_numba/methods/moments_methods.py +++ b/PySDM/backends/impl_numba/methods/moments_methods.py @@ -1,6 +1,7 @@ """ CPU implementation of moment calculation backend methods """ + import numba from PySDM.backends.impl_common.backend_methods import BackendMethods diff --git a/PySDM/backends/impl_numba/methods/pair_methods.py b/PySDM/backends/impl_numba/methods/pair_methods.py index ba64b67bd..d726ed53d 100644 --- a/PySDM/backends/impl_numba/methods/pair_methods.py +++ b/PySDM/backends/impl_numba/methods/pair_methods.py @@ -1,6 +1,7 @@ """ CPU implementation of pairwise operations backend methods """ + import numba import numpy as np diff --git a/PySDM/backends/impl_numba/methods/physics_methods.py b/PySDM/backends/impl_numba/methods/physics_methods.py index 2be3ca9d7..31185c765 100644 --- a/PySDM/backends/impl_numba/methods/physics_methods.py +++ b/PySDM/backends/impl_numba/methods/physics_methods.py @@ -1,6 +1,7 @@ """ CPU implementation of backend methods wrapping basic physics formulae """ + import numba from numba import prange diff --git a/PySDM/backends/impl_numba/methods/terminal_velocity_methods.py b/PySDM/backends/impl_numba/methods/terminal_velocity_methods.py index 02aad052d..b7b29cb62 100644 --- a/PySDM/backends/impl_numba/methods/terminal_velocity_methods.py +++ b/PySDM/backends/impl_numba/methods/terminal_velocity_methods.py @@ -1,6 +1,7 @@ """ CPU implementation of backend methods for terminal velocities """ + from functools import cached_property import numba diff --git a/PySDM/backends/impl_numba/random.py b/PySDM/backends/impl_numba/random.py index a58f61938..b155a6b94 100644 --- a/PySDM/backends/impl_numba/random.py +++ b/PySDM/backends/impl_numba/random.py @@ -1,6 +1,7 @@ """ random number generator class for Numba backend """ + import numpy as np from ..impl_common.random_common import RandomCommon diff --git a/PySDM/backends/impl_numba/storage.py b/PySDM/backends/impl_numba/storage.py index b1032c0b1..3f3c631b2 100644 --- a/PySDM/backends/impl_numba/storage.py +++ b/PySDM/backends/impl_numba/storage.py @@ -1,6 +1,7 @@ """ CPU Numpy-based implementation of Storage class """ + import numpy as np from PySDM.backends.impl_common.storage_utils import ( diff --git a/PySDM/backends/impl_numba/storage_impl.py b/PySDM/backends/impl_numba/storage_impl.py index 328b2a998..2d1b20019 100644 --- a/PySDM/backends/impl_numba/storage_impl.py +++ b/PySDM/backends/impl_numba/storage_impl.py @@ -1,6 +1,7 @@ """ Numba njit-ted basic arithmetics routines for CPU backend """ + import numba import numpy as np diff --git a/PySDM/backends/impl_numba/test_helpers/scipy_ode_condensation_solver.py b/PySDM/backends/impl_numba/test_helpers/scipy_ode_condensation_solver.py index 842c57f7c..9f177c0cf 100644 --- a/PySDM/backends/impl_numba/test_helpers/scipy_ode_condensation_solver.py +++ b/PySDM/backends/impl_numba/test_helpers/scipy_ode_condensation_solver.py @@ -2,6 +2,7 @@ condensation/evaporation solver drop-in replacement implemented using SciPy adaptive-timestep ODE solver, for use in tests only """ + import types from functools import lru_cache diff --git a/PySDM/backends/impl_numba/warnings.py b/PySDM/backends/impl_numba/warnings.py index cd8ab8648..3093f8fa6 100644 --- a/PySDM/backends/impl_numba/warnings.py +++ b/PySDM/backends/impl_numba/warnings.py @@ -2,6 +2,7 @@ warning reporting logic for use whithin Numba njitted code (printing to standard error using numba.objmode() allowing to capture the output from Python tests """ + import sys import numba diff --git a/PySDM/backends/impl_thrust_rtc/bisection.py b/PySDM/backends/impl_thrust_rtc/bisection.py index 9a2733e2d..5e332cfd8 100644 --- a/PySDM/backends/impl_thrust_rtc/bisection.py +++ b/PySDM/backends/impl_thrust_rtc/bisection.py @@ -1,6 +1,7 @@ """ C code of basic bisection root-finding algorithm for use within ThrustRTC CUDA codes """ + BISECTION = """ struct Bisect { static __device__ real_type bisect( diff --git a/PySDM/backends/impl_thrust_rtc/conf.py b/PySDM/backends/impl_thrust_rtc/conf.py index 74b347ec6..566eeca5f 100644 --- a/PySDM/backends/impl_thrust_rtc/conf.py +++ b/PySDM/backends/impl_thrust_rtc/conf.py @@ -2,6 +2,7 @@ ThrustRTC import logic implementing the switch between the genuine ThrustRTC and FakeThrustRTC; default nice_thrust flags """ + import os from warnings import warn diff --git a/PySDM/backends/impl_thrust_rtc/methods/collisions_methods.py b/PySDM/backends/impl_thrust_rtc/methods/collisions_methods.py index 40a2b99da..9b21d6ef6 100644 --- a/PySDM/backends/impl_thrust_rtc/methods/collisions_methods.py +++ b/PySDM/backends/impl_thrust_rtc/methods/collisions_methods.py @@ -1,6 +1,7 @@ """ GPU implementation of backend methods for particle collisions """ + from functools import cached_property from PySDM.backends.impl_thrust_rtc.conf import NICE_THRUST_FLAGS diff --git a/PySDM/backends/impl_thrust_rtc/methods/condensation_methods.py b/PySDM/backends/impl_thrust_rtc/methods/condensation_methods.py index 96be42f74..5b183cfc7 100644 --- a/PySDM/backends/impl_thrust_rtc/methods/condensation_methods.py +++ b/PySDM/backends/impl_thrust_rtc/methods/condensation_methods.py @@ -1,6 +1,7 @@ """ GPU implementation of backend methods for water condensation/evaporation """ + from functools import cached_property from typing import Dict, Optional diff --git a/PySDM/backends/impl_thrust_rtc/methods/displacement_methods.py b/PySDM/backends/impl_thrust_rtc/methods/displacement_methods.py index a99e99663..cd258e392 100644 --- a/PySDM/backends/impl_thrust_rtc/methods/displacement_methods.py +++ b/PySDM/backends/impl_thrust_rtc/methods/displacement_methods.py @@ -1,6 +1,7 @@ """ GPU implementation of backend methods for particle displacement (advection and sedimentation) """ + from functools import cached_property from PySDM.backends.impl_thrust_rtc.conf import NICE_THRUST_FLAGS diff --git a/PySDM/backends/impl_thrust_rtc/methods/freezing_methods.py b/PySDM/backends/impl_thrust_rtc/methods/freezing_methods.py index 3e4c20bb7..1be1c8abb 100644 --- a/PySDM/backends/impl_thrust_rtc/methods/freezing_methods.py +++ b/PySDM/backends/impl_thrust_rtc/methods/freezing_methods.py @@ -1,6 +1,7 @@ """ GPU implementation of backend methods for freezing (singular and time-dependent immersion freezing) """ + from functools import cached_property from PySDM.backends.impl_thrust_rtc.conf import NICE_THRUST_FLAGS diff --git a/PySDM/backends/impl_thrust_rtc/methods/index_methods.py b/PySDM/backends/impl_thrust_rtc/methods/index_methods.py index e56547413..a6765f13c 100644 --- a/PySDM/backends/impl_thrust_rtc/methods/index_methods.py +++ b/PySDM/backends/impl_thrust_rtc/methods/index_methods.py @@ -1,6 +1,7 @@ """ GPU implementation of shuffling and sorting backend methods """ + from functools import cached_property from PySDM.backends.impl_thrust_rtc.conf import NICE_THRUST_FLAGS diff --git a/PySDM/backends/impl_thrust_rtc/methods/isotope_methods.py b/PySDM/backends/impl_thrust_rtc/methods/isotope_methods.py index d4aff6bd2..b9682f031 100644 --- a/PySDM/backends/impl_thrust_rtc/methods/isotope_methods.py +++ b/PySDM/backends/impl_thrust_rtc/methods/isotope_methods.py @@ -1,6 +1,7 @@ """ GPU implementation of isotope-relates backend methods """ + from functools import cached_property from PySDM.backends.impl_thrust_rtc.conf import NICE_THRUST_FLAGS diff --git a/PySDM/backends/impl_thrust_rtc/methods/moments_methods.py b/PySDM/backends/impl_thrust_rtc/methods/moments_methods.py index 8cef165d3..f84cdaf3f 100644 --- a/PySDM/backends/impl_thrust_rtc/methods/moments_methods.py +++ b/PySDM/backends/impl_thrust_rtc/methods/moments_methods.py @@ -1,6 +1,7 @@ """ GPU implementation of moment calculation backend methods """ + from functools import cached_property from PySDM.backends.impl_thrust_rtc.conf import NICE_THRUST_FLAGS diff --git a/PySDM/backends/impl_thrust_rtc/methods/pair_methods.py b/PySDM/backends/impl_thrust_rtc/methods/pair_methods.py index 29b79333c..1db5c2353 100644 --- a/PySDM/backends/impl_thrust_rtc/methods/pair_methods.py +++ b/PySDM/backends/impl_thrust_rtc/methods/pair_methods.py @@ -1,6 +1,7 @@ """ GPU implementation of pairwise operations backend methods """ + from functools import cached_property from PySDM.backends.impl_thrust_rtc.conf import NICE_THRUST_FLAGS diff --git a/PySDM/backends/impl_thrust_rtc/methods/physics_methods.py b/PySDM/backends/impl_thrust_rtc/methods/physics_methods.py index bf9e5ccd8..e4ca47488 100644 --- a/PySDM/backends/impl_thrust_rtc/methods/physics_methods.py +++ b/PySDM/backends/impl_thrust_rtc/methods/physics_methods.py @@ -1,6 +1,7 @@ """ GPU implementation of backend methods wrapping basic physics formulae """ + from functools import cached_property from PySDM.backends.impl_thrust_rtc.conf import NICE_THRUST_FLAGS diff --git a/PySDM/backends/impl_thrust_rtc/methods/terminal_velocity_methods.py b/PySDM/backends/impl_thrust_rtc/methods/terminal_velocity_methods.py index f256dacc9..1e66d38a8 100644 --- a/PySDM/backends/impl_thrust_rtc/methods/terminal_velocity_methods.py +++ b/PySDM/backends/impl_thrust_rtc/methods/terminal_velocity_methods.py @@ -1,6 +1,7 @@ """ GPU implementation of backend methods for terminal velocities """ + from functools import cached_property from PySDM.backends.impl_thrust_rtc.conf import NICE_THRUST_FLAGS diff --git a/PySDM/backends/impl_thrust_rtc/methods/thrust_rtc_backend_methods.py b/PySDM/backends/impl_thrust_rtc/methods/thrust_rtc_backend_methods.py index cb9276862..9f9df2fc8 100644 --- a/PySDM/backends/impl_thrust_rtc/methods/thrust_rtc_backend_methods.py +++ b/PySDM/backends/impl_thrust_rtc/methods/thrust_rtc_backend_methods.py @@ -1,6 +1,7 @@ """ common parent class for all ThrustRTC backend methods classes """ + from typing import Callable, Optional from ...impl_common.backend_methods import BackendMethods diff --git a/PySDM/backends/impl_thrust_rtc/nice_thrust.py b/PySDM/backends/impl_thrust_rtc/nice_thrust.py index 27df161c5..9d31b9b13 100644 --- a/PySDM/backends/impl_thrust_rtc/nice_thrust.py +++ b/PySDM/backends/impl_thrust_rtc/nice_thrust.py @@ -1,6 +1,7 @@ """ a decorator triggering ThrustRTC.Wait() after each function call """ + from PySDM.backends.impl_thrust_rtc.conf import trtc diff --git a/PySDM/backends/impl_thrust_rtc/random.py b/PySDM/backends/impl_thrust_rtc/random.py index e3dc3a47b..2a1dc5e13 100644 --- a/PySDM/backends/impl_thrust_rtc/random.py +++ b/PySDM/backends/impl_thrust_rtc/random.py @@ -1,6 +1,7 @@ """ random number generator class for ThrustRTC backend (using CURandRTC) """ + from PySDM.backends.impl_thrust_rtc.conf import NICE_THRUST_FLAGS from PySDM.backends.impl_thrust_rtc.nice_thrust import nice_thrust diff --git a/PySDM/backends/impl_thrust_rtc/storage.py b/PySDM/backends/impl_thrust_rtc/storage.py index 212a54064..dc6f434df 100644 --- a/PySDM/backends/impl_thrust_rtc/storage.py +++ b/PySDM/backends/impl_thrust_rtc/storage.py @@ -1,6 +1,7 @@ """ storage internals for the ThrustRTC backend """ + import numpy as np from PySDM.backends.impl_common.storage_utils import ( diff --git a/PySDM/backends/impl_thrust_rtc/test_helpers/cpp2python.py b/PySDM/backends/impl_thrust_rtc/test_helpers/cpp2python.py index 12ce47b09..ae55c217b 100644 --- a/PySDM/backends/impl_thrust_rtc/test_helpers/cpp2python.py +++ b/PySDM/backends/impl_thrust_rtc/test_helpers/cpp2python.py @@ -2,6 +2,7 @@ a simplistic C++ to Python translation utils for use in `PySDM.backends.impl_thrust_rtc.test_helpers.fake_thrust_rtc.FakeThrustRTC` """ + import re from ...impl_numba.conf import JIT_FLAGS diff --git a/PySDM/backends/impl_thrust_rtc/test_helpers/fake_thrust_rtc.py b/PySDM/backends/impl_thrust_rtc/test_helpers/fake_thrust_rtc.py index 1791c1acf..bf4cfb907 100644 --- a/PySDM/backends/impl_thrust_rtc/test_helpers/fake_thrust_rtc.py +++ b/PySDM/backends/impl_thrust_rtc/test_helpers/fake_thrust_rtc.py @@ -3,6 +3,7 @@ to njitted (and multi-threaded) Python code - a hacky workaround enabling testing ThrustRTC code on machines with no GPU/CUDA """ + # pylint: disable=no-member,unsupported-assignment-operation,unsubscriptable-object,no-value-for-parameter import types import warnings diff --git a/PySDM/backends/impl_thrust_rtc/test_helpers/flag.py b/PySDM/backends/impl_thrust_rtc/test_helpers/flag.py index 62b17f1ec..3701b05c8 100644 --- a/PySDM/backends/impl_thrust_rtc/test_helpers/flag.py +++ b/PySDM/backends/impl_thrust_rtc/test_helpers/flag.py @@ -3,5 +3,4 @@ (for tests of GPU code on machines with no GPU) """ - fakeThrustRTC = False diff --git a/PySDM/builder.py b/PySDM/builder.py index c11b94ef9..38fc0cbdb 100644 --- a/PySDM/builder.py +++ b/PySDM/builder.py @@ -1,6 +1,7 @@ """ The Builder class handling creation of `PySDM.particulator.Particulator` instances """ + import inspect import warnings @@ -109,10 +110,10 @@ def build( LiquidSpheres.__name__, MixedPhaseSpheres.__name__, ), "implied volume-to-mass conversion is only supported for spherical particles" - attributes[ - "water mass" - ] = self.particulator.formulae.particle_shape_and_density.volume_to_mass( - attributes["volume"] + attributes["water mass"] = ( + self.particulator.formulae.particle_shape_and_density.volume_to_mass( + attributes["volume"] + ) ) del attributes["volume"] self.request_attribute("volume") diff --git a/PySDM/dynamics/__init__.py b/PySDM/dynamics/__init__.py index fc608828d..cf2def8da 100644 --- a/PySDM/dynamics/__init__.py +++ b/PySDM/dynamics/__init__.py @@ -3,6 +3,7 @@ `PySDM.dynamics.collisions.collision.Collision`, `PySDM.dynamics.condensation.Condensation`, ... """ + from PySDM.dynamics.isotopic_fractionation import IsotopicFractionation # isort: split diff --git a/PySDM/dynamics/aqueous_chemistry.py b/PySDM/dynamics/aqueous_chemistry.py index 7f29cce6e..307760bde 100644 --- a/PySDM/dynamics/aqueous_chemistry.py +++ b/PySDM/dynamics/aqueous_chemistry.py @@ -1,6 +1,7 @@ """ Hoppel-gap resolving aqueous-phase chemistry (incl. SO2 oxidation) """ + from collections import namedtuple import numpy as np diff --git a/PySDM/dynamics/collisions/__init__.py b/PySDM/dynamics/collisions/__init__.py index f51953339..76454659c 100644 --- a/PySDM/dynamics/collisions/__init__.py +++ b/PySDM/dynamics/collisions/__init__.py @@ -6,6 +6,7 @@ and breakup efficiencies `PySDM.dynamics.collisions.breakup_efficiencies`, and breakup fragmentations `PySDM.dynamics.collisions.breakup_fragmentations` """ + from PySDM.dynamics.collisions.collision import Breakup, Coalescence, Collision from . import collision_kernels diff --git a/PySDM/dynamics/collisions/breakup_efficiencies/__init__.py b/PySDM/dynamics/collisions/breakup_efficiencies/__init__.py index 048b08ba2..d6bbc4a5f 100644 --- a/PySDM/dynamics/collisions/breakup_efficiencies/__init__.py +++ b/PySDM/dynamics/collisions/breakup_efficiencies/__init__.py @@ -1,4 +1,5 @@ """ Breakup efficiencies """ + from .constEb import ConstEb diff --git a/PySDM/dynamics/collisions/breakup_fragmentations/__init__.py b/PySDM/dynamics/collisions/breakup_fragmentations/__init__.py index 85cf4239b..020ffe850 100644 --- a/PySDM/dynamics/collisions/breakup_fragmentations/__init__.py +++ b/PySDM/dynamics/collisions/breakup_fragmentations/__init__.py @@ -1,6 +1,7 @@ """ TODO #744 """ + from .always_n import AlwaysN from .constant_mass import ConstantMass from .expon_frag import ExponFrag diff --git a/PySDM/dynamics/collisions/breakup_fragmentations/expon_frag.py b/PySDM/dynamics/collisions/breakup_fragmentations/expon_frag.py index 210fa376c..e2111c57c 100644 --- a/PySDM/dynamics/collisions/breakup_fragmentations/expon_frag.py +++ b/PySDM/dynamics/collisions/breakup_fragmentations/expon_frag.py @@ -2,6 +2,7 @@ DEPRECATED P(x) = exp(-x / lambda); lambda specified in volume units """ + import warnings from .exponential import Exponential diff --git a/PySDM/dynamics/collisions/breakup_fragmentations/exponential.py b/PySDM/dynamics/collisions/breakup_fragmentations/exponential.py index d41e04a48..b322f89eb 100644 --- a/PySDM/dynamics/collisions/breakup_fragmentations/exponential.py +++ b/PySDM/dynamics/collisions/breakup_fragmentations/exponential.py @@ -1,6 +1,7 @@ """ P(x) = exp(-x / lambda); lambda specified in volume units """ + # TODO #796: introduce common code with Feingold fragmentation, including possible limiter from .impl import VolumeBasedFragmentationFunction diff --git a/PySDM/dynamics/collisions/breakup_fragmentations/feingold1988.py b/PySDM/dynamics/collisions/breakup_fragmentations/feingold1988.py index 9c56669e8..1e2cdea21 100644 --- a/PySDM/dynamics/collisions/breakup_fragmentations/feingold1988.py +++ b/PySDM/dynamics/collisions/breakup_fragmentations/feingold1988.py @@ -3,6 +3,7 @@ nu = 1/m* where m* is a scaling factor for fragment volume dist. see [Feingold et al. 1999](https://doi.org/10.1175/1520-0469(1999)056<4100:TIOGCC>2.0.CO;2) """ + from .impl import VolumeBasedFragmentationFunction diff --git a/PySDM/dynamics/collisions/breakup_fragmentations/gaussian.py b/PySDM/dynamics/collisions/breakup_fragmentations/gaussian.py index bd6c02db8..b2b416bcb 100644 --- a/PySDM/dynamics/collisions/breakup_fragmentations/gaussian.py +++ b/PySDM/dynamics/collisions/breakup_fragmentations/gaussian.py @@ -1,6 +1,7 @@ """ P(x) = exp(-(x-mu)^2 / 2 sigma^2); mu and sigma are volumes """ + from .impl import VolumeBasedFragmentationFunction diff --git a/PySDM/dynamics/collisions/breakup_fragmentations/impl/__init__.py b/PySDM/dynamics/collisions/breakup_fragmentations/impl/__init__.py index 3b6014a62..8e5c97a15 100644 --- a/PySDM/dynamics/collisions/breakup_fragmentations/impl/__init__.py +++ b/PySDM/dynamics/collisions/breakup_fragmentations/impl/__init__.py @@ -1,4 +1,5 @@ """ Abstractions and common code for fragmentation functions """ + from .volume_based import VolumeBasedFragmentationFunction diff --git a/PySDM/dynamics/collisions/breakup_fragmentations/lowlist82.py b/PySDM/dynamics/collisions/breakup_fragmentations/lowlist82.py index 7a7a681a8..01acaebc8 100644 --- a/PySDM/dynamics/collisions/breakup_fragmentations/lowlist82.py +++ b/PySDM/dynamics/collisions/breakup_fragmentations/lowlist82.py @@ -1,6 +1,7 @@ """ See [Low & List 1982](https://doi.org/10.1175/1520-0469(1982)039<1607:CCABOR>2.0.CO;2) """ + from .impl import VolumeBasedFragmentationFunction diff --git a/PySDM/dynamics/collisions/breakup_fragmentations/slams.py b/PySDM/dynamics/collisions/breakup_fragmentations/slams.py index fb5e78b29..ea4f039d4 100644 --- a/PySDM/dynamics/collisions/breakup_fragmentations/slams.py +++ b/PySDM/dynamics/collisions/breakup_fragmentations/slams.py @@ -2,6 +2,7 @@ Based on [Jokulsdottir & Archer 2016 (GMD)](https://doi.org/10.5194/gmd-9-1455-2016) for ocean particles """ + from .impl import VolumeBasedFragmentationFunction diff --git a/PySDM/dynamics/collisions/breakup_fragmentations/straub2010.py b/PySDM/dynamics/collisions/breakup_fragmentations/straub2010.py index 83eae6f8b..ff8f2bd18 100644 --- a/PySDM/dynamics/collisions/breakup_fragmentations/straub2010.py +++ b/PySDM/dynamics/collisions/breakup_fragmentations/straub2010.py @@ -1,6 +1,7 @@ """ See [Straub et al. 2010](https://doi.org/10.1175/2009JAS3175.1) """ + from PySDM.physics.constants import si from .impl import VolumeBasedFragmentationFunction diff --git a/PySDM/dynamics/collisions/coalescence_efficiencies/__init__.py b/PySDM/dynamics/collisions/coalescence_efficiencies/__init__.py index 58571cc78..c5cfc593d 100644 --- a/PySDM/dynamics/collisions/coalescence_efficiencies/__init__.py +++ b/PySDM/dynamics/collisions/coalescence_efficiencies/__init__.py @@ -1,6 +1,7 @@ """ Coalescence efficiencies for the overall collision dynamic """ + from .berry1967 import Berry1967 from .constEc import ConstEc from .lowlist1982 import LowList1982Ec diff --git a/PySDM/dynamics/collisions/coalescence_efficiencies/berry1967.py b/PySDM/dynamics/collisions/coalescence_efficiencies/berry1967.py index 88ab74748..e52b0a129 100644 --- a/PySDM/dynamics/collisions/coalescence_efficiencies/berry1967.py +++ b/PySDM/dynamics/collisions/coalescence_efficiencies/berry1967.py @@ -2,6 +2,7 @@ E.X. Berry 1967 Cloud Droplet Growth by Collection """ + from ._parameterized import Parameterized diff --git a/PySDM/dynamics/collisions/coalescence_efficiencies/lowlist1982.py b/PySDM/dynamics/collisions/coalescence_efficiencies/lowlist1982.py index 545949196..220349871 100644 --- a/PySDM/dynamics/collisions/coalescence_efficiencies/lowlist1982.py +++ b/PySDM/dynamics/collisions/coalescence_efficiencies/lowlist1982.py @@ -1,6 +1,7 @@ """ See Low & List 1982 """ + import numpy as np from PySDM.physics.constants import si diff --git a/PySDM/dynamics/collisions/coalescence_efficiencies/straub2010.py b/PySDM/dynamics/collisions/coalescence_efficiencies/straub2010.py index 650d1d60c..cebbedcaf 100644 --- a/PySDM/dynamics/collisions/coalescence_efficiencies/straub2010.py +++ b/PySDM/dynamics/collisions/coalescence_efficiencies/straub2010.py @@ -1,6 +1,7 @@ """ TODO #744 """ + import numpy as np # TODO #744: TEST diff --git a/PySDM/dynamics/collisions/collision.py b/PySDM/dynamics/collisions/collision.py index a0773f28c..d71e47655 100644 --- a/PySDM/dynamics/collisions/collision.py +++ b/PySDM/dynamics/collisions/collision.py @@ -8,6 +8,7 @@ 1 - Ec - Eb = bounce back to original fragments (subset of breakup) b. Perform the relevant dynamic """ + import warnings from collections import namedtuple diff --git a/PySDM/dynamics/collisions/collision_kernels/__init__.py b/PySDM/dynamics/collisions/collision_kernels/__init__.py index d8431e36f..c338f643e 100644 --- a/PySDM/dynamics/collisions/collision_kernels/__init__.py +++ b/PySDM/dynamics/collisions/collision_kernels/__init__.py @@ -4,6 +4,7 @@ [Geometric](https://open-atmos.github.io/PySDM/physics/collisions/kernels/geometric.html) and other... """ + from .constantK import ConstantK from .electric import Electric from .geometric import Geometric diff --git a/PySDM/dynamics/collisions/collision_kernels/electric.py b/PySDM/dynamics/collisions/collision_kernels/electric.py index 63828b76b..731e2fa9b 100644 --- a/PySDM/dynamics/collisions/collision_kernels/electric.py +++ b/PySDM/dynamics/collisions/collision_kernels/electric.py @@ -2,6 +2,7 @@ kernel modelling influence of electric field of 3000V/cm as in [Berry 1967](https://doi.org/10.1175/1520-0469(1967)024%3C0688:CDGBC%3E2.0.CO;2) """ + from PySDM.dynamics.collisions.collision_kernels.impl.parameterized import Parameterized diff --git a/PySDM/dynamics/collisions/collision_kernels/geometric.py b/PySDM/dynamics/collisions/collision_kernels/geometric.py index ec193089c..365cfa96b 100644 --- a/PySDM/dynamics/collisions/collision_kernels/geometric.py +++ b/PySDM/dynamics/collisions/collision_kernels/geometric.py @@ -1,6 +1,7 @@ """ basic geometric kernel """ + from PySDM.dynamics.collisions.collision_kernels.impl.gravitational import Gravitational from PySDM.physics import constants as const diff --git a/PySDM/dynamics/collisions/collision_kernels/golovin.py b/PySDM/dynamics/collisions/collision_kernels/golovin.py index a1a5ca0a7..cbb801cf2 100644 --- a/PySDM/dynamics/collisions/collision_kernels/golovin.py +++ b/PySDM/dynamics/collisions/collision_kernels/golovin.py @@ -1,6 +1,7 @@ """ Golovin kernel with analytic solution (see [Golovin 1963](http://mi.mathnet.ru/dan27630)) """ + import numpy as np from scipy import special diff --git a/PySDM/dynamics/collisions/collision_kernels/impl/parameterized.py b/PySDM/dynamics/collisions/collision_kernels/impl/parameterized.py index 8606280e1..bc38c63fb 100644 --- a/PySDM/dynamics/collisions/collision_kernels/impl/parameterized.py +++ b/PySDM/dynamics/collisions/collision_kernels/impl/parameterized.py @@ -1,6 +1,5 @@ """ common parent class for collision kernels specified using Berry's parameterization """ - from PySDM.physics import constants as const from .gravitational import Gravitational diff --git a/PySDM/dynamics/condensation.py b/PySDM/dynamics/condensation.py index 2d3dae646..6366b381c 100644 --- a/PySDM/dynamics/condensation.py +++ b/PySDM/dynamics/condensation.py @@ -2,6 +2,7 @@ bespoke condensational growth solver with implicit-in-particle-size integration and adaptive timestepping """ + from collections import namedtuple import numpy as np diff --git a/PySDM/dynamics/displacement.py b/PySDM/dynamics/displacement.py index 3ced13611..5a7f96229 100644 --- a/PySDM/dynamics/displacement.py +++ b/PySDM/dynamics/displacement.py @@ -6,6 +6,7 @@ rtol > |(I - E) / E| (see eqs 13-16 in [Arabas et al. 2015](https://doi.org/10.5194/gmd-8-1677-2015)) """ + from collections import namedtuple import numpy as np @@ -86,9 +87,11 @@ def upload_courant_field(self, courant_field): max_abs_delta_courant /= self._n_substeps error_estimate = max( error_estimate, - 0 - if max_abs_delta_courant == 0 - else 1 / (1 / max_abs_delta_courant - 1), + ( + 0 + if max_abs_delta_courant == 0 + else 1 / (1 / max_abs_delta_courant - 1) + ), ) def __call__(self): diff --git a/PySDM/dynamics/freezing.py b/PySDM/dynamics/freezing.py index 736ac2780..aab2c5a8a 100644 --- a/PySDM/dynamics/freezing.py +++ b/PySDM/dynamics/freezing.py @@ -1,6 +1,7 @@ """ immersion freezing using either singular or time-dependent formulation """ + from PySDM.backends.impl_common.freezing_attributes import ( SingularAttributes, TimeDependentAttributes, diff --git a/PySDM/dynamics/impl/chemistry_utils.py b/PySDM/dynamics/impl/chemistry_utils.py index 3ae66359d..047818cf0 100644 --- a/PySDM/dynamics/impl/chemistry_utils.py +++ b/PySDM/dynamics/impl/chemistry_utils.py @@ -2,6 +2,7 @@ aqueous chemistry helper utils including specific gravity constants with values obtained using [chempy](https://pythonhosted.org/chempy/)'s `Substance` """ + import numpy as np from chempy import Substance diff --git a/PySDM/dynamics/impl/random_generator_optimizer.py b/PySDM/dynamics/impl/random_generator_optimizer.py index 890fff11d..4e2bb5409 100644 --- a/PySDM/dynamics/impl/random_generator_optimizer.py +++ b/PySDM/dynamics/impl/random_generator_optimizer.py @@ -1,6 +1,7 @@ """ clever reuser of random numbers for use in adaptive coalescence """ + import math diff --git a/PySDM/dynamics/relaxed_velocity.py b/PySDM/dynamics/relaxed_velocity.py index b68c2cac9..06caa665a 100644 --- a/PySDM/dynamics/relaxed_velocity.py +++ b/PySDM/dynamics/relaxed_velocity.py @@ -3,6 +3,7 @@ `PySDM.attributes.physics.relative_fall_velocity.RelativeFallVelocity` towards the terminal velocity """ + from PySDM.attributes.impl.attribute import Attribute from PySDM.particulator import Particulator diff --git a/PySDM/dynamics/terminal_velocity/__init__.py b/PySDM/dynamics/terminal_velocity/__init__.py index a92c98510..dcc9d4169 100644 --- a/PySDM/dynamics/terminal_velocity/__init__.py +++ b/PySDM/dynamics/terminal_velocity/__init__.py @@ -1,5 +1,6 @@ """ particle terminal velocity formulae """ + from PySDM.dynamics.terminal_velocity.gunn_and_kinzer import GunnKinzer1949 from PySDM.dynamics.terminal_velocity.rogers_and_yau import RogersYau diff --git a/PySDM/dynamics/terminal_velocity/gunn_and_kinzer.py b/PySDM/dynamics/terminal_velocity/gunn_and_kinzer.py index 6384e9cc2..7fd93454f 100644 --- a/PySDM/dynamics/terminal_velocity/gunn_and_kinzer.py +++ b/PySDM/dynamics/terminal_velocity/gunn_and_kinzer.py @@ -3,6 +3,7 @@ terminal velocities used for things like coalescence kernel evaluation, particle displacement, ventilation factor, etc """ + import numba import numpy as np from scipy.interpolate import Rbf diff --git a/PySDM/dynamics/terminal_velocity/rogers_and_yau.py b/PySDM/dynamics/terminal_velocity/rogers_and_yau.py index 225cdb65a..c79398385 100644 --- a/PySDM/dynamics/terminal_velocity/rogers_and_yau.py +++ b/PySDM/dynamics/terminal_velocity/rogers_and_yau.py @@ -1,6 +1,7 @@ """ Rogers & Yau, equations: (8.5), (8.6), (8.8) """ + from PySDM.physics import constants as const diff --git a/PySDM/environments/__init__.py b/PySDM/environments/__init__.py index 8b182ffe0..f9e9d18f9 100644 --- a/PySDM/environments/__init__.py +++ b/PySDM/environments/__init__.py @@ -3,6 +3,7 @@ `PySDM.environments.box.Box`, `PySDM.environments.parcel.Parcel`, ... """ + from .box import Box from .kinematic_1d import Kinematic1D from .kinematic_2d import Kinematic2D diff --git a/PySDM/environments/box.py b/PySDM/environments/box.py index 3db676204..df357131c 100644 --- a/PySDM/environments/box.py +++ b/PySDM/environments/box.py @@ -1,6 +1,7 @@ """ Bare zero-dimensional framework """ + import numpy as np from PySDM.impl.mesh import Mesh diff --git a/PySDM/environments/impl/moist.py b/PySDM/environments/impl/moist.py index 1a2f60fda..3a825d034 100644 --- a/PySDM/environments/impl/moist.py +++ b/PySDM/environments/impl/moist.py @@ -1,6 +1,7 @@ """ common logic for environments featuring moist-air thermodynamics """ + from abc import abstractmethod import numpy as np diff --git a/PySDM/environments/parcel.py b/PySDM/environments/parcel.py index 71f16a95f..72d8e3771 100644 --- a/PySDM/environments/parcel.py +++ b/PySDM/environments/parcel.py @@ -1,6 +1,7 @@ """ Zero-dimensional adiabatic parcel framework """ + import numpy as np from PySDM.environments.impl.moist import Moist diff --git a/PySDM/exporters/__init__.py b/PySDM/exporters/__init__.py index 8cde91146..6bb5a9c3a 100644 --- a/PySDM/exporters/__init__.py +++ b/PySDM/exporters/__init__.py @@ -1,6 +1,7 @@ """ Exporters handling output to metadata-rich file formats incl. netCDF and VTK """ + from .netcdf_exporter import NetCDFExporter from .netcdf_exporter_1d import NetCDFExporter_1d, readNetCDF_1d from .vtk_exporter import VTKExporter diff --git a/PySDM/exporters/netcdf_exporter.py b/PySDM/exporters/netcdf_exporter.py index 8a47bb84e..36c346d8d 100644 --- a/PySDM/exporters/netcdf_exporter.py +++ b/PySDM/exporters/netcdf_exporter.py @@ -1,6 +1,7 @@ """ netCDF exporter implemented using [SciPy.io.netcdf_file](https://docs.scipy.org/doc/scipy/reference/tutorial/io.html#netcdf) """ + import numpy as np from scipy.io import netcdf_file diff --git a/PySDM/exporters/vtk_exporter.py b/PySDM/exporters/vtk_exporter.py index 8e61cd4b0..e61b1e206 100644 --- a/PySDM/exporters/vtk_exporter.py +++ b/PySDM/exporters/vtk_exporter.py @@ -1,6 +1,7 @@ """ VTK exporter implemented using [pyevtk](https://pypi.org/project/pyevtk/) """ + import numbers import os import sys diff --git a/PySDM/formulae.py b/PySDM/formulae.py index 2e06731e9..2f44bca58 100644 --- a/PySDM/formulae.py +++ b/PySDM/formulae.py @@ -1,6 +1,7 @@ """ Logic for enabling common CPU/GPU physics formulae code """ + import inspect import math import numbers diff --git a/PySDM/impl/arakawa_c.py b/PySDM/impl/arakawa_c.py index 941f39837..c39e3f071 100644 --- a/PySDM/impl/arakawa_c.py +++ b/PySDM/impl/arakawa_c.py @@ -1,6 +1,7 @@ """ Arakawa-C staggered spatial grid helper utils """ + import numpy as np diff --git a/PySDM/impl/mesh.py b/PySDM/impl/mesh.py index 8e45339fd..a3e32901e 100644 --- a/PySDM/impl/mesh.py +++ b/PySDM/impl/mesh.py @@ -1,6 +1,7 @@ """ spatial mesh representation (incl. memory strides) """ + import numpy as np diff --git a/PySDM/impl/particle_attributes.py b/PySDM/impl/particle_attributes.py index c8dab8f5f..0ee19ba9d 100644 --- a/PySDM/impl/particle_attributes.py +++ b/PySDM/impl/particle_attributes.py @@ -2,6 +2,7 @@ logic for handling particle attributes within `PySDM.particulator.Particulator` """ + from typing import Dict import numpy as np diff --git a/PySDM/impl/particle_attributes_factory.py b/PySDM/impl/particle_attributes_factory.py index 3d30ca918..aaddb1bf2 100644 --- a/PySDM/impl/particle_attributes_factory.py +++ b/PySDM/impl/particle_attributes_factory.py @@ -1,6 +1,7 @@ """ factory logic for creating `PySDM.impl.particle_attributes.ParticleAttributes` instances """ + import numpy as np from PySDM.attributes.impl import ( diff --git a/PySDM/impl/wall_timer.py b/PySDM/impl/wall_timer.py index 455630088..176f0c3b5 100644 --- a/PySDM/impl/wall_timer.py +++ b/PySDM/impl/wall_timer.py @@ -2,6 +2,7 @@ context manager automating wall-time counting using Python's basic [time.perf_counter()](https://docs.python.org/3/library/time.html#time.perf_counter) """ + import time diff --git a/PySDM/initialisation/__init__.py b/PySDM/initialisation/__init__.py index d7ca3dbb9..0d320c49a 100644 --- a/PySDM/initialisation/__init__.py +++ b/PySDM/initialisation/__init__.py @@ -2,6 +2,7 @@ initialisation logic, particle size spectra, sampling methods and wet radii equilibration """ + from . import sampling, spectra from .discretise_multiplicities import discretise_multiplicities from .equilibrate_wet_radii import equilibrate_wet_radii diff --git a/PySDM/initialisation/aerosol_composition/__init__.py b/PySDM/initialisation/aerosol_composition/__init__.py index 61415e18a..db1605a0c 100644 --- a/PySDM/initialisation/aerosol_composition/__init__.py +++ b/PySDM/initialisation/aerosol_composition/__init__.py @@ -2,4 +2,5 @@ classes defining structure for specifying interal and external mixtures of aerosols and functions for computing bulk properties of the aerosol like kappa """ + from .dry_aerosol import DryAerosolMixture diff --git a/PySDM/initialisation/discretise_multiplicities.py b/PySDM/initialisation/discretise_multiplicities.py index df6e5058c..b085d6e43 100644 --- a/PySDM/initialisation/discretise_multiplicities.py +++ b/PySDM/initialisation/discretise_multiplicities.py @@ -1,6 +1,7 @@ """ integer-valued discretisation with sanity checks for errors due to type casting """ + import numpy as np diff --git a/PySDM/initialisation/equilibrate_wet_radii.py b/PySDM/initialisation/equilibrate_wet_radii.py index ee1601141..c227bc095 100644 --- a/PySDM/initialisation/equilibrate_wet_radii.py +++ b/PySDM/initialisation/equilibrate_wet_radii.py @@ -1,6 +1,7 @@ """ Koehler-curve equilibrium in unsaturated conditions """ + import numba import numpy as np diff --git a/PySDM/initialisation/sampling/spatial_sampling.py b/PySDM/initialisation/sampling/spatial_sampling.py index 72a258352..e69bca0fe 100644 --- a/PySDM/initialisation/sampling/spatial_sampling.py +++ b/PySDM/initialisation/sampling/spatial_sampling.py @@ -1,6 +1,7 @@ """ spatial sampling logic (i.e., physical x-y-z coordinates) """ + # TODO #305 QUASIRANDOM & GRID # http://www.ii.uj.edu.pl/~arabas/workshop_2019/files/talk_Shima.pdf diff --git a/PySDM/initialisation/sampling/spectral_sampling.py b/PySDM/initialisation/sampling/spectral_sampling.py index a90f5e491..7af32ac01 100644 --- a/PySDM/initialisation/sampling/spectral_sampling.py +++ b/PySDM/initialisation/sampling/spectral_sampling.py @@ -2,6 +2,7 @@ spectral sampling logic incl. linear, logarithmic, uniform-random and constant-multiplicity sampling classes """ + from typing import Optional, Tuple import numpy as np diff --git a/PySDM/initialisation/sampling/spectro_glacial_sampling.py b/PySDM/initialisation/sampling/spectro_glacial_sampling.py index b28dfd6d2..ef0132e98 100644 --- a/PySDM/initialisation/sampling/spectro_glacial_sampling.py +++ b/PySDM/initialisation/sampling/spectro_glacial_sampling.py @@ -2,6 +2,7 @@ two-dimensional sampling for singular immersion freezing: constant-multiplicity sampling in the freezing-temperature vs. immersed-surface-area phase space """ + import numpy as np from PySDM.initialisation.sampling.spectral_sampling import default_cdf_range diff --git a/PySDM/initialisation/spectra/__init__.py b/PySDM/initialisation/spectra/__init__.py index 5fe243604..789507320 100644 --- a/PySDM/initialisation/spectra/__init__.py +++ b/PySDM/initialisation/spectra/__init__.py @@ -2,6 +2,7 @@ classes representing logic around size spectra and more generally probability density functions (based on SciPy.stats logic) """ + from .exponential import Exponential from .gamma import Gamma from .gaussian import Gaussian diff --git a/PySDM/initialisation/spectra/exponential.py b/PySDM/initialisation/spectra/exponential.py index e1f45b890..468deaf1a 100644 --- a/PySDM/initialisation/spectra/exponential.py +++ b/PySDM/initialisation/spectra/exponential.py @@ -2,6 +2,7 @@ exponential spectrum implemented using [SciPy.stats](https://docs.scipy.org/doc/scipy/reference/stats.html) """ + from scipy.stats import expon from PySDM.initialisation.impl.spectrum import Spectrum diff --git a/PySDM/initialisation/spectra/gamma.py b/PySDM/initialisation/spectra/gamma.py index b2e29d64b..d7f9f5d2e 100644 --- a/PySDM/initialisation/spectra/gamma.py +++ b/PySDM/initialisation/spectra/gamma.py @@ -2,6 +2,7 @@ gamma spectrum implemented using [SciPy.stats](https://docs.scipy.org/doc/scipy/reference/stats.html) """ + from scipy.stats import gamma from PySDM.initialisation.impl.spectrum import Spectrum diff --git a/PySDM/initialisation/spectra/gaussian.py b/PySDM/initialisation/spectra/gaussian.py index 4aeaa941c..3a0db161e 100644 --- a/PySDM/initialisation/spectra/gaussian.py +++ b/PySDM/initialisation/spectra/gaussian.py @@ -2,6 +2,7 @@ Gaussian/normal spectrum implemented using [SciPy.stats](https://docs.scipy.org/doc/scipy/reference/stats.html) """ + from scipy.stats import norm from PySDM.initialisation.impl.spectrum import Spectrum diff --git a/PySDM/initialisation/spectra/lognormal.py b/PySDM/initialisation/spectra/lognormal.py index 49874ebb0..ec744fa8c 100644 --- a/PySDM/initialisation/spectra/lognormal.py +++ b/PySDM/initialisation/spectra/lognormal.py @@ -2,6 +2,7 @@ lognormal spectrum implemented using [SciPy.stats](https://docs.scipy.org/doc/scipy/reference/stats.html) """ + import math from scipy.stats import lognorm diff --git a/PySDM/initialisation/spectra/sum.py b/PySDM/initialisation/spectra/sum.py index 03b241abf..e5a9c6d52 100644 --- a/PySDM/initialisation/spectra/sum.py +++ b/PySDM/initialisation/spectra/sum.py @@ -2,6 +2,7 @@ spectrum defined as a sum of an arbitrary set of `PySDM.initialisation.impl.spectrum.Spectrum` instances """ + import numpy as np from scipy.interpolate import interp1d diff --git a/PySDM/initialisation/spectra/top_hat.py b/PySDM/initialisation/spectra/top_hat.py index b6bfdaf75..ddf2347f8 100644 --- a/PySDM/initialisation/spectra/top_hat.py +++ b/PySDM/initialisation/spectra/top_hat.py @@ -1,6 +1,7 @@ """ top-hat spectrum """ + import numpy as np diff --git a/PySDM/particulator.py b/PySDM/particulator.py index 8d0149820..f679b1a2b 100644 --- a/PySDM/particulator.py +++ b/PySDM/particulator.py @@ -1,6 +1,7 @@ """ The very class exposing `PySDM.particulator.Particulator.run()` method for launching simulations """ + import numpy as np from PySDM.backends.impl_common.backend_methods import BackendMethods diff --git a/PySDM/physics/__init__.py b/PySDM/physics/__init__.py index 62d911cf4..ff9a13724 100644 --- a/PySDM/physics/__init__.py +++ b/PySDM/physics/__init__.py @@ -3,6 +3,7 @@ that can be automatically either njit-ted or translated to C (in contrast to more complex code that resides in backends) """ + from . import ( condensation_coordinate, constants_defaults, diff --git a/PySDM/physics/condensation_coordinate/__init__.py b/PySDM/physics/condensation_coordinate/__init__.py index 2292e776e..593ff9050 100644 --- a/PySDM/physics/condensation_coordinate/__init__.py +++ b/PySDM/physics/condensation_coordinate/__init__.py @@ -1,5 +1,6 @@ """ definitions of particle-size coordinates for the condensation solver """ + from .volume import Volume from .volume_logarithm import VolumeLogarithm diff --git a/PySDM/physics/condensation_coordinate/volume.py b/PySDM/physics/condensation_coordinate/volume.py index 1b4e8cec0..5e16da18f 100644 --- a/PySDM/physics/condensation_coordinate/volume.py +++ b/PySDM/physics/condensation_coordinate/volume.py @@ -1,6 +1,7 @@ """ particle volume as condensation coordinate (i.e. no transformation) """ + import numpy as np diff --git a/PySDM/physics/condensation_coordinate/volume_logarithm.py b/PySDM/physics/condensation_coordinate/volume_logarithm.py index f825cc7aa..e5f3bf041 100644 --- a/PySDM/physics/condensation_coordinate/volume_logarithm.py +++ b/PySDM/physics/condensation_coordinate/volume_logarithm.py @@ -1,6 +1,7 @@ """ logarithm of particle volume as coordinate (ensures non-negative values) """ + import numpy as np diff --git a/PySDM/physics/constants.py b/PySDM/physics/constants.py index 48f0545e1..da5da22ca 100644 --- a/PySDM/physics/constants.py +++ b/PySDM/physics/constants.py @@ -3,6 +3,7 @@ [Pint](https://pypi.org/project/Pint/)'s package `UnitRegistry` for test purposes and mocked with `PySDM.physics.impl.fake_unit_registry.FakeUnitRegistry` by default. """ + import os import time diff --git a/PySDM/physics/constants_defaults.py b/PySDM/physics/constants_defaults.py index 7cebb5581..39f2cb701 100644 --- a/PySDM/physics/constants_defaults.py +++ b/PySDM/physics/constants_defaults.py @@ -4,6 +4,7 @@ Unless, there is a very specific and sound reason, everything here should be provided in SI units. """ + import numpy as np from chempy import Substance from scipy import constants as sci diff --git a/PySDM/physics/diffusion_kinetics/__init__.py b/PySDM/physics/diffusion_kinetics/__init__.py index 9cd000924..bd6ef4459 100644 --- a/PySDM/physics/diffusion_kinetics/__init__.py +++ b/PySDM/physics/diffusion_kinetics/__init__.py @@ -1,6 +1,7 @@ """ Formulae for handling transition-régime corrections in condensational growth/evaporation """ + from .fuchs_sutugin import FuchsSutugin from .lowe_et_al_2019 import LoweEtAl2019 from .neglect import Neglect diff --git a/PySDM/physics/diffusion_kinetics/fuchs_sutugin.py b/PySDM/physics/diffusion_kinetics/fuchs_sutugin.py index 34c2a7189..828118ef5 100644 --- a/PySDM/physics/diffusion_kinetics/fuchs_sutugin.py +++ b/PySDM/physics/diffusion_kinetics/fuchs_sutugin.py @@ -2,6 +2,7 @@ Fuch-Sutugin transition-regime correction as advocated for cloud modelling in [Laaksonen et al. 2005](https://doi.org/10.5194/acp-5-461-2005) """ + import numpy as np diff --git a/PySDM/physics/diffusion_kinetics/lowe_et_al_2019.py b/PySDM/physics/diffusion_kinetics/lowe_et_al_2019.py index 04dc0c6bd..c3c13c97a 100644 --- a/PySDM/physics/diffusion_kinetics/lowe_et_al_2019.py +++ b/PySDM/physics/diffusion_kinetics/lowe_et_al_2019.py @@ -3,6 +3,7 @@ uses eq. 13-14 in Pruppacher & Klett 2005 with Delta v = 0 and no corrections for thermal conductivity """ + from PySDM.physics.diffusion_kinetics.pruppacher_and_klett_2005 import PruppacherKlett diff --git a/PySDM/physics/diffusion_kinetics/pruppacher_and_klett_2005.py b/PySDM/physics/diffusion_kinetics/pruppacher_and_klett_2005.py index 79b15ee53..0b81d2996 100644 --- a/PySDM/physics/diffusion_kinetics/pruppacher_and_klett_2005.py +++ b/PySDM/physics/diffusion_kinetics/pruppacher_and_klett_2005.py @@ -2,6 +2,7 @@ as in Pruppacher and Klett 2005 (eq. 13-14) with reference to [Okuyama and Zung 1967](https://doi.org/10.1063/1.1840906) """ + import numpy as np diff --git a/PySDM/physics/diffusion_thermics/__init__.py b/PySDM/physics/diffusion_thermics/__init__.py index 0a0896c2d..2f97fd80c 100644 --- a/PySDM/physics/diffusion_thermics/__init__.py +++ b/PySDM/physics/diffusion_thermics/__init__.py @@ -1,6 +1,7 @@ """ Formulae for representing the temperature and pressure dependence of vapour diffusion coefficient """ + from .lowe_et_al_2019 import LoweEtAl2019 from .neglect import Neglect from .tracy_welch_porter import TracyWelchPorter diff --git a/PySDM/physics/diffusion_thermics/lowe_et_al_2019.py b/PySDM/physics/diffusion_thermics/lowe_et_al_2019.py index 829183abb..de48591fe 100644 --- a/PySDM/physics/diffusion_thermics/lowe_et_al_2019.py +++ b/PySDM/physics/diffusion_thermics/lowe_et_al_2019.py @@ -1,6 +1,7 @@ """ as in [Lowe et al. 2019](https://doi.org/10.1038/s41467-019-12982-0) """ + from PySDM.physics.diffusion_thermics.seinfeld_and_pandis_2010 import ( SeinfeldAndPandis2010, ) diff --git a/PySDM/physics/diffusion_thermics/seinfeld_and_pandis_2010.py b/PySDM/physics/diffusion_thermics/seinfeld_and_pandis_2010.py index 8d5e11ba9..0f737b573 100644 --- a/PySDM/physics/diffusion_thermics/seinfeld_and_pandis_2010.py +++ b/PySDM/physics/diffusion_thermics/seinfeld_and_pandis_2010.py @@ -1,6 +1,7 @@ """ as in Seinfeld and Pandis 2010 (eq. 15.65) """ + import numpy as np diff --git a/PySDM/physics/diffusion_thermics/tracy_welch_porter.py b/PySDM/physics/diffusion_thermics/tracy_welch_porter.py index 1364f0d71..ff8ff8df4 100644 --- a/PySDM/physics/diffusion_thermics/tracy_welch_porter.py +++ b/PySDM/physics/diffusion_thermics/tracy_welch_porter.py @@ -2,6 +2,7 @@ based on "PROPERTIES OF AIR: A Manual for Use in Biophysical Ecology" (Fourth Edition - 2010, page 22) """ + import numpy as np diff --git a/PySDM/physics/dimensional_analysis.py b/PySDM/physics/dimensional_analysis.py index e55068e5b..1da24f0c9 100644 --- a/PySDM/physics/dimensional_analysis.py +++ b/PySDM/physics/dimensional_analysis.py @@ -2,6 +2,7 @@ A context manager (for use with the `with` statement) for use in unit tests which disables Numba and enables Pint """ + from importlib import reload from PySDM import formulae diff --git a/PySDM/physics/drop_growth/__init__.py b/PySDM/physics/drop_growth/__init__.py index fdb3ec2b1..986ce8e20 100644 --- a/PySDM/physics/drop_growth/__init__.py +++ b/PySDM/physics/drop_growth/__init__.py @@ -1,4 +1,5 @@ """ Formulation of the coupled heat-moisture diffusion problem """ + from .maxwell_mason import MaxwellMason diff --git a/PySDM/physics/fragmentation_function/__init__.py b/PySDM/physics/fragmentation_function/__init__.py index 88a0bb6e6..b7a32776e 100644 --- a/PySDM/physics/fragmentation_function/__init__.py +++ b/PySDM/physics/fragmentation_function/__init__.py @@ -1,6 +1,7 @@ """ fragmentation functions for use with breakup """ + from .always_n import AlwaysN from .constant_mass import ConstantMass from .expon_frag import ExponFrag diff --git a/PySDM/physics/fragmentation_function/expon_frag.py b/PySDM/physics/fragmentation_function/expon_frag.py index 7094ccc4c..554a14b02 100644 --- a/PySDM/physics/fragmentation_function/expon_frag.py +++ b/PySDM/physics/fragmentation_function/expon_frag.py @@ -1,6 +1,7 @@ """ Formulae supporting `PySDM.dynamics.collisions.breakup_fragmentations.expon_frag` """ + import warnings from .exponential import Exponential diff --git a/PySDM/physics/fragmentation_function/feingold1988.py b/PySDM/physics/fragmentation_function/feingold1988.py index f6e454751..2557010c2 100644 --- a/PySDM/physics/fragmentation_function/feingold1988.py +++ b/PySDM/physics/fragmentation_function/feingold1988.py @@ -1,6 +1,7 @@ """ Scaled exponential PDF """ + import numpy as np diff --git a/PySDM/physics/fragmentation_function/lowlist82.py b/PySDM/physics/fragmentation_function/lowlist82.py index 4eab421a5..7e916e123 100644 --- a/PySDM/physics/fragmentation_function/lowlist82.py +++ b/PySDM/physics/fragmentation_function/lowlist82.py @@ -1,6 +1,7 @@ """ Formulae supporting `PySDM.dynamics.collisions.breakup_fragmentations.lowlist82` """ + import math import numpy as np diff --git a/PySDM/physics/fragmentation_function/straub2010nf.py b/PySDM/physics/fragmentation_function/straub2010nf.py index a3872b6fc..5092ae2ab 100644 --- a/PySDM/physics/fragmentation_function/straub2010nf.py +++ b/PySDM/physics/fragmentation_function/straub2010nf.py @@ -2,7 +2,6 @@ Formulae supporting `PySDM.dynamics.collisions.breakup_fragmentations.straub2010` """ - import numpy as np diff --git a/PySDM/physics/freezing_temperature_spectrum/__init__.py b/PySDM/physics/freezing_temperature_spectrum/__init__.py index 4b66898be..82c9547ca 100644 --- a/PySDM/physics/freezing_temperature_spectrum/__init__.py +++ b/PySDM/physics/freezing_temperature_spectrum/__init__.py @@ -1,6 +1,7 @@ """ freezing temperature spectra for use with singular immersion freezing representations """ + from .bigg_1953 import Bigg_1953 from .niemand_et_al_2012 import Niemand_et_al_2012 from .null import Null diff --git a/PySDM/physics/freezing_temperature_spectrum/bigg_1953.py b/PySDM/physics/freezing_temperature_spectrum/bigg_1953.py index db0e9f6db..53d12e765 100644 --- a/PySDM/physics/freezing_temperature_spectrum/bigg_1953.py +++ b/PySDM/physics/freezing_temperature_spectrum/bigg_1953.py @@ -2,6 +2,7 @@ freezing temperature spectrum based on [Bigg 1953](https://doi.org/10.1088/0370-1301/66/8/309) formulae (i.e. immersed surface independent) """ + import numpy as np diff --git a/PySDM/physics/freezing_temperature_spectrum/niemand_et_al_2012.py b/PySDM/physics/freezing_temperature_spectrum/niemand_et_al_2012.py index c93869274..f0b92b095 100644 --- a/PySDM/physics/freezing_temperature_spectrum/niemand_et_al_2012.py +++ b/PySDM/physics/freezing_temperature_spectrum/niemand_et_al_2012.py @@ -2,6 +2,7 @@ freezing temperature spectrum based on [Niemand et al. 2012](https://doi.org/10.1175/JAS-D-11-0249.1) INAS density parameterization """ + import numpy as np diff --git a/PySDM/physics/heterogeneous_ice_nucleation_rate/__init__.py b/PySDM/physics/heterogeneous_ice_nucleation_rate/__init__.py index cb790379c..91fe9627d 100644 --- a/PySDM/physics/heterogeneous_ice_nucleation_rate/__init__.py +++ b/PySDM/physics/heterogeneous_ice_nucleation_rate/__init__.py @@ -1,6 +1,7 @@ """ immersion-freezing rate (aka J_het) formulations """ + from .abifm import ABIFM from .constant import Constant from .null import Null diff --git a/PySDM/physics/heterogeneous_ice_nucleation_rate/abifm.py b/PySDM/physics/heterogeneous_ice_nucleation_rate/abifm.py index 06f88dcd1..d41f2a2f3 100644 --- a/PySDM/physics/heterogeneous_ice_nucleation_rate/abifm.py +++ b/PySDM/physics/heterogeneous_ice_nucleation_rate/abifm.py @@ -2,6 +2,7 @@ ABIFM heterogeneous freezing rate parameterization ([Knopf & Alpert 2013](https://doi.org/10.1039/C3FD00035D)) """ + import numpy as np diff --git a/PySDM/physics/heterogeneous_ice_nucleation_rate/constant.py b/PySDM/physics/heterogeneous_ice_nucleation_rate/constant.py index 66708ec6b..4fc862be3 100644 --- a/PySDM/physics/heterogeneous_ice_nucleation_rate/constant.py +++ b/PySDM/physics/heterogeneous_ice_nucleation_rate/constant.py @@ -1,6 +1,7 @@ """ constant rate formulation (for tests) """ + import numpy as np diff --git a/PySDM/physics/hydrostatics/__init__.py b/PySDM/physics/hydrostatics/__init__.py index 63cbd7c74..e052cd476 100644 --- a/PySDM/physics/hydrostatics/__init__.py +++ b/PySDM/physics/hydrostatics/__init__.py @@ -1,4 +1,5 @@ """ Helper routines for hydrostatic pressure and density profiles """ + from .default import Default diff --git a/PySDM/physics/hydrostatics/default.py b/PySDM/physics/hydrostatics/default.py index d72abb7b6..6f032101b 100644 --- a/PySDM/physics/hydrostatics/default.py +++ b/PySDM/physics/hydrostatics/default.py @@ -1,6 +1,7 @@ """ # TODO #407 """ + import numpy as np diff --git a/PySDM/physics/hygroscopicity/__init__.py b/PySDM/physics/hygroscopicity/__init__.py index 8c5855dbe..f102d9265 100644 --- a/PySDM/physics/hygroscopicity/__init__.py +++ b/PySDM/physics/hygroscopicity/__init__.py @@ -1,5 +1,6 @@ """ Alternative formulations of particle hygroscopicity for condensational drop growth/evaporation """ + from .kappa_koehler import KappaKoehler from .kappa_koehler_leading_terms import KappaKoehlerLeadingTerms diff --git a/PySDM/physics/hygroscopicity/kappa_koehler.py b/PySDM/physics/hygroscopicity/kappa_koehler.py index 5844149d1..339c0baaa 100644 --- a/PySDM/physics/hygroscopicity/kappa_koehler.py +++ b/PySDM/physics/hygroscopicity/kappa_koehler.py @@ -2,6 +2,7 @@ kappa-Koehler parameterization ([Petters & Kreidenweis 2007](https://doi.org/10.5194/acp-7-1961-2007)) """ + import numpy as np diff --git a/PySDM/physics/hygroscopicity/kappa_koehler_leading_terms.py b/PySDM/physics/hygroscopicity/kappa_koehler_leading_terms.py index f3a86453e..83aef8410 100644 --- a/PySDM/physics/hygroscopicity/kappa_koehler_leading_terms.py +++ b/PySDM/physics/hygroscopicity/kappa_koehler_leading_terms.py @@ -3,6 +3,7 @@ two-term formulation with 1/r and 1/r^3 terms corresponding to surface-tension (Kelvin) and soluble substance (Raoult/Wüllner) effects, respectively """ + import numpy as np diff --git a/PySDM/physics/impl/__init__.py b/PySDM/physics/impl/__init__.py index ff470b35c..0c0a26974 100644 --- a/PySDM/physics/impl/__init__.py +++ b/PySDM/physics/impl/__init__.py @@ -2,4 +2,5 @@ physics stuff not intended to be imported from user code (incl. the `PySDM.physics.impl.fake_unit_registry.FakeUnitRegistry`) """ + from . import flag diff --git a/PySDM/physics/isotope_equilibrium_fractionation_factors/__init__.py b/PySDM/physics/isotope_equilibrium_fractionation_factors/__init__.py index 83be198f4..14b045596 100644 --- a/PySDM/physics/isotope_equilibrium_fractionation_factors/__init__.py +++ b/PySDM/physics/isotope_equilibrium_fractionation_factors/__init__.py @@ -1,5 +1,6 @@ """ factors describing partitioning of water isotopologues under thermodynamic phase equilibrium, defined as ratios alpha of isotopic ratios R """ + from .barkan_and_luz_2005 import BarkanAndLuz2005 from .bolot_et_al_2013 import BolotEtAl2013 from .graf_phd_2017 import GrafPhD2017 diff --git a/PySDM/physics/isotope_equilibrium_fractionation_factors/bolot_et_al_2013.py b/PySDM/physics/isotope_equilibrium_fractionation_factors/bolot_et_al_2013.py index 9b28381a9..85b682ec7 100644 --- a/PySDM/physics/isotope_equilibrium_fractionation_factors/bolot_et_al_2013.py +++ b/PySDM/physics/isotope_equilibrium_fractionation_factors/bolot_et_al_2013.py @@ -1,6 +1,7 @@ """ Equilibrium fractionation factors used in [Bolot et al. 2013](https://10.5194/acp-13-7903-2013) """ + from PySDM.physics.isotope_equilibrium_fractionation_factors.majoube_1970 import ( Majoube1970, ) diff --git a/PySDM/physics/isotope_equilibrium_fractionation_factors/graf_phd_2017.py b/PySDM/physics/isotope_equilibrium_fractionation_factors/graf_phd_2017.py index e6374fabf..162c4b4a3 100644 --- a/PySDM/physics/isotope_equilibrium_fractionation_factors/graf_phd_2017.py +++ b/PySDM/physics/isotope_equilibrium_fractionation_factors/graf_phd_2017.py @@ -2,6 +2,7 @@ Equilibrium fractionation factors used in [Graf et al. 2017](https://doi.org/10.3929/ethz-b-000266387) """ + from PySDM.physics.isotope_equilibrium_fractionation_factors.majoube_1970 import ( Majoube1970, ) diff --git a/PySDM/physics/isotope_equilibrium_fractionation_factors/horita_and_wesolowski_1994.py b/PySDM/physics/isotope_equilibrium_fractionation_factors/horita_and_wesolowski_1994.py index b5d70f8c0..34e772eb7 100644 --- a/PySDM/physics/isotope_equilibrium_fractionation_factors/horita_and_wesolowski_1994.py +++ b/PySDM/physics/isotope_equilibrium_fractionation_factors/horita_and_wesolowski_1994.py @@ -2,6 +2,7 @@ Equilibrium fractionation factors from [Horita and Wesolowski 1994](https://doi.org/10.1016/0016-7037(94)90096-5) """ + import numpy as np diff --git a/PySDM/physics/isotope_equilibrium_fractionation_factors/majoube_1970.py b/PySDM/physics/isotope_equilibrium_fractionation_factors/majoube_1970.py index 7cfbb03a4..ca4d5624c 100644 --- a/PySDM/physics/isotope_equilibrium_fractionation_factors/majoube_1970.py +++ b/PySDM/physics/isotope_equilibrium_fractionation_factors/majoube_1970.py @@ -2,6 +2,7 @@ Equilibrium fractionation factors from [Majoube 1970](https://doi.org/10.1038/2261242a0) (also published by the same author in [Majoube 1971](https://doi.org/10.1051/jcp/1971680625)) """ + import numpy as np diff --git a/PySDM/physics/isotope_equilibrium_fractionation_factors/majoube_1971.py b/PySDM/physics/isotope_equilibrium_fractionation_factors/majoube_1971.py index 22e406e8d..2aa8aba88 100644 --- a/PySDM/physics/isotope_equilibrium_fractionation_factors/majoube_1971.py +++ b/PySDM/physics/isotope_equilibrium_fractionation_factors/majoube_1971.py @@ -1,6 +1,7 @@ """ Equilibrium fractionation factors from [Majoube 1971](https://doi.org/10.1051/jcp/1971681423) """ + import numpy as np diff --git a/PySDM/physics/isotope_equilibrium_fractionation_factors/merlivat_and_nief_1967.py b/PySDM/physics/isotope_equilibrium_fractionation_factors/merlivat_and_nief_1967.py index f59865aeb..ce20b2791 100644 --- a/PySDM/physics/isotope_equilibrium_fractionation_factors/merlivat_and_nief_1967.py +++ b/PySDM/physics/isotope_equilibrium_fractionation_factors/merlivat_and_nief_1967.py @@ -2,6 +2,7 @@ Equilibrium fractionation factors from [Merlivat and Nief 1967](https://doi.org/10.3402/tellusa.v19i1.9756) """ + import numpy as np diff --git a/PySDM/physics/isotope_equilibrium_fractionation_factors/pierchala_et_al_2022.py b/PySDM/physics/isotope_equilibrium_fractionation_factors/pierchala_et_al_2022.py index 266b2631a..d1a4d8a3e 100644 --- a/PySDM/physics/isotope_equilibrium_fractionation_factors/pierchala_et_al_2022.py +++ b/PySDM/physics/isotope_equilibrium_fractionation_factors/pierchala_et_al_2022.py @@ -1,6 +1,7 @@ """ Equilibrium fractionation factors used in [Pierchala et al. 2022](https://10.1016/j.gca.2022.01.020) """ + from PySDM.physics.isotope_equilibrium_fractionation_factors.barkan_and_luz_2005 import ( BarkanAndLuz2005, ) diff --git a/PySDM/physics/isotope_equilibrium_fractionation_factors/van_hook_1968.py b/PySDM/physics/isotope_equilibrium_fractionation_factors/van_hook_1968.py index d5ec2d439..37935856b 100644 --- a/PySDM/physics/isotope_equilibrium_fractionation_factors/van_hook_1968.py +++ b/PySDM/physics/isotope_equilibrium_fractionation_factors/van_hook_1968.py @@ -1,6 +1,7 @@ """ Vapour pressure factors from Table V in [Van Hook 1968](https://10.1021/j100850a028) """ + import numpy as np diff --git a/PySDM/physics/isotope_meteoric_water_line_excess/__init__.py b/PySDM/physics/isotope_meteoric_water_line_excess/__init__.py index e1066773f..844d27ea7 100644 --- a/PySDM/physics/isotope_meteoric_water_line_excess/__init__.py +++ b/PySDM/physics/isotope_meteoric_water_line_excess/__init__.py @@ -1,4 +1,5 @@ """ definitions of meteoric water line excess parameters """ + from .barkan_and_luz_2007 import BarkanAndLuz2007 from .dansgaard_1964 import Dansgaard1964 from .null import Null diff --git a/PySDM/physics/isotope_meteoric_water_line_excess/barkan_and_luz_2007.py b/PySDM/physics/isotope_meteoric_water_line_excess/barkan_and_luz_2007.py index 70cccf96f..92ab368ef 100644 --- a/PySDM/physics/isotope_meteoric_water_line_excess/barkan_and_luz_2007.py +++ b/PySDM/physics/isotope_meteoric_water_line_excess/barkan_and_luz_2007.py @@ -2,6 +2,7 @@ Water isotopic line excess parameters defined in [Barkan and Luz 2007](https://doi.org/10.1002/rcm.3180) """ + import numpy as np diff --git a/PySDM/physics/isotope_ratio_evolution/__init__.py b/PySDM/physics/isotope_ratio_evolution/__init__.py index 14efb25d3..178d1c731 100644 --- a/PySDM/physics/isotope_ratio_evolution/__init__.py +++ b/PySDM/physics/isotope_ratio_evolution/__init__.py @@ -1,4 +1,5 @@ """ isotope-ratio evolution formulae (incl. Rayleigh distillation) """ + from .merlivat_and_jouzel_1979 import MerlivatAndJouzel1979 from .null import Null from .rayleigh_distillation import RayleighDistillation diff --git a/PySDM/physics/latent_heat/__init__.py b/PySDM/physics/latent_heat/__init__.py index e50b13e87..bc8cc28d6 100644 --- a/PySDM/physics/latent_heat/__init__.py +++ b/PySDM/physics/latent_heat/__init__.py @@ -1,6 +1,7 @@ """ alternative formulations of latent heat temperature dependence (or lack thereof) """ + from .constant import Constant from .kirchhoff import Kirchhoff from .lowe2019 import Lowe2019 diff --git a/PySDM/physics/latent_heat/lowe2019.py b/PySDM/physics/latent_heat/lowe2019.py index 735386344..921cc0c68 100644 --- a/PySDM/physics/latent_heat/lowe2019.py +++ b/PySDM/physics/latent_heat/lowe2019.py @@ -2,6 +2,7 @@ temperature-dependent latent heat of vaporization used in Lowe et al. 2019 using equation form from Seinfeld and Pandis, with constant values from ICPM code """ + from PySDM.physics import constants_defaults from PySDM.physics.latent_heat.seinfeld_and_pandis_2010 import SeinfeldPandis diff --git a/PySDM/physics/particle_advection/__init__.py b/PySDM/physics/particle_advection/__init__.py index 27e4b9a9e..36341ccaa 100644 --- a/PySDM/physics/particle_advection/__init__.py +++ b/PySDM/physics/particle_advection/__init__.py @@ -1,5 +1,6 @@ """ Implicit (default) and explicit particle displacement integrators """ + from .explicit_in_space import ExplicitInSpace from .implicit_in_space import ImplicitInSpace diff --git a/PySDM/physics/particle_shape_and_density/__init__.py b/PySDM/physics/particle_shape_and_density/__init__.py index 8dd4350fd..290958396 100644 --- a/PySDM/physics/particle_shape_and_density/__init__.py +++ b/PySDM/physics/particle_shape_and_density/__init__.py @@ -1,6 +1,7 @@ """ particle shape and density relationships """ + from .liquid_spheres import LiquidSpheres from .mixed_phase_spheres import MixedPhaseSpheres from .porous_spheroids import PorousSpheroid diff --git a/PySDM/physics/particle_shape_and_density/liquid_spheres.py b/PySDM/physics/particle_shape_and_density/liquid_spheres.py index 67e6747f0..6295147c5 100644 --- a/PySDM/physics/particle_shape_and_density/liquid_spheres.py +++ b/PySDM/physics/particle_shape_and_density/liquid_spheres.py @@ -1,6 +1,7 @@ """ spherical particles with constant density of water """ + import numpy as np diff --git a/PySDM/physics/particle_shape_and_density/mixed_phase_spheres.py b/PySDM/physics/particle_shape_and_density/mixed_phase_spheres.py index b6de0f06b..a9c886d1f 100644 --- a/PySDM/physics/particle_shape_and_density/mixed_phase_spheres.py +++ b/PySDM/physics/particle_shape_and_density/mixed_phase_spheres.py @@ -1,6 +1,7 @@ """ spherical particles with constant density of water or ice """ + import numpy as np diff --git a/PySDM/physics/saturation_vapour_pressure/__init__.py b/PySDM/physics/saturation_vapour_pressure/__init__.py index bba28fd49..6253569b5 100644 --- a/PySDM/physics/saturation_vapour_pressure/__init__.py +++ b/PySDM/physics/saturation_vapour_pressure/__init__.py @@ -1,6 +1,7 @@ """ Alternative formulations of saturation vapour pressure temperature dependence approximations """ + from .august_roche_magnus import AugustRocheMagnus from .flatau_walko_cotton import FlatauWalkoCotton from .lowe1977 import Lowe1977 diff --git a/PySDM/physics/saturation_vapour_pressure/august_roche_magnus.py b/PySDM/physics/saturation_vapour_pressure/august_roche_magnus.py index cdb2c4f76..605c07264 100644 --- a/PySDM/physics/saturation_vapour_pressure/august_roche_magnus.py +++ b/PySDM/physics/saturation_vapour_pressure/august_roche_magnus.py @@ -3,6 +3,7 @@ [Wikipedia](https://en.wikipedia.org/wiki/Clausius–Clapeyron_relation#August–Roche–Magnus_formula) and references therein) """ + import numpy as np diff --git a/PySDM/physics/saturation_vapour_pressure/murphy_koop_2005.py b/PySDM/physics/saturation_vapour_pressure/murphy_koop_2005.py index 6cf988e98..54f774b2e 100644 --- a/PySDM/physics/saturation_vapour_pressure/murphy_koop_2005.py +++ b/PySDM/physics/saturation_vapour_pressure/murphy_koop_2005.py @@ -1,6 +1,7 @@ """ [Murphy and Koop 2005](https://doi.org/10.1256/qj.04.94) """ + import numpy as np diff --git a/PySDM/physics/state_variable_triplet/__init__.py b/PySDM/physics/state_variable_triplet/__init__.py index 13d8f4f90..4adfcef56 100644 --- a/PySDM/physics/state_variable_triplet/__init__.py +++ b/PySDM/physics/state_variable_triplet/__init__.py @@ -1,4 +1,5 @@ """ Formulae pertaining to the choice of state variables """ + from .libcloudphplusplus import LibcloudphPlusPlus diff --git a/PySDM/physics/state_variable_triplet/libcloudphplusplus.py b/PySDM/physics/state_variable_triplet/libcloudphplusplus.py index 24e198b29..13cc137b2 100644 --- a/PySDM/physics/state_variable_triplet/libcloudphplusplus.py +++ b/PySDM/physics/state_variable_triplet/libcloudphplusplus.py @@ -2,6 +2,7 @@ dry-air density / dry-air potential temperature / water vapour mixing ratio triplet (as in libcloudph++) """ + import numpy as np diff --git a/PySDM/physics/surface_tension/__init__.py b/PySDM/physics/surface_tension/__init__.py index 9c89d87c8..1d78cfe69 100644 --- a/PySDM/physics/surface_tension/__init__.py +++ b/PySDM/physics/surface_tension/__init__.py @@ -1,6 +1,7 @@ """ Particle surface tension formulae """ + from .compressed_film_ovadnevaite import CompressedFilmOvadnevaite from .compressed_film_ruehl import CompressedFilmRuehl from .constant import Constant diff --git a/PySDM/physics/surface_tension/compressed_film_ovadnevaite.py b/PySDM/physics/surface_tension/compressed_film_ovadnevaite.py index 3262283dc..f4e2c9f88 100644 --- a/PySDM/physics/surface_tension/compressed_film_ovadnevaite.py +++ b/PySDM/physics/surface_tension/compressed_film_ovadnevaite.py @@ -2,6 +2,7 @@ surface tension coefficient model featuring surface-partitioning as in [Ovadnevaite et al. (2017)](https://doi.org/10.1038/nature22806) """ + import numpy as np diff --git a/PySDM/physics/surface_tension/compressed_film_ruehl.py b/PySDM/physics/surface_tension/compressed_film_ruehl.py index 8cb65d639..1308a2499 100644 --- a/PySDM/physics/surface_tension/compressed_film_ruehl.py +++ b/PySDM/physics/surface_tension/compressed_film_ruehl.py @@ -2,6 +2,7 @@ surface tension coefficient model featuring surface-partitioning as in [Ruehl et al. (2016)](https://doi.org/10.1126/science.aad4889) """ + import numba import numpy as np diff --git a/PySDM/physics/surface_tension/szyszkowski_langmuir.py b/PySDM/physics/surface_tension/szyszkowski_langmuir.py index 535cce489..45e2f5561 100644 --- a/PySDM/physics/surface_tension/szyszkowski_langmuir.py +++ b/PySDM/physics/surface_tension/szyszkowski_langmuir.py @@ -2,6 +2,7 @@ surface tension coefficient model featuring surface-partitioning as in [Ruehl et al. (2016)](https://doi.org/10.1126/science.aad4889) """ + import numpy as np diff --git a/PySDM/physics/trivia.py b/PySDM/physics/trivia.py index d7556abe3..bd676a8e3 100644 --- a/PySDM/physics/trivia.py +++ b/PySDM/physics/trivia.py @@ -3,6 +3,7 @@ `erfinv` approximation based on eqs. 11-12 from Vedder 1987, https://doi.org/10.1119/1.15018 """ + import numpy as np diff --git a/PySDM/physics/ventilation/__init__.py b/PySDM/physics/ventilation/__init__.py index 817f8ad20..a95dd6001 100644 --- a/PySDM/physics/ventilation/__init__.py +++ b/PySDM/physics/ventilation/__init__.py @@ -1,4 +1,5 @@ """ Ventilation coefficient formulae """ + from .neglect import Neglect diff --git a/PySDM/products/__init__.py b/PySDM/products/__init__.py index cdea464bb..5e42d28eb 100644 --- a/PySDM/products/__init__.py +++ b/PySDM/products/__init__.py @@ -3,6 +3,7 @@ `PySDM.products.size_spectral.particle_size_spectrum.ParticleSizeSpectrum`, ... """ + from .ambient_thermodynamics import * from .aqueous_chemistry import * from .collision import * diff --git a/PySDM/products/ambient_thermodynamics/__init__.py b/PySDM/products/ambient_thermodynamics/__init__.py index cf56dc29d..9cdca7d93 100644 --- a/PySDM/products/ambient_thermodynamics/__init__.py +++ b/PySDM/products/ambient_thermodynamics/__init__.py @@ -1,6 +1,7 @@ """ products offering access to environment variables (ambient temperature, pressure, ...) """ + from .ambient_dry_air_density import AmbientDryAirDensity from .ambient_dry_air_potential_temperature import AmbientDryAirPotentialTemperature from .ambient_pressure import AmbientPressure diff --git a/PySDM/products/ambient_thermodynamics/ambient_dry_air_density.py b/PySDM/products/ambient_thermodynamics/ambient_dry_air_density.py index 0269bfcb6..1b3239003 100644 --- a/PySDM/products/ambient_thermodynamics/ambient_dry_air_density.py +++ b/PySDM/products/ambient_thermodynamics/ambient_dry_air_density.py @@ -1,6 +1,7 @@ """ ambient dry-air density """ + from PySDM.products.impl.moist_environment_product import MoistEnvironmentProduct diff --git a/PySDM/products/ambient_thermodynamics/ambient_dry_air_potential_temperature.py b/PySDM/products/ambient_thermodynamics/ambient_dry_air_potential_temperature.py index 1785de198..9c2e33c3b 100644 --- a/PySDM/products/ambient_thermodynamics/ambient_dry_air_potential_temperature.py +++ b/PySDM/products/ambient_thermodynamics/ambient_dry_air_potential_temperature.py @@ -1,6 +1,7 @@ """ ambient dry-air potential temperature (computed using dry air partial pressure) """ + from PySDM.products.impl.moist_environment_product import MoistEnvironmentProduct diff --git a/PySDM/products/ambient_thermodynamics/ambient_pressure.py b/PySDM/products/ambient_thermodynamics/ambient_pressure.py index b583b6e44..2c6693a7c 100644 --- a/PySDM/products/ambient_thermodynamics/ambient_pressure.py +++ b/PySDM/products/ambient_thermodynamics/ambient_pressure.py @@ -1,6 +1,7 @@ """ ambient pressure """ + from PySDM.products.impl.moist_environment_product import MoistEnvironmentProduct diff --git a/PySDM/products/ambient_thermodynamics/ambient_relative_humidity.py b/PySDM/products/ambient_thermodynamics/ambient_relative_humidity.py index d6887c473..70b406210 100644 --- a/PySDM/products/ambient_thermodynamics/ambient_relative_humidity.py +++ b/PySDM/products/ambient_thermodynamics/ambient_relative_humidity.py @@ -1,6 +1,7 @@ """ ambient relative humidity (wrt water or ice) """ + from PySDM.products.impl.moist_environment_product import MoistEnvironmentProduct diff --git a/PySDM/products/ambient_thermodynamics/ambient_temperature.py b/PySDM/products/ambient_thermodynamics/ambient_temperature.py index 378977de1..c5285486e 100644 --- a/PySDM/products/ambient_thermodynamics/ambient_temperature.py +++ b/PySDM/products/ambient_thermodynamics/ambient_temperature.py @@ -1,6 +1,7 @@ """ ambient temperature """ + from PySDM.products.impl.moist_environment_product import MoistEnvironmentProduct diff --git a/PySDM/products/ambient_thermodynamics/ambient_water_vapour_mixing_ratio.py b/PySDM/products/ambient_thermodynamics/ambient_water_vapour_mixing_ratio.py index 5a52c5b56..181d9c42a 100644 --- a/PySDM/products/ambient_thermodynamics/ambient_water_vapour_mixing_ratio.py +++ b/PySDM/products/ambient_thermodynamics/ambient_water_vapour_mixing_ratio.py @@ -1,6 +1,7 @@ """ ambient water vapour mixing ratio (mass of water vapour per mass of dry air) """ + from PySDM.products.impl.moist_environment_product import MoistEnvironmentProduct diff --git a/PySDM/products/aqueous_chemistry/__init__.py b/PySDM/products/aqueous_chemistry/__init__.py index f7cccf694..ab59effcc 100644 --- a/PySDM/products/aqueous_chemistry/__init__.py +++ b/PySDM/products/aqueous_chemistry/__init__.py @@ -1,6 +1,7 @@ """ products pertinent to the `PySDM.dynamics.aqueous_chemistry.AqueousChemistry` dynamic """ + from .acidity import Acidity from .aqueous_mass_spectrum import AqueousMassSpectrum from .aqueous_mole_fraction import AqueousMoleFraction diff --git a/PySDM/products/aqueous_chemistry/acidity.py b/PySDM/products/aqueous_chemistry/acidity.py index b46e717fd..2ce76515f 100644 --- a/PySDM/products/aqueous_chemistry/acidity.py +++ b/PySDM/products/aqueous_chemistry/acidity.py @@ -2,6 +2,7 @@ average pH (averaging after or before taking the logarithm in pH definition) with weighting either by number or volume """ + import numpy as np from PySDM.products.impl.moment_product import MomentProduct diff --git a/PySDM/products/aqueous_chemistry/aqueous_mass_spectrum.py b/PySDM/products/aqueous_chemistry/aqueous_mass_spectrum.py index ce4fead8a..d6753c067 100644 --- a/PySDM/products/aqueous_chemistry/aqueous_mass_spectrum.py +++ b/PySDM/products/aqueous_chemistry/aqueous_mass_spectrum.py @@ -2,6 +2,7 @@ dry-radius-binned concentration of aqueous-chemistry relevant compounds (optionally expressed as specific concentration) """ + import numpy as np from chempy import Substance diff --git a/PySDM/products/aqueous_chemistry/aqueous_mole_fraction.py b/PySDM/products/aqueous_chemistry/aqueous_mole_fraction.py index e707546c0..ddd6ee104 100644 --- a/PySDM/products/aqueous_chemistry/aqueous_mole_fraction.py +++ b/PySDM/products/aqueous_chemistry/aqueous_mole_fraction.py @@ -1,6 +1,7 @@ """ mole fractions of aqueous-chemistry relevant compounds """ + from PySDM.products.impl.moment_product import MomentProduct DUMMY_SPECIFIC_GRAVITY = 44 diff --git a/PySDM/products/aqueous_chemistry/gaseous_mole_fraction.py b/PySDM/products/aqueous_chemistry/gaseous_mole_fraction.py index a746174df..99f841704 100644 --- a/PySDM/products/aqueous_chemistry/gaseous_mole_fraction.py +++ b/PySDM/products/aqueous_chemistry/gaseous_mole_fraction.py @@ -1,6 +1,7 @@ """ mole fractions of gaseous compounds relevant for aqueous chemistry """ + from PySDM.dynamics.impl.chemistry_utils import GASEOUS_COMPOUNDS from PySDM.products.impl.product import Product diff --git a/PySDM/products/aqueous_chemistry/total_dry_mass_mixing_ratio.py b/PySDM/products/aqueous_chemistry/total_dry_mass_mixing_ratio.py index 9bab921f5..45f9a417a 100644 --- a/PySDM/products/aqueous_chemistry/total_dry_mass_mixing_ratio.py +++ b/PySDM/products/aqueous_chemistry/total_dry_mass_mixing_ratio.py @@ -1,6 +1,7 @@ """ dry aerosol mass summed over all particles in a grid box per mass of dry air """ + import numpy as np from PySDM.products.impl.moment_product import MomentProduct diff --git a/PySDM/products/collision/collision_rates.py b/PySDM/products/collision/collision_rates.py index cdb0c6753..ae98deb5c 100644 --- a/PySDM/products/collision/collision_rates.py +++ b/PySDM/products/collision/collision_rates.py @@ -3,6 +3,7 @@ values preclude representation of resultant multiplicity in multiple collisions, or due to unrepresentable breakups from integer overflow """ + from PySDM.products.impl.rate_product import RateProduct diff --git a/PySDM/products/collision/collision_timestep_mean.py b/PySDM/products/collision/collision_timestep_mean.py index b9c59f73a..04a74722b 100644 --- a/PySDM/products/collision/collision_timestep_mean.py +++ b/PySDM/products/collision/collision_timestep_mean.py @@ -2,6 +2,7 @@ Average collision timestep length used when adaptive timestepping is enabled in the `PySDM.dynamics.collisions.collision.Collision` dynamic (fetching a value reset the counter) """ + import numba import numpy as np diff --git a/PySDM/products/collision/collision_timestep_min.py b/PySDM/products/collision/collision_timestep_min.py index d09219fca..0b971831e 100644 --- a/PySDM/products/collision/collision_timestep_min.py +++ b/PySDM/products/collision/collision_timestep_min.py @@ -2,6 +2,7 @@ Minimal collision timestep used when adaptive timestepping is enabled in the `PySDM.dynamics.collisions.collision.Collision` dynamic (fetching a value resets the counter) """ + from PySDM.products.impl.product import Product diff --git a/PySDM/products/condensation/__init__.py b/PySDM/products/condensation/__init__.py index 44c622936..39613831a 100644 --- a/PySDM/products/condensation/__init__.py +++ b/PySDM/products/condensation/__init__.py @@ -1,6 +1,7 @@ """ products pertinent to the `PySDM.dynamics.condensation.Condensation` dynamic """ + from .activable_fraction import ActivableFraction from .condensation_timestep import CondensationTimestepMax, CondensationTimestepMin from .event_rates import ActivatingRate, DeactivatingRate, RipeningRate diff --git a/PySDM/products/condensation/activable_fraction.py b/PySDM/products/condensation/activable_fraction.py index 2971743ca..eac2c566a 100644 --- a/PySDM/products/condensation/activable_fraction.py +++ b/PySDM/products/condensation/activable_fraction.py @@ -2,6 +2,7 @@ fraction of particles with critical supersaturation lower than a given supersaturation (passed as keyword argument while calling `get()`) """ + from PySDM.products.impl.moment_product import MomentProduct diff --git a/PySDM/products/condensation/condensation_timestep.py b/PySDM/products/condensation/condensation_timestep.py index ad1e6146f..aefca5193 100644 --- a/PySDM/products/condensation/condensation_timestep.py +++ b/PySDM/products/condensation/condensation_timestep.py @@ -1,6 +1,7 @@ """ minimum and maximum condensation timestep (fetching a value resets the counter) """ + import numpy as np from PySDM.products.impl.product import Product diff --git a/PySDM/products/condensation/event_rates.py b/PySDM/products/condensation/event_rates.py index 0e3f0871e..8f8b4a9dc 100644 --- a/PySDM/products/condensation/event_rates.py +++ b/PySDM/products/condensation/event_rates.py @@ -2,6 +2,7 @@ rates of activation, deactivation and ripening events (take into account substeps, fetching a value resets the given counter) """ + import numpy as np from PySDM.products.impl.product import Product diff --git a/PySDM/products/condensation/peak_supersaturation.py b/PySDM/products/condensation/peak_supersaturation.py index 3cebe7aca..b901b43ec 100644 --- a/PySDM/products/condensation/peak_supersaturation.py +++ b/PySDM/products/condensation/peak_supersaturation.py @@ -4,6 +4,7 @@ `PySDM.products.ambient_thermodynamics.ambient_relative_humidity.AmbientRelativeHumidity`; fetching a value resets the maximum value) """ + import numpy as np from PySDM.products.impl.product import Product diff --git a/PySDM/products/displacement/__init__.py b/PySDM/products/displacement/__init__.py index 67a4a7245..696efe67e 100644 --- a/PySDM/products/displacement/__init__.py +++ b/PySDM/products/displacement/__init__.py @@ -1,6 +1,7 @@ """ products pertinent to the `PySDM.dynamics.displacement.Displacement` dynamic """ + from .averaged_terminal_velocity import AveragedTerminalVelocity from .flow_velocity_component import FlowVelocityComponent from .max_courant_number import MaxCourantNumber diff --git a/PySDM/products/displacement/averaged_terminal_velocity.py b/PySDM/products/displacement/averaged_terminal_velocity.py index 0fadcdf81..9389cc700 100644 --- a/PySDM/products/displacement/averaged_terminal_velocity.py +++ b/PySDM/products/displacement/averaged_terminal_velocity.py @@ -1,6 +1,7 @@ """ average terminal with weighting either by number or volume """ + import numpy as np from PySDM.products.impl.moment_product import MomentProduct diff --git a/PySDM/products/displacement/flow_velocity_component.py b/PySDM/products/displacement/flow_velocity_component.py index 8585a6996..b8cdb0e96 100644 --- a/PySDM/products/displacement/flow_velocity_component.py +++ b/PySDM/products/displacement/flow_velocity_component.py @@ -2,6 +2,7 @@ reports on the maximum Courant field value for each cell (maximum of absolute values of Courant number on all edges of a cell) """ + import numpy as np from PySDM.products.impl.product import Product diff --git a/PySDM/products/displacement/max_courant_number.py b/PySDM/products/displacement/max_courant_number.py index 8f9aa51f0..54324ef86 100644 --- a/PySDM/products/displacement/max_courant_number.py +++ b/PySDM/products/displacement/max_courant_number.py @@ -2,6 +2,7 @@ reports on the maximum Courant field value for each cell (maximum of absolute values of Courant number on all edges of a cell) """ + import numpy as np from PySDM.products.impl.product import Product diff --git a/PySDM/products/displacement/surface_precipitation.py b/PySDM/products/displacement/surface_precipitation.py index d514a4eea..0c1801759 100644 --- a/PySDM/products/displacement/surface_precipitation.py +++ b/PySDM/products/displacement/surface_precipitation.py @@ -1,6 +1,7 @@ """ water volume flux derived from sizes of particles crossing bottom domain boundary """ + from PySDM.products.impl.product import Product diff --git a/PySDM/products/freezing/__init__.py b/PySDM/products/freezing/__init__.py index 46b69f329..da05c9903 100644 --- a/PySDM/products/freezing/__init__.py +++ b/PySDM/products/freezing/__init__.py @@ -1,6 +1,7 @@ """ products pertinent to the `PySDM.dynamics.freezing.Freezing` dynamic """ + from .cooling_rate import CoolingRate from .freezable_specific_concentration import FreezableSpecificConcentration from .frozen_particle_concentration import ( diff --git a/PySDM/products/freezing/cooling_rate.py b/PySDM/products/freezing/cooling_rate.py index c3914741d..668d585b9 100644 --- a/PySDM/products/freezing/cooling_rate.py +++ b/PySDM/products/freezing/cooling_rate.py @@ -1,6 +1,7 @@ """ number-averaged cooling rate """ + from PySDM.products.impl import MomentProduct diff --git a/PySDM/products/freezing/freezable_specific_concentration.py b/PySDM/products/freezing/freezable_specific_concentration.py index 32eb7f655..348408cab 100644 --- a/PySDM/products/freezing/freezable_specific_concentration.py +++ b/PySDM/products/freezing/freezable_specific_concentration.py @@ -1,6 +1,7 @@ """ freezing-temperature binned specific concentration of particles """ + import numpy as np from PySDM.products.impl.spectrum_moment_product import SpectrumMomentProduct diff --git a/PySDM/products/freezing/frozen_particle_concentration.py b/PySDM/products/freezing/frozen_particle_concentration.py index f0938e8be..021be4617 100644 --- a/PySDM/products/freezing/frozen_particle_concentration.py +++ b/PySDM/products/freezing/frozen_particle_concentration.py @@ -1,6 +1,7 @@ """ concentration of frozen particles (unactivated, activated or both) """ + import numpy as np from PySDM.products.impl.concentration_product import ConcentrationProduct diff --git a/PySDM/products/freezing/ice_nuclei_concentration.py b/PySDM/products/freezing/ice_nuclei_concentration.py index 3e6dcbe95..e44d0b0ac 100644 --- a/PySDM/products/freezing/ice_nuclei_concentration.py +++ b/PySDM/products/freezing/ice_nuclei_concentration.py @@ -1,6 +1,7 @@ """ immersed ice nucleus concentration (both within frozen and unfrozen particles) """ + import numpy as np from PySDM.products.impl.concentration_product import ConcentrationProduct diff --git a/PySDM/products/freezing/ice_water_content.py b/PySDM/products/freezing/ice_water_content.py index 10181bd42..963c22a65 100644 --- a/PySDM/products/freezing/ice_water_content.py +++ b/PySDM/products/freezing/ice_water_content.py @@ -1,6 +1,7 @@ """ ice water content products (mixing ratio and density) """ + import numpy as np from PySDM.products.impl.moment_product import MomentProduct diff --git a/PySDM/products/freezing/total_unfrozen_immersed_surface_area.py b/PySDM/products/freezing/total_unfrozen_immersed_surface_area.py index 992f960fe..f6a81827b 100644 --- a/PySDM/products/freezing/total_unfrozen_immersed_surface_area.py +++ b/PySDM/products/freezing/total_unfrozen_immersed_surface_area.py @@ -1,6 +1,7 @@ """ mean immersed surface area per particle for unfrozen particles """ + import numpy as np from PySDM.products.impl.moment_product import MomentProduct diff --git a/PySDM/products/housekeeping/__init__.py b/PySDM/products/housekeeping/__init__.py index d3743f734..390bfdb25 100644 --- a/PySDM/products/housekeeping/__init__.py +++ b/PySDM/products/housekeeping/__init__.py @@ -1,6 +1,7 @@ """ Housekeeping products: time, parcel displacement, super-particle counts, wall-time timers... """ + from .dynamic_wall_time import DynamicWallTime from .parcel_displacement import ParcelDisplacement from .super_droplet_count_per_gridbox import SuperDropletCountPerGridbox diff --git a/PySDM/products/housekeeping/dynamic_wall_time.py b/PySDM/products/housekeeping/dynamic_wall_time.py index 52d43e21c..a5b30a297 100644 --- a/PySDM/products/housekeeping/dynamic_wall_time.py +++ b/PySDM/products/housekeeping/dynamic_wall_time.py @@ -1,6 +1,7 @@ """ wall-time for a given dynamic (fetching a value resets the counter) """ + from PySDM.products.impl.product import Product diff --git a/PySDM/products/housekeeping/parcel_displacement.py b/PySDM/products/housekeeping/parcel_displacement.py index 58707b6d2..6211f5b70 100644 --- a/PySDM/products/housekeeping/parcel_displacement.py +++ b/PySDM/products/housekeeping/parcel_displacement.py @@ -1,6 +1,7 @@ """ parcel displacement, for use with `PySDM.environments.parcel.Parcel` environment only """ + from PySDM.environments import Parcel from PySDM.products.impl.product import Product diff --git a/PySDM/products/housekeeping/super_droplet_count_per_gridbox.py b/PySDM/products/housekeeping/super_droplet_count_per_gridbox.py index 869dacab6..d2cdc2077 100644 --- a/PySDM/products/housekeeping/super_droplet_count_per_gridbox.py +++ b/PySDM/products/housekeeping/super_droplet_count_per_gridbox.py @@ -1,6 +1,7 @@ """ super-droplet count per gridbox (dimensionless) """ + import numba from PySDM.backends.impl_numba.conf import JIT_FLAGS diff --git a/PySDM/products/housekeeping/time.py b/PySDM/products/housekeeping/time.py index 7408ca56c..785bb5607 100644 --- a/PySDM/products/housekeeping/time.py +++ b/PySDM/products/housekeeping/time.py @@ -1,6 +1,7 @@ """ physical time (in dt increments) """ + from PySDM.products.impl.product import Product diff --git a/PySDM/products/housekeeping/timers.py b/PySDM/products/housekeeping/timers.py index d4fb5fb7a..f333b2f73 100644 --- a/PySDM/products/housekeeping/timers.py +++ b/PySDM/products/housekeeping/timers.py @@ -1,6 +1,7 @@ """ CPU- and wall-time counters (fetching a value resets the counter) """ + import time from abc import abstractmethod diff --git a/PySDM/products/impl/__init__.py b/PySDM/products/impl/__init__.py index 87d4c9221..e7a1f4bc4 100644 --- a/PySDM/products/impl/__init__.py +++ b/PySDM/products/impl/__init__.py @@ -1,4 +1,5 @@ """ commons, not intended to be imported from user code """ + from PySDM.products.impl.moist_environment_product import MoistEnvironmentProduct from PySDM.products.impl.moment_product import MomentProduct from PySDM.products.impl.product import Product diff --git a/PySDM/products/impl/activation_filtered_product.py b/PySDM/products/impl/activation_filtered_product.py index 950a92c32..f643c2700 100644 --- a/PySDM/products/impl/activation_filtered_product.py +++ b/PySDM/products/impl/activation_filtered_product.py @@ -1,6 +1,7 @@ """ common base class for products filtering droplets based on their activation state """ + import numpy as np diff --git a/PySDM/products/impl/moist_environment_product.py b/PySDM/products/impl/moist_environment_product.py index 9773394eb..9c64faf67 100644 --- a/PySDM/products/impl/moist_environment_product.py +++ b/PySDM/products/impl/moist_environment_product.py @@ -1,6 +1,7 @@ """ common code for products based on moist environment variables (e.g., ambient humidity) """ + from PySDM.environments.impl.moist import Moist from PySDM.products.impl.product import Product diff --git a/PySDM/products/impl/moment_product.py b/PySDM/products/impl/moment_product.py index 002f016bf..e2e73489a 100644 --- a/PySDM/products/impl/moment_product.py +++ b/PySDM/products/impl/moment_product.py @@ -1,4 +1,5 @@ """ common code for products computing statistical moments (e.g., effective radius, acidity) """ + from abc import ABC import numpy as np diff --git a/PySDM/products/impl/product.py b/PySDM/products/impl/product.py index 0d96be8fe..fe082663c 100644 --- a/PySDM/products/impl/product.py +++ b/PySDM/products/impl/product.py @@ -1,6 +1,7 @@ """ logic around the `PySDM.products.impl.product.Product` - parent class for all products """ + import inspect import re from abc import abstractmethod diff --git a/PySDM/products/impl/rate_product.py b/PySDM/products/impl/rate_product.py index 21b98250e..2931aa878 100644 --- a/PySDM/products/impl/rate_product.py +++ b/PySDM/products/impl/rate_product.py @@ -1,6 +1,7 @@ """ common code for products representing event rates """ + from PySDM.products.impl.product import Product diff --git a/PySDM/products/impl/spectrum_moment_product.py b/PySDM/products/impl/spectrum_moment_product.py index 144cff252..b02fe781d 100644 --- a/PySDM/products/impl/spectrum_moment_product.py +++ b/PySDM/products/impl/spectrum_moment_product.py @@ -2,6 +2,7 @@ common code for products computing **binned** statistical moments (e.g., dry radius spectrum in each grid cell) """ + from abc import ABC from PySDM.products.impl.product import Product diff --git a/PySDM/products/size_spectral/__init__.py b/PySDM/products/size_spectral/__init__.py index f4ad9087e..5aa4647e2 100644 --- a/PySDM/products/size_spectral/__init__.py +++ b/PySDM/products/size_spectral/__init__.py @@ -1,4 +1,5 @@ """ products expressing particle size-spectral quantities """ + from .arbitrary_moment import ( RadiusFirstMoment, RadiusSixthMoment, diff --git a/PySDM/products/size_spectral/arbitrary_moment.py b/PySDM/products/size_spectral/arbitrary_moment.py index 8362fe5b6..ece1f870f 100644 --- a/PySDM/products/size_spectral/arbitrary_moment.py +++ b/PySDM/products/size_spectral/arbitrary_moment.py @@ -1,6 +1,7 @@ """ factory for arbitrary-moment product classes """ + from PySDM.products.impl.moment_product import MomentProduct diff --git a/PySDM/products/size_spectral/effective_radius.py b/PySDM/products/size_spectral/effective_radius.py index dc3fc9cf1..703bff9fd 100644 --- a/PySDM/products/size_spectral/effective_radius.py +++ b/PySDM/products/size_spectral/effective_radius.py @@ -2,6 +2,7 @@ effective radius of particles within a grid cell (ratio of third to second moments, optionally restricted to a given size range) """ + import numba import numpy as np diff --git a/PySDM/products/size_spectral/mean_radius.py b/PySDM/products/size_spectral/mean_radius.py index 901bdc556..ab896c1de 100644 --- a/PySDM/products/size_spectral/mean_radius.py +++ b/PySDM/products/size_spectral/mean_radius.py @@ -1,6 +1,7 @@ """ mean radius of particles within a grid cell (optionally restricted to a given size range) """ + import numpy as np from PySDM.products.impl.moment_product import MomentProduct diff --git a/PySDM/products/size_spectral/mean_radius_activated.py b/PySDM/products/size_spectral/mean_radius_activated.py index 8f59739ae..8800f4b8f 100644 --- a/PySDM/products/size_spectral/mean_radius_activated.py +++ b/PySDM/products/size_spectral/mean_radius_activated.py @@ -1,6 +1,7 @@ """ mean radius of particles within a grid cell, for activated, unactivated or both """ + from PySDM.products.impl.activation_filtered_product import _ActivationFilteredProduct from PySDM.products.impl.moment_product import MomentProduct diff --git a/PySDM/products/size_spectral/number_size_spectrum.py b/PySDM/products/size_spectral/number_size_spectrum.py index e66740eda..3d601f0c5 100644 --- a/PySDM/products/size_spectral/number_size_spectrum.py +++ b/PySDM/products/size_spectral/number_size_spectrum.py @@ -2,6 +2,7 @@ n(V) particle volume spectrum per volume of air, i.e. number of particles per volume of air having in the size range bin """ + import numpy as np from PySDM.products.impl.spectrum_moment_product import SpectrumMomentProduct diff --git a/PySDM/products/size_spectral/particle_concentration.py b/PySDM/products/size_spectral/particle_concentration.py index c9b859a62..2fc22a1f1 100644 --- a/PySDM/products/size_spectral/particle_concentration.py +++ b/PySDM/products/size_spectral/particle_concentration.py @@ -2,6 +2,7 @@ concentration of particles within a grid cell (either per-volume of per-mass-of-dry air, optionally restricted to a given size range) """ + import numpy as np from PySDM.products.impl.concentration_product import ConcentrationProduct diff --git a/PySDM/products/size_spectral/particle_size_spectrum.py b/PySDM/products/size_spectral/particle_size_spectrum.py index 09c64b95c..6eb402df1 100644 --- a/PySDM/products/size_spectral/particle_size_spectrum.py +++ b/PySDM/products/size_spectral/particle_size_spectrum.py @@ -1,6 +1,7 @@ """ wet radius-binned particle size spectra (per mass of dry air or per volume of air) """ + from abc import ABC import numpy as np diff --git a/PySDM/products/size_spectral/particle_volume_versus_radius_logarithm_spectrum.py b/PySDM/products/size_spectral/particle_volume_versus_radius_logarithm_spectrum.py index bd3e70c72..aec4f3817 100644 --- a/PySDM/products/size_spectral/particle_volume_versus_radius_logarithm_spectrum.py +++ b/PySDM/products/size_spectral/particle_volume_versus_radius_logarithm_spectrum.py @@ -3,6 +3,7 @@ i.e. volume of particles per volume of air having in the size range ln(r) to ln(r) + dln(r) """ + import numpy as np from PySDM.products.impl.spectrum_moment_product import SpectrumMomentProduct diff --git a/PySDM/products/size_spectral/radius_binned_number_averaged_terminal_velocity.py b/PySDM/products/size_spectral/radius_binned_number_averaged_terminal_velocity.py index b9ac99f6b..a1bf36193 100644 --- a/PySDM/products/size_spectral/radius_binned_number_averaged_terminal_velocity.py +++ b/PySDM/products/size_spectral/radius_binned_number_averaged_terminal_velocity.py @@ -1,6 +1,7 @@ """ Provides radius bin-resolved average terminal velocity (average is particle-number weighted) """ + import numpy as np from PySDM.products.impl.spectrum_moment_product import SpectrumMomentProduct diff --git a/PySDM/products/size_spectral/size_standard_deviation.py b/PySDM/products/size_spectral/size_standard_deviation.py index 6fa1d4ef6..2ceb6a796 100644 --- a/PySDM/products/size_spectral/size_standard_deviation.py +++ b/PySDM/products/size_spectral/size_standard_deviation.py @@ -2,6 +2,7 @@ standard deviation of radius/area/volume of particles within a grid cell, for activated, unactivated or both """ + import numpy as np from PySDM.products.impl.activation_filtered_product import _ActivationFilteredProduct diff --git a/PySDM/products/size_spectral/total_particle_concentration.py b/PySDM/products/size_spectral/total_particle_concentration.py index b5ac589f5..e4c2e1b57 100644 --- a/PySDM/products/size_spectral/total_particle_concentration.py +++ b/PySDM/products/size_spectral/total_particle_concentration.py @@ -1,6 +1,7 @@ """ particle concentration (per volume of air) """ + from PySDM.products.impl.concentration_product import ConcentrationProduct diff --git a/PySDM/products/size_spectral/total_particle_specific_concentration.py b/PySDM/products/size_spectral/total_particle_specific_concentration.py index 23391cd4b..172d114c3 100644 --- a/PySDM/products/size_spectral/total_particle_specific_concentration.py +++ b/PySDM/products/size_spectral/total_particle_specific_concentration.py @@ -1,6 +1,7 @@ """ particle specific concentration (per mass of dry air) """ + from PySDM.products.impl.concentration_product import ConcentrationProduct diff --git a/PySDM/products/size_spectral/water_mixing_ratio.py b/PySDM/products/size_spectral/water_mixing_ratio.py index ddf55d4c9..f4c9919f4 100644 --- a/PySDM/products/size_spectral/water_mixing_ratio.py +++ b/PySDM/products/size_spectral/water_mixing_ratio.py @@ -2,6 +2,7 @@ liquid water mixing ratio (per mass of dry air) computed from particle sizes (optionally restricted to a given size range) """ + import numpy as np from PySDM.products.impl.moment_product import MomentProduct diff --git a/examples/PySDM_examples/Alpert_and_Knopf_2016/__init__.py b/examples/PySDM_examples/Alpert_and_Knopf_2016/__init__.py index fef8840a6..56e6ef62e 100644 --- a/examples/PySDM_examples/Alpert_and_Knopf_2016/__init__.py +++ b/examples/PySDM_examples/Alpert_and_Knopf_2016/__init__.py @@ -2,6 +2,7 @@ box-environment example based on [Alpert & Knopf 2016 (Atmos. Chem. Phys. 16)](https://doi.org/10.5194/acp-16-2083-2016) """ + # pylint: disable=invalid-name from .simulation import Simulation, simulation from .table_1 import Table1 diff --git a/examples/PySDM_examples/Arabas_and_Shima_2017/__init__.py b/examples/PySDM_examples/Arabas_and_Shima_2017/__init__.py index c58169286..098ac3f53 100644 --- a/examples/PySDM_examples/Arabas_and_Shima_2017/__init__.py +++ b/examples/PySDM_examples/Arabas_and_Shima_2017/__init__.py @@ -2,4 +2,5 @@ condensation-evaportaion parcel example based on [Arabas and Shima 2017 (Nonlin. Processes Geophys. 24)](https://doi.org/10.5194/npg-24-535-2017) """ + # pylint: disable=invalid-name diff --git a/examples/PySDM_examples/Arabas_et_al_2015/settings.py b/examples/PySDM_examples/Arabas_et_al_2015/settings.py index 4a22933ae..cb58b24b9 100644 --- a/examples/PySDM_examples/Arabas_et_al_2015/settings.py +++ b/examples/PySDM_examples/Arabas_et_al_2015/settings.py @@ -28,10 +28,7 @@ def __dir__(self) -> Iterable[str]: def __init__( self, formulae=None, - rhod_w_max: float = 0.6 - * si.metres - / si.seconds - * (si.kilogram / si.metre**3), + rhod_w_max: float = 0.6 * si.metres / si.seconds * (si.kilogram / si.metre**3), ): super().__init__(formulae or Formulae(), rhod_w_max=rhod_w_max) diff --git a/examples/PySDM_examples/Arabas_et_al_2023/__init__.py b/examples/PySDM_examples/Arabas_et_al_2023/__init__.py index f084f2dd4..94e6bd995 100644 --- a/examples/PySDM_examples/Arabas_et_al_2023/__init__.py +++ b/examples/PySDM_examples/Arabas_et_al_2023/__init__.py @@ -2,6 +2,7 @@ box-model and 2D prescribed-flow immersion-freezing examples based on [Arabas et al. 2023](https://arxiv.org/abs/2308.05015) """ + from .make_particulator import make_particulator from .plots import make_freezing_spec_plot, make_pdf_plot, make_temperature_plot from .run_simulation import run_simulation diff --git a/examples/PySDM_examples/Arabas_et_al_2023/plots.py b/examples/PySDM_examples/Arabas_et_al_2023/plots.py index 52eb71abf..fdd326a9c 100644 --- a/examples/PySDM_examples/Arabas_et_al_2023/plots.py +++ b/examples/PySDM_examples/Arabas_et_al_2023/plots.py @@ -28,9 +28,11 @@ def make_temperature_plot(data): xy2.plot( datum["t"], np.asarray(datum["qi"]) / qi_unit, # marker='.', - label=f"Monte-Carlo ({labels[v['singular']]})" - if not plotted[v["singular"]] - else "", + label=( + f"Monte-Carlo ({labels[v['singular']]})" + if not plotted[v["singular"]] + else "" + ), color=colors[v["singular"]], ) plotted[v["singular"]] = True diff --git a/examples/PySDM_examples/Bartman_et_al_2021/label.py b/examples/PySDM_examples/Bartman_et_al_2021/label.py index d6711a207..a53be17e4 100644 --- a/examples/PySDM_examples/Bartman_et_al_2021/label.py +++ b/examples/PySDM_examples/Bartman_et_al_2021/label.py @@ -1,11 +1,11 @@ def label(settings): lbl = str( { - k.replace("condensation_", ""): f"{v:.1e}" - if isinstance(v, float) - else str(v).zfill(2) - if isinstance(v, int) - else v + k.replace("condensation_", ""): ( + f"{v:.1e}" + if isinstance(v, float) + else str(v).zfill(2) if isinstance(v, int) else v + ) for k, v in settings.items() } ) diff --git a/examples/PySDM_examples/Berry_1967/__init__.py b/examples/PySDM_examples/Berry_1967/__init__.py index 686adf932..3a5da9a8c 100644 --- a/examples/PySDM_examples/Berry_1967/__init__.py +++ b/examples/PySDM_examples/Berry_1967/__init__.py @@ -2,4 +2,5 @@ box-model coalescence-only example based on [Berry 1967 (J. Atmos. Sci. 24)](https://doi.org/10.1175/1520-0469(1967)024%3C0688:CDGBC%3E2.0.CO;2) """ + # pylint: disable=invalid-name diff --git a/examples/PySDM_examples/Bieli_et_al_2022/__init__.py b/examples/PySDM_examples/Bieli_et_al_2022/__init__.py index bfa5a0ca1..66e5b62b4 100644 --- a/examples/PySDM_examples/Bieli_et_al_2022/__init__.py +++ b/examples/PySDM_examples/Bieli_et_al_2022/__init__.py @@ -1,4 +1,5 @@ """ collision-only box-model example from [Bieli et al. 2022](https://doi.org/10.1029/2022MS002994) """ + # pylint: disable=invalid-name diff --git a/examples/PySDM_examples/Bolot_et_al_2013/__init__.py b/examples/PySDM_examples/Bolot_et_al_2013/__init__.py index bd8e0823c..cec20372c 100644 --- a/examples/PySDM_examples/Bolot_et_al_2013/__init__.py +++ b/examples/PySDM_examples/Bolot_et_al_2013/__init__.py @@ -2,4 +2,5 @@ figures from Bolot et al. 2013 (Atmos. Chem. Phys. 13) https://doi.org/10.5194/acp-13-7903-2013 """ + # pylint: disable=invalid-name diff --git a/examples/PySDM_examples/Ervens_and_Feingold_2012/__init__.py b/examples/PySDM_examples/Ervens_and_Feingold_2012/__init__.py index f8adbf860..778a04337 100644 --- a/examples/PySDM_examples/Ervens_and_Feingold_2012/__init__.py +++ b/examples/PySDM_examples/Ervens_and_Feingold_2012/__init__.py @@ -2,4 +2,5 @@ aerosol distribution from [Ervens and Feingold 2012 (Atmos. Chem. Phys. 12)](https://doi.org/10.5194/acp-12-5807-2012) """ + # pylint: disable=invalid-name diff --git a/examples/PySDM_examples/Ervens_and_Feingold_2012/settings.py b/examples/PySDM_examples/Ervens_and_Feingold_2012/settings.py index 7fb51ffb7..5e588639c 100644 --- a/examples/PySDM_examples/Ervens_and_Feingold_2012/settings.py +++ b/examples/PySDM_examples/Ervens_and_Feingold_2012/settings.py @@ -7,8 +7,6 @@ def sampled_ccn_diameter_number_concentration_spectrum( n_sd: int = 11, size_range: tuple = (0.02 * si.um, 2 * si.um) ): return Logarithmic( - spectrum=Lognormal( - s_geom=1.4, m_mode=0.04 * si.um, norm_factor=100 / si.cm**3 - ), + spectrum=Lognormal(s_geom=1.4, m_mode=0.04 * si.um, norm_factor=100 / si.cm**3), size_range=size_range, ).sample(n_sd) diff --git a/examples/PySDM_examples/Kreidenweis_et_al_2003/settings.py b/examples/PySDM_examples/Kreidenweis_et_al_2003/settings.py index 87a6fe4a8..de7bd938a 100644 --- a/examples/PySDM_examples/Kreidenweis_et_al_2003/settings.py +++ b/examples/PySDM_examples/Kreidenweis_et_al_2003/settings.py @@ -70,11 +70,13 @@ def __init__( self.starting_amounts = { "moles_" - + k: self.formulae.trivia.volume(self.r_dry) - * self.DRY_RHO - / self.dry_molar_mass - if k in ("N_mIII", "S_VI") - else np.zeros(self.n_sd) + + k: ( + self.formulae.trivia.volume(self.r_dry) + * self.DRY_RHO + / self.dry_molar_mass + if k in ("N_mIII", "S_VI") + else np.zeros(self.n_sd) + ) for k in AQUEOUS_COMPOUNDS } diff --git a/examples/PySDM_examples/Merlivat_and_Nief_1967/__init__.py b/examples/PySDM_examples/Merlivat_and_Nief_1967/__init__.py index d0d1193a3..d7603595e 100644 --- a/examples/PySDM_examples/Merlivat_and_Nief_1967/__init__.py +++ b/examples/PySDM_examples/Merlivat_and_Nief_1967/__init__.py @@ -2,4 +2,5 @@ figure from Merlivat and Nief 1967 (Tellus) https://doi.org/10.3402/tellusa.v19i1.9756 """ + # pylint: disable=invalid-name diff --git a/examples/PySDM_examples/Niedermeier_et_al_2014/__init__.py b/examples/PySDM_examples/Niedermeier_et_al_2014/__init__.py index 62208d8a4..1eff3edbc 100644 --- a/examples/PySDM_examples/Niedermeier_et_al_2014/__init__.py +++ b/examples/PySDM_examples/Niedermeier_et_al_2014/__init__.py @@ -1,3 +1,4 @@ """ based on [Niedermeier et al. 2014](https://doi.org/10.1002/2013GL058684) """ + from .settings import Settings from .simulation import Simulation diff --git a/examples/PySDM_examples/Niedermeier_et_al_2014/simulation.py b/examples/PySDM_examples/Niedermeier_et_al_2014/simulation.py index cfd93c536..47cb4c673 100644 --- a/examples/PySDM_examples/Niedermeier_et_al_2014/simulation.py +++ b/examples/PySDM_examples/Niedermeier_et_al_2014/simulation.py @@ -68,9 +68,11 @@ def __init__(self, settings: Settings): data[:-1], np.full( settings.in_sampling_n, - data[-1] - if attribute != "multiplicity" - else data[-1] / settings.in_sampling_n, + ( + data[-1] + if attribute != "multiplicity" + else data[-1] / settings.in_sampling_n + ), ), ) ) diff --git a/examples/PySDM_examples/Pierchala_et_al_2022/__init__.py b/examples/PySDM_examples/Pierchala_et_al_2022/__init__.py index b7f2928a5..875d20b0b 100644 --- a/examples/PySDM_examples/Pierchala_et_al_2022/__init__.py +++ b/examples/PySDM_examples/Pierchala_et_al_2022/__init__.py @@ -2,4 +2,5 @@ based on Pierchala et al. 2022 (Geochim. Cosmochim. Acta) https://doi.org/10.1016/j.gca.2022.01.020 """ + # pylint: disable=invalid-name diff --git a/examples/PySDM_examples/Pyrcel/profile_plotter.py b/examples/PySDM_examples/Pyrcel/profile_plotter.py index 1be4a431f..5f945a31a 100644 --- a/examples/PySDM_examples/Pyrcel/profile_plotter.py +++ b/examples/PySDM_examples/Pyrcel/profile_plotter.py @@ -57,11 +57,11 @@ def plot_data(self, settings, output): settings.formulae.trivia.radius(volume=np.asarray(volume)) / si.um, output["products"]["z"], color="magenta" if drop_id < settings.n_sd_per_mode[0] else "blue", - label="mode 1" - if drop_id == 0 - else "mode 2" - if drop_id == settings.n_sd_per_mode[0] - else "", + label=( + "mode 1" + if drop_id == 0 + else "mode 2" if drop_id == settings.n_sd_per_mode[0] else "" + ), ) axR.legend(loc="upper right") axR.set_xlabel("Droplet radius [μm]") diff --git a/examples/PySDM_examples/Shipway_and_Hill_2012/settings.py b/examples/PySDM_examples/Shipway_and_Hill_2012/settings.py index ec6529037..46e9dbcd9 100644 --- a/examples/PySDM_examples/Shipway_and_Hill_2012/settings.py +++ b/examples/PySDM_examples/Shipway_and_Hill_2012/settings.py @@ -60,8 +60,8 @@ def __init__( self.t_max = t_max t_1 = 600 * si.s - self.rho_times_w = ( - lambda t: rho_times_w_1 * np.sin(np.pi * t / t_1) if t < t_1 else 0 + self.rho_times_w = lambda t: ( + rho_times_w_1 * np.sin(np.pi * t / t_1) if t < t_1 else 0 ) apprx_w1 = rho_times_w_1 / self.formulae.constants.rho_STP self.particle_reservoir_depth = ( diff --git a/examples/PySDM_examples/Srivastava_1982/__init__.py b/examples/PySDM_examples/Srivastava_1982/__init__.py index eb8b1c3cc..b2236429a 100644 --- a/examples/PySDM_examples/Srivastava_1982/__init__.py +++ b/examples/PySDM_examples/Srivastava_1982/__init__.py @@ -2,6 +2,7 @@ box-model examples feat. analytic solution for breakup from [Srivastava 1982 (JAS)](https://doi.org/10.1175/1520-0469(1982)039%3C1317:ASMOPC%3E2.0.CO;2) """ + from .equations import Equations, EquationsHelpers from .example import ( add_to_plot_simulation_results, diff --git a/examples/PySDM_examples/Srivastava_1982/example.py b/examples/PySDM_examples/Srivastava_1982/example.py index d5b01cd3e..10d86cce1 100644 --- a/examples/PySDM_examples/Srivastava_1982/example.py +++ b/examples/PySDM_examples/Srivastava_1982/example.py @@ -137,10 +137,10 @@ def get_breakup_coalescence_analytic_results(equations, settings, m0, x, x_log): def get_analytic_results(equations, settings, mean_mass, mean_mass_ratio): res = {} - res[ - SimProducts.Computed.mean_drop_volume_total_volume_ratio.name - ] = compute_drop_volume_total_volume_ratio( - mean_volume=mean_mass / settings.rho, total_volume=settings.total_volume + res[SimProducts.Computed.mean_drop_volume_total_volume_ratio.name] = ( + compute_drop_volume_total_volume_ratio( + mean_volume=mean_mass / settings.rho, total_volume=settings.total_volume + ) ) res[SimProducts.PySDM.total_numer.name] = equations.M / mean_mass_ratio return res diff --git a/examples/PySDM_examples/Srivastava_1982/simulation.py b/examples/PySDM_examples/Srivastava_1982/simulation.py index 63aa38ef8..3af7ea1fd 100644 --- a/examples/PySDM_examples/Srivastava_1982/simulation.py +++ b/examples/PySDM_examples/Srivastava_1982/simulation.py @@ -70,9 +70,9 @@ def run_convergence_analysis(self, x, seeds): if step != 0: particulator.run(steps=1) for prod in self.settings.prods: - self.simulation_res[n_sd][prod][seed][ - step - ] = particulator.products[prod].get() + self.simulation_res[n_sd][prod][seed][step] = ( + particulator.products[prod].get() + ) np.testing.assert_allclose( actual=self.simulation_res[n_sd][ diff --git a/examples/PySDM_examples/Szumowski_et_al_1998/gui_viewer.py b/examples/PySDM_examples/Szumowski_et_al_1998/gui_viewer.py index ee779e986..8891aff2c 100644 --- a/examples/PySDM_examples/Szumowski_et_al_1998/gui_viewer.py +++ b/examples/PySDM_examples/Szumowski_et_al_1998/gui_viewer.py @@ -93,13 +93,15 @@ def reinit(self, products): self.spectrumPlots[key] = ( _SpectrumPlot(r_bins, self.settings.spectrum_per_mass_of_dry_air) if key == "size" - else _TemperaturePlot( - self.settings.T_bins_edges, self.settings.formulae - ) - if key == "temperature" - else _TerminalVelocityPlot( - self.settings.terminal_velocity_radius_bin_edges, - self.settings.formulae, + else ( + _TemperaturePlot( + self.settings.T_bins_edges, self.settings.formulae + ) + if key == "temperature" + else _TerminalVelocityPlot( + self.settings.terminal_velocity_radius_bin_edges, + self.settings.formulae, + ) ) ) clear_output() diff --git a/examples/PySDM_examples/Szumowski_et_al_1998/simulation.py b/examples/PySDM_examples/Szumowski_et_al_1998/simulation.py index f69111cfb..a7a5f0ced 100644 --- a/examples/PySDM_examples/Szumowski_et_al_1998/simulation.py +++ b/examples/PySDM_examples/Szumowski_et_al_1998/simulation.py @@ -162,11 +162,11 @@ def reinit(self, products=None): ) if self.settings.freezing_singular: - attributes[ - "freezing temperature" - ] = formulae.freezing_temperature_spectrum.invcdf( - np.random.random(immersed_surface_area.size), # TODO #599: seed - immersed_surface_area, + attributes["freezing temperature"] = ( + formulae.freezing_temperature_spectrum.invcdf( + np.random.random(immersed_surface_area.size), # TODO #599: seed + immersed_surface_area, + ) ) else: attributes["immersed surface area"] = immersed_surface_area diff --git a/examples/PySDM_examples/Van_Hook_1968/__init__.py b/examples/PySDM_examples/Van_Hook_1968/__init__.py index 936ed4b83..2dc2a8b3e 100644 --- a/examples/PySDM_examples/Van_Hook_1968/__init__.py +++ b/examples/PySDM_examples/Van_Hook_1968/__init__.py @@ -2,4 +2,5 @@ figure from Van Hook 1968 (J. Phys. Chem.) https://doi.org/10.1021/j100850a028 """ + # pylint: disable=invalid-name diff --git a/examples/PySDM_examples/__init__.py b/examples/PySDM_examples/__init__.py index 0dcfcc5f5..1f5fa6165 100644 --- a/examples/PySDM_examples/__init__.py +++ b/examples/PySDM_examples/__init__.py @@ -2,6 +2,7 @@ PySDM_examples package includes common Python modules used in PySDM smoke tests and in example notebooks (but the package wheels do not include the notebooks) """ + from importlib.metadata import PackageNotFoundError, version try: diff --git a/examples/PySDM_examples/deJong_Mackay_et_al_2023/__init__.py b/examples/PySDM_examples/deJong_Mackay_et_al_2023/__init__.py index c1e112902..2ee7923c0 100644 --- a/examples/PySDM_examples/deJong_Mackay_et_al_2023/__init__.py +++ b/examples/PySDM_examples/deJong_Mackay_et_al_2023/__init__.py @@ -2,6 +2,7 @@ box- and single-column breakup-focused examples from [de Jong et al. 2023](https://doi.org/10.5194/gmd-16-4193-2023) """ + # pylint: disable=invalid-name from .plot_rates import plot_ax, plot_zeros_ax from .settings1D import Settings1D diff --git a/examples/PySDM_examples/utils/__init__.py b/examples/PySDM_examples/utils/__init__.py index ee2410fda..388dd1d41 100644 --- a/examples/PySDM_examples/utils/__init__.py +++ b/examples/PySDM_examples/utils/__init__.py @@ -1,6 +1,7 @@ """ reusable commons for examples """ + from .basic_simulation import BasicSimulation from .dummy_controller import DummyController from .notebook_vars import notebook_vars diff --git a/examples/PySDM_examples/utils/notebook_vars.py b/examples/PySDM_examples/utils/notebook_vars.py index df7721515..a052c3c51 100644 --- a/examples/PySDM_examples/utils/notebook_vars.py +++ b/examples/PySDM_examples/utils/notebook_vars.py @@ -1,4 +1,5 @@ """ helper routines for use in smoke tests """ + from pathlib import Path import nbformat diff --git a/setup.py b/setup.py index b3a1c6752..999eb1812 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,7 @@ """ the magick behind "pip install PySDM" """ + import os from setuptools import find_packages, setup diff --git a/tests/smoke_tests/box/dejong_and_mackay_et_al_2023/test_fig_7.py b/tests/smoke_tests/box/dejong_and_mackay_et_al_2023/test_fig_7.py index 799c8e1be..78149329a 100644 --- a/tests/smoke_tests/box/dejong_and_mackay_et_al_2023/test_fig_7.py +++ b/tests/smoke_tests/box/dejong_and_mackay_et_al_2023/test_fig_7.py @@ -68,9 +68,11 @@ def test_fig_7a(backend_class, plot=False): data_x[lbl], data_y[lbl][0] * settings.rho, color=CMAP(i / len(nf_vals)), - label=lbl - if lbl not in pyplot.gca().get_legend_handles_labels()[1] - else "", + label=( + lbl + if lbl not in pyplot.gca().get_legend_handles_labels()[1] + else "" + ), ) pyplot.xscale("log") pyplot.xlabel("particle radius (um)") @@ -149,9 +151,11 @@ def test_fig_7b(backend_class, plot=False): # pylint: disable=too-many-locals data_y[lbl][0] * settings.rho, color=CMAP(i / len(mu_vals)), linestyle="-", - label=lbl - if lbl not in pyplot.gca().get_legend_handles_labels()[1] - else "", + label=( + lbl + if lbl not in pyplot.gca().get_legend_handles_labels()[1] + else "" + ), ) pyplot.xscale("log") diff --git a/tests/smoke_tests/box/partmc/test_dry_wet_equilibration.py b/tests/smoke_tests/box/partmc/test_dry_wet_equilibration.py index 2a14a9f02..aa73cf885 100644 --- a/tests/smoke_tests/box/partmc/test_dry_wet_equilibration.py +++ b/tests/smoke_tests/box/partmc/test_dry_wet_equilibration.py @@ -1,5 +1,6 @@ """ comparing kappa-Koehler wet radius equilibration in PySDM and PartMC (based on PyPartMC-examples notebook by Zach D'Aquino) """ + # pylint: disable=missing-function-docstring,no-member import platform from collections import namedtuple diff --git a/tests/smoke_tests/box/shima_et_al_2009/test_lwc_constant.py b/tests/smoke_tests/box/shima_et_al_2009/test_lwc_constant.py index fab58f262..9100d71fb 100644 --- a/tests/smoke_tests/box/shima_et_al_2009/test_lwc_constant.py +++ b/tests/smoke_tests/box/shima_et_al_2009/test_lwc_constant.py @@ -1,6 +1,7 @@ """ checks if liquid water contant remains constant throughout coalescence-only simulation """ + import numpy as np import pytest diff --git a/tests/smoke_tests/conftest.py b/tests/smoke_tests/conftest.py index ee9c49502..0614d7104 100644 --- a/tests/smoke_tests/conftest.py +++ b/tests/smoke_tests/conftest.py @@ -1,4 +1,5 @@ """ borrowing everything from unit_tests (this cannot be one level up due to devops_tests) """ + import pytest from ..unit_tests.conftest import backend_class diff --git a/tests/smoke_tests/no_env/pierchala_et_al_2022/test_fig_3.py b/tests/smoke_tests/no_env/pierchala_et_al_2022/test_fig_3.py index c4db8f79d..82dcd7903 100644 --- a/tests/smoke_tests/no_env/pierchala_et_al_2022/test_fig_3.py +++ b/tests/smoke_tests/no_env/pierchala_et_al_2022/test_fig_3.py @@ -1,14 +1,15 @@ """ regression tests checking values from the plots in Fig 3 """ + from pathlib import Path import numpy as np import pytest -from PySDM_examples import Pierchala_et_al_2022 from PySDM_examples.utils.notebook_vars import notebook_vars from PySDM.physics.constants import PER_MEG, PER_MILLE +from PySDM_examples import Pierchala_et_al_2022 PLOT = False diff --git a/tests/smoke_tests/no_env/pierchala_et_al_2022/test_fig_4.py b/tests/smoke_tests/no_env/pierchala_et_al_2022/test_fig_4.py index 383667482..4dcc94c33 100644 --- a/tests/smoke_tests/no_env/pierchala_et_al_2022/test_fig_4.py +++ b/tests/smoke_tests/no_env/pierchala_et_al_2022/test_fig_4.py @@ -1,14 +1,15 @@ """ regression tests checking values from the plots in Fig 4 """ + from pathlib import Path import numpy as np import pytest -from PySDM_examples import Pierchala_et_al_2022 from PySDM_examples.utils.notebook_vars import notebook_vars from PySDM.physics.constants import PER_MEG, PER_MILLE +from PySDM_examples import Pierchala_et_al_2022 PLOT = False diff --git a/tests/smoke_tests/no_env/pierchala_et_al_2022/test_supplement.py b/tests/smoke_tests/no_env/pierchala_et_al_2022/test_supplement.py index 7f232bdaa..05afcf559 100644 --- a/tests/smoke_tests/no_env/pierchala_et_al_2022/test_supplement.py +++ b/tests/smoke_tests/no_env/pierchala_et_al_2022/test_supplement.py @@ -1,4 +1,5 @@ """ tests for consistency of values taken from the Supplement """ + import numpy as np from PySDM_examples.Pierchala_et_al_2022.commons import deltas_0_SMOW diff --git a/tests/smoke_tests/parcel/graf_et_al_2019/test_fig_4.py b/tests/smoke_tests/parcel/graf_et_al_2019/test_fig_4.py index 73ccc1287..bc00cc029 100644 --- a/tests/smoke_tests/parcel/graf_et_al_2019/test_fig_4.py +++ b/tests/smoke_tests/parcel/graf_et_al_2019/test_fig_4.py @@ -1,11 +1,12 @@ """ tests ensuring values on plots match those in the paper """ + from pathlib import Path import pytest -from PySDM_examples import Graf_et_al_2019 from PySDM_examples.utils import notebook_vars from PySDM.physics import si +from PySDM_examples import Graf_et_al_2019 PLOT = False diff --git a/tests/smoke_tests/parcel/graf_et_al_2019/test_table_1.py b/tests/smoke_tests/parcel/graf_et_al_2019/test_table_1.py index a08ff10f1..ad9eb8710 100644 --- a/tests/smoke_tests/parcel/graf_et_al_2019/test_table_1.py +++ b/tests/smoke_tests/parcel/graf_et_al_2019/test_table_1.py @@ -1,12 +1,13 @@ """ tests ensuring values on plots match those in the paper """ + from pathlib import Path import numpy as np import pytest -from PySDM_examples import Graf_et_al_2019 from PySDM_examples.utils import notebook_vars from PySDM.physics.constants import PER_MILLE +from PySDM_examples import Graf_et_al_2019 PLOT = False diff --git a/tests/unit_tests/attributes/test_isotopes.py b/tests/unit_tests/attributes/test_isotopes.py index 128f717b3..836968ca3 100644 --- a/tests/unit_tests/attributes/test_isotopes.py +++ b/tests/unit_tests/attributes/test_isotopes.py @@ -1,6 +1,7 @@ """ unit tests for isotope-related attributes """ + import numpy as np import pytest diff --git a/tests/unit_tests/backends/test_isotope_methods.py b/tests/unit_tests/backends/test_isotope_methods.py index a80457b98..f84ce3b06 100644 --- a/tests/unit_tests/backends/test_isotope_methods.py +++ b/tests/unit_tests/backends/test_isotope_methods.py @@ -1,6 +1,7 @@ """ unit tests for backend isotope-related routines """ + import numpy as np diff --git a/tests/unit_tests/dynamics/condensation/test_parcel_sanity_checks.py b/tests/unit_tests/dynamics/condensation/test_parcel_sanity_checks.py index 178c9f268..b2bdf7847 100644 --- a/tests/unit_tests/dynamics/condensation/test_parcel_sanity_checks.py +++ b/tests/unit_tests/dynamics/condensation/test_parcel_sanity_checks.py @@ -1,4 +1,5 @@ """ tests ensuring proper condensation solver operation in some parcel-model based cases """ + import pytest from matplotlib import pyplot from scipy import signal diff --git a/tests/unit_tests/dynamics/test_isotopic_fractionation.py b/tests/unit_tests/dynamics/test_isotopic_fractionation.py index f27016d22..fa1b2df9f 100644 --- a/tests/unit_tests/dynamics/test_isotopic_fractionation.py +++ b/tests/unit_tests/dynamics/test_isotopic_fractionation.py @@ -1,6 +1,7 @@ """ unit test for the IsotopicFractionation dynamic """ + from contextlib import nullcontext import numpy as np diff --git a/tests/unit_tests/physics/test_hygroscopicity_fierce_diagrams.py b/tests/unit_tests/physics/test_hygroscopicity_fierce_diagrams.py index 5f9b3da9b..ca8630e92 100644 --- a/tests/unit_tests/physics/test_hygroscopicity_fierce_diagrams.py +++ b/tests/unit_tests/physics/test_hygroscopicity_fierce_diagrams.py @@ -1,6 +1,7 @@ """ comparing full and linearised formula for kappa-Koehler hygroscopicity parameterisation using dry-radius/kappa surfaces of critical supersaturation (diagram concept by Laura Fierce) """ + import numpy as np from matplotlib import pyplot diff --git a/tests/unit_tests/physics/test_isotope_ratio_evolution.py b/tests/unit_tests/physics/test_isotope_ratio_evolution.py index 3eb99e7ac..c52737437 100644 --- a/tests/unit_tests/physics/test_isotope_ratio_evolution.py +++ b/tests/unit_tests/physics/test_isotope_ratio_evolution.py @@ -1,4 +1,5 @@ """ Tests for formulae from [Merlivat and Jouzel 1979](https://doi.org/10.1029/JC084iC08p05029) """ + from functools import partial import numpy as np diff --git a/tests/unit_tests/products/test_concentration_product.py b/tests/unit_tests/products/test_concentration_product.py index a2c719d34..1d8b56060 100644 --- a/tests/unit_tests/products/test_concentration_product.py +++ b/tests/unit_tests/products/test_concentration_product.py @@ -38,9 +38,9 @@ def test_stp(backend_class, stp): # assert np.testing.assert_approx_equal( actual=prod, - desired=CONC / RHOD * particulator.formulae.constants.rho_STP - if stp - else CONC, + desired=( + CONC / RHOD * particulator.formulae.constants.rho_STP if stp else CONC + ), significant=7, ) diff --git a/tests/unit_tests/test_imports.py b/tests/unit_tests/test_imports.py index d1d5bfa59..28c2f3ff1 100644 --- a/tests/unit_tests/test_imports.py +++ b/tests/unit_tests/test_imports.py @@ -1,4 +1,5 @@ """ test ensuring that all needed __init__.py entries are in place """ + import pytest import PySDM From 965884977703f6bcb815bc28d4e8f7197d230c16 Mon Sep 17 00:00:00 2001 From: Sylwester Arabas Date: Sun, 28 Jan 2024 05:17:21 +0100 Subject: [PATCH 2/5] disable wrong-import-order checks (as anyhow enforced by isort) --- .github/workflows/tests+artifacts+pypi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests+artifacts+pypi.yml b/.github/workflows/tests+artifacts+pypi.yml index fef889c46..d30e8ad5f 100644 --- a/.github/workflows/tests+artifacts+pypi.yml +++ b/.github/workflows/tests+artifacts+pypi.yml @@ -102,7 +102,7 @@ jobs: pip install -e .[tests] - run: | # TODO #682 - pylint --unsafe-load-any-extension=y --disable=fixme,invalid-name,missing-function-docstring,missing-class-docstring,protected-access,duplicate-code $(git ls-files '*.py' | grep -v -e ^examples -e ^tutorials) + pylint --unsafe-load-any-extension=y --disable=fixme,wrong-import-order,invalid-name,missing-function-docstring,missing-class-docstring,protected-access,duplicate-code $(git ls-files '*.py' | grep -v -e ^examples -e ^tutorials) - run: | # TODO #682 pylint --max-module-lines=550 --unsafe-load-any-extension=y --disable=fixme,too-many-function-args,unsubscriptable-object,consider-using-with,protected-access,too-many-statements,too-many-public-methods,too-many-branches,duplicate-code,invalid-name,missing-function-docstring,missing-module-docstring,missing-class-docstring,too-many-locals,too-many-instance-attributes,too-few-public-methods,too-many-arguments,c-extension-no-member $(git ls-files '*.py' | grep ^examples) From 65e258c4cce6a0aa9e5a15198345cbf263835e4a Mon Sep 17 00:00:00 2001 From: Sylwester Arabas Date: Sun, 28 Jan 2024 14:35:05 +0100 Subject: [PATCH 3/5] disable isort since it gives inconsistent output on CI vs. local machines (with same versions!) --- .github/workflows/tests+artifacts+pypi.yml | 2 +- .pre-commit-config.yaml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests+artifacts+pypi.yml b/.github/workflows/tests+artifacts+pypi.yml index d30e8ad5f..fef889c46 100644 --- a/.github/workflows/tests+artifacts+pypi.yml +++ b/.github/workflows/tests+artifacts+pypi.yml @@ -102,7 +102,7 @@ jobs: pip install -e .[tests] - run: | # TODO #682 - pylint --unsafe-load-any-extension=y --disable=fixme,wrong-import-order,invalid-name,missing-function-docstring,missing-class-docstring,protected-access,duplicate-code $(git ls-files '*.py' | grep -v -e ^examples -e ^tutorials) + pylint --unsafe-load-any-extension=y --disable=fixme,invalid-name,missing-function-docstring,missing-class-docstring,protected-access,duplicate-code $(git ls-files '*.py' | grep -v -e ^examples -e ^tutorials) - run: | # TODO #682 pylint --max-module-lines=550 --unsafe-load-any-extension=y --disable=fixme,too-many-function-args,unsubscriptable-object,consider-using-with,protected-access,too-many-statements,too-many-public-methods,too-many-branches,duplicate-code,invalid-name,missing-function-docstring,missing-module-docstring,missing-class-docstring,too-many-locals,too-many-instance-attributes,too-few-public-methods,too-many-arguments,c-extension-no-member $(git ls-files '*.py' | grep ^examples) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a6e92c538..d2eb269d3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,10 +8,10 @@ repos: hooks: - id: black - - repo: https://github.com/timothycrosley/isort - rev: 5.13.2 - hooks: - - id: isort +# - repo: https://github.com/timothycrosley/isort +# rev: 5.13.2 +# hooks: +# - id: isort - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.5.0 From 787092cfab2cddc0906544247e4a7201a280944a Mon Sep 17 00:00:00 2001 From: Sylwester Arabas Date: Sun, 28 Jan 2024 15:38:43 +0100 Subject: [PATCH 4/5] import order for pylint --- tests/smoke_tests/no_env/pierchala_et_al_2022/test_fig_3.py | 3 ++- tests/smoke_tests/no_env/pierchala_et_al_2022/test_fig_4.py | 3 ++- tests/smoke_tests/parcel/graf_et_al_2019/test_fig_4.py | 3 ++- tests/smoke_tests/parcel/graf_et_al_2019/test_table_1.py | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/smoke_tests/no_env/pierchala_et_al_2022/test_fig_3.py b/tests/smoke_tests/no_env/pierchala_et_al_2022/test_fig_3.py index 82dcd7903..446b6eb3f 100644 --- a/tests/smoke_tests/no_env/pierchala_et_al_2022/test_fig_3.py +++ b/tests/smoke_tests/no_env/pierchala_et_al_2022/test_fig_3.py @@ -6,9 +6,10 @@ import numpy as np import pytest -from PySDM_examples.utils.notebook_vars import notebook_vars from PySDM.physics.constants import PER_MEG, PER_MILLE + +from PySDM_examples.utils.notebook_vars import notebook_vars from PySDM_examples import Pierchala_et_al_2022 PLOT = False diff --git a/tests/smoke_tests/no_env/pierchala_et_al_2022/test_fig_4.py b/tests/smoke_tests/no_env/pierchala_et_al_2022/test_fig_4.py index 4dcc94c33..3e06c3f12 100644 --- a/tests/smoke_tests/no_env/pierchala_et_al_2022/test_fig_4.py +++ b/tests/smoke_tests/no_env/pierchala_et_al_2022/test_fig_4.py @@ -6,9 +6,10 @@ import numpy as np import pytest -from PySDM_examples.utils.notebook_vars import notebook_vars from PySDM.physics.constants import PER_MEG, PER_MILLE + +from PySDM_examples.utils.notebook_vars import notebook_vars from PySDM_examples import Pierchala_et_al_2022 PLOT = False diff --git a/tests/smoke_tests/parcel/graf_et_al_2019/test_fig_4.py b/tests/smoke_tests/parcel/graf_et_al_2019/test_fig_4.py index bc00cc029..71f09fdc2 100644 --- a/tests/smoke_tests/parcel/graf_et_al_2019/test_fig_4.py +++ b/tests/smoke_tests/parcel/graf_et_al_2019/test_fig_4.py @@ -3,9 +3,10 @@ from pathlib import Path import pytest -from PySDM_examples.utils import notebook_vars from PySDM.physics import si + +from PySDM_examples.utils import notebook_vars from PySDM_examples import Graf_et_al_2019 PLOT = False diff --git a/tests/smoke_tests/parcel/graf_et_al_2019/test_table_1.py b/tests/smoke_tests/parcel/graf_et_al_2019/test_table_1.py index ad9eb8710..e25633814 100644 --- a/tests/smoke_tests/parcel/graf_et_al_2019/test_table_1.py +++ b/tests/smoke_tests/parcel/graf_et_al_2019/test_table_1.py @@ -4,9 +4,10 @@ import numpy as np import pytest -from PySDM_examples.utils import notebook_vars from PySDM.physics.constants import PER_MILLE + +from PySDM_examples.utils import notebook_vars from PySDM_examples import Graf_et_al_2019 PLOT = False From ef2226c6762ce4b484b07fb7d213906c31701666 Mon Sep 17 00:00:00 2001 From: Sylwester Arabas Date: Sun, 28 Jan 2024 15:51:58 +0100 Subject: [PATCH 5/5] one more import reorder --- tests/smoke_tests/no_env/pierchala_et_al_2022/test_fig_3.py | 4 ++-- tests/smoke_tests/no_env/pierchala_et_al_2022/test_fig_4.py | 4 ++-- tests/smoke_tests/parcel/graf_et_al_2019/test_fig_4.py | 4 ++-- tests/smoke_tests/parcel/graf_et_al_2019/test_table_1.py | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/smoke_tests/no_env/pierchala_et_al_2022/test_fig_3.py b/tests/smoke_tests/no_env/pierchala_et_al_2022/test_fig_3.py index 446b6eb3f..445a0471c 100644 --- a/tests/smoke_tests/no_env/pierchala_et_al_2022/test_fig_3.py +++ b/tests/smoke_tests/no_env/pierchala_et_al_2022/test_fig_3.py @@ -7,11 +7,11 @@ import numpy as np import pytest -from PySDM.physics.constants import PER_MEG, PER_MILLE - from PySDM_examples.utils.notebook_vars import notebook_vars from PySDM_examples import Pierchala_et_al_2022 +from PySDM.physics.constants import PER_MEG, PER_MILLE + PLOT = False diff --git a/tests/smoke_tests/no_env/pierchala_et_al_2022/test_fig_4.py b/tests/smoke_tests/no_env/pierchala_et_al_2022/test_fig_4.py index 3e06c3f12..644036102 100644 --- a/tests/smoke_tests/no_env/pierchala_et_al_2022/test_fig_4.py +++ b/tests/smoke_tests/no_env/pierchala_et_al_2022/test_fig_4.py @@ -7,11 +7,11 @@ import numpy as np import pytest -from PySDM.physics.constants import PER_MEG, PER_MILLE - from PySDM_examples.utils.notebook_vars import notebook_vars from PySDM_examples import Pierchala_et_al_2022 +from PySDM.physics.constants import PER_MEG, PER_MILLE + PLOT = False diff --git a/tests/smoke_tests/parcel/graf_et_al_2019/test_fig_4.py b/tests/smoke_tests/parcel/graf_et_al_2019/test_fig_4.py index 71f09fdc2..c4d9eedd1 100644 --- a/tests/smoke_tests/parcel/graf_et_al_2019/test_fig_4.py +++ b/tests/smoke_tests/parcel/graf_et_al_2019/test_fig_4.py @@ -4,11 +4,11 @@ import pytest -from PySDM.physics import si - from PySDM_examples.utils import notebook_vars from PySDM_examples import Graf_et_al_2019 +from PySDM.physics import si + PLOT = False diff --git a/tests/smoke_tests/parcel/graf_et_al_2019/test_table_1.py b/tests/smoke_tests/parcel/graf_et_al_2019/test_table_1.py index e25633814..16729fd72 100644 --- a/tests/smoke_tests/parcel/graf_et_al_2019/test_table_1.py +++ b/tests/smoke_tests/parcel/graf_et_al_2019/test_table_1.py @@ -5,11 +5,11 @@ import numpy as np import pytest -from PySDM.physics.constants import PER_MILLE - from PySDM_examples.utils import notebook_vars from PySDM_examples import Graf_et_al_2019 +from PySDM.physics.constants import PER_MILLE + PLOT = False