Skip to content

Commit 1bbccdb

Browse files
mileslucasgiordano
authored andcommitted
Dustmap update and extinct function (#7)
* download sfd98 map in build step * siwtch sfd98maps to use call method * bump project version to 0.6.0 * update documentation for dustmap changes * whitespace fix * add unitful support for sfd and test measurement/unitful support for sfd * gather exports into one location * add `extinct` and `extinc!` function. * update documentation * update readme with new dustmap usage and extinct method * add more verbosity to build download step * add a hack to find build.log in travis * fix dir in durty hack * fix error with julia 1.0 tests which don't have `eachcol` * refactor documentation, make simpler docstrings, remove extinct! method, add logo and color law plot * update readme * fix travis documenter build step * update CI for running julia 1.2 and add codecov to travis * add codecov badge to readme * add separate citation files and tidy up docs * add polynomials for ccm89 law which led to type stability and beefed up the test suite for type stability * add hack to deploy pull request docs * tidy up every doc string * fix doc strings * test out windows builds on travis * change travis 32-bit to jobs not matrix * fix broken doctests * add ColorLaw type and relevant structs * Revert "fix broken doctests" This reverts commit 84b4d3e. * reforganize files * refactor code into new files for simplicity * update documentation * clean up docstrings * fix dangling html * remove new CI changes * add julia 1.3 to CI suite * small changes from review
1 parent 0b72612 commit 1bbccdb

29 files changed

+1068
-690
lines changed

.cirrus.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ task:
66
matrix:
77
- JULIA_VERSION: 1.0
88
- JULIA_VERSION: 1.1
9+
- JULIA_VERSION: 1.2
10+
- JULIA_VERSION: 1.3
911
- JULIA_VERSION: nightly
1012
install_script:
1113
- sh -c "$(fetch https://raw.githubusercontent.com/ararslan/CirrusCI.jl/master/bin/install.sh -o -)"
1214
build_script:
1315
- cirrusjl build
1416
test_script:
1517
- cirrusjl test
16-
coverage_script:
17-
- cirrusjl coverage codecov coveralls

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ deps/build.log
2020
deps/downloads/
2121
deps/usr/
2222
deps/src/
23+
deps/*.fits
2324

2425
# Build artifacts for creating documentation generated by the Documenter package
2526
docs/build/

.travis.yml

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,31 @@
11
language: julia
2+
23
os:
34
- linux
45
- osx
6+
57
julia:
68
- 1.0
79
- 1.1
10+
- 1.2
11+
- 1.3
812
- nightly
13+
914
matrix:
1015
allow_failures:
1116
- julia: nightly
12-
git:
13-
depth: 999999
17+
1418
notifications:
1519
email: false
1620

21+
codecov: true
1722

1823
jobs:
1924
include:
2025
- stage: "Documentation"
21-
julia: 1.1
26+
julia: 1.2
2227
os: linux
2328
script:
24-
- julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
29+
- julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate(); Pkg.build("DustExtinction")'
2530
- julia --project=docs/ docs/make.jl
2631
after_success: skip

Project.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
name = "DustExtinction"
22
uuid = "fb44c06c-c62f-5397-83f5-69249e0a3c8e"
33
license = "MIT"
4-
version = "0.5.0"
4+
version = "0.6.0"
55

66
[deps]
77
FITSIO = "525bcba6-941b-5504-bd06-fd0dc1a4d2eb"
8+
Polynomials = "f27b6e38-b328-58d1-80ce-0feddd5e7a45"
89
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
910
UnitfulAstro = "6112ee07-acf9-5e0f-b108-d242c714bf9f"
1011

README.md

+32-12
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
# DustExtinction.jl
22

3-
[![Build Status](https://img.shields.io/travis/JuliaAstro/DustExtinction.jl.svg?style=flat-square)](https://travis-ci.org/JuliaAstro/DustExtinction.jl)
3+
[![Build Status](https://img.shields.io/travis/JuliaAstro/DustExtinction.jl.svg)](https://travis-ci.org/JuliaAstro/DustExtinction.jl)
44
[![](https://img.shields.io/badge/docs-stable-blue.svg)](https://JuliaAstro.github.io/DustExtinction.jl/stable)
55
[![](https://img.shields.io/badge/docs-dev-blue.svg)](https://JuliaAstro.github.io/DustExtinction.jl/dev)
6+
[![codecov](https://codecov.io/gh/JuliaAstro/DustExtinction.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/JuliaAstro/DustExtinction.jl)
7+
68

79

810
Tools for interstellar dust extinction in astronomy
911

1012
Documentation: [DustExtinction](https://JuliaAstro.github.io/DustExtinction.jl/stable)
1113

12-
## Install
14+
## Installation
1315

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

1618
``` add DustExtinction```
1719

18-
Usage
19-
-----
20+
## Usage
2021

2122
Color laws:
2223

@@ -35,21 +36,40 @@ julia> ccm89.([4000., 5000.], 3.1)
3536
Dust maps:
3637

3738
```julia
38-
julia> ENV["SFD98_DIR"] = "/home/user/data/dust"
39-
40-
# download maps (once)
41-
julia> download_sfd98()
42-
4339
julia> dustmap = SFD98Map()
44-
SFD98Map("/home/user/data/dust")
40+
SFD98Map("[...]")
4541

46-
julia> ebv_galactic(dustmap, 0.1, 0.1)
42+
julia> dustmap(0.1, 0.1)
4743
0.793093095733043
4844

49-
julia> ebv_galactic(dustmap, [0.1, 0.2], [0.1, 0.2])
45+
julia> dustmap.([0.1, 0.2], [0.1, 0.2])
5046
2-element Array{Float64,1}:
5147
0.793093
5248
0.539507
5349
```
5450

51+
Extinction:
52+
53+
```julia
54+
julia> wave = [4000., 5000.]
55+
2-element Array{Float64,1}:
56+
4000.0
57+
5000.0
58+
59+
julia> flux = [1.0, 1.5]
60+
2-element Array{Float64,1}:
61+
1.0
62+
1.5
63+
64+
julia> extinct.(flux, wave, 0.3)
65+
2-element Array{Float64,1}:
66+
0.6671958182723856
67+
1.1000733242882896
68+
69+
```
70+
71+
We provide first-class support for `Unitful.jl` and `Measurements.jl` packages, too! Check out the documentation for more examples.
72+
73+
## Contributing
5574

75+
Feel free to open an issue or a pull-request for any discussion, suggestions, new features, or patches!

appveyor.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
environment:
22
matrix:
3-
- julia_version: 1
3+
- julia_version: 1.0
44
- julia_version: 1.1
5+
- julia_version: 1.2
6+
- julia_version: 1.3
57
- julia_version: nightly
68

79
platform:

deps/build.jl

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Downloads the SFD98 Map file
2+
const SFD98_BASEURL = "http://sncosmo.github.io/data/dust/"
3+
4+
const destdir = haskey(ENV, "SFD98_DIR") ? ENV["SFD98_DIR"] : @__DIR__
5+
6+
try
7+
for fname in ["SFD_dust_4096_ngp.fits", "SFD_dust_4096_sgp.fits"]
8+
dest = joinpath(destdir, fname)
9+
if isfile(dest)
10+
@info "$dest already exists, skipping download."
11+
else
12+
download(SFD98_BASEURL * fname, dest)
13+
@info "downloaded $dest successfully."
14+
end
15+
end
16+
catch
17+
@error "There was an error downloading the SFD98 Dust Maps. Please re-build or manually download the maps and set the \"SFD98_DIR\" environment variable."
18+
end

docs/Project.toml

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
[deps]
22
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
3+
LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
34
Measurements = "eff96d63-e80a-5855-80a2-b1b0885c5ab7"
5+
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
6+
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
7+
UnitfulAstro = "6112ee07-acf9-5e0f-b108-d242c714bf9f"
48

59
[compat]
6-
Documenter = "~0.20"
10+
Documenter = "~0.23"
11+
UnitfulAstro = "0.4.0"

docs/make.jl

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
using Documenter
22
using DustExtinction
33

4-
makedocs(
5-
modules = [DustExtinction],
4+
makedocs(modules = [DustExtinction],
65
sitename = "DustExtinction.jl",
6+
format = Documenter.HTML(prettyurls = get(ENV, "CI", nothing) == "true"),
7+
authors = "Kyle Barbary, Mosé Giordano, Miles Lucas",
8+
strict = true,
9+
pages = [
10+
"Home" => "index.md",
11+
"Color Laws" => "color_laws.md",
12+
"Dust Maps" => "dust_maps.md"
13+
],
714
)
815

9-
deploydocs(
10-
repo = "github.com/JuliaAstro/DustExtinction.jl.git",
11-
)
16+
deploydocs(repo = "github.com/JuliaAstro/DustExtinction.jl.git")

docs/src/assets/cal00.bib

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
@ARTICLE{2000ApJ...533..682C,
2+
author = {{Calzetti}, Daniela and {Armus}, Lee and {Bohlin}, Ralph C. and
3+
{Kinney}, Anne L. and {Koornneef}, Jan and {Storchi-Bergmann}, Thaisa},
4+
title = "{The Dust Content and Opacity of Actively Star-forming Galaxies}",
5+
journal = {\apj},
6+
keywords = {GALAXIES: STARBURST, INFRARED: GALAXIES, INFRARED: ISM: CONTINUUM, ISM: DUST, EXTINCTION, Astrophysics},
7+
year = "2000",
8+
month = "Apr",
9+
volume = {533},
10+
number = {2},
11+
pages = {682-695},
12+
doi = {10.1086/308692},
13+
archivePrefix = {arXiv},
14+
eprint = {astro-ph/9911459},
15+
primaryClass = {astro-ph},
16+
adsurl = {https://ui.adsabs.harvard.edu/abs/2000ApJ...533..682C},
17+
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
18+
}

docs/src/assets/ccm89.bib

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@ARTICLE{1989ApJ...345..245C,
2+
author = {{Cardelli}, Jason A. and {Clayton}, Geoffrey C. and {Mathis}, John S.},
3+
title = "{The Relationship between Infrared, Optical, and Ultraviolet Extinction}",
4+
journal = {\apj},
5+
keywords = {Infrared Spectra, Interstellar Extinction, Ultraviolet Spectra, Visible Spectrum, Computational Astrophysics, Interstellar Matter, Iue, Astrophysics, INTERSTELLAR: MATTER, ULTRAVIOLET: SPECTRA},
6+
year = "1989",
7+
month = "Oct",
8+
volume = {345},
9+
pages = {245},
10+
doi = {10.1086/167900},
11+
adsurl = {https://ui.adsabs.harvard.edu/abs/1989ApJ...345..245C},
12+
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
13+
}

docs/src/assets/logo.svg

+12
Loading

docs/src/assets/od94.bib

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@ARTICLE{1994ApJ...422..158O,
2+
author = {{O'Donnell}, James E.},
3+
title = "{R v-dependent Optical and Near-Ultraviolet Extinction}",
4+
journal = {\apj},
5+
keywords = {Interstellar Extinction, Light (Visible Radiation), Near Infrared Radiation, Ultraviolet Radiation, Astronomical Photometry, Iue, Astrophysics, ISM: DUST, EXTINCTION},
6+
year = "1994",
7+
month = "Feb",
8+
volume = {422},
9+
pages = {158},
10+
doi = {10.1086/173713},
11+
adsurl = {https://ui.adsabs.harvard.edu/abs/1994ApJ...422..158O},
12+
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
13+
}

docs/src/assets/sfd98.bib

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
@ARTICLE{1998ApJ...500..525S,
2+
author = {{Schlegel}, David J. and {Finkbeiner}, Douglas P. and {Davis}, Marc},
3+
title = "{Maps of Dust Infrared Emission for Use in Estimation of Reddening and Cosmic Microwave Background Radiation Foregrounds}",
4+
journal = {\apj},
5+
keywords = {COSMOLOGY: DIFFUSE RADIATION, COSMOLOGY: COSMIC MICROWAVE BACKGROUND, ISM: DUST, EXTINCTION, INTERPLANETARY MEDIUM, INFRARED: ISM: CONTINUUM, Cosmology: Cosmic Microwave Background, Cosmology: Diffuse Radiation, ISM: Dust, Extinction, Infrared: ISM: Continuum, Interplanetary Medium, Astrophysics},
6+
year = "1998",
7+
month = "Jun",
8+
volume = {500},
9+
number = {2},
10+
pages = {525-553},
11+
doi = {10.1086/305772},
12+
archivePrefix = {arXiv},
13+
eprint = {astro-ph/9710327},
14+
primaryClass = {astro-ph},
15+
adsurl = {https://ui.adsabs.harvard.edu/abs/1998ApJ...500..525S},
16+
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
17+
}

0 commit comments

Comments
 (0)