Guest User

Untitled

a guest
Sep 12th, 2025
13
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.03 KB | None | 0 0
  1. # Tiny Appendix Notebook — Spin→Projection → Observable (GR baselines + overlay)
  2. # Requirements: numpy, matplotlib
  3. # Run: python spin_projection_lensing_demo.py
  4. # Or copy into a Colab cell (set backend inline).
  5.  
  6. import numpy as np
  7. import matplotlib.pyplot as plt
  8.  
  9. # ------------------------------
  10. # Constants (SI unless noted)
  11. # ------------------------------
  12. G = 6.67430e-11 # m^3 kg^-1 s^-2
  13. c = 299_792_458.0 # m s^-1
  14. Msun= 1.98847e30 # kg
  15. Rsun= 6.957e8 # m
  16. AU = 1.495978707e11 # m
  17. arcsec = np.pi/(180.*3600.) # rad per arcsec
  18.  
  19. # ------------------------------
  20. # 1) GR Baselines (compact)
  21. # ------------------------------
  22. def alpha_GR_point_mass(M, b):
  23. """
  24. GR deflection for null geodesic near point mass (leading PN):
  25. alpha(b) = 4GM/(c^2 b) [radians]
  26. """
  27. return 4*G*M/(c**2 * b)
  28.  
  29. def shapiro_delay_approx(M, rE, rR, b):
  30. """
  31. Shapiro time delay (schematic, leading log approx):
  32. Δt ≈ (2GM/c^3) * ln( 4 r_E r_R / b^2 )
  33. Inputs in meters; output in seconds.
  34. """
  35. return (2*G*M/c**3)*np.log(4*rE*rR/(b**2))
  36.  
  37. def thetaE_SIS(sigma_v, Dds_over_Ds):
  38. """
  39. SIS Einstein angle: θ_E = 4π (σ_v^2 / c^2) * (D_ds / D_s)
  40. Returns radians.
  41. """
  42. return 4*np.pi*(sigma_v**2/c**2)*Dds_over_Ds
  43.  
  44. # ------------------------------
  45. # 2) Spin→Projection placeholder
  46. # (replace this with your actual mapping)
  47. # ------------------------------
  48. def projection_kernel(b, params):
  49. """
  50. YOUR MODEL lives here.
  51. Idea: map spin-phase/flow → an effective deflection alpha_proj(b).
  52. 'b' is impact parameter array [m].
  53. 'params' can hold your spin frequency, elliptic constraint knobs, etc.
  54.  
  55. This default is a toy: GR baseline plus a small phase-y modulation
  56. that vanishes as b grows (so far field matches GR).
  57. """
  58. M = params.get('M', 1.0*Msun)
  59. eps = params.get('eps', 0.0) # 0.0 by default: no deviation
  60. kphase = params.get('kphase', 1e-9) # set your scale
  61. base = alpha_GR_point_mass(M, b)
  62. mod = 1.0 + eps*np.sin(kphase*b)/(1.0 + (kphase*b)**2)
  63. return base*mod
  64.  
  65. # ------------------------------
  66. # 3) One-figure traction demo
  67. # ------------------------------
  68. def demo_overlay_point_mass():
  69. # Scenario: grazing the Sun & out to 5 R_sun
  70. M = 1.0*Msun
  71. b = np.linspace(1.0*Rsun, 5.0*Rsun, 400) # impact parameter [m]
  72.  
  73. # GR baseline curve
  74. alpha_gr = alpha_GR_point_mass(M, b) # radians
  75. alpha_gr_arcsec = alpha_gr/arcsec
  76.  
  77. # Your projection curve (edit params)
  78. params = dict(M=M, eps=0.0, kphase=1e-9) # set eps>0 to show deviation
  79. alpha_proj = projection_kernel(b, params)/arcsec
  80.  
  81. # Plot
  82. fig, ax = plt.subplots(figsize=(7.5,4.5), dpi=140)
  83. ax.plot(b/Rsun, alpha_gr_arcsec, lw=2.5, label='GR (point mass)', color='#4444aa')
  84. ax.plot(b/Rsun, alpha_proj, lw=2.0, ls='--', label='Projection (spin→deflection)', color='#d9534f')
  85. ax.set_xlabel('impact parameter b / R$_\\odot$')
  86. ax.set_ylabel('deflection α (arcsec)')
  87. ax.set_title('Light Bending: projection kernel overlaid on GR baseline')
  88. ax.grid(alpha=0.2)
  89. ax.legend()
  90. plt.tight_layout()
  91. plt.show()
  92.  
  93. def demo_shapiro():
  94. # Earth–Mars schematic at superior conjunction (toy inputs)
  95. M = Msun
  96. rE = 1.0*AU
  97. rR = 1.52*AU
  98. b = 1.0*Rsun
  99. dt = shapiro_delay_approx(M, rE, rR, b)
  100. print(f"Shapiro delay (approx, Earth–Mars, b=1 R_sun): {dt:.3e} s")
  101.  
  102. def demo_SIS():
  103. # SIS Einstein angle for cluster-like numbers
  104. sigma_v = 200_000.0 # m/s (200 km/s)
  105. Dds_over_Ds = 0.5 # unitless ratio
  106. thetaE = thetaE_SIS(sigma_v, Dds_over_Ds)
  107. print(f"SIS Einstein angle θ_E ≈ {thetaE/arcsec:.3f} arcsec")
  108.  
  109. if __name__ == "__main__":
  110. print("== GR checks ==")
  111. demo_shapiro()
  112. demo_SIS()
  113. print("\n== Overlay demo ==")
  114. demo_overlay_point_mass()
  115. print("\nEdit projection_kernel(...) to map your spin/flow parameters to α(b).")
Advertisement
Add Comment
Please, Sign In to add comment