Skip to content

Commit

Permalink
work
Browse files Browse the repository at this point in the history
  • Loading branch information
montyvesselinov committed Jan 24, 2024
1 parent c654bf2 commit e9fd51c
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
32 changes: 31 additions & 1 deletion src/MadsIO.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1768,8 +1768,38 @@ function testlinks()
rm(link)
end

function jld2append(fname, varname, data)
function jldappend(fname::AbstractString, varname::AbstractString, data::Any)
JLD.jldopen(fname, true, true, true, false, true) do file
file[varname] = data
end
end

function jld2append(fname::AbstractString, varname::AbstractString, data::Any)
JLD2.jldopen(fname, "a+") do file
file[varname] = data
end
end

function jld2haskey(fname::AbstractString, varnames...)
flag = true
JLD2.jldopen(fname, "r") do file
for varname in varnames
if !haskey(file, varname)
flag = false
end
end
end
return flag
end

function jldhaskey(fname::AbstractString, varnames...)
flag = true
JLD.jldopen(fname, "r") do file
for varname in varnames
if !haskey(file, varname)
flag = false
end
end
end
return flag
end
4 changes: 2 additions & 2 deletions src/MadsPlot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ function spaghettiplot(madsdata::AbstractDict, dictarray::AbstractDict; seed::In
end
spaghettiplot(madsdata::AbstractDict, Y; kw...)
end
function spaghettiplot(madsdata::AbstractDict, matrix::AbstractMatrix; plotdata::Bool=true, filename::AbstractString="", keyword::AbstractString="", format::AbstractString="", title::AbstractString="", xtitle::AbstractString="", ytitle::AbstractString="", yfit::Bool=false, obs_plot_dots::Bool=true, linewidth::Measures.AbsoluteLength=2Gadfly.pt, pointsize::Measures.AbsoluteLength=4Gadfly.pt, grayscale::Bool=false, alpha::Number=0.3, xmin::Any=nothing, xmax::Any=nothing, ymin::Any=nothing, ymax::Any=nothing, quiet::Bool=!Mads.graphoutput, colors::AbstractVector=["red", "blue", "green", "cyan", "magenta", "yellow"], plot_nontargets::Bool=false, gm::AbstractVector=[])
function spaghettiplot(madsdata::AbstractDict, matrix::AbstractMatrix; plotdata::Bool=true, filename::AbstractString="", keyword::AbstractString="", format::AbstractString="", title::AbstractString="", xtitle::AbstractString="", ytitle::AbstractString="", yfit::Bool=false, obs_plot_dots::Bool=true, linewidth::Measures.AbsoluteLength=2Gadfly.pt, pointsize::Measures.AbsoluteLength=4Gadfly.pt, grayscale::Bool=false, alpha::Number=0.2, alphas::AbstractVector=[alpha], xmin::Any=nothing, xmax::Any=nothing, ymin::Any=nothing, ymax::Any=nothing, quiet::Bool=!Mads.graphoutput, colors::AbstractVector=["red", "blue", "green", "cyan", "magenta", "yellow"], plot_nontargets::Bool=false, gm::AbstractVector=[])
madsinfo("Spaghetti plots for all the selected model parameter (type != null) ...\n")
rootname = getmadsrootname(madsdata)
obskeys = Mads.getobskeys(madsdata)
Expand Down Expand Up @@ -939,7 +939,7 @@ function spaghettiplot(madsdata::AbstractDict, matrix::AbstractMatrix; plotdata:
pl = Gadfly.plot(pa..., Gadfly.layer(Y, x=repeat(t; inner=numberofsamples), y=Gadfly.Col.value(1:numberofsamples...),
color=colindex, group=colindex, Gadfly.Geom.line()),
Gadfly.Scale.color_discrete(colormap),
Gadfly.Theme(key_position=:none, line_width=linewidth, point_size=pointsize, highlight_width=0Gadfly.pt, discrete_highlight_color=c->nothing, alphas=[alpha]),
Gadfly.Theme(key_position=:none, line_width=linewidth, point_size=pointsize, highlight_width=0Gadfly.pt, discrete_highlight_color=c->nothing, alphas=alphas),
Gadfly.Guide.title(title),
Gadfly.Guide.XLabel(xtitle; orientation=:horizontal), Gadfly.Guide.YLabel(ytitle; orientation=:vertical),
gm...)
Expand Down

0 comments on commit e9fd51c

Please sign in to comment.