-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTakeDerivatives.py
66 lines (56 loc) · 1.63 KB
/
TakeDerivatives.py
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
# Script to look at derivative of one channel
import UsefulFunctions as uf
import numpy as np
import scipy
import scipy.signal as sig
import os
from scipy import io
from scipy import signal
from PyQt5 import QtGui, QtWidgets
import matplotlib.pyplot as plt
from numpy import linalg as lin
import pyqtgraph as pg
import matplotlib.pyplot as plt
import matplotlib
from matplotlib.backends.backend_pdf import PdfPages
filetoload='/Volumes/backup/2016/Michael/Axopatch/21112016/17B_10mMCis100mMtransKCl_80mer.dat'
PartToConsider=np.array([21.542, 21.566])
out = uf.ImportAxopatchData(filetoload)
partinsamples=np.int64(np.round(out['samplerate']*PartToConsider))
i1part=out['i1'][partinsamples[0]:partinsamples[1]]
i2part=out['i2'][partinsamples[0]:partinsamples[1]]
t=self.t[partinsamples[0]:partinsamples[1]]
plt.figure(1)
plt.subplot(2, 1, 1)
plt.plot(t, i1part, 'b')
plt.title('i1 vs. i2')
plt.ylabel('Ionic Current [A]')
ax = plt.gca()
ax.set_xticklabels([])
plt.subplot(2, 1, 2)
plt.plot(t, i2part, 'r')
plt.xlabel('time (s)')
plt.ylabel('Transverse Current [A]')
plt.figure(2)
plt.subplot(2, 1, 1)
plt.plot(t, i1part, 'b')
plt.title('i1 vs. its derivative')
plt.ylabel('Ionic Current [A]')
ax = plt.gca()
ax.set_xticklabels([])
plt.subplot(2, 1, 2)
plt.plot(t[:-1], np.diff(i1part), 'y')
plt.xlabel('time (s)')
plt.ylabel('d(Ionic Current [A])/dt')
plt.figure(3)
plt.subplot(2, 1, 1)
plt.plot(t, i2part, 'r')
plt.title('i2 vs. its derivative')
plt.ylabel('Transverse Current [A]')
ax = plt.gca()
ax.set_xticklabels([])
plt.subplot(2, 1, 2)
plt.plot(t[:-1], np.diff(i2part), 'y')
plt.xlabel('time (s)')
plt.ylabel('d(Transverse Current [A])/dt')
plt.show()