def scan_once(dT=5, T=22.0, mode=''):
    (P, I, D) = caget('NIH:LIGHTWAVE.PCOF'), caget(
        'NIH:LIGHTWAVE.ICOF'), caget('NIH:LIGHTWAVE.DCOF')
    if mode == 'advance':
        caput('NIH:TEMP.VAL_ADV', T)
        cawait('NIH:TEMP.VAL_ADV')
    else:
        caput('NIH:TEMP.VAL', T)
        cawait('NIH:TEMP.VAL')
    sleep(1)

    while not caget('NIH:TEMP.DMOV'):
        sleep(0.05)
    sleep(1)
    caget('NIH:TEMP.DMOV')

    t_start = time()
    if mode == 'advance':
        caput('NIH:TEMP.VAL_ADV', T + dT)
        cawait('NIH:TEMP.VAL_ADV')
    else:
        caput('NIH:TEMP.VAL', T + dT)
        cawait('NIH:TEMP.VAL')
    sleep(1)

    while not caget('NIH:TEMP.DMOV'):
        sleep(0.05)
    t_end = time()
    sleep(5)
    current = caget('NIH:TEMP.I')
    res = {}
    res['temperature'] = T + dT
    res['current'] = current
    res['t start'] = t_start
    res['t end'] = t_end
    res['dt'] = t_end - t_start
    res['dT'] = dT
    res['P'] = P
    res['I'] = I
    res['D'] = D
    res['oasis_T'] = caget('NIH:CHILLER.VAL')
    if mode == 'advance':
        res['mode'] = 1
    else:
        res['mode'] = 0
    res['data_rbv'] = asarray(
        channel_archiver.history('NIH:LIGHTWAVE.RBV', t_start, t_end))
    res['data_current'] = asarray(
        channel_archiver.history('NIH:LIGHTWAVE.I', t_start, t_end))
    res['data_val'] = asarray(
        channel_archiver.history('NIH:LIGHTWAVE.VAL', t_start, t_end))
    return res
 def set_PIDCOF(self,value):
     from CA import caput,cawait
     if self.get_PIDCOF() != value:
         print('setting PIDCOF: %r -> %r' %(self.get_PIDCOF(),value))
         caput(self.lightwave_prefix + '.PIDCOF',value)
         cawait(self.lightwave_prefix + '.PIDCOF')
 def set_DCOF(self,value):
     from CA import caput,cawait
     if self.get_DCOF() != value:
         caput(self.lightwave_prefix + '.DCOF',value)
         cawait(self.lightwave_prefix + '.DCOF')
 def set_set_lightwaveT(self,value):
     from CA import caput, cawait
     from numpy import isnan
     if value is not isnan:
         caput(self.lightwave_prefix + '.VAL', value = float(value))
         cawait(self.lightwave_prefix + '.VAL')