PlotStatistics.py 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. # -*- coding: utf-8 -*-
  2. """
  3. Created on Wed Jul 24 11:17:18 2019
  4. @author: rgarcia1
  5. """
  6. import deepdish as dd
  7. import numpy as np
  8. import matplotlib.pyplot as plt
  9. import math
  10. def set_box_color(bp, color):
  11. plt.setp(bp['boxes'], color=color)
  12. plt.setp(bp['whiskers'], color=color)
  13. plt.setp(bp['caps'], color=color)
  14. #%% Load Data from 10 probes, one of them is discarded because of conection problems during characterization
  15. plt.close('all')
  16. GmAll, IrmsAll, UrmsAll, Ids = dd.io.load('GmIrmsUrmsIds10Probe_2.h5')
  17. #%%
  18. #plot histogram
  19. Gm = np.array([])
  20. BestProbes = ['B12784O18-T3',] #select 3 best probes for specific analysis
  21. for keyProbe in GmAll.keys():
  22. if keyProbe in BestProbes:
  23. for keyTrt in GmAll[keyProbe].keys():
  24. Gm = np.append(Gm,np.max(GmAll[keyProbe][keyTrt][:-1]))
  25. hist, vect = np.histogram(Gm*1000/0.1, bins=22 , range = (1.3,3.3))
  26. plt.figure(1)
  27. plt.hist(Gm*1000/0.1, bins =22, range = (1.3,3.3), color = 'firebrick', label = '192 g-SGFETs from 3 probes')
  28. xbin = np.linspace(1.2,3.5,100)
  29. Gm = np.sort(Gm)[1:]
  30. plt.plot(xbin, 14*np.exp(-(xbin-np.mean(Gm)*10000)**2/(2*(np.std(Gm)*10000)**2)),'k',label = 'Gaussian, $\mu$ = '+'{} - '.format(round(np.mean(Gm)*10000),1)+'$\sigma$ = '+'{}'.format(round(np.std(Gm)*10000),1) + '[mS/V]')
  31. plt.xlabel('G$_m$ (mS/V)')
  32. plt.ylabel('# counts')
  33. plt.legend()
  34. Urms = np.array([])
  35. for keyProbe in UrmsAll.keys():
  36. for keyTrt in UrmsAll[keyProbe].keys():
  37. if keyProbe in BestProbes:
  38. Urms = np.append(Urms,np.min(UrmsAll[keyProbe][keyTrt][:-1]))
  39. hist, vect = np.histogram(np.log10(Urms*1e6), bins=50 , range = (0,2))
  40. xbin = np.linspace(0,3.5,1000)
  41. plt.figure(2)
  42. plt.hist(np.log10(Urms*1e6), bins =50, range = (0,2),color= 'blue',label = '192 g-SGFETs from 3 probes')
  43. Urms = np.sort(Urms)[:-8]
  44. plt.plot(xbin, 15*np.exp(-(xbin-np.mean(np.log10(Urms*1e6)))**2/(2*(np.std(np.log10(Urms*1e6)))**2)),'k',label = 'Gaussian, $\mu$ = '+'{} - '.format(round(np.mean(Gm)*10000),1)+'$\sigma$ = '+'{}'.format(round(np.std(Gm)*10000),1) + '[mS/V]')
  45. plt.xlabel('log(U$_{gs-rms}$)')
  46. plt.ylabel('# counts')
  47. plt.legend()
  48. #%% plot boxplots
  49. GM = []
  50. for keyProbe in GmAll.keys():
  51. if keyProbe == 'B12142O37-T4': #probe discarded due to wrong characterization
  52. continue
  53. Gm = np.array([])
  54. for keyTrt in GmAll[keyProbe].keys():
  55. Gm = np.append(Gm,np.max(GmAll[keyProbe][keyTrt][:-1]))
  56. Gm = Gm*10000
  57. Gm = np.ndarray.tolist(Gm)
  58. GM.append(Gm)
  59. URMS = []
  60. for keyProbe in UrmsAll.keys():
  61. if keyProbe == 'B12142O37-T4':
  62. continue
  63. Urms = np.array([])
  64. for keyTrt in UrmsAll[keyProbe].keys():
  65. va = np.min(UrmsAll[keyProbe][keyTrt][:-1])
  66. if math.isnan(va):
  67. Urms = 1e-3 #sets Nan to an extremely bad sensitivity
  68. else:
  69. Urms = np.append(Urms,va)
  70. Urms = Urms*1e6
  71. Urms = np.ndarray.tolist(Urms)
  72. URMS.append(Urms)
  73. Fig, ax = plt.subplots()
  74. bpr = ax.boxplot(GM,flierprops={'markeredgecolor': 'firebrick'})
  75. ax.set_ylabel('G$_m$ (mS/V)')
  76. set_box_color(bpr, 'firebrick')
  77. plt.xlabel('Device number')
  78. Fig, ax2 = plt.subplots()
  79. bpr2 = ax2.boxplot(URMS,positions=[2,6,3,5,1,4,7,8,9],flierprops={'markeredgecolor': 'blue'})
  80. set_box_color(bpr2, 'blue')
  81. ax2.set_ylabel('U$_{gs-rms}$ ($\mu$V)')
  82. ax2.set_yscale('log')
  83. plt.xlabel('Device number')