lu-group/sbinn

Errors when running practical_identifiability.jl

Closed this issue · 4 comments

I tried running the practical_identifiability.jl file. I get this error:

┌ Warning: Assignment to `F` in soft scope is ambiguous because a global variable by the same name exists: `F` will be treated as a new local. Disambiguate by using `local F` to suppress this warning or `global F` to assign to the existing global variable.
└ @ ~/work/practical_identifiability.jl:89
ERROR: LoadError: UndefVarError: F not defined
Stacktrace:
 [1] top-level scope
   @ ~/work/practical_identifiability.jl:89
in expression starting at /home/jovyan/work/practical_identifiability.jl:84

I tried adding global in front of F on line 89, as suggested. I then get this error:

# julia practical_identifiability.jl
ERROR: LoadError: KeyError: key :tickfont_pointsize not found
Stacktrace:
  [1] getindex(h::Dict{Symbol, Any}, key::Symbol)
    @ Base ./dict.jl:481
  [2] default(k::Symbol)
    @ Plots ~/.julia/packages/Plots/tXtrW/src/args.jl:1083
  [3] warn_on_unsupported_args(pkg::Plots.GRBackend, plotattributes::RecipesPipeline.DefaultsDict)
    @ Plots ~/.julia/packages/Plots/tXtrW/src/args.jl:1616
  [4] _add_the_series(plt::Plots.Plot{Plots.GRBackend}, sp::Plots.Subplot{Plots.GRBackend}, plotattributes::RecipesPipeline.DefaultsDict)
    @ Plots ~/.julia/packages/Plots/tXtrW/src/pipeline.jl:413
  [5] add_series!(plt::Plots.Plot{Plots.GRBackend}, plotattributes::RecipesPipeline.DefaultsDict)
    @ Plots ~/.julia/packages/Plots/tXtrW/src/pipeline.jl:343
  [6] _process_seriesrecipe(plt::Any, plotattributes::Any)
    @ RecipesPipeline ~/.julia/packages/RecipesPipeline/F2mWY/src/series_recipe.jl:46
  [7] _process_seriesrecipes!(plt::Any, kw_list::Any)
    @ RecipesPipeline ~/.julia/packages/RecipesPipeline/F2mWY/src/series_recipe.jl:27
  [8] recipe_pipeline!(plt::Any, plotattributes::Any, args::Any)
    @ RecipesPipeline ~/.julia/packages/RecipesPipeline/F2mWY/src/RecipesPipeline.jl:97
  [9] _plot!(plt::Plots.Plot, plotattributes::Any, args::Any)
    @ Plots ~/.julia/packages/Plots/tXtrW/src/plot.jl:208
 [10] #plot#135
    @ ~/.julia/packages/Plots/tXtrW/src/plot.jl:91 [inlined]
 [11] heatmap(args::Any; kw::Base.Pairs{Symbol, V, Tuple{Vararg{Symbol, N}}, NamedTuple{names, T}} where {V, N, names, T<:Tuple{Vararg{Any, N}}})
    @ Plots ~/.julia/packages/RecipesBase/qpxEX/src/RecipesBase.jl:410
 [12] top-level scope
    @ ~/work/practical_identifiability.jl:95
in expression starting at /home/jovyan/work/practical_identifiability.jl:95

I've tried Googling around a bit, but I couldn't find anything with a similar issue.
I'm running the file through docker version 4.5.1, with julia v1.7.0. Running it on Windows 10 with julia v1.7.2 produced the same errors.

Any help would be appreciated.

The issue is within julia. When a variable is defined and then later used in the loop, it will use a local variable inside the loop. There are a few workarounds. One is running the code in blocks. Another is wrapping it inside of a function. The last solution is defining F within the loop as a global variable. The code has been updated to include the global variable solution. It should work now.

That solved the first error, but I still get the second error when I try to plot the heatmap on line 92.

The lines xtickfont = font(14, "Times") and ytickfont = font(14, "Times") are causing this error. This has an effect on both plots. The code was originally run in julia 1.6.3 and worked when published, but I am getting the same error as you when I updated to 1.7.2. It is possible the error is in julia and will either be fixed, or there is a new format to use that I am as of yet unaware of. I am unable to find why the code will not work on the new version of julia, but after removing these pieces of the code it should plot for you. Another solution is to save the R matrix and the eigenvalues to another file type, such as .csv, and plot them elsewhere such as in Matlab.

Ah, that worked. Thanks a lot!