Пример #1
0
    ax2.set_ylabel('INL [LSB]')
    ax2.annotate(' max INL = %0.2f \n min INL = %0.2f ' %(max_inl, min_inl), \
                 xy=(0.65,0.7),xycoords='axes fraction', textcoords='offset points', size=22, bbox=dict(boxstyle="round", fc=(1.0, 1.0, 1.0), ec="none"))
    
    plt.xlabel('ADC Code')
    
    plt.tight_layout()
    figure_name =  lin_dir + "DNL_INL_%s_%s_ch%d"%(env,refs,chnno) + ".png" 
    print (figure_name)
    plt.savefig(figure_name)
    plt.close()   


#Write misscodes in text log
if(misscodes > 0):
    cq.pass_log('WARNING: Number of misscodes found = %d' %misscodes)    

#Save DNLs and INLs to characterization table
if(refs == "BJT"):
    file_table = rawdir + "Channel_Characterization_BJT_ADC0.csv"
    dnl_adc0 = dnl_all[0:8]
    dnl_adc0.insert(0,"Worst DNL (%s Ms/s)"%adc_sample_rate)      
    inl_adc0 = inl_all[0:8]
    inl_adc0.insert(0,"Worst INL (%s Ms/s)"%adc_sample_rate)     
    with open(file_table, 'a', newline='') as csvfile: 
        csvwriter = csv.writer(csvfile) 
        csvwriter.writerow(dnl_adc0)    
        csvwriter.writerow(inl_adc0) 
    csvfile.close()
    
    file_table = rawdir + "Channel_Characterization_BJT_ADC1.csv"
Пример #2
0
    if (chnno == 12 or chnno == 13 or chnno == 14 or chnno == 15):
        ax.set_xlabel("ADC Output / LSB", size=14)
    ax.legend(loc="lower center", fontsize='large')

fig.suptitle("RMS Noise: Histogram with " + "%d samples" % N, size=18)
fig.tight_layout()
fig.subplots_adjust(top=0.94)
plt.savefig(noise_dir + "Hist_NoiseTest_%s_%s_%s" % (env, refs, baseline) +
            ".png")
plt.close()

bad_rms = [x for x in rms if (x > 1.5 or x < 0.1)]
if not (bad_rms == []):
    for i in range(len(bad_rms)):
        cq.pass_log(
            "WARNING: Channel %d RMS Noise (%f) is out of expected range \n" %
            (i, bad_rms[i]))

fig = plt.figure(figsize=(16, 9))
plt.title("RMS Noise: All Channels", size=22)
plt.plot(rms, marker='o')

plt.ylim(0.2, 1.2)
plt.yticks(size=18)
plt.xticks(np.arange(0, 16, 1), size=18)
plt.xlabel('Channel', size=18)
plt.ylabel('RMS Noise', size=18)
plt.savefig(noise_dir + "RMS_NoiseTest_%s_%s_%s" % (env, refs, baseline) +
            ".png")
plt.close()
Пример #3
0
        signal_pwr = signal_pwr + p[mx + k] + p[mx - k]
        p_aux[mx + k] = noise
        p_aux[mx - k] = noise

    ##### Extract parameters of interest #####
    NAD = np.sum(p) - signal_pwr
    SINAD = 10 * np.log10(signal_pwr / NAD)
    ENOB = (SINAD - 1.76 + 20 * np.log10(Vfullscale / Vinput)) / 6.02
    print(SINAD, ENOB, NAD, 20 * np.log10(Vfullscale / Vinput), Vfullscale,
          Vinput)

    fundamental = max(p)
    SFDR = 10 * np.log10(fundamental / max(p_aux))

    if (ENOB < 8):
        cq.pass_log("WARNING: Channel %d ENOB = %0.2f bits \n" % (chnno, ENOB))

    enob_all.append(ENOB)

    ##### Plot normalized power spectral density in dBFS #####
    fig = plt.figure(figsize=(10, 8))
    psd = psd[trunc:Ntot - trunc]
    psd_dbfs = psd - max(psd) - 20 * np.log10(Vfullscale / Vinput)
    points_dbfs = np.linspace(0, fs / 2, len(psd_dbfs))
    plt.plot(points_dbfs, psd_dbfs)
    plt.title('%s Environment. %s Reference. Channel %d' % (env, refs, chnno))
    plt.xlabel('Frequency [kHz]')
    plt.ylabel('Amplitude [dBFS]')
    plt.annotate('SFDR = %0.2f dB \nSINAD = %0.2f dB \nENOB = %0.2f bits' %
                 (np.around(SFDR, decimals=2), np.around(
                     SINAD, decimals=2), np.around(ENOB, decimals=2)),