add sorting for vector strength and burstiness

This commit is contained in:
a.ott 2020-07-09 13:59:46 +02:00
parent fc9065e31a
commit bf8634a247

View File

@ -5,6 +5,7 @@ import numpy as np
import os
import matplotlib.pyplot as plt
import pyrelacs.DataLoader as Dl
from Baseline import BaselineCellData
data_save_path = "test_routines/test_files/"
read = False
@ -12,7 +13,47 @@ read = False
def main():
# test_kraken_files()
test_for_species()
# test_for_species()
test_for_vector_strength()
def test_for_vector_strength():
directory = "invivo_data/"
bursty = []
p_units = []
no_vs = []
for cell in os.listdir(directory):
if "thresh" in cell:
continue
cell_path = os.path.join(directory, cell)
print(cell_path)
cell_data = CellData(cell_path)
base = BaselineCellData(cell_data)
if base.get_vector_strength() < 0.5:
no_vs.append(cell_path)
# print(cell_path, "->", "data/invivo_no_vs/" + cell)
os.rename(cell_path, "data/invivo_no_vs/" + cell)
continue
# vs > 0.5
if base.get_burstiness() > 0.2:
bursty.append(cell_path)
# print(cell_path, "->", "data/invivo_bursty/" + cell)
os.rename(cell_path, "data/invivo_bursty/" + cell)
continue
# vs > 0.5 and bursty == 0
p_units.append(cell_path)
# print(cell_path, "->", "data/invivo/" + cell)
os.rename(cell_path, "data/invivo/" + cell)
print("done")
print("bursty:", len(bursty), bursty)
print("no vs:", len(no_vs), no_vs)
print("p-units:", len(p_units), p_units)
def test_for_species():