PlotBode.py 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. # -*- coding: utf-8 -*-
  2. """
  3. Created on Sun Apr 28 15:50:58 2019
  4. @author: aemdlabs
  5. """
  6. import deepdish as dd
  7. import matplotlib.pyplot as plt
  8. import numpy as np
  9. plt.close('all')
  10. MCSMapI={'SE1':'Ch03',
  11. 'SE2':'Ch05',
  12. 'SE3':'Ch01',
  13. 'SE4':'Ch02',
  14. 'SE5':'Ch22',
  15. 'SE6':'Ch06',
  16. 'SE7':'Ch16',
  17. 'SE8':'Ch37',
  18. 'SE9':'Ch20',
  19. 'SE10':'Ch10',
  20. 'SE11':'Ch24',
  21. 'SE12':'Ch08',
  22. 'SE13':'Ch14',
  23. 'SE14':'Ch04',
  24. 'SE15':'Ch18',
  25. 'SE16':'Ch33',
  26. 'SE17':'Ch34',
  27. 'SE18':'Ch60',
  28. 'SE19':'Ch38',
  29. 'SE20':'Ch64',
  30. 'SE21':'Ch40',
  31. 'SE22':'Ch56',
  32. 'SE23':'Ch42',
  33. 'SE24':'Ch70',
  34. 'SE25':'Ch66',
  35. 'SE26':'Ch65',
  36. 'SE27':'Ch68',
  37. 'SE28':'Ch67',
  38. 'SE29':'Ch55',
  39. 'SE30':'Ch62',
  40. 'SE31':'Ch58',
  41. 'SE32':'Ch69',
  42. 'ME1':'Ch57',
  43. 'ME2':'Ch61',
  44. 'ME3':'Ch53',
  45. 'ME4':'Ch63',
  46. 'ME5':'Ch52',
  47. 'ME6':'Ch41',
  48. 'ME7':'Ch49',
  49. 'ME8':'Ch51',
  50. 'ME9':'Ch46',
  51. 'ME10':'Ch45',
  52. 'ME11':'Ch44',
  53. 'ME12':'Ch39',
  54. 'ME13':'Ch54',
  55. 'ME14':'Ch43',
  56. 'ME15':'Ch50',
  57. 'ME16':'Ch47',
  58. 'ME17':'Ch32',
  59. 'ME18':'Ch27',
  60. 'ME19':'Ch30',
  61. 'ME20':'Ch29',
  62. 'ME21':'Ch28',
  63. 'ME22':'Ch25',
  64. 'ME23':'Ch26',
  65. 'ME24':'Ch07',
  66. 'ME25':'Ch21',
  67. 'ME26':'Ch11',
  68. 'ME27':'Ch17',
  69. 'ME28':'Ch15',
  70. 'ME29':'Ch13',
  71. 'ME30':'Ch31',
  72. 'ME31':'Ch19',
  73. 'ME32':'Ch09'}
  74. #Col, Row
  75. MCSMapFacingDown={'Ch58':(0,1),
  76. 'Ch57':(0,2),
  77. 'Ch56':(0,3),
  78. 'Ch55':(0,4),
  79. 'Ch54':(0,5),
  80. 'Ch53':(0,6),
  81. 'Ch52':(0,7),
  82. 'Ch51':(0,8),
  83. 'Ch50':(0,9),
  84. 'Ch49':(0,10),
  85. 'Ch60':(1,0),
  86. 'Ch61':(1,1),
  87. 'Ch62':(1,2),
  88. 'Ch63':(1,3),
  89. 'Ch64':(1,4),
  90. 'Ch65':(1,5),
  91. 'Ch43':(1,6),
  92. 'Ch44':(1,7),
  93. 'Ch45':(1,8),
  94. 'Ch46':(1,9),
  95. 'Ch47':(1,10),
  96. 'Ch70':(2,0),
  97. 'Ch69':(2,1),
  98. 'Ch68':(2,2),
  99. 'Ch67':(2,3),
  100. 'Ch66':(2,4),
  101. 'Ch42':(2,5),
  102. 'Ch41':(2,6),
  103. 'Ch40':(2,7),
  104. 'Ch39':(2,8),
  105. 'Ch38':(2,9),
  106. 'Ch37':(2,10),
  107. 'Ch01':(3,0),
  108. 'Ch02':(3,1),
  109. 'Ch03':(3,2),
  110. 'Ch04':(3,3),
  111. 'Ch05':(3,4),
  112. 'Ch06':(3,5),
  113. 'Ch30':(3,6),
  114. 'Ch31':(3,7),
  115. 'Ch32':(3,8),
  116. 'Ch33':(3,9),
  117. 'Ch34':(3,10),
  118. 'Ch11':(4,0),
  119. 'Ch10':(4,1),
  120. 'Ch09':(4,2),
  121. 'Ch08':(4,3),
  122. 'Ch07':(4,4),
  123. 'Ch29':(4,5),
  124. 'Ch28':(4,6),
  125. 'Ch27':(4,7),
  126. 'Ch26':(4,8),
  127. 'Ch25':(4,9),
  128. 'Ch24':(4,10),
  129. 'Ch12':None,
  130. 'Ch59':None,
  131. 'Ch13':(5,1),
  132. 'Ch14':(5,2),
  133. 'Ch15':(5,3),
  134. 'Ch16':(5,4),
  135. 'Ch17':(5,5),
  136. 'Ch18':(5,6),
  137. 'Ch19':(5,7),
  138. 'Ch20':(5,8),
  139. 'Ch21':(5,9),
  140. 'Ch22':(5,10)}
  141. Directory = '../Analyzed data/2019-08-01T15-46-48/'
  142. Fsigs,GmDict = dd.io.load(Directory+'GmChDict')
  143. for key in GmDict.keys():
  144. plt.figure(1)
  145. plt.loglog(Fsigs[:-2], GmDict[key])
  146. plt.xlabel('Frequency (Hz)')
  147. plt.ylabel('|Gm Vsig| (A)')
  148. plt.figure()
  149. A=np.log10(np.ones((11,6))*5e-14)
  150. for Trt in GmDict.keys():
  151. if Trt in ['M1','M2','S1','S2']:
  152. continue
  153. ch = MCSMapI[Trt]
  154. # if Trt in DCch:
  155. # continue
  156. A[MCSMapFacingDown[ch][1],MCSMapFacingDown[ch][0]] =np.log10(abs(GmDict[Trt][0]))
  157. plt.imshow(A, interpolation='nearest', vmin=-8.5, vmax=-7.5)
  158. plt.grid(True)
  159. cbar=plt.colorbar()
  160. plt.xlabel('column',fontsize=12)
  161. plt.ylabel('row',fontsize=12)
  162. cbar.set_label('I$_{ds-rms}$ (@1Hz)', rotation=270, labelpad=15,fontsize=13)
  163. plt.title('Response to bipolar current stimulation')