AstroLib.jl
AstroLib 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’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 is available for Julia 1.0 and later versions, and can be installed with Julia's built-in package manager. In a Julia session run the command
julia> Pkg.update()
julia> Pkg.add("AstroLib")
Older versions are also available for Julia 0.4-0.6.
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")
Usage
After installing the package, you can start using AstroLib with
using AstroLib
Many functions in AstroLib.jl
are compatible with Measurements.jl package, which allows you to define quantities with uncertainty and propagate the error when performing calculations according to propagation of uncertainty rules. For example:
julia> using AstroLib, Measurements
julia> mag2flux(12.54 ± 0.03)
3.499451670283562e-14 ± 9.669342299577655e-16
How Can I Help?
AstroLib.jl
is developed on GitHub. 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
Related Projects
This is not the only effort to bundle astronomical functions written in Julia language. Other packages useful for more specific purposes are available at JuliaAstro. A list of other packages is available here.
Because of this, some of IDL AstroLib’s utilities are not provided in AstroLib.jl
as they are already present in other Julia packages. Here is a list of such utilities:
aper
, see Photometry.jl packageasinh
, already present in Julia with the same namecirrange
, it is equivalent tomod(x, 360)
. To restrict a number to the range[0, 2pi)
usemod2pi(x)
cosmo_param
, see Cosmology.jl packagegalage
, see Cosmology.jl packageglactc_pm
, see SkyCoords.jl packageglactc
, see SkyCoords.jl packagejplephinterp
, see JPLEphemeris.jl packagejplephread
, see JPLEphemeris.jl packagejplephtest
, see JPLEphemeris.jl packagelumdist
, see Cosmology.jl packagereadcol
, use readdlm, part of JuliaBase.DataFmt
module. This is not a complete replacement forreadcol
but most of the time it does-the-right-thing even without using any option (it automatically identifies string and numerical columns) and you do not need to manually specify a variable for each column
In addition, there are similar projects for Python (Python AstroLib) and R (Astronomy Users Library).