Skip to content

Commit aa2834d

Browse files
authored
Merge pull request #86 from JuliaAstro/patch-tests-docs
Documentation and test updates and fixes
2 parents 059fe2a + 1d7bd16 commit aa2834d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+498
-448
lines changed

Project.toml

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ julia = "1"
1616

1717
[extras]
1818
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
19+
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
20+
Measurements = "eff96d63-e80a-5855-80a2-b1b0885c5ab7"
1921

2022
[targets]
2123
test = ["Test"]

docs/Project.toml

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[deps]
22
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
3+
Measurements = "eff96d63-e80a-5855-80a2-b1b0885c5ab7"
34

45
[compat]
56
Documenter = "0.26, 0.27, 1"

docs/make.jl

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
using Documenter, AstroLib
22

33
include("pages.jl")
4+
5+
DocMeta.setdocmeta!(AstroLib, :DocTestSetup, :(using AstroLib), recursive=true)
6+
47
makedocs(
58
modules = [AstroLib],
69
sitename = "AstroLib",
7-
pages=pages
10+
format = Documenter.HTML(
11+
size_threshold = 400 * 1024, # 400 KiB because API reference page is big
12+
size_threshold_warn = 200 * 1024,
13+
#assets = [],
14+
),
15+
pages = pages,
816
)
917

1018
deploydocs(

docs/pages.jl

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pages = [
2-
"Introduction" => "index.md",
3-
"Reference" => "ref.md",
4-
]
1+
pages = [
2+
"Introduction" => "index.md",
3+
"Reference" => "ref.md",
4+
]

docs/src/assets/draw-logo.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function ellipse2c(focus1::Point, focus2::Point, k; stepvalue=pi/100)
2525
end
2626

2727
"""
28-
Draw a logo with ellipse and colored circles
28+
Draw a logo with ellipse and colored circles
2929
"""
3030
function draw_logo(fname)
3131
Drawing(500, 500, fname)

docs/src/index.md

+9-8
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ An extensive error testing suite ensures old fixed bugs will not be brought back
88

99
## Installation
1010

11-
AstroLib is available for Julia 1.0 and later versions, and can be installed with [Julia](https://github.com/julialang/julia.jl)'s built-in package manager. In a Julia session run the command
11+
AstroLib is available for Julia 1.0 and later versions, and can be installed with [Julia](https://github.com/julialang/julia.jl)'s built-in package manager. In a Julia session run the commands
1212

13-
```julia
13+
```julia-repl
14+
julia> import Pkg
1415
julia> Pkg.update()
1516
julia> Pkg.add("AstroLib")
1617
```
@@ -19,7 +20,7 @@ Older versions are also available for Julia 0.4-0.6.
1920

2021
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
2122

22-
```julia
23+
```julia-repl
2324
julia> Pkg.build("AstroLib")
2425
```
2526

@@ -33,11 +34,11 @@ using AstroLib
3334

3435
Many functions in `AstroLib.jl` are compatible with [Measurements.jl](https://github.com/giordano/Measurements.jl) package, which allows you to define quantities with uncertainty and propagate the error when performing calculations according to [propagation of uncertainty rules](https://en.wikipedia.org/wiki/Propagation_of_uncertainty). For example:
3536

36-
```julia
37+
```jldoctest
3738
julia> using AstroLib, Measurements
3839
3940
julia> mag2flux(12.54 ± 0.03)
40-
3.499451670283562e-14 ± 9.669342299577655e-16
41+
3.499e-14 ± 9.7e-16
4142
```
4243

4344
## How Can I Help?
@@ -56,19 +57,19 @@ This project is a work-in-progress, only few procedures have been translated so
5657

5758
Every function provided has detailed documentation that can be [accessed](http://docs.julialang.org/en/stable/manual/documentation/#accessing-documentation) at Julia REPL with
5859

59-
```julia
60+
```julia-repl
6061
julia> ?FunctionName
6162
```
6263

6364
or with
6465

65-
```julia
66+
```julia-repl
6667
julia> @doc FunctionName
6768
```
6869

6970
## Related Projects
7071

71-
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](https://juliaastro.github.io/). A list of other packages is available [here](https://github.com/svaksha/Julia.jl/blob/master/Astronomy.md).
72+
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](https://juliaastro.github.io/).
7273

7374
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:
7475

docs/src/ref.md

+94-87
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
```@meta
2+
DocTestSetup = :(using AstroLib)
3+
```
14
# Reference
25

36
## Data types
47

58
### Observatory
69

7-
`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
10+
`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](https://docs.julialang.org/en/v1/manual/types/#Composite-Types) whose fields are
811

912
- `name` (`String` type): the name of the site
1013
- `latitude` (`Float64` type): North-ward latitude of the site in degrees
@@ -22,7 +25,7 @@ Observatory(name, lat, long, alt, tz)
2225

2326
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
2427

25-
```julia
28+
```jldoctest
2629
julia> obs = AstroLib.observatories["eso"]
2730
Observatory: European Southern Observatory
2831
latitude: -29.256666666666668°N
@@ -66,16 +69,20 @@ Planet(name, radius, eqradius, polradius, mass, ecc, axis, period)
6669

6770
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:
6871

69-
```julia
72+
```jldoctest
7073
julia> AstroLib.planets["mercury"]
71-
Planet: Mercury
72-
mean radius: 2.4397e6 m
73-
equatorial radius: 2.4397e6 m
74-
polar radius: 2.4397e6 m
75-
mass: 3.3011e23 kg
76-
eccentricity: 0.20563069
77-
semi-major axis: 5.790905e10 m
78-
period: 5.790905e10 s
74+
Planet: Mercury
75+
mean radius: 2.4397e6 m
76+
equatorial radius: 2.4397e6 m
77+
polar radius: 2.4397e6 m
78+
mass: 3.3011e23 kg
79+
eccentricity: 0.20563593
80+
semi-major axis: 5.790922654152439e10 m
81+
period: 7.60053024e6 s
82+
inclination: 7.00497902 °
83+
longitude of ascending node: 48.33076593 °
84+
longitude of perihelion: 77.45779628 °
85+
mean longitude: 252.2503235 °
7986
8087
julia> AstroLib.planets["mars"].eqradius
8188
3.3962e6
@@ -88,94 +95,94 @@ julia> AstroLib.planets["saturn"].mass
8895

8996
### Coordinates and positions
9097

91-
[`adstring()`](@ref),
92-
[`aitoff()`](@ref),
93-
[`altaz2hadec()`](@ref),
94-
[`baryvel()`](@ref),
95-
[`bprecess()`](@ref),
96-
[`co_aberration()`](@ref),
97-
[`co_nutate()`](@ref),
98-
[`co_refract()`](@ref),
99-
[`eci2geo()`](@ref),
100-
[`eq2hor()`](@ref),
101-
[`eqpole()`](@ref),
102-
[`euler()`](@ref),
103-
[`gcirc()`](@ref),
104-
[`geo2eci()`](@ref),
105-
[`geo2geodetic()`](@ref),
106-
[`geo2mag()`](@ref),
107-
[`geodetic2geo()`](@ref),
108-
[`hadec2altaz()`](@ref),
109-
[`helio_rv()`](@ref),
110-
[`helio()`](@ref),
111-
[`hor2eq()`](@ref),
112-
[`jprecess()`](@ref),
113-
[`mag2geo()`](@ref),
114-
[`mean_obliquity()`](@ref),
115-
[`planet_coords()`](@ref),
116-
[`polrec()`](@ref),
117-
[`posang()`](@ref),
118-
[`precess()`](@ref),
119-
[`precess_cd()`](@ref),
120-
[`precess_xyz()`](@ref),
121-
[`premat()`](@ref),
122-
[`radec()`](@ref),
123-
[`recpol()`](@ref),
124-
[`true_obliquity()`](@ref),
125-
[`zenpos()`](@ref)
98+
- [`adstring()`](@ref)
99+
- [`aitoff()`](@ref)
100+
- [`altaz2hadec()`](@ref)
101+
- [`baryvel()`](@ref)
102+
- [`bprecess()`](@ref)
103+
- [`co_aberration()`](@ref)
104+
- [`co_nutate()`](@ref)
105+
- [`co_refract()`](@ref)
106+
- [`eci2geo()`](@ref)
107+
- [`eq2hor()`](@ref)
108+
- [`eqpole()`](@ref)
109+
- [`euler()`](@ref)
110+
- [`gcirc()`](@ref)
111+
- [`geo2eci()`](@ref)
112+
- [`geo2geodetic()`](@ref)
113+
- [`geo2mag()`](@ref)
114+
- [`geodetic2geo()`](@ref)
115+
- [`hadec2altaz()`](@ref)
116+
- [`helio_rv()`](@ref)
117+
- [`helio()`](@ref)
118+
- [`hor2eq()`](@ref)
119+
- [`jprecess()`](@ref)
120+
- [`mag2geo()`](@ref)
121+
- [`mean_obliquity()`](@ref)
122+
- [`planet_coords()`](@ref)
123+
- [`polrec()`](@ref)
124+
- [`posang()`](@ref)
125+
- [`precess()`](@ref)
126+
- [`precess_cd()`](@ref)
127+
- [`precess_xyz()`](@ref)
128+
- [`premat()`](@ref)
129+
- [`radec()`](@ref)
130+
- [`recpol()`](@ref)
131+
- [`true_obliquity()`](@ref)
132+
- [`zenpos()`](@ref)
126133

127134
### Time and date
128135

129-
[`ct2lst()`](@ref),
130-
[`daycnv()`](@ref),
131-
[`get_date()`](@ref),
132-
[`get_juldate()`](@ref),
133-
[`helio_jd()`](@ref),
134-
[`jdcnv()`](@ref),
135-
[`juldate()`](@ref),
136-
[`month_cnv()`](@ref),
137-
[`nutate()`](@ref),
138-
[`ydn2md()`](@ref),
139-
[`ymd2dn()`](@ref)
136+
- [`ct2lst()`](@ref)
137+
- [`daycnv()`](@ref)
138+
- [`get_date()`](@ref)
139+
- [`get_juldate()`](@ref)
140+
- [`helio_jd()`](@ref)
141+
- [`jdcnv()`](@ref)
142+
- [`juldate()`](@ref)
143+
- [`month_cnv()`](@ref)
144+
- [`nutate()`](@ref)
145+
- [`ydn2md()`](@ref)
146+
- [`ymd2dn()`](@ref)
140147

141148
### Moon and sun
142149

143-
[`moonpos()`](@ref),
144-
[`mphase()`](@ref),
145-
[`sunpos()`](@ref),
146-
[`xyz()`](@ref)
150+
- [`moonpos()`](@ref)
151+
- [`mphase()`](@ref)
152+
- [`sunpos()`](@ref)
153+
- [`xyz()`](@ref)
147154

148155
### Utilities
149156

150-
[`airtovac()`](@ref),
151-
[`calz_unred()`](@ref),
152-
[`deredd()`](@ref),
153-
[`flux2mag()`](@ref),
154-
[`gal_uvw()`](@ref),
155-
[`imf()`](@ref),
156-
[`ismeuv()`](@ref),
157-
[`kepler_solver()`](@ref),
158-
[`lsf_rotate()`](@ref),
159-
[`mag2flux()`](@ref),
160-
[`paczynski()`](@ref),
161-
[`planck_freq()`](@ref),
162-
[`planck_wave()`](@ref),
163-
[`rad2sec()`](@ref),
164-
[`rhotheta()`](@ref),
165-
[`sec2rad()`](@ref),
166-
[`sixty()`](@ref),
167-
[`sphdist()`](@ref),
168-
[`ten()`](@ref),
169-
[`tic_one()`](@ref),
170-
[`ticpos()`](@ref),
171-
[`tics()`](@ref),
172-
[`trueanom()`](@ref),
173-
[`uvbybeta()`](@ref),
174-
[`vactoair()`](@ref)
157+
- [`airtovac()`](@ref)
158+
- [`calz_unred()`](@ref)
159+
- [`deredd()`](@ref)
160+
- [`flux2mag()`](@ref)
161+
- [`gal_uvw()`](@ref)
162+
- [`imf()`](@ref)
163+
- [`ismeuv()`](@ref)
164+
- [`kepler_solver()`](@ref)
165+
- [`lsf_rotate()`](@ref)
166+
- [`mag2flux()`](@ref)
167+
- [`paczynski()`](@ref)
168+
- [`planck_freq()`](@ref)
169+
- [`planck_wave()`](@ref)
170+
- [`rad2sec()`](@ref)
171+
- [`rhotheta()`](@ref)
172+
- [`sec2rad()`](@ref)
173+
- [`sixty()`](@ref)
174+
- [`sphdist()`](@ref)
175+
- [`ten()`](@ref)
176+
- [`tic_one()`](@ref)
177+
- [`ticpos()`](@ref)
178+
- [`tics()`](@ref)
179+
- [`trueanom()`](@ref)
180+
- [`uvbybeta()`](@ref)
181+
- [`vactoair()`](@ref)
175182

176183
### Miscellaneous (non-astronomy) functions
177184

178-
[`ordinal()`](@ref)
185+
- [`ordinal()`](@ref)
179186

180187
## Types and functions organized alphabetically
181188

src/adstring.jl

+2-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ julia> adstring.([30.4, -15.63], [-1.23, 48.41], precision=1)
7777
" 22 57 28.80 +48 24 36.0"
7878
```
7979
"""
80-
function adstring(ra::T, dec::T; precision::Int=0,
80+
function adstring(ra::T, dec::T;
81+
precision::Int=0,
8182
truncate::Bool=false) where {T<:AbstractFloat}
8283
# XXX: IDL implementation takes also real values for "precision" and
8384
# truncates it. I think it's better to enforce an integer type and cure

src/airtovac.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ Converts air wavelengths to vacuum wavelengths.
2727
### Explanation ###
2828
2929
Wavelengths are corrected for the index of refraction of air under standard conditions.
30-
Wavelength values below \$2000 Å\$ will *not* be altered, take care within \$[1 Å, 2000
31-
Å]\$. Uses relation of Ciddor (1996).
30+
Wavelength values below ``2000 Å`` will *not* be altered, take care within
31+
``[1 Å, 2000 Å]``. Uses relation of Ciddor (1996).
3232
3333
### Arguments ###
3434

0 commit comments

Comments
 (0)