Skip to content

Commit

Permalink
fix: turn matrix to vec on single model invoke
Browse files Browse the repository at this point in the history
  • Loading branch information
fjebaker committed Sep 30, 2023
1 parent 6affe82 commit a54c3ba
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 26 deletions.
4 changes: 2 additions & 2 deletions src/abstract-models.jl
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,13 @@ invokemodel(energy, model, p0)
```
"""
function invokemodel(e, m::AbstractSpectralModel)
flux = construct_objective_cache(m, e)
flux = construct_objective_cache(m, e) |> vec
invokemodel!(flux, e, m)
flux
end
function invokemodel(e, m::AbstractSpectralModel, free_params)
model = remake_with_free(m, free_params)
flux = construct_objective_cache(eltype(free_params), m, e)
flux = construct_objective_cache(eltype(free_params), m, e) |> vec
invokemodel!(flux, e, model)
flux
end
Expand Down
7 changes: 1 addition & 6 deletions src/datasets/binning.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export rebin_flux, make_flux, construct_objective_cache, domain_vector, regroup!
export rebin_flux, construct_objective_cache, regroup!

function rebin_flux(flux, current_energy, dest_energy_bins::AbstractVector)
downsample_rebin(
Expand Down Expand Up @@ -51,11 +51,6 @@ function downsample_rebin(input, current_bins, target_bins_high)
output
end

make_flux(m::AbstractSpectralModel, e::AbstractVector) = make_flux(eltype(e), m, e)
make_flux(T::Type, m::AbstractSpectralModel, e::AbstractVector) =
make_flux(T, length(e) + Δoutput_length(m))
make_flux(T::Type, n::Int) = zeros(T, n)

construct_objective_cache(model::AbstractSpectralModel, domain::AbstractVector) = construct_objective_cache(preferred_support(model), model, domain)
construct_objective_cache(T::Type, model::AbstractSpectralModel, domain::AbstractVector) = construct_objective_cache(preferred_support(model), T, model, domain)
construct_objective_cache(layout::AbstractDataLayout, model::AbstractSpectralModel, domain::AbstractVector{T}) where {T} =
Expand Down
18 changes: 0 additions & 18 deletions src/plotting-recipes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,6 @@ end
(x, rate)
end

@recipe function _plotting_func(d::SimpleDataset)
seriestype --> :scatter
xscale --> :log10
yscale --> :log10
markerstrokewidth --> 0
xlabel --> "x ($(d.x_units))"
ylabel --> "y ($(d.y_units))"
label --> d.name
if !isnothing(d.x_err)
@views xerr --> d.x_err[1:end-1]
end
if !isnothing(d.y_err)
yerr --> d.y_err
end
minorgrid --> true
@views (d.x[1:end-1], d.y)
end

plotting_domain(dataset::AbstractDataset) = spectrum_energy(dataset)
plotting_domain(dataset::InjectiveData) = dataset.domain

Expand Down

0 comments on commit a54c3ba

Please sign in to comment.