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

Adding Optxagnf model #127

Merged
merged 2 commits into from
Sep 19, 2024
Merged

Adding Optxagnf model #127

merged 2 commits into from
Sep 19, 2024

Conversation

GloriaRAH
Copy link
Contributor

Adding a draft for the Optxagnf model. Not yet tested if it is working.

@fjebaker
Copy link
Owner

Not necessarily for you, but I wanted to write this up to eventually put in the documentation:

Here's a short guide on how to test / develop, just for reference in case it's needed

mkdir temp-jl && cd temp-jl      # use a temporary environment
julia --project=.
# then in package manager mode
(temp-jl) pkg> dev --local SpectralFitting

# back on the command line
cd dev/SpectralFitting
git fetch origin pull/127/head:gloria
git switch gloria
cd ../..

Now you have your version of the code loaded in development mode. So you can use code . or whatever to open the temp-jl directory in VSCode.

@fjebaker
Copy link
Owner

Fixing that typo fixes everything :) The following works fine:

using SpectralFitting

model = XS_Optxagnf() 
energies = collect(range(0.01, 10.0, 100))
invokemodel(energies, model)

@fjebaker
Copy link
Owner

using SpectralFitting, UnicodePlots

function plotmodel(energy, model)
    flux = invokemodel(energy, model)
    lineplot(
        energy[1:end-1],
        flux,
        title=String(Base.typename(typeof(model)).name),
        xlabel="E (keV)",
        canvas=DotCanvas
    )
end

# e.g. for XS_PowerLaw()
energy = collect(range(0.1, 20.0, 100))
plotmodel(energy, XS_Optxagnf())

The resulting plot might need log axes or some different parameters, but I'll leave that choice to you

This commit refactors the `xspec-models/additive.jl` file to use the `AbstractSpectralModel` type instead of `AbstractSpectraModel`. This change ensures consistency and improves code readability.
src/xspec-models/additive.jl Outdated Show resolved Hide resolved
@fjebaker fjebaker merged commit ecd933c into fjebaker:main Sep 19, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants