From bf8634a247a074aa9a897c566326e00d881d0b0c Mon Sep 17 00:00:00 2001 From: "a.ott" Date: Thu, 9 Jul 2020 13:59:46 +0200 Subject: [PATCH] add sorting for vector strength and burstiness --- test_for_cells.py | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/test_for_cells.py b/test_for_cells.py index ca8c462..6feb68d 100644 --- a/test_for_cells.py +++ b/test_for_cells.py @@ -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():