Module swisseph
[frames] | no frames]

Module swisseph

Python extension to AstroDienst's Swiss Ephemeris library.
Extended documentation can be found on AstroDienst website.

Pyswisseph homepage: http://pyswisseph.atarax.org
AstroDienst: http://www.astro.com/swisseph


Version: 20081029

Classes
  Error
Functions
 
azalt(...)
Calculate horizontal coordinates (azimuth and altitude) of a planet or a star from either ecliptical or equatorial coordinates (UTC).
 
azalt_rev(...)
Calculate either ecliptical or equatorial coordinates from azimuth and true altitude.
 
calc(...)
Calculate body positions (ET).
 
calc_ut(...)
Calculate body positions (UTC).
 
close(...)
Close swiss ephemeris.
 
cotrans(...)
Coordinate transformation from ecliptic to equator or vice-versa.
 
cotrans_sp(...)
Coordinate transformation of position and speed, from ecliptic to equator or vice-versa.
 
cs2degstr(...)
Get degrees string from centiseconds.
 
cs2lonlatstr(...)
Get longitude or latitude string from centiseconds.
 
cs2timestr(...)
Get time string from centiseconds.
 
csnorm(...)
Normalization of any centisecond number to the range [0;360].
 
csroundsec(...)
Round centiseconds, but at 29.5959 always down.
 
d2l(...)
Double to integer with rounding, no overflow check.
 
date_conversion(...)
Calculate Julian day number with check wether date is correct.
 
day_of_week(...)
Calculate day of week number [0;6] from julian day number.
 
deg_midp(...)
Calculate midpoint (in degrees).
 
degnorm(...)
Normalization of any degree number to the range [0;360].
 
deltat(...)
Calculate value of delta T.
 
difcs2n(...)
Calculate distance in centisecs p1 - p2 normalized to [-180;180].
 
difcsn(...)
Calculate distance in centisecs p1 - p2.
 
difdeg2n(...)
Calculate distance in degrees p1 - p2 normalized to [-180;180].
 
difdegn(...)
Calculate distance in degrees p1 - p2.
 
difrad2n(...)
Calculate distance in radians p1 - p2 normalized to [-180;180].
 
fixstar(...)
Calculate fixed star positions (ET).
 
fixstar_mag(...)
Get fixed star magnitude.
 
fixstar_ut(...)
Calculate fixed star positions (UTC).
 
gauquelin_sector(...)
Calculate Gauquelin sector position of a body (UTC).
 
get_ayanamsa(...)
Calculate ayanamsa (ET).
 
get_ayanamsa_name(...)
Get ayanamsa name from sidereal mode constant.
 
get_ayanamsa_ut(...)
Calculate ayanamsa (UTC).
 
get_planet_name(...)
Get planet name.
 
get_tid_acc(...)
Get tidal acceleration.
 
house_pos(...)
Calculate house position of a body.
 
houses(...)
Calculate houses cusps (UTC).
 
houses_armc(...)
Calculate houses cusps with ARMC.
 
houses_ex(...)
Calculate houses cusps (extended) (UTC).
 
julday(...)
Calculate Julian day number.
 
lun_eclipse_how(...)
Calculate attributes of a lunar eclipse (UTC).
 
lun_eclipse_when(...)
Find the next lunar eclipse (UTC).
 
lun_occult_when_glob(...)
Find the next occultation of a planet or star by the moon globally (UTC).
 
lun_occult_when_loc(...)
Find next occultation of a body by the moon for a given geographic position (UTC).
 
lun_occult_where(...)
Find where a lunar occultation is central or maximal (UTC).
 
nod_aps(...)
Calculate planetary nodes and apsides (ET).
 
nod_aps_ut(...)
Calculate planetary nodes and apsides (UTC).
 
pheno(...)
Calculate planetary phenomena (ET).
 
pheno_ut(...)
Calculate planetary phenomena (UTC).
 
rad_midp(...)
Calculate midpoint (in radians).
 
radnorm(...)
Normalization of any radian number to the range [0;2*pi].
 
refrac(...)
Calculate either true altitude from apparent altitude, or apparent altitude from true altitude.
 
refrac_extended(...)
Calculate either true altitude from apparent altitude, or apparent altitude from true altitude, for geographical altitudes above sea level.
 
revjul(...)
Calculate year, month, day, hour from Julian day number.
 
rise_trans(...)
Calculate times of rising, setting and meridian transits.
 
set_ephe_path(...)
Set ephemeris files path.
 
set_jpl_file(...)
Set JPL file path.
 
set_lapse_rate(...)
Set lapse rate.
 
set_sid_mode(...)
Set sidereal mode.
 
set_tid_acc(...)
Set tidal acceleration.
 
set_topo(...)
Set topocentric parameters.
 
sidtime(...)
Calculate sidereal time (UTC).
 
sidtime0(...)
Calculate sidereal time, given obliquity and nutation (UTC).
 
sol_eclipse_how(...)
Calculate attributes of a solar eclipse.
 
sol_eclipse_when_glob(...)
Find the next solar eclipse globally (UTC).
 
sol_eclipse_when_loc(...)
Find the next solar eclipse for a given geographic position (UTC).
 
sol_eclipse_where(...)
Find where a solar eclipse is central or maximal (UTC).
 
split_deg(...)
Split centiseconds in degrees, minutes, seconds, fraction of seconds, zodiac sign number.
 
time_equ(...)
Calculate equation of time (ET).
Variables
  ADMETOS = 45
  APOLLON = 44
  APP_TO_TRUE = 1
  ARMC = 2
  ASC = 0
  ASP_BINOVILE = 80
  ASP_BIQUINTILE = 144
  ASP_BISEPTILE = 102.857142857
  ASP_BIUNDECILE = 65.4545454545
  ASP_CONJUNCTION = 0
  ASP_NOVILE = 40
  ASP_OPPOSITION = 180
  ASP_QUADUNDECILE = 130.909090909
  ASP_QUATRONOVILE = 160
  ASP_QUINCUNX = 150
  ASP_QUINTILE = 72
  ASP_QUINUNDECILE = 163.636363636
  ASP_SEMINOVILE = 20
  ASP_SEMIQUINTILE = 36
  ASP_SEMISEXTILE = 30
  ASP_SEMISQUARE = 45
  ASP_SEPTILE = 51.4285714286
  ASP_SESQUISQUARE = 135
  ASP_SEXTILE = 60
  ASP_SQUARE = 90
  ASP_SQUISEXTILE = 15
  ASP_SQUISQUARE = 22.5
  ASP_TRINE = 120
  ASP_TRISEPTILE = 154.285714286
  ASP_TRIUNDECILE = 98.1818181818
  ASP_UNDECILE = 32.7272727273
  ASTNAMFILE = 'seasnam.txt'
  AST_OFFSET = 10000
  BIT_DISC_CENTER = 256
  BIT_NO_REFRACTION = 512
  CALC_ITRANSIT = 8
  CALC_MTRANSIT = 4
  CALC_RISE = 1
  CALC_SET = 2
  CERES = 17
  CHIRON = 15
  COASC1 = 5
  COASC2 = 6
  COMET_OFFSET = 1000
  CUPIDO = 40
  DE_NUMBER = 406
  EARTH = 14
  ECL2HOR = 0
  ECL_1ST_VISIBLE = 512
  ECL_2ND_VISIBLE = 1024
  ECL_3RD_VISIBLE = 2048
  ECL_4TH_VISIBLE = 4096
  ECL_ANNULAR = 8
  ECL_ANNULAR_TOTAL = 32
  ECL_CENTRAL = 1
  ECL_MAX_VISIBLE = 256
  ECL_NONCENTRAL = 2
  ECL_NUT = -1
  ECL_ONE_TRY = 32768
  ECL_PARTIAL = 16
  ECL_PENUMBRAL = 64
  ECL_TOTAL = 4
  ECL_VISIBLE = 128
  EPHE_PATH = '.:/users/ephe2/:/users/ephe/'
  EQU2HOR = 1
  EQUASC = 4
  FICTFILE = 'seorbel.txt'
  FICT_MAX = 999
  FICT_OFFSET = 40
  FICT_OFFSET_1 = 39
  FIXSTAR = -10
  FLG_BARYCTR = 16384
  FLG_DEFAULTEPH = 2
  FLG_EQUATORIAL = 2048
  FLG_HELCTR = 8
  FLG_ICRS = 131072
  FLG_J2000 = 32
  FLG_JPLEPH = 1
  FLG_MOSEPH = 4
  FLG_NOABERR = 1024
  FLG_NOGDEFL = 512
  FLG_NONUT = 64
  FLG_RADIANS = 8192
  FLG_SIDEREAL = 65536
  FLG_SPEED = 256
  FLG_SPEED3 = 128
  FLG_SWIEPH = 2
  FLG_TOPOCTR = 32768
  FLG_TRUEPOS = 16
  FLG_XYZ = 4096
  FNAME_DE200 = 'de200.eph'
  FNAME_DE403 = 'de403.eph'
  FNAME_DE404 = 'de404.eph'
  FNAME_DE405 = 'de405.eph'
  FNAME_DE406 = 'de406.eph'
  FNAME_DFT = 'de406.eph'
  GREG_CAL = 1
  HADES = 41
  HARRINGTON = 50
  HOR2ECL = 0
  HOR2EQU = 1
  INTP_APOG = 21
  INTP_PERG = 22
  ISIS = 48
  JUL_CAL = 0
  JUNO = 19
  JUPITER = 5
  KRONOS = 43
  MARS = 4
  MAX_STNAME = 20
  MC = 1
  MEAN_APOG = 12
  MEAN_NODE = 10
  MERCURY = 2
  MOON = 1
  NALL_NAT_POINTS = 38
  NASCMC = 8
  NEPTUNE = 8
  NEPTUNE_ADAMS = 52
  NEPTUNE_LEVERRIER = 51
  NFICT_ELEM = 15
  NIBIRU = 49
  NODBIT_FOPOINT = 256
  NODBIT_MEAN = 1
  NODBIT_OSCU = 2
  NODBIT_OSCU_BAR = 4
  NPLANETS = 23
  NSIDM_PREDEF = 21
  OSCU_APOG = 13
  PALLAS = 18
  PHOLUS = 16
  PLUTO = 9
  PLUTO_LOWELL = 53
  PLUTO_PICKERING = 54
  POLASC = 7
  POSEIDON = 47
  PROSERPINA = 57
  SATURN = 6
  SIDBITS = 256
  SIDBIT_ECL_T0 = 256
  SIDBIT_SSY_PLANE = 512
  SIDM_ALDEBARAN_15TAU = 14
  SIDM_B1950 = 20
  SIDM_BABYL_ETPSC = 13
  SIDM_BABYL_HUBER = 12
  SIDM_BABYL_KUGLER1 = 9
  SIDM_BABYL_KUGLER2 = 10
  SIDM_BABYL_KUGLER3 = 11
  SIDM_DELUCE = 2
  SIDM_DJWHAL_KHUL = 6
  SIDM_FAGAN_BRADLEY = 0
  SIDM_GALCENT_0SAG = 17
  SIDM_HIPPARCHOS = 15
  SIDM_J1900 = 19
  SIDM_J2000 = 18
  SIDM_JN_BHASIN = 8
  SIDM_KRISHNAMURTI = 5
  SIDM_LAHIRI = 1
  SIDM_RAMAN = 3
  SIDM_SASSANIAN = 16
  SIDM_USER = 255
  SIDM_USHASHASHI = 4
  SIDM_YUKTESHWAR = 7
  SPLIT_DEG_KEEP_DEG = 32
  SPLIT_DEG_KEEP_SIGN = 16
  SPLIT_DEG_ROUND_DEG = 4
  SPLIT_DEG_ROUND_MIN = 2
  SPLIT_DEG_ROUND_SEC = 1
  SPLIT_DEG_ZODIACAL = 8
  STARFILE = 'fixstars.cat'
  SUN = 0
  TRUE_NODE = 11
  TRUE_TO_APP = 0
  URANUS = 7
  VARUNA = 30000
  VENUS = 3
  VERTEX = 3
  VESTA = 20
  VULCAN = 55
  VULKANUS = 46
  WALDEMATH = 58
  WHITE_MOON = 56
  ZEUS = 42
  version = '1.75.00'
Function Details

azalt(...)

 
Calculate horizontal coordinates (azimuth and altitude) of a planet or a star from either ecliptical or equatorial coordinates (UTC).

Args: float julday, float lon, float lat, float hei, float x, float y, float z=0.0, float press=0.0, float temp=0.0, int flag=ECL2HOR
Return: tuple of 3 float (azimuth, true altitude, apparent altitude)

azalt_rev(...)

 
Calculate either ecliptical or equatorial coordinates from azimuth and true altitude.

Args: float julday, float lon, float lat, float hei, double azim, double alt, int flag=HOR2ECL
Return: tuple of 2 float

calc(...)

 
Calculate body positions (ET).

Args: float julday, int planet, int flag=FLG_SWIEPH+FLG_SPEED
Return: tuple of 6 float

calc_ut(...)

 
Calculate body positions (UTC).

Args: float julday, int planet, int flag=FLG_SWIEPH+FLG_SPEED
Return: tuple of 6 float

close(...)

 
Close swiss ephemeris.

Args: -
Return: None

cotrans(...)

 
Coordinate transformation from ecliptic to equator or vice-versa.

Args: float lon, float lat, float dist, float obliquity
Return: tuple of 3 float (longitude, latitude, distance)

cotrans_sp(...)

 
Coordinate transformation of position and speed, from ecliptic to equator or vice-versa.

Args: float lon, float lat, float dist, float lonspeed, float latspeed, float distspeed, float obliquity
Return: tuple of 6 float

cs2degstr(...)

 
Get degrees string from centiseconds.

Args: int cs
Return: str

cs2lonlatstr(...)

 
Get longitude or latitude string from centiseconds.

Args: int cs, char plus, char minus
Return: str

cs2timestr(...)

 
Get time string from centiseconds.

Args: int cs, char sep, bool suppresszero=True
Return: str

csnorm(...)

 
Normalization of any centisecond number to the range [0;360].

Args: int x
Return: int

csroundsec(...)

 
Round centiseconds, but at 29.5959 always down.

Args: int x
Return: int

d2l(...)

 
Double to integer with rounding, no overflow check.

Args: float x
Return: int

date_conversion(...)

 
Calculate Julian day number with check wether date is correct.

Args: int year, int month, int day, float hour=12.0, char cal='g'
Return: float

day_of_week(...)

 
Calculate day of week number [0;6] from julian day number.

Args: float julday
Return: int

deg_midp(...)

 
Calculate midpoint (in degrees).

Args: float x, float y
Return: float

degnorm(...)

 
Normalization of any degree number to the range [0;360].

Args: float x
Return: float

deltat(...)

 
Calculate value of delta T.

Args: float julday
Return: float

difcs2n(...)

 
Calculate distance in centisecs p1 - p2 normalized to [-180;180].

Args: int p1, int p2
Return: int

difcsn(...)

 
Calculate distance in centisecs p1 - p2.

Args: int p1, int p2
Return: int

difdeg2n(...)

 
Calculate distance in degrees p1 - p2 normalized to [-180;180].

Args: float p1, float p2
Return: float

difdegn(...)

 
Calculate distance in degrees p1 - p2.

Args: float p1, float p2
Return: float

difrad2n(...)

 
Calculate distance in radians p1 - p2 normalized to [-180;180].

Args: float p1, float p2
Return: float

fixstar(...)

 
Calculate fixed star positions (ET).

Args: str star, float julday, int flag=FLG_SWIEPH
Return: tuple of 6 float

fixstar_mag(...)

 
Get fixed star magnitude.

Args: str star
Return: float

fixstar_ut(...)

 
Calculate fixed star positions (UTC).

Args: str star, float julday, int flag=FLG_SWIEPH
Return: tuple of 6 float

gauquelin_sector(...)

 
Calculate Gauquelin sector position of a body (UTC).

Args: float julday, int or str body, float lon, float lat, float alt, float press=0, float temp=0, int method=0, int flag=FLG_SWIEPH
Return: float

get_ayanamsa(...)

 
Calculate ayanamsa (ET).

Args: float julday
Return: float

get_ayanamsa_name(...)

 
Get ayanamsa name from sidereal mode constant.

Args: int sidmode
Return: str

get_ayanamsa_ut(...)

 
Calculate ayanamsa (UTC).

Args: float julday
Return: float

get_planet_name(...)

 
Get planet name.

Args: int planet
Return: str

get_tid_acc(...)

 
Get tidal acceleration.

Args: -
Return: float

house_pos(...)

 
Calculate house position of a body.

Args: float armc, float geolat, float obliquity, float objlon, float objlat=0.0, char hsys='P'
Return: float

houses(...)

 
Calculate houses cusps (UTC).

Args: float julday, float lat, float lon, char hsys='P'
Return: 2 tuples of 12 and 8 float (cusps, ascmc) (except Gauquelin)

houses_armc(...)

 
Calculate houses cusps with ARMC.

Args: float armc, float lat, float obliquity, char hsys='P'
Return: 2 tuples of 12 and 8 float (cusps, ascmc) (except Gauquelin)

houses_ex(...)

 
Calculate houses cusps (extended) (UTC).

Args: float julday, float lat, float lon, char hsys='P', int flag=0
Return: 2 tuples of 12 and 8 float (cusps, ascmc) (except Gauquelin)

julday(...)

 
Calculate Julian day number.

Args: int year, int month, int day, float hour=12.0, int cal=GREG_CAL
Return: float

lun_eclipse_how(...)

 
Calculate attributes of a lunar eclipse (UTC).

Args: float julday, float lon, float lat, float alt=0.0, int flag=FLG_SWIEPH
Return: tuple of results

lun_eclipse_when(...)

 
Find the next lunar eclipse (UTC).

Args: float jd_start, int ecl_type=0, bool backward=False, int flag=FLG_SWIEPH
Return: tuple of results

lun_occult_when_glob(...)

 
Find the next occultation of a planet or star by the moon globally (UTC).

Args: float jd_start, int or str body, int ecl_type=0, bool backward=False, int flag=FLG_SWIEPH
Return: tuple of results

lun_occult_when_loc(...)

 
Find next occultation of a body by the moon for a given geographic position (UTC).

Args: float julday, int or str body, float lon, float lat, float alt=0.0, bool backward=False, int flag=FLG_SWIEPH
Return: tuple of results

lun_occult_where(...)

 
Find where a lunar occultation is central or maximal (UTC).

Args: float julday, int or str body, int flag=FLG_SWIEPH
Return: tuple of results

nod_aps(...)

 
Calculate planetary nodes and apsides (ET).

Args: float julday, int planet, int method=NODBIT_MEAN, int flag=FLG_SWIEPH+FLG_SPEED
Return: 4 tuples of 6 float (asc, des, per, aph)

nod_aps_ut(...)

 
Calculate planetary nodes and apsides (UTC).

Args: float julday, int planet, int method=NODBIT_MEAN, int flag=FLG_SWIEPH+FLG_SPEED
Return: 4 tuples of 6 float (asc, des, per, aph)

pheno(...)

 
Calculate planetary phenomena (ET).

Args: float julday, int planet, int flag=FLG_SWIEPH
Return: tuple of results

pheno_ut(...)

 
Calculate planetary phenomena (UTC).

Args: float julday, int planet, int flag=FLG_SWIEPH
Return: tuple of results

rad_midp(...)

 
Calculate midpoint (in radians).

Args: float x, float y
Return: float

radnorm(...)

 
Normalization of any radian number to the range [0;2*pi].

Args: float x
Return: float

refrac(...)

 
Calculate either true altitude from apparent altitude, or apparent altitude from true altitude.

Args: float alt, float press=0.0, float temp=0.0, int flag=TRUE_TO_APP
Return: float

refrac_extended(...)

 
Calculate either true altitude from apparent altitude, or apparent altitude from true altitude, for geographical altitudes above sea level.

Args: float alt, float geoalt, float lrate, float press=0.0, float temp=0.0, int flag=TRUE_TO_APP
Return: 2 tuples of 1 and 4 float

revjul(...)

 
Calculate year, month, day, hour from Julian day number.

Args: float julday, int cal=GREG_CAL
Return: tuple of 3 int and 1 float

rise_trans(...)

 
Calculate times of rising, setting and meridian transits.

Args: float jd_start, int or str body, float lon, float lat, float alt=0.0, float press=0.0, float temp=0.0, int rsmi=0, int flag=FLG_SWIEPH
Return: tuple of results

set_ephe_path(...)

 
Set ephemeris files path.

Args: str path="/usr/share/swisseph:/usr/local/share/swisseph"
Return: None

set_jpl_file(...)

 
Set JPL file path.

Args: str path
Return: None

set_lapse_rate(...)

 
Set lapse rate.

Args: float lrate
Return: None

set_sid_mode(...)

 
Set sidereal mode.

Args: int mode, float t0=0.0, float ayan_t0=0.0
Return: None

set_tid_acc(...)

 
Set tidal acceleration.

Args: float acc
Return: None

set_topo(...)

 
Set topocentric parameters.

Args: float lon, float lat, float alt=0.0
Return: None

sidtime(...)

 
Calculate sidereal time (UTC).

Args: float julday
Return: float

sidtime0(...)

 
Calculate sidereal time, given obliquity and nutation (UTC).

Args: float julday, float obliquity, float nutation
Return: float

sol_eclipse_how(...)

 
Calculate attributes of a solar eclipse.

Args: float julday, float lon, float lat, float alt=0.0, int flag=FLG_SWIEPH
Return: tuple of results

sol_eclipse_when_glob(...)

 
Find the next solar eclipse globally (UTC).

Args: float jd_start, ecl_type=0, bool backward=False, int flag=FLG_SWIEPH
Return: tuple of results

sol_eclipse_when_loc(...)

 
Find the next solar eclipse for a given geographic position (UTC).

Args: float julday, float lon, float lat, float alt=0.0, bool backward=False, int flag=FLG_SWIEPH
Return: tuple of results

sol_eclipse_where(...)

 
Find where a solar eclipse is central or maximal (UTC).

Args: float julday, int flag=FLG_SWIEPH
Return: tuple of results

split_deg(...)

 
Split centiseconds in degrees, minutes, seconds, fraction of seconds, zodiac sign number.

Args: float ddeg, int roundflag
Return: tuple

time_equ(...)

 
Calculate equation of time (ET).

Args: float julday
Return: float