naturedynamics 1.4__tar.gz → 1.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. {naturedynamics-1.4 → naturedynamics-1.6}/PKG-INFO +1 -1
  2. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/__init__.py +1 -1
  3. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/astrophysics/galactic.py +43 -0
  4. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/astrophysics/magnetism.py +13 -0
  5. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/astrophysics/orbital.py +15 -0
  6. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/astrophysics/stellar.py +36 -8
  7. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/constants.py +4 -0
  8. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/utils/conversions.py +18 -0
  9. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/utils/units.py +9 -0
  10. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics.egg-info/PKG-INFO +1 -1
  11. {naturedynamics-1.4 → naturedynamics-1.6}/pyproject.toml +1 -1
  12. {naturedynamics-1.4 → naturedynamics-1.6}/LICENSE +0 -0
  13. {naturedynamics-1.4 → naturedynamics-1.6}/README.md +0 -0
  14. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/applications/__init__.py +0 -0
  15. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/applications/energy.py +0 -0
  16. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/applications/engineering.py +0 -0
  17. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/applications/environmental.py +0 -0
  18. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/applications/medical.py +0 -0
  19. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/astrophysics/__init__.py +0 -0
  20. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/astrophysics/atmospheric.py +0 -0
  21. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/astrophysics/cosmology.py +0 -0
  22. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/astrophysics/insolation.py +0 -0
  23. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/astrophysics/photometry.py +0 -0
  24. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/astrophysics/planetary.py +0 -0
  25. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/astrophysics/tidal.py +0 -0
  26. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/biophysics/__init__.py +0 -0
  27. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/biophysics/biomechanics.py +0 -0
  28. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/biophysics/diffusion.py +0 -0
  29. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/biophysics/membrane.py +0 -0
  30. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/biophysics/neuroscience.py +0 -0
  31. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/biophysics/photosynthesis.py +0 -0
  32. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/computational/__init__.py +0 -0
  33. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/computational/finite_elements.py +0 -0
  34. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/computational/monte_carlo.py +0 -0
  35. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/computational/numerical_methods.py +0 -0
  36. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/computational/optimization.py +0 -0
  37. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/data/CIE_CMF.py +0 -0
  38. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/data/__init__.py +0 -0
  39. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/data/materials/__init__.py +0 -0
  40. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/data/materials/materials.py +0 -0
  41. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/data/spectroscopic_data/__init__.py +0 -0
  42. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/data/spectroscopic_data/spectra.py +0 -0
  43. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/electromagnetism/__init__.py +0 -0
  44. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/electromagnetism/circuits.py +0 -0
  45. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/electromagnetism/electrostatics.py +0 -0
  46. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/electromagnetism/magnetostatics.py +0 -0
  47. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/electromagnetism/maxwell.py +0 -0
  48. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/electromagnetism/optics.py +0 -0
  49. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/electromagnetism/waves.py +0 -0
  50. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/experimental/__init__.py +0 -0
  51. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/experimental/data_analysis.py +0 -0
  52. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/experimental/error_analysis.py +0 -0
  53. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/experimental/instrumentation.py +0 -0
  54. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/experimental/measurement.py +0 -0
  55. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/geophysics/__init__.py +0 -0
  56. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/geophysics/convection.py +0 -0
  57. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/geophysics/plate_kinematics.py +0 -0
  58. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/laws/__init__.py +0 -0
  59. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/laws/conservation.py +0 -0
  60. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/laws/electromagnetic.py +0 -0
  61. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/laws/momentum.py +0 -0
  62. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/laws/newtons_laws.py +0 -0
  63. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/laws/work_energy.py +0 -0
  64. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/mathematical/__init__.py +0 -0
  65. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/mathematical/complex_analysis.py +0 -0
  66. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/mathematical/differential_equations.py +0 -0
  67. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/mathematical/group_theory.py +0 -0
  68. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/mathematical/mathematical_neuroscience.py +0 -0
  69. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/mathematical/special_functions.py +0 -0
  70. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/mathematical/tensor_calculus.py +0 -0
  71. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/mechanics/__init__.py +0 -0
  72. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/mechanics/continuum.py +0 -0
  73. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/mechanics/dynamics.py +0 -0
  74. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/mechanics/fluid_mechanics.py +0 -0
  75. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/mechanics/kinematics.py +0 -0
  76. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/mechanics/lagrangian.py +0 -0
  77. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/mechanics/rotational_mechanics.py +0 -0
  78. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/mechanics/sound.py +0 -0
  79. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/mechanics/statics.py +0 -0
  80. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/mechanics/stress_strain.py +0 -0
  81. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/nuclear/__init__.py +0 -0
  82. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/nuclear/binding_energy.py +0 -0
  83. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/nuclear/decay.py +0 -0
  84. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/nuclear/fission_fusion.py +0 -0
  85. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/nuclear/particles.py +0 -0
  86. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/nuclear/reactions.py +0 -0
  87. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/oscillations/__init__.py +0 -0
  88. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/oscillations/acoustics.py +0 -0
  89. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/oscillations/coupled_oscillators.py +0 -0
  90. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/oscillations/shm.py +0 -0
  91. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/oscillations/vibrations.py +0 -0
  92. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/oscillations/wave_oscillation.py +0 -0
  93. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/plasma/__init__.py +0 -0
  94. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/plasma/basic.py +0 -0
  95. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/plasma/kinetic.py +0 -0
  96. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/plasma/magnetohydrodynamics.py +0 -0
  97. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/plasma/waves.py +0 -0
  98. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/quantum/__init__.py +0 -0
  99. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/quantum/harmonic_oscillator.py +0 -0
  100. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/quantum/hydrogen_atom.py +0 -0
  101. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/quantum/operators.py +0 -0
  102. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/quantum/perturbation.py +0 -0
  103. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/quantum/spin.py +0 -0
  104. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/quantum/statistics.py +0 -0
  105. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/quantum/tunneling.py +0 -0
  106. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/quantum/wave_functions.py +0 -0
  107. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/relativity/__init__.py +0 -0
  108. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/relativity/cosmology.py +0 -0
  109. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/relativity/general.py +0 -0
  110. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/relativity/spacetime.py +0 -0
  111. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/relativity/special.py +0 -0
  112. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/solidstate/__init__.py +0 -0
  113. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/solidstate/crystal_structure.py +0 -0
  114. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/solidstate/electronic.py +0 -0
  115. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/solidstate/magnetic.py +0 -0
  116. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/solidstate/phonons.py +0 -0
  117. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/solidstate/superconductivity.py +0 -0
  118. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/solutions/__init__.py +0 -0
  119. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/solutions/atomic.py +0 -0
  120. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/solutions/field_theory.py +0 -0
  121. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/solutions/molecular.py +0 -0
  122. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/solutions/operators.py +0 -0
  123. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/solutions/statistical.py +0 -0
  124. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/statistical_mechanics/__init__.py +0 -0
  125. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/statistical_mechanics/critical_phenomena.py +0 -0
  126. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/statistical_mechanics/distributions.py +0 -0
  127. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/statistical_mechanics/partition_functions.py +0 -0
  128. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/statistical_mechanics/quantum_statistics.py +0 -0
  129. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/thermodynamics/__init__.py +0 -0
  130. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/thermodynamics/heat_engines.py +0 -0
  131. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/thermodynamics/heat_transfer.py +0 -0
  132. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/thermodynamics/laws.py +0 -0
  133. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/thermodynamics/phase_transitions.py +0 -0
  134. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/tools/__init__.py +0 -0
  135. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/tools/calculators.py +0 -0
  136. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/tools/exporters.py +0 -0
  137. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/tools/simulators.py +0 -0
  138. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/tools/visualizers.py +0 -0
  139. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/utils/__init__.py +0 -0
  140. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/utils/decorators.py +0 -0
  141. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/utils/plotting.py +0 -0
  142. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics/utils/validators.py +0 -0
  143. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics.egg-info/SOURCES.txt +0 -0
  144. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics.egg-info/dependency_links.txt +0 -0
  145. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics.egg-info/requires.txt +0 -0
  146. {naturedynamics-1.4 → naturedynamics-1.6}/naturedynamics.egg-info/top_level.txt +0 -0
  147. {naturedynamics-1.4 → naturedynamics-1.6}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: naturedynamics
3
- Version: 1.4
3
+ Version: 1.6
4
4
  Summary: A comprehensive physics library providing constants, equations, and formulas
5
5
  Author-email: Fabian Schober <reach@fabianschober.com>
6
6
  License: MIT
@@ -2,4 +2,4 @@
2
2
 
3
3
  from . import constants
4
4
 
5
- __version__ = "1.4"
5
+ __version__ = "1.6"
@@ -210,3 +210,46 @@ def stellar_relaxation_time(stellar_density, stellar_mass, velocity_dispersion):
210
210
  coulomb_log = 10 # Typical value
211
211
  return (velocity_dispersion**3) / (4 * PI * GRAVITATIONAL_CONSTANT**2 * stellar_mass**2 * stellar_density * coulomb_log)
212
212
 
213
+
214
+ def exponential_disc_surface_density(mass, scale_length, radius):
215
+ """
216
+ Surface density of an exponential disc (Freeman 1970,
217
+ https://doi.org/10.1086/150474): M / (2 pi R_d^2) * exp(-R / R_d).
218
+
219
+ Args:
220
+ mass (float): Total mass of the disc (kg)
221
+ scale_length (float): Disc scale length R_d (m)
222
+ radius (float): Distance from the centre (m)
223
+
224
+ Returns:
225
+ float: Surface density (kg/m²)
226
+ """
227
+ return mass / (2 * PI * scale_length**2) * math.exp(-radius / scale_length)
228
+
229
+
230
+ def baryonic_tully_fisher_velocity(baryonic_mass):
231
+ """
232
+ Flat rotation velocity from the baryonic Tully-Fisher relation,
233
+ M_b = A V_f^4 (McGaugh 2012, https://doi.org/10.1088/0004-6256/143/2/40).
234
+
235
+ Args:
236
+ baryonic_mass (float): Stars and gas of the galaxy (kg)
237
+
238
+ Returns:
239
+ float: Flat rotation velocity (m/s)
240
+ """
241
+ return (baryonic_mass / BARYONIC_TULLY_FISHER_NORMALISATION) ** 0.25
242
+
243
+
244
+ def circular_orbit_period(radius, velocity):
245
+ """
246
+ Period of a circular orbit, 2 pi R / v.
247
+
248
+ Args:
249
+ radius (float): Orbit radius (m)
250
+ velocity (float): Orbital velocity (m/s)
251
+
252
+ Returns:
253
+ float: Period (s)
254
+ """
255
+ return 2 * PI * radius / velocity
@@ -62,3 +62,16 @@ def bow_shock_distance(standoff, ratio=BOW_SHOCK_STANDOFF_RATIO):
62
62
  def magnetotail_length(standoff, ratio=MAGNETOTAIL_LENGTH_RATIO):
63
63
  """Magnetotail length (m). Empirical and only loosely constrained."""
64
64
  return standoff * ratio
65
+
66
+
67
+ def polar_cap_colatitude(radius, magnetopause_distance):
68
+ """Colatitude (rad) of the polar cap boundary, the auroral oval's poleward edge.
69
+
70
+ A dipole field line crossing the equator at L lies at r = L sin^2(theta);
71
+ the last closed one crosses at the magnetopause, so it reaches the surface
72
+ at sin^2(theta) = radius / magnetopause_distance (as R_P = R_m sin^2(a_cap)
73
+ in https://arxiv.org/abs/2511.16370, read from its abstract only). A vacuum
74
+ dipole: no ring current, no day-night asymmetry. Earth: 18.9 deg at 9.5 R.
75
+ Undefined (ValueError) when the magnetopause does not clear the surface.
76
+ """
77
+ return math.asin(math.sqrt(radius / magnetopause_distance))
@@ -159,3 +159,18 @@ def eccentric_from_true_anomaly(true_anomaly, eccentricity):
159
159
  math.sqrt(1 - eccentricity) * math.sin(true_anomaly / 2),
160
160
  math.sqrt(1 + eccentricity) * math.cos(true_anomaly / 2),
161
161
  )
162
+
163
+
164
+ def resonance_semi_major_axis(semi_major_axis, period_ratio):
165
+ """
166
+ Semi-major axis of an orbit whose period is period_ratio times that of an
167
+ orbit with the given semi-major axis around the same mass. Kepler's third
168
+ law, P^2 proportional to a^3: a' = a (P'/P)^(2/3).
169
+
170
+ A 4:1 interior mean-motion resonance with Jupiter is period_ratio 1/4;
171
+ Neptune's 2:3 exterior one (Pluto) is 3/2.
172
+
173
+ Returns:
174
+ float: a', in the unit of semi_major_axis
175
+ """
176
+ return semi_major_axis * period_ratio ** (2 / 3)
@@ -10,6 +10,9 @@ CIE_LAMBDA_STEP = photometry.CIE_LAMBDA_STEP
10
10
  _cie_xyz_bar = photometry.cie_xyz_bar
11
11
  _srgb_gamma = photometry.srgb_gamma
12
12
 
13
+ AGE_BRIGHTENING = 0.3
14
+ SOLAR_AGE_FRACTION = 0.46
15
+
13
16
 
14
17
  def _planck(wavelength_nm: float, temperature: float) -> float:
15
18
  """Spectral radiance of a blackbody at a given wavelength (nm) and temp (K)."""
@@ -99,15 +102,20 @@ def stellar_luminosity_by_age(mass: float, age: float) -> float:
99
102
  """
100
103
  Estimate luminosity (W) from mass (kg) and age (years),
101
104
  via the mass-luminosity relation with a simple age brightening term.
102
- """
103
- mass_solar = mass / SOLAR_MASS
104
- base_luminosity = SOLAR_LUMINOSITY * mass_solar**3.5
105
-
106
- ms_lifetime = main_sequence_lifetime(mass_solar)
107
- age_fraction = min(age / ms_lifetime, 1.0) # clamp at 1.0 = end of MS life
108
- brightening = 1 + 0.3 * age_fraction # up to ~30% brighter by MS end
109
105
 
110
- return base_luminosity * brightening
106
+ L = L_sun (M/M_sun)^3.5 (1 + 0.3 f) / (1 + 0.3 f_sun), with f the share
107
+ of the main-sequence lifetime lived, capped at 1. M^3.5 is calibrated to
108
+ the Sun as it is today, so the term is divided by the Sun's own
109
+ (f_sun = 4.6 of 10 Gyr): a solar-mass star reads 1 L_sun at 4.6 Gyr,
110
+ 0.88 at birth and 1.14 at the end of the main sequence.
111
+ """
112
+ base_luminosity = SOLAR_LUMINOSITY * (mass / SOLAR_MASS) ** 3.5
113
+ age_fraction = min(age / main_sequence_lifetime(mass), 1.0)
114
+ return (
115
+ base_luminosity
116
+ * (1 + AGE_BRIGHTENING * age_fraction)
117
+ / (1 + AGE_BRIGHTENING * SOLAR_AGE_FRACTION)
118
+ )
111
119
 
112
120
 
113
121
  def effective_temperature(luminosity: float, radius: float) -> float:
@@ -296,3 +304,23 @@ def blackbody_spectrum(wavelengths, temperature, total_flux):
296
304
  return [0.0 for _ in wavelengths]
297
305
  scale = total_flux * math.pi * 1e-9 / bolometric
298
306
  return [_planck(w, temperature) * scale for w in wavelengths]
307
+
308
+
309
+ def snow_line(luminosity):
310
+ """
311
+ Distance from a star where water ice condenses in its protoplanetary disk,
312
+ the frost line: r = 2.7 AU (L/L_sun)^(1/2).
313
+
314
+ Hayashi 1981, Prog. Theor. Phys. Suppl. 70, 35,
315
+ https://doi.org/10.1143/PTPS.70.35: an optically thin disk at
316
+ T = 280 K (r/AU)^(-1/2) (L/L_sun)^(1/4) reaches 170 K at 2.7 AU around the
317
+ Sun. The 2.7 AU and 170 K are read from papers citing it (Lecar et al.
318
+ 2006, https://arxiv.org/abs/astro-ph/0602217); the original is unread.
319
+
320
+ Args:
321
+ luminosity (float): Stellar luminosity (W)
322
+
323
+ Returns:
324
+ float: Snow line distance (m)
325
+ """
326
+ return 2.7 * ASTRONOMICAL_UNIT * (luminosity / SOLAR_LUMINOSITY) ** 0.5
@@ -248,6 +248,9 @@ PARSEC = 3.0857e16
248
248
  LIGHT_YEAR = 9.4607304725808e15
249
249
  SOLAR_LUMINOSITY = 3.828e26
250
250
  SOLAR_SURFACE_TEMPERATURE = 5778
251
+ # McGaugh 2012, https://doi.org/10.1088/0004-6256/143/2/40: M_b = A V_f^4 with
252
+ # A = 47 +/- 6 MSol (km/s)^-4, here in kg (m/s)^-4.
253
+ BARYONIC_TULLY_FISHER_NORMALISATION = 47 * SOLAR_MASS / 1e3**4
251
254
  SOLAR_ABSOLUTE_MAGNITUDE = 4.83 # defined calibration point of the magnitude scale
252
255
  HUBBLE_CONSTANT = 2.2e-18
253
256
  CRITICAL_DENSITY_UNIVERSE = 9.47e-27
@@ -527,6 +530,7 @@ __all__ = [
527
530
  "MOON_RADIUS",
528
531
  "ASTRONOMICAL_UNIT",
529
532
  "PARSEC",
533
+ "BARYONIC_TULLY_FISHER_NORMALISATION",
530
534
  "LIGHT_YEAR",
531
535
  "SOLAR_LUMINOSITY",
532
536
  "SOLAR_SURFACE_TEMPERATURE",
@@ -16,6 +16,8 @@ LENGTH_CONVERSIONS = {
16
16
  "ly": LIGHT_YEAR,
17
17
  "au": ASTRONOMICAL_UNIT,
18
18
  "pc": PARSEC,
19
+ "kpc": 1e3 * PARSEC,
20
+ "Mpc": 1e6 * PARSEC,
19
21
  "bohr": 5.29177210903e-11,
20
22
  "planck": 1.616255e-35,
21
23
  "Å": 1e-10,
@@ -395,3 +397,19 @@ def resistance_conversion(value, from_unit, to_unit):
395
397
  raise ValueError(f"Unsupported resistance unit: {from_unit} or {to_unit}")
396
398
  ohms = value * conversions[from_unit]
397
399
  return ohms / conversions[to_unit]
400
+
401
+
402
+ SURFACE_DENSITY_CONVERSIONS = {
403
+ "kg/m²": 1.0,
404
+ "MSol/pc²": SOLAR_MASS / PARSEC**2,
405
+ }
406
+
407
+
408
+ def surface_density_conversion(value, from_unit, to_unit):
409
+ if (
410
+ from_unit not in SURFACE_DENSITY_CONVERSIONS
411
+ or to_unit not in SURFACE_DENSITY_CONVERSIONS
412
+ ):
413
+ raise ValueError(f"Unsupported surface density unit: {from_unit} or {to_unit}")
414
+ kg_m2 = value * SURFACE_DENSITY_CONVERSIONS[from_unit]
415
+ return kg_m2 / SURFACE_DENSITY_CONVERSIONS[to_unit]
@@ -40,6 +40,8 @@ class LengthUnit(Enum):
40
40
  LY = "ly"
41
41
  AU = "au"
42
42
  PC = "pc"
43
+ KPC = "kpc"
44
+ MPC = "Mpc"
43
45
  BOHR = "bohr"
44
46
  PLANCK = "planck"
45
47
  ANGSTROM = "Å"
@@ -107,6 +109,11 @@ class DensityUnit(Enum):
107
109
  KG_L = "kg/L"
108
110
 
109
111
 
112
+ class SurfaceDensityUnit(Enum):
113
+ KG_M2 = "kg/m²"
114
+ MSOL_PC2 = "MSol/pc²"
115
+
116
+
110
117
  class VelocityUnit(Enum):
111
118
  M_S = "m/s"
112
119
  KM_H = "km/h"
@@ -218,6 +225,7 @@ CONVERTERS = {
218
225
  TimeUnit: _conversions.time_conversion,
219
226
  AngleUnit: _conversions.angle_conversion,
220
227
  DensityUnit: _conversions.density_conversion,
228
+ SurfaceDensityUnit: _conversions.surface_density_conversion,
221
229
  VelocityUnit: _conversions.velocity_conversion,
222
230
  AccelerationUnit: _conversions.acceleration_conversion,
223
231
  PowerUnit: _conversions.power_conversion,
@@ -235,6 +243,7 @@ SI_BASE = {
235
243
  TimeUnit: TimeUnit.S,
236
244
  AngleUnit: AngleUnit.RAD,
237
245
  DensityUnit: DensityUnit.KG_M3,
246
+ SurfaceDensityUnit: SurfaceDensityUnit.KG_M2,
238
247
  VelocityUnit: VelocityUnit.M_S,
239
248
  AccelerationUnit: AccelerationUnit.M_S2,
240
249
  PowerUnit: PowerUnit.W,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: naturedynamics
3
- Version: 1.4
3
+ Version: 1.6
4
4
  Summary: A comprehensive physics library providing constants, equations, and formulas
5
5
  Author-email: Fabian Schober <reach@fabianschober.com>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "naturedynamics"
7
- version = "1.4"
7
+ version = "1.6"
8
8
  authors = [{name = "Fabian Schober", email = "reach@fabianschober.com"}]
9
9
  description = "A comprehensive physics library providing constants, equations, and formulas"
10
10
  readme = "README.md"
File without changes
File without changes
File without changes