Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aggregated updates #45

Merged
merged 34 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
e03d67d
Move docs workflow to separate file
abhro Jul 16, 2024
483003e
Update checkout version in workflows
abhro Jul 16, 2024
4517fe9
Tighten julia compat to 1.6 and up
abhro Jul 16, 2024
7d7bfee
Add compat bounds for Documenter.jl
abhro Jul 16, 2024
dd6f770
Change CI to run on 1.6 and higher
abhro Jul 16, 2024
b739eab
Add compat bounds for other doc dependencies
abhro Jul 16, 2024
b62c403
Fix doctests
abhro Jul 16, 2024
b06809b
Fix more doctests
abhro Jul 16, 2024
dc9121c
Update install instructions
abhro Jul 16, 2024
12f15bf
Update example code blocks in README.md
abhro Jul 16, 2024
1cd8c99
Wrap lines and fix markdown
abhro Jul 16, 2024
901c02b
Fix indents and spacing
abhro Jul 16, 2024
f463f6a
Update abstract type docstring header
abhro Jul 16, 2024
9be798f
Use more specific DomainError instead of error()
abhro Jul 16, 2024
ae2e515
Move error handling to top of method
abhro Jul 16, 2024
516831a
Fix tests to catch correct exception type
abhro Jul 16, 2024
a6d2bc6
Make curve F99 method more type stable
abhro Jul 16, 2024
ef7b5c0
Move bibtex asset files to their own directory
abhro Jul 16, 2024
000e455
Fix capitalization
abhro Jul 16, 2024
d571900
Add docstrings to site for G03_SMCBar
abhro Jul 16, 2024
f73fba1
Add docstring for checkbounds to site
abhro Jul 16, 2024
ec5824a
Turn docstrings missing from doc site into warnings
abhro Jul 16, 2024
dd5d3ca
Split up color laws into separate files
abhro Jul 16, 2024
d152b42
Update GitHub/Julia actions versions
abhro Jul 16, 2024
2acbee3
Add coloring to aqua workflow
abhro Jul 16, 2024
96132f6
Update codecov action version
abhro Jul 16, 2024
f6a53b0
Encapsulate all tests into larger testset
abhro Jul 16, 2024
07ae89a
Add dependabot
abhro Jul 16, 2024
c2c348f
Allow manual triggering of CompatHelper
abhro Jul 16, 2024
c6699d5
Give CompatHelper pull request permissions
abhro Jul 16, 2024
0e39b01
Rename CompatHelper job steps
abhro Jul 16, 2024
d7f5da6
Reformat CompatHelper runner
abhro Jul 16, 2024
0a12509
Add compat entry for DelimitedFiles
abhro Jul 16, 2024
8935f9a
Use separate Project.toml for tests
abhro Jul 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 10 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,23 @@ on:
tags: ["*"]
pull_request:
branches: [master]

concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: only if it is a pull request build.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

jobs:

test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- '1.0'
- '1.6'
- '1'
- 'nightly'
os:
Expand All @@ -28,8 +31,8 @@ jobs:
arch:
- x64
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
Expand All @@ -42,34 +45,16 @@ jobs:
- uses: codecov/codecov-action@v1
with:
file: lcov.info
abhro marked this conversation as resolved.
Show resolved Hide resolved

aqua:
name: Aqua tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: '1'
- uses: julia-actions/cache@v1
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-buildpkg@v1
- run: julia -e 'using Pkg; Pkg.add("Aqua")'
- run: julia --project=@. -e 'using Aqua, DustExtinction; Aqua.test_all(DustExtinction, ambiguities=false)'
abhro marked this conversation as resolved.
Show resolved Hide resolved
docs:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
version: '1'
- uses: julia-actions/cache@v1
- run: |
julia --project=docs -e '
using Pkg
Pkg.develop(PackageSpec(path=pwd()))
Pkg.instantiate()'
- run: julia --project=docs docs/make.jl
env:
GKSwstype: nul
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
26 changes: 26 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Documentation

on:
push:
branches: [master]
tags: ["*"]
pull_request:
branches: [master]

jobs:

docs:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: '1'
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-docdeploy@v1
env:
GKSwstype: nul
DATADEPS_ALWAYS_ACCEPT: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ FITSIO = "0.13.0, 0.14, 0.15, 0.16.1, 0.17"
Parameters = "0.12"
Unitful = "0.17.0, 1"
UnitfulAstro = "0.3.0, 0.4, 1"
julia = "1.0"
julia = "1.6"

[extras]
Measurements = "eff96d63-e80a-5855-80a2-b1b0885c5ab7"
Expand Down
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,61 +17,63 @@ Documentation: [DustExtinction](https://JuliaAstro.github.io/DustExtinction.jl/s

## Installation

From package manager (``` ]``` key)
From package manager (`]` key)

``` add DustExtinction```
```julia-repl
pkg> add DustExtinction
```

## Usage

Color laws:

```julia
```julia-repl
julia> using DustExtinction

julia> CCM89(Rv=3.1)(4000)
1.4645557029425842

julia> CCM89(Rv=3.1).([4000, 5000])
2-element Array{Float64,1}:
2-element Vector{Float64}:
1.46456
1.12225
```

Dust maps:

```julia
```julia-repl
julia> dustmap = SFD98Map()
SFD98Map("[...]")

julia> dustmap(0.1, 0.1)
0.793093095733043

julia> dustmap.([0.1, 0.2], [0.1, 0.2])
2-element Array{Float64,1}:
2-element Vector{Float64}:
0.793093
0.539507
```

Reddening:

```julia
```julia-repl
julia> wave = [4000., 5000.]
2-element Array{Float64,1}:
2-element Vector{Float64}:
4000.0
5000.0

julia> flux = [1.0, 1.5]
2-element Array{Float64,1}:
2-element Vector{Float64}:
1.0
1.5

julia> red = redden.(CCM89, wave, flux; Av=0.3, Rv=3.1)
2-element Array{Float64,1}:
2-element Vector{Float64}:
0.6671958182723856
1.1000733242882896

julia> deredden.(CCM89(Rv=3.1), wave, red; Av=0.3)
2-element Array{Float64,1}:
2-element Vector{Float64}:
1.0
1.5
```
Expand Down
8 changes: 8 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,11 @@ Measurements = "eff96d63-e80a-5855-80a2-b1b0885c5ab7"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
UnitfulAstro = "6112ee07-acf9-5e0f-b108-d242c714bf9f"

[compat]
Documenter = "1"
LaTeXStrings = "1"
Measurements = "2"
Plots = "1"
Unitful = "1"
UnitfulAstro = "1"
3 changes: 2 additions & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ makedocs(modules = [DustExtinction],
sitename = "DustExtinction.jl",
format = Documenter.HTML(prettyurls = get(ENV, "CI", nothing) == "true"),
authors = "Kyle Barbary, Mosé Giordano, Miles Lucas",
pages = pages
pages = pages,
warnonly = [:missing_docs],
)

deploydocs(repo = "github.com/JuliaAstro/DustExtinction.jl.git", push_preview = true)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 1 addition & 5 deletions docs/src/assets/m14.bib → docs/src/assets/bibtex/m14.bib
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
@ARTICLE{2014A&A...564A..63M,
author = {{Ma{\'\i}z Apell{\'a}niz}, J. and {Evans}, C.~J. and {Barb{\'a}}, R.~H. and
{Gr{\"a}fener}, G. and {Bestenlehner}, J.~M. and {Crowther}, P.~A. and
{Garc{\'\i}a}, M. and {Herrero}, A. and {Sana}, H. and
{Sim{\'o}n-D{\'\i}az}, S. and {Taylor}, W.~D. and {van Loon}, J. Th. and
{Vink}, J.~S. and {Walborn}, N.~R.},
author = {{Ma{\'\i}z Apell{\'a}niz}, J. and {Evans}, C.~J. and {Barb{\'a}}, R.~H. and {Gr{\"a}fener}, G. and {Bestenlehner}, J.~M. and {Crowther}, P.~A. and {Garc{\'\i}a}, M. and {Herrero}, A. and {Sana}, H. and {Sim{\'o}n-D{\'\i}az}, S. and {Taylor}, W.~D. and {van Loon}, J. Th. and {Vink}, J.~S. and {Walborn}, N.~R.},
title = "{The VLT-FLAMES Tarantula Survey. XVI. The optical and NIR extinction laws in 30 Doradus and the photometric determination of the effective temperatures of OB stars}",
journal = {\aap},
keywords = {open clusters and associations: individual: 30 Doradus, dust, extinction, Magellanic Clouds, stars: early-type, stars: fundamental parameters, Astrophysics - Astrophysics of Galaxies, Astrophysics - Cosmology and Nongalactic Astrophysics, Astrophysics - Instrumentation and Methods for Astrophysics, Astrophysics - Solar and Stellar Astrophysics},
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
60 changes: 33 additions & 27 deletions docs/src/color_laws.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The following empirical laws allow us to model the reddening of light as it trav
DocTestSetup = quote
using DustExtinction, Random
Random.seed!(1)
ENV["UNITFUL_FANCY_EXPONENTS"] = false
end
```

Expand All @@ -17,17 +18,15 @@ Color laws are constructed and then used as a function for passing wavelengths.
```jldoctest
julia> CCM89(Rv=3.1)(4000)
1.464555702942584

```

These laws can be applied across higher dimension arrays using the `.` operator

```jldoctest
julia> CCM89(Rv=3.1).([4000, 5000])
2-element Array{Float64,1}:
2-element Vector{Float64}:
1.464555702942584
1.1222468788993019

```

these laws return magnitudes, which we can apply directly to flux by mulitplication with a base-2.5 logarithmic system (because astronomers are fun):
Expand All @@ -46,8 +45,8 @@ julia> flux = 1e-8 .* wave .+ 1e-2
0.01004:3.3333333333333333e-6:0.01005

julia> redden.(CCM89, wave, flux; Av=0.3)
4-element Array{Float64,1}:
0.006698646015454752
4-element Vector{Float64}:
0.00669864601545475
0.006918253926353551
0.007154659823737299
0.007370491272731541
Expand All @@ -65,7 +64,7 @@ The color laws also have built-in support for uncertainties using [Measurements.
julia> using Measurements

julia> CCM89(Rv=3.1).([4000. ± 10.5, 5000. ± 10.2])
2-element Array{Measurement{Float64},1}:
2-element Vector{Measurement{Float64}}:
1.4646 ± 0.0033
1.1222 ± 0.003

Expand All @@ -77,8 +76,8 @@ and also support units via [Unitful.jl](https://github.com/painterqubits/unitful
julia> using Unitful, UnitfulAstro

julia> mags = CCM89(Rv=3.1).([4000u"angstrom", 0.5u"μm"])
2-element Array{Gain{Unitful.LogInfo{:Magnitude,10,-2.5},:?,Float64},1}:
1.4645557029425837 mag
2-element Vector{Gain{Unitful.LogInfo{:Magnitude, 10, -2.5}, :?, Float64}}:
1.464555702942584 mag
1.1222468788993019 mag

```
Expand All @@ -92,28 +91,28 @@ julia> wave = range(0.3, 1.0, length=5)u"μm"
(0.3:0.175:1.0) μm

julia> err = randn(length(wave))
5-element Array{Float64,1}:
0.2972879845354616
0.3823959677906078
-0.5976344767282311
-0.01044524463737564
-0.839026854388764
5-element Vector{Float64}:
-0.07058313895389791
0.5314767537831963
-0.806852326006714
2.456991333983293
1.1648740735275196

julia> flux = @.(300 / ustrip(wave)^4 ± err)*u"Jy"
5-element Array{Quantity{Measurement{Float64},𝐌*𝐓⁻²,Unitful.FreeUnits{(Jy,),𝐌*𝐓⁻²,nothing}},1}:
37037.04 ± 0.3 Jy
5893.14 ± 0.38 Jy
1680.61 ± -0.6 Jy
647.598 ± -0.01 Jy
300.0 ± -0.84 Jy
5-element Vector{Quantity{Measurement{Float64}, 𝐌 𝐓^-2, Unitful.FreeUnits{(Jy,), 𝐌 𝐓^-2, nothing}}}:
37037.037 ± -0.071 Jy
5893.14 ± 0.53 Jy
1680.61 ± -0.81 Jy
647.6 ± 2.5 Jy
300.0 ± 1.2 Jy

julia> redden.(CCM89, wave, flux; Av=0.3)
5-element Array{Quantity{Measurement{Float64},𝐌*𝐓⁻²,Unitful.FreeUnits{(Jy,),𝐌*𝐓⁻²,nothing}},1}:
22410.8 ± 0.18 Jy
4229.74 ± 0.27 Jy
1337.12 ± 0.48 Jy
554.3349 ± 0.0089 Jy
268.31 ± 0.75 Jy
5-element Vector{Quantity{Measurement{Float64}, 𝐌 𝐓^-2, Unitful.FreeUnits{(Jy,), 𝐌 𝐓^-2, nothing}}}:
22410.804 ± 0.043 Jy
4229.74 ± 0.38 Jy
1337.12 ± 0.64 Jy
554.3 ± 2.1 Jy
268.3 ± 1.0 Jy

```

Expand Down Expand Up @@ -203,7 +202,7 @@ F19

### Maiz Apellaniz et al. (2014)

![](assets/m14_plot.svg)
![](assets/M14_plot.svg)

```@docs
M14
Expand All @@ -216,6 +215,7 @@ redden
deredden
DustExtinction.ExtinctionLaw
DustExtinction.bounds
DustExtinction.checkbounds
```

### Fittable Extinction Laws
Expand All @@ -230,6 +230,12 @@ FM90

### Mixture Extinction Laws

#### Gordon et al. (2003)

```@docs
G03_SMCBar
```

#### Gordon et al. (2016)

![](assets/G16_fixed_f_A_plot.svg)
Expand Down
2 changes: 1 addition & 1 deletion docs/src/dust_maps.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ julia> b = range(-π/2, π/2, length=5)
-1.5707963267948966:0.7853981633974483:1.5707963267948966

julia> [dustmap(l[i], b[j]) for i in 1:length(l), j in 1:length(b)]
5×5 Array{Float64,2}:
5×5 Matrix{Float64}:
0.0159853 0.105782 1.40486 0.0158918 0.0119615
0.0159853 0.0268289 3.47788 0.0654852 0.0119615
0.0159853 0.0343457 99.6976 0.103875 0.0119615
Expand Down
Loading
Loading