Пример #1
0
def main(start, stop, incr, desc):
    """ Run the sweep, does not include <stop> in the positions. """
    start = float(start)
    stop = float(stop)
    incr = float(incr)
    positions = np.arange(start, stop, incr)
    N = len(positions)
    DAQ = daq.Daq(broadcast=False, print_normal=True)
    ID = check_log()
    add_to_log(ID)
    global META_PATH
    META_PATH = file.get_dirName('META', '') + str(ID) + '.txt'
    create_meta(desc)

    # Connect all devices we want to use
    devices = connect_instruments(DAQ)
    if devices is None:
        DAQ.close_daq()
        return
    NF, FF, stage_cam, xps, sdg, TC = devices
    DAQ.create_dir_struct()
    # Handle the XPS directly rather than through the DAQ
    print('Connecting XPS motor controller')
    xps_dev = xps.device_cls(xps.address)
    time.sleep(5)
    print('Finished waiting 5s for instruments to connect')
    # Config any instrument settings that we want to make sure are correct
    config_instruments(DAQ, NF, FF, stage_cam)

    # Take the initial dataset
    pos = move_stage(positions[0], xps_dev)
    instrs = {
        NF.serial: NF,
        FF.serial: FF,
    }
    append_meta('Initial laser parameters:\t{:s}'.format(str(DAQ.dataset)))
    take_laser('Initial laser parameters', DAQ, instrs)

    # Move the stage and take a dataset at each position
    instrs = {
        stage_cam.serial: stage_cam,
        #FF.serial: FF,
    }
    for i in range(N):
        pos = move_stage(positions[i], xps_dev)
        step_desc = 'Step:\t{:d}\t{:0.3f}'.format(i + 1, pos)
        append_meta('Step:\t{:0.3f}\t{:s}'.format(pos, str(DAQ.dataset)))
        take_step(step_desc, DAQ, instrs)
        adjust_gain()

    # Take the final dataset
    instrs = {
        NF.serial: NF,
        FF.serial: FF,
    }
    append_meta('Final laser parameters:\t{:s}'.format(str(DAQ.dataset)))
    take_laser('Final laser parameters', DAQ, instrs, adv=False)
    DAQ.close_daq()
Пример #2
0
import linac
lcls_linac = linac.Linac()
import daq
import socket
daq_hostname = socket.gethostname()
xppdaq = daq.Daq(host=daq_hostname, platform=1, lcls=lcls_linac)
Пример #3
0
                TC = True
            else:
                self.TCBoolLabel.setText('No')
        else:
            self.TCBoolLabel.setText('No')
        # Return if we are ready to take a dataset
        return SDG and TC

    @pyqtSlot(int)
    def toggle_save_cam_settings(self, save):
        if save == 0:
            self.save_cam_settings = False
        else:
            self.save_cam_settings = True

    def closeEvent(self, event):
        """ Override the close method to disconnect all instruments. """
        self.DAQ.close_daq()
        # Cause the logging thread to end
        print('__exit__')
        event.accept()

if __name__ == "__main__":
    import sys
    app = QtGui.QApplication(sys.argv)
    DAQ = daq.Daq(broadcast=True)
    ui = UI(DAQ)
    ui.set_dataset_num()
    ui.show()
    sys.exit(app.exec_())
Пример #4
0
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 10 12:23:14 2018

@author: cu-pwfa
"""

import sys

sys.path.append('../')
import daq
import file
import globalVAR as Gvar
import visa
import numpy as np
import time
from random import randint
import PyCapture2 as pc2

DAQ = daq.Daq(desc='Test Descritpion')

DAQ.connect_instr('Camera', 17571186)

time.sleep(5)

DAQ.send_command(DAQ.command_queue[17571186], 'take_photo')

time.sleep(5)

DAQ.turn_off_daq()