-
Notifications
You must be signed in to change notification settings - Fork 1
/
optical_traces.py
93 lines (70 loc) · 3.04 KB
/
optical_traces.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 20 10:08:22 2017
@author: lab
"""
import scipy.io as spio
import matplotlib.pyplot as plt
import scipy.signal as sig
### TRACES
ca_trace_preload = spio.loadmat('/home/lab/Documents/OpticalMapping/Examples/20170615-rata-08-ca.mat', squeeze_me=True)
vm_trace_preload = spio.loadmat('/home/lab/Documents/OpticalMapping/Examples/20170615-rata-08-vm.mat', squeeze_me=True)
ca_trace=ca_trace_preload['calcium']
vm_trace=vm_trace_preload['voltage']
ca_trace_smooth=sig.savgol_filter(ca_trace,5,3)
vm_trace_smooth=sig.savgol_filter(vm_trace,7,3)
plt.plot(vm_trace_smooth,color='orange',linewidth=2)
ax=plt.gca()
plt.plot(ca_trace_smooth+0.2,color='r',linewidth=2)
ax.tick_params(axis='x', which='both',bottom='on',top='off')
plt.xlim(xmin=350,xmax=1200)
plt.ylim(ymin=-0.4,ymax=0.8)
ax.spines['right'].set_visible(False)
ax.spines['top'].set_visible(False)
plt.ylabel('Fluorescence',fontsize=16)
plt.xlabel('Time (msec)',fontsize=16)
plt.plot(vm_trace_smooth,color='orange',linewidth=2)
ax=plt.gca()
plt.plot(ca_trace_smooth+0.2,color='r',linewidth=2)
ax.tick_params(axis='x', which='both',bottom='on',top='off')
ax.tick_params(axis='y', which='both',right='off',left='on')
plt.xlim(xmin=400,xmax=440)
plt.ylim(ymin=-0.4,ymax=0.8)
ax.spines['right'].set_visible(False)
ax.spines['top'].set_visible(False)
plt.ylabel('Fluorescence',fontsize=16)
plt.xlabel('Time (msec)',fontsize=16)
#plt.savefig('ca_vm_trace_zoom.svg')
#
ca_trace_preload = spio.loadmat('/home/lab/Documents/OpticalMapping/Examples/20171017-rata-16-ca-ventricle.mat', squeeze_me=True)
vm_trace_preload = spio.loadmat('/home/lab/Documents/OpticalMapping/Examples/20171017-rata-16-vm-ventricle.mat', squeeze_me=True)
ca_trace=ca_trace_preload['calcium']
vm_trace=vm_trace_preload['voltage']
ca_trace_smooth=sig.savgol_filter(ca_trace,5,3)
vm_trace_smooth=sig.savgol_filter(vm_trace,31,3)
plt.plot(vm_trace_smooth*2,color='orange',linewidth=2)
ax=plt.gca()
plt.plot(ca_trace_smooth+1,color='r',linewidth=2)
ax.tick_params(axis='x', which='both',bottom='on',top='off')
plt.xlim(xmin=350,xmax=1200)
plt.ylim(ymin=1,ymax=2)
ax.spines['right'].set_visible(False)
ax.spines['top'].set_visible(False)
plt.ylabel('Fluorescence',fontsize=16)
plt.xlabel('Time (msec)',fontsize=16)
ca_trace_preload = spio.loadmat('/home/lab/Documents/OpticalMapping/Examples/20171017-rata-16-ca-atrium.mat', squeeze_me=True)
vm_trace_preload = spio.loadmat('/home/lab/Documents/OpticalMapping/Examples/20171017-rata-16-vm-ventricle.mat', squeeze_me=True)
ca_trace=ca_trace_preload['calcium']
vm_trace=vm_trace_preload['voltage']
ca_trace_smooth=sig.savgol_filter(ca_trace,5,3)
vm_trace_smooth=sig.savgol_filter(vm_trace,31,3)
plt.plot(vm_trace_smooth*2,color='orange',linewidth=2)
ax=plt.gca()
plt.plot(ca_trace_smooth+1.1,color='r',linewidth=2)
ax.tick_params(axis='x', which='both',bottom='on',top='off')
plt.xlim(xmin=350,xmax=1200)
plt.ylim(ymin=1,ymax=2)
ax.spines['right'].set_visible(False)
ax.spines['top'].set_visible(False)
plt.ylabel('Fluorescence',fontsize=16)
plt.xlabel('Time (msec)',fontsize=16)