-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #200 from astro-group-bristol/fergus/lib-gradus-mo…
…dels Gradus Spectral Models
- Loading branch information
Showing
6 changed files
with
93 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
name = "GradusSpectralModels" | ||
uuid = "0bd1f26a-7f13-41ad-b364-0116c59c8ea1" | ||
authors = ["fjebaker <fergusbkr@gmail.com>"] | ||
version = "0.1.0" | ||
|
||
[deps] | ||
Gradus = "c5b7b928-ea15-451c-ad6f-a331a0f3e4b7" | ||
SpectralFitting = "f2c56810-742e-4b72-8bf4-27af3bb81a12" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
module GradusSpectralModels | ||
|
||
using Gradus, SpectralFitting | ||
|
||
struct LineProfile{D,T} <: AbstractTableModel{T,Additive} | ||
table::D | ||
K::T | ||
"Spin" | ||
a::T | ||
"Observer inclination (degrees off of the spin axis)." | ||
θ::T | ||
"Inner radius of the accretion disc." | ||
rin::T | ||
"Outer radius of the accretion disc." | ||
rout::T | ||
"Central emission line energy (keV)." | ||
E₀::T | ||
end | ||
|
||
function LineProfile( | ||
profile, | ||
table::Gradus.CunninghamTransferTable; | ||
K = FitParam(1.0), | ||
a = FitParam(0.998), | ||
θ = FitParam(45.0), | ||
rin = FitParam(1.0), | ||
rout = FitParam(100.0, upper_limit = 100.0), | ||
E₀ = FitParam(1.0), | ||
) | ||
setup = integration_setup(profile, table((get_value(θ), get_value(a)))) | ||
LineProfile((; setup = setup, table = table), K, a, θ, rin, rout, E₀) | ||
end | ||
|
||
function SpectralFitting.invoke!(output, domain, model::LineProfile) | ||
grid = model.table.table((model.θ, model.a)) | ||
rmin = if model.rmin < grid.r_grid[1] | ||
grid.r_grid[1] | ||
else | ||
model.rmin | ||
end | ||
Gradus.integrate_lineprofile!( | ||
output, | ||
model.table.setup, | ||
grid, | ||
domain; | ||
rmin = rmin, | ||
rmax = model.rout, | ||
) | ||
output | ||
end | ||
|
||
export LineProfile | ||
|
||
end # module GradusSpectralModels |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters