Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
cff-version: 1.2.0
type: software
title: Spectra.jl
title: SpectrumBase.jl
message: If you use this software, please cite it using the metadata from this file.
repository-code: 'https://github.com/JuliaAstro/Spectra.jl'
repository-code: 'https://github.com/JuliaAstro/SpectrumBase.jl'
authors:
- given-names: Miles
family-names: Lucas
Expand All @@ -11,5 +11,5 @@ authors:
- name: JuliaAstro
email: astro@julialang.org
website: 'https://juliaastro.org'
url: 'https://juliaastro.org/Spectra'
url: 'https://juliaastro.org/SpectrumBase'
license: MIT
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name = "Spectra"
name = "SpectrumBase"
uuid = "391af1a9-06f1-59d3-8d21-0be089654739"
version = "0.1.0"
authors = ["Miles Lucas <mdlucas@hawaii.edu>"]
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Spectra.jl
# SpectrumBase.jl

[![](https://img.shields.io/badge/docs-stable-blue.svg?label=docs)](https://juliaastro.org/Spectra.jl/stable)
[![](https://img.shields.io/badge/docs-dev-blue.svg?label=docs)](https://juliaastro.org/Spectra.jl/dev)
[![](https://img.shields.io/badge/docs-stable-blue.svg?label=docs)](https://juliaastro.org/SpectrumBase.jl/stable)
[![](https://img.shields.io/badge/docs-dev-blue.svg?label=docs)](https://juliaastro.org/SpectrumBase.jl/dev)

[![CI](https://github.com/JuliaAstro/Spectra.jl/actions/workflows/CI.yml/badge.svg)](https://github.com/JuliaAstro/Spectra.jl/actions/workflows/CI.yml)
[![codecov](https://codecov.io/gh/juliaastro/Spectra.jl/graph/badge.svg?token=EjMJcszaoQ)](https://codecov.io/gh/juliaastro/Spectra.jl)
![GitHub](https://img.shields.io/github/license/juliaastro/Spectra.jl.svg)
[![CI](https://github.com/JuliaAstro/SpectrumBase.jl/actions/workflows/CI.yml/badge.svg)](https://github.com/JuliaAstro/SpectrumBase.jl/actions/workflows/CI.yml)
[![codecov](https://codecov.io/gh/juliaastro/SpectrumBase.jl/graph/badge.svg?token=EjMJcszaoQ)](https://codecov.io/gh/juliaastro/SpectrumBase.jl)
![GitHub](https://img.shields.io/github/license/juliaastro/SpectrumBase.jl.svg)

Utilities for interfacing with astronomical spectra and synthetic spectra libraries.

Expand All @@ -17,7 +17,7 @@ Utilities for interfacing with astronomical spectra and synthetic spectra librar

Currently this package can only be installed from github. To do so, either clone this repository and install it or

pkg> add https://github.com/JuliaAstro/Spectra.jl
pkg> add https://github.com/JuliaAstro/SpectrumBase.jl

from the `pkg` command line (Press `]` from Julia REPL)

Expand All @@ -33,10 +33,10 @@ julia --proj
julia> import Pkg

# List tests
julia> Pkg.test("Spectra"; test_args = `--list`)
julia> Pkg.test("SpectrumBase"; test_args = `--list`)

# Run specific testsets by name. Will match with `startswith`
julia> Pkg.test("Spectra"; test_args = `--verbose <testset name>`)
julia> Pkg.test("SpectrumBase"; test_args = `--verbose <testset name>`)
```

### Docs
Expand Down
2 changes: 1 addition & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Interpolations = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59"
Measurements = "eff96d63-e80a-5855-80a2-b1b0885c5ab7"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
Spectra = "391af1a9-06f1-59d3-8d21-0be089654739"
SpectrumBase = "391af1a9-06f1-59d3-8d21-0be089654739"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
UnitfulAstro = "6112ee07-acf9-5e0f-b108-d242c714bf9f"

Expand Down
14 changes: 7 additions & 7 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
using Documenter
using Spectra
using SpectrumBase
using Unitful
using Measurements
using Revise

Revise.revise()

DocMeta.setdocmeta!(Spectra, :DocTestSetup, :(using Spectra); recursive = true)
DocMeta.setdocmeta!(SpectrumBase, :DocTestSetup, :(using SpectrumBase); recursive = true)

makedocs(sitename = "Spectra.jl",
makedocs(sitename = "SpectrumBase.jl",
format = Documenter.HTML(;
prettyurls = true,
canonical = "https://juliaastro.org/Spectra/stable/",
canonical = "https://juliaastro.org/SpectrumBase/stable/",
),
authors = "Miles Lucas and contributors.",
linkcheck = !("skiplinks" in ARGS),
modules = [Spectra],
modules = [SpectrumBase],
pages = [
"Home" => "index.md",
"spectrum.md",
Expand All @@ -29,8 +29,8 @@ makedocs(sitename = "Spectra.jl",
)

deploydocs(;
repo = "github.com/JuliaAstro/Spectra.jl.git",
repo = "github.com/JuliaAstro/SpectrumBase.jl.git",
devbranch = "main",
push_preview = true,
versions = ["stable" => "v^", "v#.#"], # Restrict to minor releases
)
)
6 changes: 0 additions & 6 deletions docs/old_docs/fitting.md

This file was deleted.

7 changes: 0 additions & 7 deletions docs/old_docs/utils.md

This file was deleted.

16 changes: 8 additions & 8 deletions docs/src/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Spectra.jl
# SpectrumBase.jl

Utilities for interfacing with astronomical spectra and synthetic spectra libraries.

Expand All @@ -11,9 +11,9 @@ Pages = ["index.md", "spectrum.md", "transforms.md"]
From the REPL, press `]` to enter Pkg mode

```julia-repl
pkg> add https://github.com/JuliaAstro/Spectra.jl
pkg> add https://github.com/JuliaAstro/SpectrumBase.jl

julia> using Spectra
julia> using SpectrumBase
```

## Quick Start
Expand All @@ -23,7 +23,7 @@ Here is a quick demo of some of our features.
### Spectrum construction

```jldoctest guide
julia> using Spectra, FITSIO, Unitful, UnitfulAstro, Plots
julia> using SpectrumBase, FITSIO, Unitful, UnitfulAstro, Plots

julia> # fitsurl = "https://dr14.sdss.org/optical/spectrum/view/data/format=fits/spec=lite?plateid=1323&mjd=52797&fiberid=12";

Expand Down Expand Up @@ -60,14 +60,14 @@ For constructing higher dimensional spectra, e.g., for echelle or IFU spectra, s
If you found this software or any derivative work useful in your academic work, I ask that you please cite the code.

```
@misc{Spectra.jl,
@misc{SpectrumBase.jl,
author = {Miles Lucas and contributors},
title = {Spectra.jl: Utilities for interfacing with astronomical spectra},
url = {https://github.com/JuliaAstro/Spectra.jl},
title = {SpectrumBase.jl: Utilities for interfacing with astronomical spectra},
url = {https://github.com/JuliaAstro/SpectrumBase.jl},
year = {2024}
}
```

## Contributing

Please see [Contributing](@ref contrib) for information on contributing and extending Spectra.jl.
Please see [Contributing](@ref contrib) for information on contributing and extending SpectrumBase.jl.
22 changes: 11 additions & 11 deletions docs/src/spectrum.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ Here we will go over the different spectral types and how we use them.

## Types

Spectra are defined as possible subtypes of `AbstractSpectrum`. You can use these directly for construction, or use the catch-all [`spectrum`](@ref) function, which is preferred.
SpectrumBase are defined as possible subtypes of `AbstractSpectrum`. You can use these directly for construction, or use the catch-all [`spectrum`](@ref) function, which is preferred.

```@docs
Spectra.AbstractSpectrum
Spectra.Spectrum
Spectra.SingleSpectrum
Spectra.EchelleSpectrum
Spectra.IFUSpectrum
SpectrumBase.AbstractSpectrum
SpectrumBase.Spectrum
SpectrumBase.SingleSpectrum
SpectrumBase.EchelleSpectrum
SpectrumBase.IFUSpectrum
```

## Constructors

```@docs
Spectra.spectrum
SpectrumBase.spectrum
```


Expand All @@ -27,9 +27,9 @@ For more advanced transformations, see [Transformations](@ref)

### Getters
```@docs
Spectra.spectral_axis(::AbstractSpectrum)
Spectra.flux_axis(::AbstractSpectrum)
Spectra.meta(::AbstractSpectrum)
SpectrumBase.spectral_axis(::AbstractSpectrum)
SpectrumBase.flux_axis(::AbstractSpectrum)
SpectrumBase.meta(::AbstractSpectrum)
```

### Array interface
Expand Down Expand Up @@ -69,7 +69,7 @@ Unitful.ustrip
We provide simple plotting recipes for spectra using [Plots.jl](https://github.com/juliaplots/plots.jl)

```@example
using Plots, Spectra
using Plots, SpectrumBase

wave = range(1e3, 5e4, length=100)
spec = blackbody(wave, 2000)
Expand Down
4 changes: 2 additions & 2 deletions docs/src/transforms.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
By leveraging [DustExtinction.jl](https://github.com/juliaastro/dustextinction.jl) we can apply common reddening laws to our spectra.

```jldoctest
julia> using Spectra, Unitful, Measurements, Random
julia> using SpectrumBase, Unitful, Measurements, Random

julia> rng = Random.seed!(0);

Expand Down Expand Up @@ -66,4 +66,4 @@ External interpolators, e.g., from [DataInterpolations.jl](https://github.com/Sc

```@docs
SpectrumResampler
```
```
2 changes: 1 addition & 1 deletion src/Spectra.jl → src/SpectrumBase.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Spectra
module SpectrumBase

# Uniform API
export AbstractSpectrum, Spectrum, spectrum, spectral_axis, flux_axis
Expand Down
2 changes: 1 addition & 1 deletion src/transforms/resampler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Interpolation methods from many packages can be used without issue. Below we sho
First, we set up an arbitrary spectrum and a linear interpolator from DataInterpolations.jl:

```jldoctest resampling
julia> using Spectra: SpectrumResampler, spectrum, spectral_axis, flux_axis
julia> using SpectrumBase: SpectrumResampler, spectrum, spectral_axis, flux_axis

julia> using DataInterpolations: LinearInterpolation, ExtrapolationType

Expand Down
2 changes: 1 addition & 1 deletion src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The physical constants are calculated using [PhysicalConstants.jl](https://githu

# Examples
```jldoctest
julia> using Spectra, Unitful, UnitfulAstro
julia> using SpectrumBase, Unitful, UnitfulAstro

julia> wave = range(1, 3, length=100)u"μm"
(1.0:0.020202020202020204:3.0) μm
Expand Down
2 changes: 1 addition & 1 deletion test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Measurements = "eff96d63-e80a-5855-80a2-b1b0885c5ab7"
ParallelTestRunner = "d3525ed8-44d0-4b2c-a655-542cee43accc"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
Spectra = "391af1a9-06f1-59d3-8d21-0be089654739"
SpectrumBase = "391af1a9-06f1-59d3-8d21-0be089654739"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
UnitfulAstro = "6112ee07-acf9-5e0f-b108-d242c714bf9f"
2 changes: 1 addition & 1 deletion test/aqua.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
using Aqua: test_all

test_all(Spectra)
test_all(SpectrumBase)
6 changes: 3 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using ParallelTestRunner: runtests, find_tests, parse_args
import Spectra
import SpectrumBase

const init_code = quote
using Spectra: Spectra, Spectrum, SingleSpectrum, EchelleSpectrum, IFUSpectrum, spectrum, spectral_axis, flux_axis
using SpectrumBase: SpectrumBase, Spectrum, SingleSpectrum, EchelleSpectrum, IFUSpectrum, spectrum, spectral_axis, flux_axis
using Measurements: Measurements, ±
using Unitful: @u_str, unit, ustrip
import Random
Expand All @@ -11,4 +11,4 @@ end
args = parse_args(Base.ARGS)
testsuite = find_tests(@__DIR__)

runtests(Spectra, args; testsuite, init_code)
runtests(SpectrumBase, args; testsuite, init_code)
2 changes: 1 addition & 1 deletion test/transforms/redden.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Spectra:
using SpectrumBase:
redden,
redden!,
deredden,
Expand Down
4 changes: 2 additions & 2 deletions test/transforms/resample.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Spectra: Spectra, AbstractSpectrum, SpectrumResampler, spectrum, spectral_axis, flux_axis
using SpectrumBase: SpectrumBase, AbstractSpectrum, SpectrumResampler, spectrum, spectral_axis, flux_axis
using DataInterpolations: LinearInterpolation, ExtrapolationType
using Unitful: @u_str, uconvert
using UnitfulAstro
Expand Down Expand Up @@ -36,7 +36,7 @@ end
resampler = SpectrumResampler(spec, interp)
expected = """
SpectrumResampler(Float64, Measurements.Measurement{Float64})
spec: Spectra.SingleSpectrum{Float64, Measurements.Measurement{Float64}}
spec: SpectrumBase.SingleSpectrum{Float64, Measurements.Measurement{Float64}}
interpolator: DataInterpolations.LinearInterpolation{Vector{Measurements.Measurement{Float64}}, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, Vector{Measurements.Measurement{Float64}}, Vector{Measurements.Measurement{Float64}}, Measurements.Measurement{Float64}}"""

@test sprint(show, resampler) == expected
Expand Down
6 changes: 3 additions & 3 deletions test/utils.jl
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
using Spectra: blackbody#, line_flux, equivalent_width
using SpectrumBase: blackbody#, line_flux, equivalent_width

@testset "Blackbody T=$T" for T in [2000, 4000, 6000]
wave = range(1e3, 5e4, length = 1000)
b = 2.897771955185172e7

bb = @inferred blackbody(wave, T)
@test typeof(bb) <: Spectra.Spectrum
@test typeof(bb) <: SpectrumBase.Spectrum
@test bb.T == T
@test spectral_axis(bb)[argmax(bb)] ≈ b / T rtol = 0.01

wave *= u"angstrom"
T *= u"K"
bb = @inferred blackbody(wave, T)
@test typeof(bb) <: Spectra.Spectrum
@test typeof(bb) <: SpectrumBase.Spectrum
@test unit(bb)[2] == u"W/m^2/angstrom"
@test bb.T == T
@test spectral_axis(bb)[argmax(bb)] ≈ b * u"angstrom*K" / T rtol = 0.01
Expand Down
Loading