AstroLib.jl¶
AstroLib.jl is a package of small generic routines useful above all in astronomical and astrophysical context, written in Julia.
Included are also translations of some IDL Astronomy User’s
Library procedures,
which are released under terms of BSD-2-Clause
License.
AstroLib.jl
‘s functions are not drop-in replacement of those
procedures, Julia standard data types are often used (e.g., DateTime
type instead of generic string for dates) and the syntax may slightly
differ.
An extensive error testing suite ensures old fixed bugs will not be brought back by future changes.
Installation¶
AstroLib.jl
is available for Julia 0.4 and later versions, and can
be installed with Julia built-in package
manager. In a
Julia session run the command
julia> Pkg.add("AstroLib")
You may need to update your package list with Pkg.update()
in order
to get the latest version of AstroLib.jl
.
Note that, in order to work, a few functions require external files, which are automatically downloaded when building the package. Should these files be missing for some reason, you will be able to load the package but some functions may not work properly. You can manually build the package with
julia> Pkg.build("AstroLib")
New Types¶
Observatory¶
AstroLib.jl
defines a new Observatory
type. This can be used to define a
new object holding information about an observing site. It is a composite type whose
fields are
name
(AbstractString
type): the name of the sitelatitude
(Real
type): North-ward latitude of the site in degreeslongitude
(Real
type): East-ward longitude of the site in degreesaltitude
(Real
type): altitude of the site in meterstz
(Real
type): the number of hours of offset from UTC
The type constructor Observatory
can be used to create a new
Observatory
object. Its syntax is
Observatory(name, lat, long, alt, tz)
name
should be a string; lat
, long
, and tz
should be
anything that can be converted to a floating number with ten
function; alt
should be a real number.
A predefined list of some observing sites is provided with
AstroLib.observatories
constant. It is a dictionary whose keys are the
abbreviated names of the observatories. For example, you can access information
of the European Southern Observatory with
julia> obs = AstroLib.observatories["eso"]
Observatory: European Southern Observatory
latitude: -29.256666666666668°N
longitude: -70.73°E
altitude: 2347.0 m
time zone: UTC-4
julia> obs.longitude
-70.73
You can list all keys of the dictionary with
keys(AstroLib.observatories)
Feel free to contribute new sites or adjust information of already present ones.
Planet¶
The package provides Planet
type to hold information about Solar
System planets. Its fields are
- Designation:
name
: the name
- Physical characteristics:
radius
: mean radius in meterseqradius
: equatorial radius in meterspolradius
: polar radius in metersmass
: mass in kilogram
- Orbital characteristics (epoch J2000):
ecc
: eccentricity of the orbitaxis
: semi-major axis of the orbit in metersperiod
: sidereal orbital period in seconds
The constructor has this syntax:
Planet(name, radius, eqradius, polradius, mass, ecc, axis, period)
The list of Solar System planets, from Mercury to Pluto, is available
with AstroLib.planets
dictionary. The keys of this dictionary are the
lowercase names of the planets. For example:
julia> AstroLib.planets["mercury"]
Planet: Mercury
mean radius: 2.4397e6 m
equatorial radius: 2.4397e6 m
polar radius: 2.4397e6 m
mass: 3.3011e23 kg
eccentricity: 0.20563069
semi-major axis: 5.790905e10 m
period: 5.790905e10 s
julia> AstroLib.planets["mars"].eqradius
3.3962e6
julia> AstroLib.planets["saturn"].mass
5.6834e25
How Can I Help?¶
AstroLib.jl
is developed on GitHub at
https://github.com/giordano/AstroLib.jl. You can contribute to the project in a
number of ways: by translating more routines from IDL Astronomy User’s Library,
or providing brand-new functions, or even improving existing ones (make them
faster and more precise). Also bug reports are encouraged.
License¶
The AstroLib.jl
package is licensed under the MIT “Expat” License. The original author is Mosè Giordano.
Notes¶
This project is a work-in-progress, only few procedures have been translated so far. In addition, function syntax may change from time to time. Check TODO.md out to see how you can help. Volunteers are welcome!
Documentation¶
Every function provided has detailed documentation that can be accessed at Julia REPL with
julia> ?FunctionName
or with
julia> @doc FunctionName
The following is the list of all functions provided to the users. Click on them to read their documentation.
Astronomical Utilities¶
- adstring
- airtovac
- aitoff
- altaz2hadec
- bprecess
- calz_unred
- ct2lst
- daycnv
- deredd
- eci2geo
- eqpole
- flux2mag
- gal_uvw
- geo2eci
- geo2geodetic
- geo2mag
- geodetic2geo
- get_date
- get_juldate
- gcirc
- hadec2altaz
- helio_jd
- helio_rv
- jdcnv
- jprecess
- juldate
- kepler_solver
- lsf_rotate
- mag2flux
- mag2geo
- month_cnv
- moonpos
- mphase
- nutate
- paczynski
- planck_freq
- planck_wave
- polrec
- posang
- precess
- precess_xyz
- premat
- radec
- recpol
- rhotheta
- sixty
- sphdist
- sunpos
- ten
- trueanom
- vactoair
- xyz
- ydn2md
- ymd2dn