Skip to content

Commit

Permalink
added Preferences for switching synapse versions
Browse files Browse the repository at this point in the history
  • Loading branch information
hsseung committed Aug 5, 2024
1 parent 13e0e2b commit de91141
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ MissingsAsFalse = "bd3c0b08-7cce-4d14-b276-b0e6d20a7f61"
NamedArrays = "86f7a689-2022-50b4-a561-43c23ac3c673"
NaturalSort = "c020b1a1-e9b0-503a-9c33-f039bfc54a85"
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
Preferences = "21216c6a-2e73-6563-6e65-726566657250"
PrettyTables = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d"
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
Expand Down
29 changes: 26 additions & 3 deletions src/OpticLobe.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,33 @@ include("cellids.jl")
export ind2id, id2ind

include("celltypes.jl")
export intrinsictypes, boundarytypes, centraltypes, ind2type, visualtypes, alltypes, ind2nt
export intrinsictypes, boundarytypes, centraltypes, ind2type, visualtypes, alltypes, ind2nt, A

include("weightmatrix.jl")
export W, A
using Preferences
function set_synapses(new_synapses::String)
if !(new_synapses in ("Buhmann", "Zetta"))
throw(ArgumentError("Invalid synapses version: \"$(new_synapses)\""))
end

# Set it in our runtime values, as well as saving it to disk at .julia/environments/v1.10/LocalPreferences.toml
@set_preferences!("synapses" => new_synapses)
@info("New version of synapses set; restart your Julia session for this change to take effect!")
end
export set_synapses

const synapses = @load_preference("synapses", "Buhmann")

# choose Buhmann (original) or Zetta synapses
@static if synapses == "Buhmann"
include("weightmatrix.jl")
elseif synapses == "Zetta"
using JLD2, LinearAlgebra
W = load("/Users/sseung/.julia/dev/OpticLobe/data/old/weightmatrix-v783.2.jld2", "WW")
W[diagind(W)] .= 0 # eliminate autapses
else
return nothing
end
export W

include("inoutaverages.jl")
export Wtt, Wct, Wtc, infraction, outfraction, inmean, outmean
Expand Down

0 comments on commit de91141

Please sign in to comment.