From e3169f9f51845f117db697939e72169c005169d0 Mon Sep 17 00:00:00 2001 From: David Hart Date: Wed, 1 Jan 2025 22:10:34 -0700 Subject: [PATCH] style: Add digit separators to constants for readability --- src/python/sansmic/_version.py | 2 +- src/python/sansmic/empirical.py | 314 ++++++++++++++++---------------- src/python/sansmic/model.py | 12 +- 3 files changed, 164 insertions(+), 164 deletions(-) diff --git a/src/python/sansmic/_version.py b/src/python/sansmic/_version.py index 94ca773..d4d37bc 100644 --- a/src/python/sansmic/_version.py +++ b/src/python/sansmic/_version.py @@ -6,7 +6,7 @@ # # SPDX-License-Identifier: BSD-3-Clause. -__version__ = "1.0.7" +__version__ = "1.0.8-dev.01" copyright = f"""Copyright (c) 2024 National Technology and Engineering Solutions of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S. diff --git a/src/python/sansmic/empirical.py b/src/python/sansmic/empirical.py index 9dbb48b..c40fa69 100644 --- a/src/python/sansmic/empirical.py +++ b/src/python/sansmic/empirical.py @@ -22,12 +22,12 @@ a = array( [ - 7.6091661297e-1, - -3.8715516531, - 7.8254117638, - -7.8395924067, - 3.8789476581, - -0.7533873462, + 7.609_166_129_7e-1, + -3.871_551_653_1, + 7.825_411_763_8, + -7.839_592_406_7, + 3.878_947_658_1, + -0.753_387_346_2, ], dtype=float, ) @@ -38,9 +38,9 @@ # Coefficients used for source term see (SAND2015-XXXX Ch2.3) c = array( [ - 1.0019795678, - 0.67459890538, - 0.32350531044, + 1.001_979_567_8, + 0.674_598_905_38, + 0.323_505_310_44, ], dtype=float, ) @@ -51,184 +51,184 @@ sg_matrix = array( [ [ - 0.99987, - 0.99973, - 0.99823, - 0.99707, - 0.99567, - 0.99224, - 0.98807, - 0.98324, - 0.97183, - 0.95838, + 0.999_87, + 0.999_73, + 0.998_23, + 0.997_07, + 0.995_67, + 0.992_24, + 0.988_07, + 0.983_24, + 0.971_83, + 0.958_38, ], [ - 1.00747, - 1.00707, - 1.00534, - 1.00409, - 1.00261, - 0.99908, - 0.99482, + 1.007_47, + 1.007_07, + 1.005_34, + 1.004_09, + 1.002_61, + 0.999_08, + 0.994_82, 0.99, - 0.9785, - 0.9651, + 0.978_5, + 0.965_1, ], [ - 1.01509, - 1.01442, - 1.01246, - 1.01112, - 1.00957, - 1.00593, - 1.00161, - 0.9967, - 0.9852, - 0.9719, + 1.015_09, + 1.014_42, + 1.012_46, + 1.011_12, + 1.009_57, + 1.005_93, + 1.001_61, + 0.996_7, + 0.985_2, + 0.971_9, ], [ - 1.03038, - 1.0292, - 1.0268, - 1.0253, - 1.02361, - 1.01977, - 1.01531, - 1.0103, - 0.9988, - 0.9855, + 1.030_38, + 1.029_2, + 1.026_8, + 1.025_3, + 1.023_61, + 1.019_77, + 1.015_31, + 1.010_3, + 0.998_8, + 0.985_5, ], [ - 1.04575, - 1.04408, - 1.04127, - 1.03963, - 1.03781, - 1.03378, - 1.02919, - 1.0241, - 1.0125, - 0.9994, + 1.045_75, + 1.044_08, + 1.041_27, + 1.039_63, + 1.037_81, + 1.033_78, + 1.029_19, + 1.024_1, + 1.012_5, + 0.999_4, ], [ - 1.06121, - 1.05907, - 1.05589, - 1.05412, - 1.05219, - 1.04798, - 1.04326, - 1.0381, - 1.0264, - 1.0134, + 1.061_21, + 1.059_07, + 1.055_89, + 1.054_12, + 1.052_19, + 1.047_98, + 1.043_26, + 1.038_1, + 1.026_4, + 1.013_4, ], [ - 1.07677, - 1.07419, - 1.07068, - 1.06879, - 1.06676, - 1.06238, - 1.05753, - 1.0523, - 1.0405, - 1.0276, + 1.076_77, + 1.074_19, + 1.070_68, + 1.068_79, + 1.066_76, + 1.062_38, + 1.057_53, + 1.052_3, + 1.040_5, + 1.027_6, ], [ - 1.09244, - 1.08946, - 1.08566, - 1.08365, - 1.08153, - 1.07699, - 1.07202, - 1.0667, - 1.0549, + 1.092_44, + 1.089_46, + 1.085_66, + 1.083_65, + 1.081_53, + 1.076_99, + 1.072_02, + 1.066_7, + 1.054_9, 1.042, ], [ - 1.10824, - 1.10491, - 1.10085, - 1.09872, - 1.09651, - 1.09182, - 1.08674, - 1.0813, - 1.0694, - 1.0565, + 1.108_24, + 1.104_91, + 1.100_85, + 1.098_72, + 1.096_51, + 1.091_82, + 1.086_74, + 1.081_3, + 1.069_4, + 1.056_5, ], [ - 1.12419, - 1.12056, - 1.11621, - 1.11401, - 1.11171, - 1.10688, - 1.1017, - 1.0962, - 1.0842, - 1.0713, + 1.124_19, + 1.120_56, + 1.116_21, + 1.114_01, + 1.111_71, + 1.106_88, + 1.101_7, + 1.096_2, + 1.084_2, + 1.071_3, ], [ - 1.14031, - 1.13643, - 1.1319, - 1.12954, - 1.12715, - 1.12218, - 1.11691, - 1.1113, - 1.0993, - 1.0864, + 1.140_31, + 1.136_43, + 1.131_9, + 1.129_54, + 1.127_15, + 1.122_18, + 1.116_91, + 1.111_3, + 1.099_3, + 1.086_4, ], [ - 1.15663, - 1.15254, - 1.14779, - 1.14533, - 1.14285, - 1.13774, - 1.13238, - 1.1268, - 1.1146, - 1.1017, + 1.156_63, + 1.152_54, + 1.147_79, + 1.145_33, + 1.142_85, + 1.137_74, + 1.132_38, + 1.126_8, + 1.114_6, + 1.101_7, ], [ - 1.17318, - 1.16891, - 1.16395, - 1.1614, - 1.15883, - 1.15358, - 1.14812, - 1.1425, - 1.1303, - 1.1172, + 1.173_18, + 1.168_91, + 1.163_95, + 1.161_4, + 1.158_83, + 1.153_58, + 1.148_12, + 1.142_5, + 1.130_3, + 1.117_2, ], [ - 1.18999, - 1.18557, - 1.1804, - 1.17776, - 1.17511, - 1.16971, - 1.16414, - 1.1584, - 1.1463, - 1.1331, + 1.189_99, + 1.185_57, + 1.180_4, + 1.177_76, + 1.175_11, + 1.169_71, + 1.164_14, + 1.158_4, + 1.146_3, + 1.133_1, ], [ - 1.20709, - 1.20254, - 1.19717, - 1.19443, - 1.1917, - 1.18614, - 1.18045, - 1.1747, - 1.1626, - 1.1492, + 1.207_09, + 1.202_54, + 1.197_17, + 1.194_43, + 1.191_7, + 1.186_14, + 1.180_45, + 1.174_7, + 1.162_6, + 1.149_2, ], ], dtype=float, diff --git a/src/python/sansmic/model.py b/src/python/sansmic/model.py index c719c0f..f148fae 100644 --- a/src/python/sansmic/model.py +++ b/src/python/sansmic/model.py @@ -63,22 +63,22 @@ class Units(IntEnum): @classmethod def inch(self): """1 in ≔ 0.0254 m""" - return Fraction(254, 10000) + return Fraction(254, 10_000) @classmethod def foot(self): """1 ft ≔ 0.3048 m""" - return Fraction(3048, 10000) + return Fraction(3048, 10_000) @classmethod def cubic_foot(self): - """1 ft³ == 0.028316846592 m³""" - return Fraction(3048, 10000) ** 3 + """1 ft³ == 0.028 316 846 592 m³""" + return Fraction(3048, 10_000) ** 3 @classmethod def barrel(self): - """1 bbl == 0.158987294928 m³""" - return 42 * 231 * Fraction(254, 10000) ** 3 + """1 bbl == 0.158 987 294 928 m³""" + return 42 * 231 * Fraction(254, 10_000) ** 3 @classmethod def centimeter(self):