Skip to content

Instantly share code, notes, and snippets.

@zenna
Created August 10, 2019 03:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zenna/eb068f5d0e11d4bc1886f54421e523ac to your computer and use it in GitHub Desktop.
Save zenna/eb068f5d0e11d4bc1886f54421e523ac to your computer and use it in GitHub Desktop.
using Omega
# Add uncertainty to this if you want
region_size = 30_000
# The number of groups
ngroups = uniform(1:region_size)
# Produced random Boolean correlation matrix
function correlation_model(rng, nprobes = 10)
# Sample ids without replacement
neuron_ids = Int[]
while length(neuron_ids) < nprobes
id = uniform(rng, 1:region_size)
if id ∉ neuron_ids
push!(neuron_ids, id)
end
end
# Split the ids [1, 2, 3] into groups: [[1,2], ]
region_id(i) = Int(floor(nprobes*i/region_size))
issamegroup(i, j) = region_id(i) == region_id(j)
correlated = [issamegroup(i,j) for i in neuron_ids, j in neuron_ids]
end
# THis is just omega stuff to turn function into random variable
correlation_model = ciid(correlation_model)
rand(correlation_model)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment