Skip to content

Commit

Permalink
Merge pull request #43 from legend-exp/format
Browse files Browse the repository at this point in the history
Switch from Formatting.jl to Format.jl
  • Loading branch information
theHenks authored Apr 3, 2024
2 parents 05f1016 + 1b44757 commit 1f0c07f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ChangesOfVariables = "9e997f8a-9a97-42d5-a9f1-ce6bfc15e2c0"
DensityInterface = "b429d917-457f-4dbc-8f4c-0cc954292b1d"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
Formatting = "59287772-0a20-5a39-b81b-1366585eb4c0"
Format = "1fa38f19-a742-5d3f-a2b9-30dd87b9d5f8"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
IntervalSets = "8197267c-284f-5f27-9208-e0e47529a953"
InverseFunctions = "3587e190-3f89-42d0-90ee-14403ec27112"
Expand Down Expand Up @@ -49,8 +49,8 @@ BAT = "~3.0, ~3.1"
ChangesOfVariables = "0.1.1"
DensityInterface = "0.4"
Distributions = "0.24, 0.25"
FillArrays = "0.7,0.8, 0.9, 0.10, 0.11, 0.12, 0.13, 1"
Formatting = "0.4"
FillArrays = "0.7, 0.8, 0.9, 0.10, 0.11, 0.12, 0.13, 1"
Format = "1.2, 1.3"
ForwardDiff = "0.10"
IntervalSets = "0.7"
InverseFunctions = "0.1"
Expand Down
2 changes: 1 addition & 1 deletion ext/LegendSpecFitsRecipesBaseExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module LegendSpecFitsRecipesBaseExt

using RecipesBase
using Unitful, Formatting, Measurements
using Unitful, Format, Measurements
using Measurements: value, uncertainty
using StatsBase, LinearAlgebra

Expand Down
1 change: 1 addition & 0 deletions src/LegendSpecFits.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ using ArraysOfArrays
using BAT
using Distributions
using FillArrays
using Format
using ForwardDiff
using IntervalSets
using InverseFunctions
Expand Down
8 changes: 4 additions & 4 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,20 @@ end


"""
get_mc_value_shapes(v::NamedTuple, v_err::NamedTuple, n::Int64)
get_mc_value_shapes(v::NamedTuple, v_err::NamedTuple, n::Integer)
Return a `NamedTuple` with the same fields as `v` and `v_err` but with
`Normal` distributions for each field.
"""
function get_mc_value_shapes(v::NamedTuple, v_err::NamedTuple, n::Int64)
function get_mc_value_shapes(v::NamedTuple, v_err::NamedTuple, n::Integer)
vs = BAT.distprod(map(Normal, v, v_err))
NamedTuple.(rand(vs, n))
end

"""
get_mc_value_shapes(v::NamedTuple, v_err::Matrix, n::Union{Int64,Int32})
get_mc_value_shapes(v::NamedTuple, v_err::Matrix, n::Integer)
Generate `n` random samples of fit parameters using their respective best-fit values `v` and covariance matrix `v_err`
"""
function get_mc_value_shapes(v::NamedTuple, v_err::Matrix, n::Union{Int64,Int32})
function get_mc_value_shapes(v::NamedTuple, v_err::Matrix, n::Integer)
if !isposdef(v_err)
v_err = nearestSPD(v_err)
@debug "Covariance matrix not positive definite. Using nearestSPD"
Expand Down

0 comments on commit 1f0c07f

Please sign in to comment.