Пример #1
0
i2_ua = np.array(i2_ua)


# First, close any open plots
plt.close('all')

#
#   Now, it's time to tell the story
#   These plots are organized by the topic being investigated
#

#===============================#
#   Generic IV characteristics  #
#===============================#
ax1 = init_fig('Voltage (V)','Current ($\mu$A)')
this = lconfig.dfile(data_dir + filename[22])
i = this.data[:,1]*25.242500 - .15605
v = this.data[:,0]
ax1.plot(v,i,marker='d',markersize=4,mec='k',mew=.5,mfc='w',ls='none',label='5.8mm, .55')
this = lconfig.dfile(data_dir + filename[27])
i = this.data[:,1]*25.242500 - .15605
v = this.data[:,0]
ax1.plot(v,i,marker='o',markersize=4,mec='k',mew=.5,mfc='w',ls='none', label='5.8mm, .80')
this = lconfig.dfile(data_dir + filename[39])
i = this.data[:,1]*25.242500 - .15605
v = this.data[:,0]
ax1.plot(v,i,marker='s',markersize=4,mec='k',mew=.5,mfc='k',ls='none', label='11.7mm, .55')
ax1.legend(loc=0)
ax1.set_xlim([-10,10])
export_file = 'ivchar'
plt.savefig(os.path.join(export_dir,export_file + std_type), dpi=std_dpi)
Пример #2
0
            # look for the positive 0 crossing in voltage
            if I[index]<0. and I[index+1]>=0.:
                Vsample.append(\
                    V[index] - (V[index+1] - V[index])/(I[index+1] - I[index]) * I[index])
                Is = I[index:index+100].tolist()
                Is.sort(reverse=True)
                tsample.append(t[index+50])
                Isample.append(Is[4]) # Reject the 4 largest points
                Tsample.append(np.mean(out['T'][index:index+100]))
                index+=120
            else:
                index += 1

    out['Tsample'] = Tsample
    out['Isample'] = Isample
    out['tsample'] = tsample
    out['Vsample'] = Vsample
    return out
    

datafile = 'data/a4_1.dat'
#datafile = 'data/b1_1.dat'
data = lconfig.dfile(datafile, afun=fsanalysis, afile=None)

plt.close('all')
lplot.set_defaults(screen_dpi=112)

ax = lplot.init_fig('Voltage (V)', 'Current ($\mu$A)', figure_size=(6., 4.5))
index = data.t()>15.
ax.plot(data.analysis['V'][index], data.analysis['I'][index], '.')
Пример #3
0
def fsanalysis(fileobj):
    # First, copy the meta parameters using the default function
    out = lconfig.default_afun(fileobj)
    # Create calibrated data
    V = fileobj.data[:, 0]
    I = fileobj.data[:, 1] * 25.242500 - .15605
    ts = 1. / fileobj.config[0].samplehz
    t = fileobj.t()
    out['V'] = V
    out['I'] = I
    return out


steelfile = 'data/a3_1.dat'
#steelfile = 'data/b2_3.dat'
steel = lconfig.dfile(steelfile, afun=fsanalysis, afile=None)
C = lconfig.collection(afun=fsanalysis, asave=False)
C.add_dir('../experiment2/data/150_1')
cufile = '../experiment2/data/150_1/ivchar20170412170728.dat'
#cufile = '../experiment2/data/150_1/ivchar20170412175533.dat'
cu1 = lconfig.dfile(cufile, afun=fsanalysis, afile=None)
cufile = '../experiment2/data/150_1/ivchar20170412175136.dat'
#cufile = '../experiment2/data/150_1/ivchar20170412171254.dat'
cu2 = lconfig.dfile(cufile, afun=fsanalysis, afile=None)

plt.close('all')
lplot.set_defaults(screen_dpi=112)

ax0 = lplot.init_fig('Voltage (V)', 'Current ($\mu$A)', figure_size=(6., 4.5))
ax0.plot(steel.analysis['V'][17700:349700],
         steel.analysis['I'][17700:349700],
Пример #4
0
    out['Vsample'] = Vsample
    return out


files = ['data/b1_1.dat', 'data/b2_3.dat']
tstart = [24., 24.]
tstop = [344., 600.]
styles = ['o', 's']
LAB = ['20scfh', '25scfh']

plt.close('all')
lplot.set_defaults(screen_dpi=112)

ax0 = lplot.init_fig('Floating Potential (V)',
                     'Saturation Current ($\mu$A)',
                     figure_size=(6., 4.5))

for index in range(len(files)):

    data = lconfig.dfile(files[index], afun=fsanalysis, afile=None)

    t = np.array(data.analysis['tsample'])
    V = np.array(data.analysis['Vsample'])
    I = np.array(data.analysis['Isample'])

    ii = (t > tstart[index]) * (t < tstop[index])

    ax0.plot(V[ii], I[ii], styles[index], mec='k', mfc='w', label=LAB[index])
ax0.legend(loc=0)
ax0.get_figure().savefig('float_sat.png')
Пример #5
0
    # Create calibrated data
    V = fileobj.data[:,0]
    I = fileobj.data[:,1]*25.242500 - .15605
    Vtc1 = smooth(fileobj.data[:,2],200)
    Vtc2 = smooth(fileobj.data[:,3],200)
    Vcj = tc.KmV(21.)
    ts = 1./fileobj.config[0].samplehz
    t = np.arange(0,len(I)*ts,ts)
    out['V'] = V
    out['I'] = I
    out['T1'] = tc.K(Vtc1*1000.+Vcj)
    out['T2'] = tc.K(Vtc2*1000.+Vcj)
    out['t'] = t
    return out
    
dfile = lconfig.dfile('data/drun2055_2.dat', afun=fsanalysis)


f = plt.figure(1)
f.clf()
ax1 = f.add_subplot(211)
ax2 = f.add_subplot(212)

f = plt.figure(2)
f.clf()
ax3 = f.add_subplot(111)

vtest = 0.0
vtol = .02
index = (dfile.analysis['V']<(vtest+vtol)) * (dfile.analysis['V']>(vtest-vtol))
V = dfile.analysis['V'][index]
Пример #6
0
def loadall(WORKING_DIR='/home/chris/experiment/data'):
    """Load all *.dat files containing lconfig data
    records, DATA_RECORD = loadall()
    
records = number of files loaded
DATA_RECORD = dictionary containing the results
"""
    DATA_RECORD = {
        'data': [],
        'path': [],
        'filename': [],
        'fileprefix': [],
        'date': [],
        'points': [],
        'excite': [],
        'V': [],
        'I': [],
        'analysis': []
    }

    meta_params = [
        'standoff_in', 'plate_tpeak_c', 'fuel_scfh', 'oxygen_scfh',
        'flow_scfh', 'ratio_fto'
    ]

    # Add the meta params to the initial data record
    for thismeta in meta_params:
        DATA_RECORD[thismeta] = []

    contents = os.listdir(WORKING_DIR)
    contents.sort()

    records = 0

    for filename in contents:
        thisfile = os.path.join(WORKING_DIR, filename)
        thisfile = os.path.abspath(thisfile)
        # Only analyze *.dat files
        fileprefix, _, temp = filename.partition('.')
        if temp == 'dat':
            records += 1
            DATA_RECORD['analysis'].append({})
            DATA_RECORD['filename'].append(filename)
            DATA_RECORD['path'].append(thisfile)
            # load
            data = lconfig.dfile(thisfile)
            DATA_RECORD['data'].append(data)

            # Strip the date from the file prefix
            # Isolate only characters that are alpha
            temp = ''
            for thischar in fileprefix:
                if thischar.isalpha():
                    temp += thischar
                else:
                    break
            DATA_RECORD['fileprefix'].append(temp)
            # Test starting time
            DATA_RECORD['date'].append(data.start)
            # Pull the aosignal parameter
            DATA_RECORD['excite'].append(data.config[0].aoch[0].signal)
            # Get the calibrated data
            DATA_RECORD['V'].append(data.data[:, 0])
            DATA_RECORD['I'].append(data.data[:, 1] * 25.242500 - .15605)

            # Now read the meta parameters
            for thismeta in meta_params:
                if thismeta in data.config[0].meta:
                    DATA_RECORD[thismeta].append(data.config[0].meta[thismeta])
                else:
                    DATA_RECORD[thismeta].append(None)

            # How many data points were collected?
            DATA_RECORD['points'].append(data.data.shape)
    return DATA_RECORD