Error Messages

I am trying to run the trained simulation from the following neuroscience paper (Distributing task-related neural activity across a cortical network through task-independent connections and my script currently looks like this

using JLD
include("load_files.jl")
include("runtest.jl")
p, w0Index, w0Weights, nc0, wpIndexIn, wpIndexOut, wpIndexConvert, wpWeightIn, wpWeightOut, ncpIn, ncpOut, stim, almOrd, matchedCells, ffwdRate, wpWeightFfwd = load_files("/Users/luol3/Downloads/distributedActivity-main/data_network/", "right")
xtotal, xebal, xibal, xplastic, times, ns, vtotal_exccell, vtotal_inhcell, vebal_exccell, vibal_exccell, vebal_inhcell, vibal_inhcell, vplastic_exccell, vplastic_inhcell = runtest(p,w0Index,w0Weights,nc0,wpIndexOut,wpWeightOut,ncpOut,stim,ffwdRate,wpWeightFfwd)

Both loadfiles and runtest are from the following github repository: GitHub - SpikingNetwork/distributedActivity.
When I run loadfiles, I get the following warning message

Warning: type paramType not present in workspace; reconstructing
└ @ JLD ~/.julia/packages/JLD/S6t6A/src/jld_types.jl:697

and when the script runs the function runtest, I get the following error message

33ERROR: LoadError: MethodError: no method matching isless(::Float64, ::Matrix{Float64})
Closest candidates are:
  isless(::T, ::T) where T<:Union{Float16, Float32, Float64} at float.jl:424
  isless(::Real, ::DualNumbers.Dual{<:Real}) at ~/.julia/packages/DualNumbers/5knFX/src/dual.jl:182
  isless(::AbstractFloat, ::AbstractFloat) at operators.jl:184
  ...
Stacktrace:
 [1] <(x::Float64, y::Matrix{Float64})
   @ Base ./operators.jl:356
 [2] runtest(p::JLD.var"##paramType#312", w0Index::Matrix{Int64}, w0Weights::Matrix{Float64}, nc0::Vector{Int64}, wpIndexOut::Matrix{Float64}, wpWeightOut::Matrix{Float64}, ncpOut::Vector{Int64}, stim::Matrix{Float64}, ffwdRate::Vector{Matrix{Float64}}, wpWeightFfwd::Vector{Matrix{Float64}})
   @ Main ~/Downloads/distributedActivity-main/runtest.jl:178
 [3] top-level scope
   @ ~/Downloads/distributedActivity-main/trainedrightactivity.jl:5
 [4] include(fname::String)
   @ Base.MainInclude ./client.jl:476
 [5] top-level scope
   @ REPL[2]:1
in expression starting at /Users/luol3/Downloads/distributedActivity-main/trainedrightactivity.jl:5

Does anyone have any ideas on what I should do? I have never coded in Julia before.

Hi there!

It looks like that git repository did not include the environment files (usual called Project.toml and/or Manifest.toml). These files specify what packages to use for a given project. You can read more about environment in the Julia manual here:
https://docs.julialang.org/en/v1/manual/code-loading/#Environments

Ideally, the authors should include these files as part of the software repository, as they help with making the analysis more reproducible.

I took a look at the main.jl file to try and figure out the dependencies. It looks like the dependencies (packages not included in Julia’s standard library) are: Distributions, JLD, PyCall, PyPlot, and DelimitedFiles. You can set up an environment with these packages by running the following code in Julia (assuming you are working in the top-level directory of the git repository):

using Pkg
Pkg.activate(".")
Pkg.add(["Distributions", "JLD", "PyCall", "PyPlot", "DelimitedFiles"])

Then, when you want to run the code you’re using, start with the following:

using Pkg
Pkg.activate(".")

That will tell Julia to use the project environment that we just defined.

4 Likes

I modified my script to say this

using JLD
using Distributions
using PyCall
using PyPlot
using DelimitedFiles
using LinearAlgebra
using Random
using SparseArrays
include("load_files.jl")
include("runtest.jl")
p, w0Index, w0Weights, nc0, wpIndexIn, wpIndexOut, wpIndexConvert, wpWeightIn, wpWeightOut, ncpIn, ncpOut, stim, almOrd, matchedCells, ffwdRate, wpWeightFfwd = load_files("/Users/luol3/Downloads/distributedActivity-main/data_network/", "right")
xtotal, xebal, xibal, xplastic, times, ns, vtotal_exccell, vtotal_inhcell, vebal_exccell, vibal_exccell, vebal_inhcell, vibal_inhcell, vplastic_exccell, vplastic_inhcell = runtest(p,w0Index,w0Weights,nc0,wpIndexOut,wpWeightOut,ncpOut,stim,ffwdRate,wpWeightFfwd)

because there were a few more dependencies in the main file, but an error message showed up again.

 Warning: type paramType not present in workspace; reconstructing
└ @ JLD ~/.julia/packages/JLD/S6t6A/src/jld_types.jl:697
33ERROR: LoadError: MethodError: no method matching isless(::Float64, ::Matrix{Float64})
Closest candidates are:
  isless(::T, ::T) where T<:Union{Float16, Float32, Float64} at float.jl:424
  isless(::Real, ::DualNumbers.Dual{<:Real}) at ~/.julia/packages/DualNumbers/5knFX/src/dual.jl:182
  isless(::Real, ::ColorTypes.AbstractGray) at ~/.julia/packages/ColorTypes/1dGw6/src/operations.jl:39
  ...
Stacktrace:
 [1] <(x::Float64, y::Matrix{Float64})
   @ Base ./operators.jl:356
 [2] runtest(p::JLD.var"##paramType#312", w0Index::Matrix{Int64}, w0Weights::Matrix{Float64}, nc0::Vector{Int64}, wpIndexOut::Matrix{Float64}, wpWeightOut::Matrix{Float64}, ncpOut::Vector{Int64}, stim::Matrix{Float64}, ffwdRate::Vector{Matrix{Float64}}, wpWeightFfwd::Vector{Matrix{Float64}})
   @ Main ~/Downloads/distributedActivity-main/runtest.jl:178
 [3] top-level scope
   @ ~/Downloads/distributedActivity-main/trainedrightactivity.jl:12
 [4] include(fname::String)
   @ Base.MainInclude ./client.jl:476
 [5] top-level scope
   @ REPL[2]:1
in expression starting at /Users/luol3/Downloads/distributedActivity-main/trainedrightactivity.jl:12

I think this is the exact same error message.

It says no method matching isless(::Float64, ::Matrix{Float64}), which is called from < on line ~/Downloads/distributedActivity-main/runtest.jl:178

i.e. you are trying to compare number < matrix, and of course it is failing because there is no such comparison operation in Julia.

That line is if rndFfwd[ci] < ffwdRate[tidx,ci]/(1000/p.dt), where ffwdRate is one of the parameters you are passing to runtest. So it sounds like ffwdRate[tidx,ci] is a matrix when it is supposed to be a number?

Indeed the callback says ffwdRate::Vector{Matrix{Float64}}, i.e. ffwdRate is an array of matrices, which doesn’t make sense if it is used as ffwdRate[tidx,ci]. Maybe you’re supposed to be passing one of the matrices in ffwdRate, e.g. ffwdRate[1] or something? (Similarly for wpWeightFfwd.)

2 Likes

ffwdRate and wpWeightFfwd, when I load them in individually, are dictionary files of the form

Dict{String, Any} with 1 entry

but I don’t know what the keys are for those files or where to find them.

Edit: I found the keys function and got my script to work.

1 Like