Example #1
0
def SHINYload(hkefname, calfname):
    """Load a SHINY data file using the standard recipe."""
    cal = loadtxt(calfname)
    calTs, calRs = cal.T
    RofT = interp1d(calTs, calRs, bounds_error=False, fill_value=-1.)
    calRs = calRs[::-1]
    calTs = calTs[::-1]
    TofR = interp1d(calRs, calTs, bounds_error=False, fill_value=-1.)

    f = BinaryFile(hkefname)

    # Thermometer data
    dataT = f.get_data('SHINY_T4 (5-TRead_Standard): Demod')
    dataT = dataT[..., 0]
    Ts = TofR(dataT)

    # Side 1 resistances
    dataR1 = f.get_data('SHINY_T3 (8-TRead_LR): Demod')
    dataR1 = dataR1.T

    # Side 2 resistances
    dataR2 = f.get_data('SHINY_T1 (4-TRead_LR): Demod')
    dataR2 = dataR2.T

    # Transition temperatures (midpoint method)
    Tcs1 = array([find_mid_temp(rs, Ts) for rs in dataR1])
    Tcs2 = array([find_mid_temp(rs, Ts) for rs in dataR2])

    # Excitation currents
    IsT = f.get_data('SHINY_T4 (5-TRead_Standard): ADac')[0]

    Is1 = f.get_data('SHINY_T3 (8-TRead_LR): ADac')
    Is1 = Is1.T

    Is2 = f.get_data('SHINY_T1 (4-TRead_LR): ADac')
    Is2 = Is2.T

    # Collect data into dictionary
    retdict = {}

    retdict['file'] = f
    #    retdict['dataT'] = dataT
    retdict['Temperatures'] = dataT
    #    retdict['dataR1'] = dataR1
    retdict['Side 1 Resistances'] = dataR1
    #    retdict['dataR2'] = dataR2
    retdict['Side 2 Resistances'] = dataR2
    #    retdict['Tcs1'] = Tcs1
    retdict['Side 1 Transition Temperatures'] = Tcs1
    #    retdict['Tcs2'] = Tcs2
    retdict['Side 2 Transition Temperatures'] = Tcs2
    #    retdict['IsT'] = IsT
    retdict['Thermometer Excitation Current'] = IsT
    #    retdict['Is1'] = Is1
    retdict['Side 1 Excitation Currents'] = Is1
    #    retdict['Is2'] = Is2
    retdict['Side 2 Excitation Currents'] = Is2

    return retdict
Example #2
0
def CRAACload(hkefname, calfname):
    """Load a CRAAC data file using the standard recipe."""
    cal = loadtxt(calfname)
    calTs, calRs = cal.T
    RofT = interp1d(calTs, calRs, bounds_error=False, fill_value=-1.)
    calRs = calRs[::-1]
    calTs = calTs[::-1]
    TofR = interp1d(calRs, calTs, bounds_error=False, fill_value=-1.)

    f = BinaryFile(hkefname)

    dataT = f.get_data(0).flatten()
    Ts = TofR(dataT)

    dataR = f.get_data(-6)
    dataR = dataR.T

    Tcs = array([find_mid_temp(rs, Ts) for rs in dataR])

    return Ts, dataR, Tcs, TofR, RofT, f
Example #3
0
def hkebinary_to_csv(fname):
    f = File(fname)

    reglist = f.list_registers()

    header = []
    alldata = None
    for reg in reglist:
        data = f.get_data(reg)
        ncols = data.shape[1]
        colnames = ['{0}_{1}'.format(reg, i) for i in range(ncols)]
        header.extend(colnames)
        try:
            alldata = np.hstack([alldata, data])
        except ValueError:
            alldata = data

    header = ','.join(header)

    base, ext = os.path.splitext(fname)
    newfname = base + '.csv.gz'
    np.savetxt(newfname, alldata, delimiter=',', header=header)
Example #4
0
    def loadfile(self, hkefname, calfname, #taddress=None, tchannel=None,
                 bcfgfile=None, description=None, handleerrors=True):
        hkefname = os.path.abspath(hkefname)
        folder, name = os.path.split(hkefname)
        fn, ext = os.path.splitext(hkefname)
        newcfgname = fn + '_boards.txt'

        calfname = os.path.abspath(calfname)

        hkefile = BinaryFile(hkefname)
        if bcfgfile is None:
            bcfgfile = newcfgname
        try:
            boardsdict = parse_boards_file(bcfgfile)
        except IOError:
            raise HKEPlotLoadError(hkefname, calfname)

        boards = boardsdict['boards']

        # Load thermometer interpolation curves
        cal = self._cal_load(calfname)
        calTs, calRs = cal.T
        RofT = interp1d(calTs, calRs, bounds_error=False,
                        fill_value=-1.)
        calRs = calRs[::-1]
        calTs = calTs[::-1]
        TofR = interp1d(calRs, calTs, bounds_error=False,
                        fill_value=-1.)

        # Load data from datafile
        for addr in boards.keys():
            t = boards[addr]['type']
            if t not in ['pmaster']:
                regname = construct_register_name(boards, addr)
                boards[addr]['register_name'] = regname
                data = hkefile.get_data(regname).T
                boards[addr]['data'] = data

        # Use first available data register as T, if none specified.
        # if taddress is None:
        #     print "toaddress is None!" #DELME
        #     treg = boards.values()[0]
        #     taddress = treg['address']
        #     tchannel = 0
        # else:
        #     treg = boards[taddress]
        taddress = boardsdict['temperature']['address']
        tchannel = boardsdict['temperature']['channel']
        if taddress is None:
            treg = boards.values()[0]
        else:
            treg = boards[taddress]
        if tchannel is None:
            tchannel = 0
        dataT = treg['data'][tchannel]

        Ts = TofR(dataT)

        # Compute TCs
        for addr in boards.keys():
            t = boards[addr]['type']
            if t not in ['pmaster']:
                data = boards[addr]['data']
                Tcs = array([self.find_mid_temp(rs, Ts) for rs in data])
                boards[addr]['Tcs'] = Tcs

        boardsdict['filename'] = os.path.abspath(hkefname)
        boardsdict['file'] = hkefile
        boardsdict['calfile'] = calfname
        boardsdict['boardsfile'] = newcfgname
        if isinstance(description, StringTypes):
            boardsdict['description'] = description

        boardsdict['temperature'] = {'address': taddress,
                                     'channel': tchannel,
                                     'Ts': Ts,
                                     'TofR': TofR,
                                     'RofT': RofT}

        # Save copy of the config file.
        if not os.path.isfile(newcfgname):
            save_board_file(boardsdict, newcfgname)

        self.datafiles[name] = boardsdict
        self.orderedkeys.append(name)

        return True
Example #5
0
from matplotlib.pyplot import *
from HKEBinaryFile import HKEBinaryFile as File
from scipy import *
from scipy.interpolate import interp1d

cal = loadtxt('U02728.txt')
calTs, calRs = cal.T
calRs = calRs[::-1]
calTs = calTs[::-1]
TofR = interp1d(calRs, calTs)

f0615_001 = File('hke_20120615_001.dat')
dataT = f0615_001.get_data(0).flatten()
dataR = f0615_001.get_data(-6)
r1 = dataR[...,2]
r1 = sqrt(r1*r1)

t1 = TofR(dataT)

plot(t1, r1, label='SHINY Electronics (I = 10 $\mu A$)')
yscale('log')
xscale('log')
ylabel('$|R_{\mathrm{device}}|$ ($\Omega$)', fontsize='large')
xlabel('T (K)', fontsize='large')
title('R vs T for Characterization Test Chip Channel 1', fontsize='large')
show()