aeclipseuse0_1.py

Created by steveg1cmz

Created on October 03, 2023

2.29 KB

Illustrates example calls to aeclipse. Calendar will show a 1-year calendar (but None for most months is not yet suppressed).


"""Astronomy: Eclipse Use.

Illustrates how to use Astronomy:Eclipse.
Includes example calls (but not expected values).

Note that sometimes you have to search a month earlier to get the expected event.
And sometimes use koffset=-0.5 not 0.5.

Note: Calculations are geocentric (not specific to a particular lat/long).

"""
#this version works but None is not suppressed
__version__="0.1"

crid="Astronomy:Eclipse Use V"+__version__+"""
© 2023 SteveG1CMZ"""

#customise
showme=True
intro=__name__+""":
Illustrates use of aeclipse module.
"""
#end custom

try: 
  from aeclipse import *
except:
  print(crid)
  print(intro)
  print(__name__+""":
Requires aeclipse module.
  """)
  showme=False
  
def eclipsesjm():
  #52=54 eclipses examples
  #solar
  print("a:")
  eclipse(1993+5/12,0) #52=54.a
  print("b:")
  eclipse(2009+7/12,0) #52=54.b
  #lunar
  #NB Some seem better with -0.5 some with 0.5
  #perhaps I need to tweak rounding
  print("c:")
  eclipse(1973.5,-0.5) #52=54.c
  print("d:")
  eclipse(1997+9/12,-0.5) #52=54.d

def eclipsesjmsolar():
  #52=54 eclipses more examples
  #just dates and types
  print("seven non-central solars:")
  print("one miscategorised (noted by jm)")
  
  print(eclipse(1950+3/12,0))
  print(eclipse(1957+4/12,0)) #miscategorised
  #(lists as central coz GAMMA 0.9966 is in reality 0.9990)
  print(eclipse(1957+10/12,0))
  print(eclipse(1967+10/12,0)) #November
  print(eclipse(2014+4/12,0))
  print(eclipse(2043+4/12,0))
  print(eclipse(2043+9/12,0)) #October
  
def eclipsesjmmore():
  #affected by accuracy of jm algorithm
  print(eclipse(1935+1/12,0))
  print(eclipse(1957+4/12,0))
  print(eclipse(1890+11/12,0.5)) #k=-1349.5
  
def calendar(yyyy=None,koff=None):
  """year calendar (real)
  year.: calendar (real)
  koff: offset (0 solar, -0.5 or 0.5 lunar)
  """
  if yyyy==None: 
    yyyy=float(input("YYYY.?"))
  if koff==None:
    koff=float(input("type[0:solar,[-]0.5:lunar]?"))
  print("Calendar:",yyyy,koff)
  for ii in range (12):
    i=float(ii)
    details=eclipse(yyyy+(i/12),koff)
    if not(details==None): 
      print(details)

if showme or __name__=="__main__":
  print(crid)  
  #eclipse(2023+9/12,0.5) #None
  #eclipsesjm()
  eclipsesjmsolar()
  calendar(2023.75,0.5)
  #calendar(None,None)
  #koff=float(input("type[-0.5,0,0.5]?"))
  #eclipse(None,koff)