reading of chirp times
This commit is contained in:
parent
c6b4869b01
commit
258b3074b8
@ -31,8 +31,31 @@ def load_chirp_spikes(dataset):
|
||||
return spikes
|
||||
|
||||
|
||||
def load_chirp_times(dataset):
|
||||
spikes_file = os.path.join(dataset, "chirpss.dat")
|
||||
if not os.path.exists(spikes_file):
|
||||
print("found no chirpss.dat!")
|
||||
return {}
|
||||
with open(spikes_file, 'r') as f:
|
||||
lines = f.readlines()
|
||||
chirp_times = {}
|
||||
for l in lines:
|
||||
l = l.strip()
|
||||
if "index" in l and "chirp" not in l:
|
||||
index = int(l.split(":")[-1])
|
||||
if "deltaf" in l and "true" not in l:
|
||||
df = l.split(":")[-1]
|
||||
if "contrast" in l and "true" not in l:
|
||||
contrast = l.split(":")[-1]
|
||||
if "#Key" in l:
|
||||
chirp_times[(index, df, contrast)] = []
|
||||
if len(l.strip()) != 0 and "#" not in l:
|
||||
chirp_times[(index, df, contrast)].append(float(l.split()[1]))
|
||||
return chirp_times
|
||||
|
||||
if __name__ == "__main__":
|
||||
data_dir = "../data"
|
||||
dataset = "2018-11-09-ad-invivo-1"
|
||||
spikes = load_chirp_spikes(os.path.join(data_dir, dataset))
|
||||
|
||||
chirp_times = load_chirp_times(os.path.join(data_dir, dataset))
|
||||
embed()
|
||||
|
Loading…
Reference in New Issue
Block a user