-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
33 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Spectral fitting examples | ||
|
||
```@setup sf_examples | ||
using SpectralFitting | ||
using Plots | ||
ENV["GKSwstype"]="nul" | ||
Plots.default(show=false) | ||
``` | ||
|
||
Below are a number of examples illustrating how this package may be used. | ||
|
||
## Using the model library | ||
|
||
The model library details a model algebra (see [`AbstractSpectralModelKind`](@ref)) for composing models together. An example use of this may be to construct a complex model from a series of simpler models, and invoke the models on a given energy grid: | ||
|
||
```@example sf_examples | ||
using SpectralFitting | ||
using Plots | ||
model = PhotoelectricAbsorption() * (PowerLaw() + BlackBody()) | ||
# define energy grid | ||
energy = collect(range(0.1, 12.0, 100)) | ||
flux = invokemodel(energy, model) | ||
plot(energy[1:end-1], flux) | ||
``` | ||
|
||
Note this energy grid may be arbitrarily spaced, but, like XSPEC, assumes the bins are contiguous, i.e. that the high energy limit of one bin is the low energy limit of the next. | ||
|
||
The full model library of available models is listed in [Model index](./models.md). |
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