ax.grid(True) if (chnno == 0 or chnno == 4 or chnno == 8 or chnno == 12): ax.set_ylabel("Normalized counts", size=14) if (chnno == 12 or chnno == 13 or chnno == 14 or chnno == 15): ax.set_xlabel("ADC output / LSB", size=14) ax.legend(loc=3, fontsize='x-small') fig.suptitle("RMS Noise: Histogram with " + "%d samples" % N, size=18) fig.tight_layout() fig.subplots_adjust(top=0.92) plt.savefig(rawdir + "Hist_NoiseTest_%d_%s" % (baseline, env) + ".png") #plt.close() bad_rms = [x for x in rms if (x > 0.8 or x < 0.3)] if not (bad_rms == []): for i in range(len(bad_rms)): cq.err_log("Channel %d RMS Noise (%f) is out of expected range \n" % (i, bad_rms[i])) cq.status = "FAIL" fig = plt.figure(figsize=(16, 9)) fig.suptitle("RMS Noise: All Channels", size=18) plt.plot(rms, marker='o') plt.ylim(0.2, 1.2) plt.xticks(np.arange(0, 16, 1)) plt.xlabel('Channel', size=16) plt.ylabel('RMS Noise', size=16) plt.savefig(rawdir + "RMS_NoiseTest_%d_%s" % (baseline, env) + ".png") plt.show() plt.close()
#Normalized transition voltages Vj = -np.cos(np.pi * sum_Hk / Ntot) end = len(Vj) #Linearized histogram hlin = Vj[1:] - Vj[:-1] #Arbitrary bit truncation trunc = trunc hlin_trunc = hlin[trunc:-trunc] #LSB calculation as average code width lsb = np.sum(hlin_trunc) / len(hlin_trunc) #DNL: concatenate a 0 at the beginning dnl = np.insert(hlin_trunc / lsb - 1, 0, 0.) #Misscodes detection misscodes = np.where((dnl > 1) | (dnl < -1)) if (np.array(misscodes).size > 0): cq.err_log('Number of misscodes found = %d' % np.array(misscodes).size) cq.status = "FAIL" #INL: cumulative sum of DNL inl = np.cumsum(dnl) fig = plt.figure(figsize=(10, 8)) ax1 = plt.subplot2grid((2, 2), (0, 0), colspan=2, rowspan=1) ax1.x = np.arange(first_bin + trunc, last_bin - trunc + 1) ax1.plot(ax1.x, dnl) ax1.set_xlim([0, 4095]) ax1.set_ylim([-0.8, 0.8]) ax1.set_title('%s1 Environment. %s2 References' % (env, refs)) ax1.set_ylabel('DNL [LSB]') ax1.annotate( ' max DNL = %0.2f \n min DNL = %0.2f ' % (np.around(max(dnl), decimals=2), np.around(min(dnl), decimals=2)),