Пример #1
0
def main():
    """Connect device, set up stage and read and display datarecorder data."""
    with GCSDevice(CONTROLLERNAME) as pidevice:
        pidevice.ConnectTCPIP(ipaddress='192.168.90.207')
        # pidevice.ConnectUSB(serialnum='123456789')
        # pidevice.ConnectRS232(comport=1, baudrate=115200)
        print('connected: {}'.format(pidevice.qIDN().strip()))
        print('initialize connected stages...')
        pitools.startup(pidevice, STAGES, REFMODES)
        drec = datarectools.Datarecorder(pidevice)
        recorddata(drec)
        print('move stage on axis {}...'.format(pidevice.axes[0]))
        pidevice.MVR(pidevice.axes[0], 0.1)
        processdata(drec)
Пример #2
0
def readdatarecorder(pidevice):
    """Set up data recorder, move stage and read data of 2 tables for first axis.
    @type pidevice : pipython.gcscommands.GCSCommands
    @return : Tuple of (header, data), see qDRR command.
    """
    drec = datarectools.Datarecorder(pidevice)
    drec.numvalues = NUMVALUES
    drec.samplefreq = RECRATE
    print('data recorder rate: {:.2f} Hz'.format(drec.samplefreq))
    drec.options = (datarectools.RecordOptions.ACTUAL_POSITION_2, datarectools.RecordOptions.COMMANDED_POSITION_1)
    drec.sources = pidevice.axes[0]
    drec.trigsources = datarectools.TriggerSources.POSITION_CHANGING_COMMAND_1
    drec.arm()
    print('move stage on axis {}...'.format(pidevice.axes[0]))
    pidevice.MVR(pidevice.axes[0], 0.1)
    return drec.getdata()
    print('Servo Status: ', pidevice.qSVO())
    pidevice.WGO(wavegens, mode=[0]*len(wavegens))
    '''
        Auto-Zero
    '''
#     pidevice.ATZ({1:0, 2:0, 4:0})
#     time.sleep(5)
    '''
        Turn on control loop
    '''
    pidevice.SVO({'1':1,'2':1,'3':1,'4':1,'5':1,'6':1})
#     print('Servo Status: ', pidevice.qSVO())
    '''
        Data Recording Configuration
    '''
    drec = datarectools.Datarecorder(pidevice)
    drec.numvalues = NUMVALUES
    drec.samplefreq = RECRATE
    print('data recorder rate: {:.2f} Hz'.format(drec.samplefreq))
    drec.options = (datarectools.RecordOptions.ACTUAL_POSITION_2)
#     drec.sources = ('2', '3', '5') ### 2=y=lenth 3=rot_z=hor_angle, 5=rot_x=ver_angle
#     drec.trigsources = datarectools.TriggerSources.POSITION_CHANGING_COMMAND_1
    drec.trigsources = datarectools.TriggerSources.TRIGGER_IMMEDIATELY_4
#     drec.arm()
    print('Data recorder TriggerSource: ', pidevice.qDRT())
    
    print('Sampling Freq. = ', drec.samplefreq)
#     pidevice.RTR(60)
#     print('Record Table Rate: ', pidevice.qRTR())
    
    pidevice.DRC(tables=1, sources='2', options=2)