-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsaveOutFigs.py
More file actions
66 lines (51 loc) · 2.77 KB
/
Copy pathsaveOutFigs.py
File metadata and controls
66 lines (51 loc) · 2.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#save output figures
import numpy as np
from modules.postAnalysis import printNetVoltages,printLV2Voltages
import os
import pandas as pd
import h5py
endIDX = 100*16#20 per page so this is 16 pages
archivedPath = os.path.join("..","CGresults","fixed_Gsyn","MedwithLV2")
"""
def readDat(f,endIDX):
firstdatasetName = list(f.keys())[0]
number_of_rows = f[firstdatasetName].shape[0]
myiter = f['default'].__iter__()# __iter__ is a method of the dataset subclass that returns an iterator. when called () this is actually a generator,which moves by next()
savedDat = []
#now read in only the data between rows 30 and 40
for i in range(0,number_of_rows):
newDat = next(myiter)
if i < endIDX:
savedDat.append(newDat)
else:
pass
f.close()
return np.array(savedDat)
archivedPath = os.path.join("..","CGresults","fixed_Gsyn","MedwithLV2")
RejectionResults = np.loadtxt(os.path.join(archivedPath,"output","LV2","LV2RejectionResults.txt"))[:,:endIDX]
f = h5py.File(os.path.join(archivedPath,"output","LV2","VsomaControl.h5"), 'r')
Voltages = readDat(f,endIDX)
printLV2Voltages(Voltages.T,RejectionResults,"LV2 Voltages - Control")
f = h5py.File(os.path.join(archivedPath,"output","LV2","VsomaTEA.h5"), 'r')
Voltages = readDat(f,endIDX)
printLV2Voltages(Voltages.T,RejectionResults,"LV2 Voltages - TEA")
#don't forget to uncomment matplotlib.use('Agg') and matplotlib in postAnalysis if printing a large dataset
"""
#print all voltages to a pdf
archivedPath = os.path.join("..","CGresults","fixed_Gsyn","MedwithLV2")
RejectionResults = np.loadtxt(os.path.join(archivedPath,"output","LV2","LV2RejectionResults.txt"))
Voltages = np.array(np.load(os.path.join(archivedPath,"output","LV2","VsomaControl.pkl.npy"))).T
printLV2Voltages(Voltages[:,:endIDX],RejectionResults[:,:endIDX],"LV2 Voltages - Control")
#RejectionResults = np.loadtxt(os.path.join(archivedPath,"LV2","LV2RejectionResults.txt"))
#Voltages = np.array(np.load(os.path.join(archivedPath,"LV2","VsomaTEA.pkl.npy"))).T
#printLV2Voltages(Voltages[:,:endIDX],RejectionResults[:,:endIDX],"LV2 Voltages - TEA")
archivedPath = os.path.join("..","CGresults","fixed_Gsyn","MedwithLV2","output")
#archivedPath = os.path.join("output")
"""
RejectionResults = np.loadtxt(os.path.join(archivedPath,"LV3","LV3RejectionResults.txt"))
Voltages = np.array(pd.read_pickle(os.path.join(archivedPath,"LV3","VSomaControl.pkl"))).T
printNetVoltages(Voltages,RejectionResults,"LV3 Voltages - Control")
"""
RejectionResults = np.loadtxt(os.path.join(archivedPath,"LV3","LV3RejectionResults.txt"))
Voltages = np.array(pd.read_pickle(os.path.join(archivedPath,"LV3","VSomaTEA.pkl"))).T
printNetVoltages(Voltages,RejectionResults,"LV3 Voltages - TEA")