| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
SwissEphemeris
Synopsis
- data Planet
- data HouseSystem
- type JulianTime = Double
- data Coordinates = Coordinates {}
- data HouseCusps = HouseCusps {}
- data Angles = Angles {}
- data CuspsCalculation = CuspsCalculation {}
- defaultCoordinates :: Coordinates
- mkCoordinates :: Coordinates
- julianDay :: Int -> Int -> Int -> Double -> JulianTime
- setEphemeridesPath :: FilePath -> IO ()
- setNoEphemeridesPath :: IO ()
- closeEphemerides :: IO ()
- withEphemerides :: FilePath -> IO a -> IO a
- withoutEphemerides :: IO a -> IO a
- calculateCoordinates :: JulianTime -> Planet -> IO (Either String Coordinates)
- calculateCusps :: JulianTime -> Coordinates -> HouseSystem -> IO CuspsCalculation
- calculateCuspsLenient :: JulianTime -> Coordinates -> HouseSystem -> IO CuspsCalculation
- calculateCuspsStrict :: JulianTime -> Coordinates -> HouseSystem -> IO (Either String CuspsCalculation)
Documentation
Constructors
| Sun | |
| Moon | |
| Mercury | |
| Venus | |
| Mars | |
| Jupiter | |
| Saturn | |
| Uranus | |
| Neptune | |
| Pluto | |
| MeanNode | |
| TrueNode | |
| MeanApog | |
| OscuApog | |
| Earth | |
| Chiron |
Instances
data HouseSystem Source #
Constructors
| Placidus | |
| Koch | |
| Porphyrius | |
| Regiomontanus | |
| Campanus | |
| Equal | |
| WholeSign |
Instances
type JulianTime = Double Source #
data Coordinates Source #
Constructors
| Coordinates | |
Instances
data HouseCusps Source #
Constructors
| HouseCusps | |
Instances
Constructors
| Angles | |
Fields
| |
Instances
data CuspsCalculation Source #
Constructors
| CuspsCalculation | |
Fields
| |
Instances
defaultCoordinates :: Coordinates Source #
Default coordinates with all zeros -- when you don't care about/know the velocities, which would be the case for most inputs (though most outputs _will_ include them.) Usually you'll set only lat and lng (e.g. `defaultCoordinates{lat = 1.4, lng = 4.1}`) when using it as an input for another function.
mkCoordinates :: Coordinates Source #
Constructor alias of defaultCoordinates, since it's used a lot in that role.
julianDay :: Int -> Int -> Int -> Double -> JulianTime Source #
Given year, month and day as Int and a time as Double, return
a single floating point number representing absolute Julian Time.
The input date is assumed to be in Gregorian time.
More info on this:
https://www.astro.com/swisseph/swephprg.htm#_Toc46406824
setEphemeridesPath :: FilePath -> IO () Source #
Given a path to a directory, point the underlying ephemerides library to it. You only need to call this function to provide an explicit ephemerides path, if the environment variable SE_EPHE_PATH is set, it overrides this function.
setNoEphemeridesPath :: IO () Source #
Explicitly state that we don't want to set an ephemeris path, which will default to the built-in ephemeris, or use the directory in the SE_EPHE_PATH environment variable, if set.
closeEphemerides :: IO () Source #
Explicitly release all "cache" pointers and open files obtained by the C library.
withEphemerides :: FilePath -> IO a -> IO a Source #
Run a computation with a given ephemerides path open, and then close it. Note that the computation does _not_ receive the ephemerides, in keeping with the underlying library's side-effectful conventions.
withoutEphemerides :: IO a -> IO a Source #
Run a computation with no explicit ephemerides set, if the SE_EPHE_PATH environment variable is set, that will be used. If not, it'll fall back to in-memory data.
calculateCoordinates :: JulianTime -> Planet -> IO (Either String Coordinates) Source #
Given a decimal representation of Julian Time (see julianDay),
and a Planet, returns either the position of that planet at the given time,
if available in the ephemeris, or an error.
This function is in IO because it _may_ allocate memory/read data beyond
its scope, when using ephemeris data.
Call it with withEphemerides or withoutEphemerides.
Failing to call closeEphemerides at some point after calling this function
will likely result in a segmentation fault down the line!!
calculateCusps :: JulianTime -> Coordinates -> HouseSystem -> IO CuspsCalculation Source #
Alias for calculateCuspsLenient
calculateCuspsLenient :: JulianTime -> Coordinates -> HouseSystem -> IO CuspsCalculation Source #
Given a decimal representation of Julian Time (see julianDay),
a set of Coordinates (see mkCoordinates,) and a HouseSystem
(most applications use Placidus,) return a CuspsCalculation with all 12
house cusps in that system, and other relevant Angles. Notice that certain systems,
like Placidus and Koch, are very likely to fail close to the polar circles; in this
and other edge cases, the calculation returns cusps in the Porphyrius system.
This function is in IO because it _may_ allocate memory/read data beyond
its scope, when using ephemeris data.
Call it with withEphemerides or withoutEphemerides.
Failing to call closeEphemerides at some point after calling this function
will likely result in a segmentation fault!!
calculateCuspsStrict :: JulianTime -> Coordinates -> HouseSystem -> IO (Either String CuspsCalculation) Source #
Unlike calculateCuspsLenient, return a Left value if the required house system
couldn't be used to perform the calculations.