diff --git a/scripts/compute_all_cdmentropy.m b/scripts/compute_all_cdmentropy.m new file mode 100644 index 0000000..b50ced4 --- /dev/null +++ b/scripts/compute_all_cdmentropy.m @@ -0,0 +1,21 @@ +addpath("~/Documents/CDMentropy/src") +addpath("~/Documents/CDMentropy/lib/PYMentropy/src") +pkg load statistics +pkg load parallel + + +basedir = "../data/exp_pro/matrix_old/joost_long/full/cdmentropy"; +dirs = readdir(basedir)(3:end); +for i = 1:length(dirs) + sdp = fullfile(basedir, dirs(i)){1}; + files = readdir(sdp); + files = files(3:length(files)); + fps = cell(length(files), 1); + for j = 1:length(files) + fps{j} = fullfile(sdp, files(j, 1)); + end + [Hbs, Hvs] = pararrayfun(nproc-1, @compute_cdmentropy, fps); + savepath = fullfile(basedir, strcat(dirs(i), ".mat")){1}; + save(savepath, "files", "Hbs", "Hvs", "-v6") +end + diff --git a/scripts/compute_cdmentropy.m b/scripts/compute_cdmentropy.m new file mode 100644 index 0000000..7b5c16a --- /dev/null +++ b/scripts/compute_cdmentropy.m @@ -0,0 +1,9 @@ +function [Hb, Hv] = parcompute_cdmentropy(filepath) + load(filepath{1,1}{1,1}); + % for some reason cells is a matrix, so have to extract + counts = double(counts); + spike_counts = double(spike_counts); + cells = double(cells(1)); + [Hb, Hv] = computeH_CDM(counts, spike_counts, cells(1)); +end +