Elektrine lite

← Feed

@linuxgal@techhub.social

2026-07-28 02:20 UTC

With #Python calculate the "comfort zone" of a star system based on visual magitude and distance. Example is for Ran aka Epsilon Eridani (at Sol the comfort zone happens to be at 1 AU, what a coincidence!) #!/usr/bin/env python3 import math import sys SUN_ABS_MAG = 4.83 LY_PER_PC = 3.26156 m = float(sys.argv[1]) d_ly = float(sys.argv[2]) d_pc = d_ly / LY_PER_PC M = m - 5 * (math.log10(d_pc) - 1) L = 10 ** ((SUN_ABS_MAG - M) / 2.5) R = math.sqrt(L) print(f"Distance : {d_ly:.3f} ly ({d_pc:.3f} pc)") print(f"Absolute magnitude : {M:.3f}") print(f"Luminosity : {L:.3f} L☉") print(f"Goldilocks radius : {R:.3f} AU")

Replies (0)

No replies.