def init(self):
        from labscript_utils import check_version
        check_version('spinapi', '3.2.0', '4')
        exec('from spinapi import *', globals())
        global h5py
        import labscript_utils.h5_lock, h5py
        global zprocess
        import zprocess

        self.pb_start = pb_start
        self.pb_stop = pb_stop
        self.pb_reset = pb_reset
        self.pb_close = pb_close
        self.pb_read_status = pb_read_status
        self.smart_cache = {
            'pulse_program': None,
            'ready_to_go': False,
            'initial_values': None
        }

        # An event for checking when all waits (if any) have completed, so that
        # we can tell the difference between a wait and the end of an experiment.
        # The wait monitor device is expected to post such events, which we'll wait on:
        self.all_waits_finished = zprocess.Event('all_waits_finished')
        self.waits_pending = False

        pb_select_board(self.board_number)
        pb_init()
        pb_core_clock(self.core_clock_freq)

        # This is only set to True on a per-shot basis, so set it to False
        # for manual mode. Set associated attributes to None:
        self.time_based_stop_workaround = False
        self.time_based_shot_duration = None
        self.time_based_shot_end_time = None
    def init(self):
        from labscript_utils import check_version
        check_version('spinapi', '3.1.1', '4')
        exec 'from spinapi import *' in globals()
        global h5py
        import labscript_utils.h5_lock, h5py
        global zprocess
        import zprocess

        self.pb_start = pb_start
        self.pb_stop = pb_stop
        self.pb_reset = pb_reset
        self.pb_close = pb_close
        self.pb_read_status = pb_read_status
        self.smart_cache = {
            'pulse_program': None,
            'ready_to_go': False,
            'initial_values': None
        }

        # An event for checking when all waits (if any) have completed, so that
        # we can tell the difference between a wait and the end of an experiment.
        # The wait monitor device is expected to post such events, which we'll wait on:
        self.all_waits_finished = zprocess.Event('all_waits_finished')
        self.waits_pending = False

        pb_select_board(self.board_number)
        pb_init()
        pb_core_clock(self.core_clock_freq)
 def init(self):
     from labscript_utils import check_version
     check_version('spinapi', '3.1.1', '4')
     exec 'from spinapi import *' in globals()
     global h5py; import labscript_utils.h5_lock, h5py
     global zprocess; import zprocess
     
     self.pb_start = pb_start
     self.pb_stop = pb_stop
     self.pb_reset = pb_reset
     self.pb_close = pb_close
     self.pb_read_status = pb_read_status
     self.smart_cache = {'pulse_program':None,'ready_to_go':False,
                         'initial_values':None}
                         
     # An event for checking when all waits (if any) have completed, so that
     # we can tell the difference between a wait and the end of an experiment.
     # The wait monitor device is expected to post such events, which we'll wait on:
     self.all_waits_finished = zprocess.Event('all_waits_finished')
     self.waits_pending = False
 
     pb_select_board(self.board_number)
     pb_init()
     pb_core_clock(self.core_clock_freq)
#                                                                   #
# This file is part of the program labscript, in the labscript      #
# suite (see http://labscriptsuite.org), and is licensed under the  #
# Simplified BSD License. See the license.txt file in the root of   #
# the project for the full license.                                 #
#                                                                   #
#####################################################################

from labscript import *

try:
    from labscript_utils import check_version
except ImportError:
    raise ImportError('Require labscript_utils > 2.1.0')

check_version('labscript_utils', '2.2', '3')

# Initialisation, runs at import. Can be suppressed by setting
# labscript_auto_init = False in the locals of the importing scope
# before importing labscript. If you do this, you'll need to call
# labscript_init() yourself:

#import inspect
#importing_frame = inspect.currentframe()
#importing_locals = importing_frame.f_back.f_locals
#if not 'labscript_auto_init' in importing_locals or importing_locals['labscript_auto_init']:
#    overwrite = False
#    if '-f' in sys.argv:
#        overwrite = True
#        sys.argv.remove('-f')
#    if len(sys.argv) > 1:
from __future__ import print_function, unicode_literals, division, absolute_import

from labscript_utils import check_version

check_version('PyDAQmx', '1.4.2', '2.0.0')

import ctypes
import PyDAQmx as daqmx
import PyDAQmx.DAQmxConstants as c
import PyDAQmx.DAQmxTypes as types
"""This file is distinct from utils.py as it requires PyDAQmx to be installed,
whereas the contents of utils.py do not."""


def get_devices():
    BUFSIZE = 4096
    result = ctypes.create_string_buffer(BUFSIZE)
    daqmx.DAQmxGetSysDevNames(result, types.uInt32(BUFSIZE))
    return result.value.decode('utf8').split(',')


def get_product_type(device_name):
    BUFSIZE = 4096
    result = ctypes.create_string_buffer(BUFSIZE)
    daqmx.DAQmxGetDevProductType(device_name, result, types.uInt32(BUFSIZE))
    return result.value.decode('utf8')


def get_CI_chans(device_name):
    BUFSIZE = 4096
    result = ctypes.create_string_buffer(BUFSIZE)
Exemple #6
0
# This file is part of the module labscript_devices, in the         #
# labscript suite (see http://labscriptsuite.org), and is           #
# licensed under the Simplified BSD License. See the license.txt    #
# file in the root of the project for the full license.             #
#                                                                   #
#####################################################################

from __future__ import division, unicode_literals, print_function, absolute_import
from labscript_utils import PY2, check_version

if PY2:
    str = unicode

__version__ = '1.0.0'

check_version('labscript', '2.5.0', '3.0.0')

from labscript import (
    IntermediateDevice,
    AnalogOut,
    DigitalOut,
    StaticAnalogOut,
    StaticDigitalOut,
    AnalogIn,
    bitfield,
    config,
    LabscriptError,
    set_passed_properties,
)
from labscript_utils import dedent
from .utils import split_conn_DO, split_conn_AO, split_conn_AI
from labscript_utils.ls_zprocess import Lock, connect_to_zlock_server, kill_lock

from labscript_utils import check_version

from labscript_utils.shared_drive import path_to_agnostic
from labscript_utils import PY2
if PY2:
    str = unicode

if 'h5py' in sys.modules:
    raise ImportError('h5_lock must be imported prior to importing h5py')

import h5py
# This module used to contain a monkeypatch to work around an issue now fixed in h5py.
# Depend on the fix since we no longer have the monkeypatch.
check_version('h5py', '2.9', '3')

_File = h5py.File


class File(_File):
    def __init__(self, name, mode=None, driver=None, libver=None, **kwds):
        if not isinstance(name, h5py._objects.ObjectID):
            kwargs = {}
            if mode == 'r':
                kwargs['read_only'] = True
            # Do not terminate upon SIGTERM while the file is open:
            self.kill_lock = kill_lock
            self.kill_lock.acquire()
            # Ask other zlock users not to open the file while we have it open:
            self.zlock = Lock(path_to_agnostic(name), **kwargs)
from __future__ import division, unicode_literals, print_function, absolute_import
try:
    from labscript_utils import check_version
except ImportError:
    raise ImportError('Require labscript_utils > 2.1.0')

check_version('labscript_utils', '2.7.1', '3')
from labscript_utils import PY2
if PY2:
    str = unicode

import os
import sys
import importlib

__version__ = '2.1.0'

check_version('qtutils', '2.0.0', '3.0.0')
check_version('labscript', '2.1', '3')
check_version('blacs', '2.1', '3')
check_version('zprocess', '2.2.7', '3')


class ClassRegister(object):
    """A register for looking up classes by module name.  Provides a
     decorator and a method for looking up classes decorated with it,
     importing as necessary."""
    def __init__(self, instancename):
        self.registered_classes = {}
        # The name given to the instance in this namespace, so we can use it in error messages:
        self.instancename = instancename
Exemple #9
0
from labscript_utils.labconfig import LabConfig
import pandas
from numpy import array, ndarray
import types

from zprocess import zmq_get

__version__ = '2.2.0'

try:
    from labscript_utils import check_version
except ImportError:
    raise ImportError('Require labscript_utils > 2.1.0')

# require pandas v0.15.0 up to the next major version
check_version('pandas', '0.15.0', '1.0')
check_version('zprocess', '2.2.0', '3.0')
check_version('labscript_utils', '2.6', '3.0')
from labscript_utils import PY2
if PY2:
    str = unicode

# If running stand-alone, and not from within lyse, the below two variables
# will be as follows. Otherwise lyse will override them with spinning_top =
# True and path <name of hdf5 file being analysed>:
spinning_top = False
# data to be sent back to the lyse GUI if running within lyse
_updated_data = {}

# get port that lyse is using for communication
try:
Exemple #10
0
import lyse
import runmanager.remote as rm
import numpy as np
import mloop_config
import sys
import logging
import os
from labscript_utils.setup_logging import LOG_PATH

try:
    from labscript_utils import check_version
except ImportError:
    raise ImportError('Require labscript_utils > 2.1.0')

check_version('lyse', '2.5.0', '4.0')
check_version('zprocess', '2.13.1', '4.0')
check_version('labscript_utils', '2.12.5', '4.0')


def configure_logging(config):
    console_log_level = config['analysislib_console_log_level']
    file_log_level = config['analysislib_file_log_level']
    LOG_FILENAME = 'analysislib_mloop.log'

    global logger
    logger = logging.getLogger('analysislib_mloop')
    logger.setLevel(logging.DEBUG)
    formatter = logging.Formatter(
        '%(filename)s:%(funcName)s:%(lineno)d:%(levelname)s: %(message)s'
    )
Exemple #11
0
#                                                                   #
# This file is part of labscript_devices, in the labscript suite    #
# (see http://labscriptsuite.org), and is licensed under the        #
# Simplified BSD License. See the license.txt file in the root of   #
# the project for the full license.                                 #
#                                                                   #
#####################################################################

from __future__ import print_fuction

try:
    from labscript_utils import check_version
except ImportError:
    raise ImportError('Require labscript_utils > 2.1.0')

check_version('labscript', '2.0.1', '3')

from labscript_devices import labscript_device, BLACS_tab, BLACS_worker
from labscript import TriggerableDevice, LabscriptError, set_passed_properties
import numpy as np


@labscript_device
class SimCam(TriggerableDevice):
    description = 'Simulated Camera'

    # To be set as instantiation arguments:
    trigger_edge_type = None
    minimum_recovery_time = None

    @set_passed_properties(
Exemple #12
0
import labscript_utils.h5_lock, h5py
import pandas
from numpy import array, ndarray
import types

from zprocess import zmq_get

__version__ = '2.1.0'

try:
    from labscript_utils import check_version
except ImportError:
    raise ImportError('Require labscript_utils > 2.1.0')

# require pandas v0.15.0 up to the next major version
check_version('pandas', '0.15.0', '1.0')

# If running stand-alone, and not from within lyse, the below two variables
# will be as follows. Otherwise lyse will override them with spinning_top =
# True and path <name of hdf5 file being analysed>:
spinning_top = False

if len(sys.argv) > 1:
    path = sys.argv[1]
else:
    path = None


def data(filepath=None, host='localhost', timeout=5):
    if filepath is not None:
        return _get_singleshot(filepath)
Exemple #13
0
#                                                                   #
# Copyright 2019, David Meyer                                       #
#                                                                   #
# This file is part of the naqslab devices extension to the         #
# labscript_suite. It is licensed under the Simplified BSD License. #
#                                                                   #
#                                                                   #
#####################################################################
from naqslab_devices.SignalGenerator.blacs_tab import SignalGeneratorTab
from naqslab_devices.SignalGenerator.blacs_worker import SignalGeneratorWorker

from labscript_utils import check_version
from labscript import LabscriptError

# need this version to ensure labscript device properties are auto-passed to worker
check_version('blacs', '2.8.0', '3')


class KeysightSigGenTab(SignalGeneratorTab):
    """BLACS Tab for Modern Keysight/Agilent/HP CW Signal Generators
    
    Specific devices should subclass this class and define 
    `base_units`
    `base_min`
    `base_max`
    `base_step`
    `base_decimals`
    for the frequency output 'channel 0'. Definitions are given is the base units.
    """
    # Event Status Byte Label Definitions for Keysight Sig Gens
    status_byte_labels = {
Exemple #14
0
from __future__ import division, unicode_literals, print_function, absolute_import

try:
    from labscript_utils import check_version
except ImportError:
    raise ImportError('Require labscript_utils > 2.1.0')

check_version('labscript_utils', '2.13.2', '3')
from labscript_utils import PY2

if PY2:
    str = unicode

import os
import sys
import importlib
import imp
import warnings
import traceback
import inspect
from labscript_utils import labscript_suite_install_dir, dedent
from labscript_utils.labconfig import LabConfig

__version__ = '2.6.0'

check_version('qtutils', '2.0.0', '3.0.0')
check_version('labscript', '2.6', '3')
check_version('blacs', '2.7.0', '3.0.0')
check_version('zprocess', '2.17.0', '3')
check_version('numpy', '1.15.1', '2')
"""This file contains the machinery for registering and looking up what BLACS tab and
from labscript_utils import check_version

import sys
if sys.version_info < (3, 6):
    raise RuntimeError("IMAQdxCamera driver requires Python 3.6+")

check_version('labscript_utils', '2.14.0', '3')
check_version('labscript', '2.5.2', '3')
#####################################################################
#                                                                   #
# /labscript_devices/Camera.py                                      #
#                                                                   #
# Copyright 2013, Monash University                                 #
#                                                                   #
# This file is part of labscript_devices, in the labscript suite    #
# (see http://labscriptsuite.org), and is licensed under the        #
# Simplified BSD License. See the license.txt file in the root of   #
# the project for the full license.                                 #
#                                                                   #
#####################################################################
from __future__ import division, unicode_literals, print_function, absolute_import

from labscript_utils import check_version
check_version('labscript', '2.0.1', '3')
check_version('zprocess', '2.4.8', '3')
from labscript_utils import PY2
if PY2:
    str = unicode

from labscript_devices import BLACS_tab
from labscript import TriggerableDevice, LabscriptError, set_passed_properties
import numpy as np


class Camera(TriggerableDevice):
    description = 'Generic Camera'

    # To be set as instantiation arguments:
    trigger_edge_type = None
import signal
# Quit on ctrl-c
signal.signal(signal.SIGINT, signal.SIG_DFL)

import labscript_utils.excepthook

# Set working directory to runviewer folder, resolving symlinks
runviewer_dir = os.path.dirname(os.path.realpath(__file__))
os.chdir(runviewer_dir)

try:
    from labscript_utils import check_version
except ImportError:
    raise ImportError('Require labscript_utils > 2.1.0')

check_version('labscript_utils', '2.0', '3')
check_version('qtutils', '1.5.2', '2')
check_version('zprocess', '1.1.2', '2')

from labscript_utils.setup_logging import setup_logging
logger = setup_logging('runviewer')
labscript_utils.excepthook.set_logger(logger)

from zprocess import zmq_get, ZMQServer
import zprocess.locking, labscript_utils.h5_lock, h5py
zprocess.locking.set_client_process_name('runviewer')

# This must be bumped until after the h5_lock import
# This is because the check imports pyqtgraph, which imports h5py
# h5py must be imported after h5_lock, thus we do the check here
check_version('pyqtgraph', '0.9.10', '1')
# http://labscriptsuite.org) and is licensed under the Simplified   #
# BSD License. See the license.txt file in the root of the project  #
# for the full license.                                             #
#                                                                   #
#####################################################################

import sys
import time
import zprocess
from labscript_utils import check_version
import labscript_utils.shared_drive
# importing this wraps zlock calls around HDF file openings and closings:
import labscript_utils.h5_lock
import h5py
import numpy as np
check_version('zprocess', '1.3.3', '2.0')

# This file implements the protocol for a camera server, that is, a program
# that BLACS can interface with to control cameras. It contains a class that
# acts as a camera server and communicates with BLACS over zeromq. The
# protocol is as below. A user need not implement this protocol themselves,
# they instead should subclass CameraServer and override the
# transition_to_buffered(), transition_to_static(), and abort() methods. An
# example is show at the bottom of this file. Note that the filepath send from
# BLACS to the camera server has a 'network agnostic' prefix - it is assumed
# that BLACS and the camera server may not have the same path to the location
# of the HDF5 file, it may be on a shared drive with different drive
# letters/mount points on the two computers. So BLACS calls
# labscript_utils.shared_drive.path_to_agnostic() on the filepath before
# sending it, and the camera server should call
# labscript_utils.shared_drive.path_to_local() once receiving it. If you
from __future__ import print_function, unicode_literals, division, absolute_import
from labscript_utils import PY2, check_version
if PY2:
    str = unicode
import os

if PY2:
    try:
        import autocython
    except ImportError:
        msg = ('autocython required, installable via pip')
        raise RuntimeError(msg)

    check_version('autocython', '1.1', '2.0')
    from autocython import ensure_extensions_compiled, import_extension

    ensure_extensions_compiled(os.path.abspath(os.path.dirname(__file__)))
    extension = import_extension('runviewer.resample.resample')
    resample = extension.resample
else:
    from .resample import resample
import labscript_utils.h5_lock, h5py
import pandas
from numpy import array, ndarray
import types

from zprocess import zmq_get

__version__ = '2.1.0'

try:
    from labscript_utils import check_version
except ImportError:
    raise ImportError('Require labscript_utils > 2.1.0')

# require pandas v0.15.0 up to the next major version
check_version('pandas', '0.15.0', '1.0')

# If running stand-alone, and not from within lyse, the below two variables
# will be as follows. Otherwise lyse will override them with spinning_top =
# True and path <name of hdf5 file being analysed>:
spinning_top = False

if len(sys.argv) > 1:
    path = sys.argv[1]
else:
    path = None


class _RoutineStorage(object):
    """An empty object that analysis routines can store data in. It will
    persist from one run of an analysis routine to the next when the routine
Exemple #21
0
import pandas
import os
from numpy import *
import tzlocal
import labscript_utils.shared_drive
from labscript_utils.dict_diff import dict_diff

import runmanager

# Monkey patch a bugfix onto older versions of pandas on Python 2. This code
# can be removed once lyse otherwise depends on pandas >= 0.21.0.
# https://github.com/pandas-dev/pandas/pull/17099
if PY2:
    try:
        from labscript_utils import check_version, VersionException
        check_version('pandas', '0.21.0', '2.0')
    except VersionException:

        import numpy as np
        from pandas import Series, Index
        from pandas.core.indexing import maybe_droplevels

        def _getitem_multilevel(self, key):
            loc = self.columns.get_loc(key)
            if isinstance(loc, (slice, Series, np.ndarray, Index)):
                new_columns = self.columns[loc]
                result_columns = maybe_droplevels(new_columns, key)
                if self._is_mixed_type:
                    result = self.reindex(columns=new_columns)
                    result.columns = result_columns
                else:
Exemple #22
0
from __future__ import division, unicode_literals, print_function, absolute_import

try:
    from labscript_utils import check_version
except ImportError:
    raise ImportError('Require labscript_utils > 2.1.0')

check_version('labscript_utils', '2.8.0', '3')
from labscript_utils import PY2

if PY2:
    str = unicode

import os
import sys
import importlib
import imp
import warnings
import traceback
import inspect

__version__ = '2.4.0'

check_version('qtutils', '2.0.0', '3.0.0')
check_version('labscript', '2.5', '3')
check_version('blacs', '2.4.0', '3.0.0')
check_version('zprocess', '2.2.7', '3')
check_version('numpy', '1.15.1', '2')

from labscript_utils import labscript_suite_install_dir, dedent
Exemple #23
0
import signal
# Quit on ctrl-c
signal.signal(signal.SIGINT, signal.SIG_DFL)

from qtutils.qt.QtCore import *
from qtutils.qt.QtGui import *
from qtutils.qt.QtWidgets import *
from qtutils.qt import QT_ENV
from qtutils.qt.QtCore import pyqtSignal as Signal

try:
    from labscript_utils import check_version
except ImportError:
    raise ImportError('Require labscript_utils > 2.1.0')

check_version('labscript_utils', '2.7.2', '3')
check_version('qtutils', '2.0.0', '3.0.0')
check_version('zprocess', '2.9.2', '3')
check_version('labscript_devices', '2.0', '3')

# Pythonlib imports
### Must be in this order
import zprocess.locking, labscript_utils.h5_lock, h5py
zprocess.locking.set_client_process_name('BLACS')
###
from zprocess import zmq_get, ZMQServer, raise_exception_in_thread
from labscript_utils.setup_logging import setup_logging
import labscript_utils.shared_drive

# Setup logging
logger = setup_logging('BLACS')
import os
import sys
import importlib

__version__ = '2.0.2'

from labscript_utils import check_version

check_version('labscript_utils', '2.2', '3')
check_version('labscript', '2.1', '3')
check_version('blacs', '2.1', '3')


class ClassRegister(object):
    """A register for looking up classes by module name.  Provides a
     decorator and a method for looking up classes decorated with it,
     importing as necessary."""
    def __init__(self, instancename):
        self.registered_classes = {}
        # The name given to the instance in this namespace, so we can use it in error messages:
        self.instancename = instancename

    def __call__(self, cls):
        """Adds the class to the register so that it can be looked up later
        by module name"""
        # Add an attribute to the class so it knows its own name in case
        # it needs to look up other classes in the same module:
        cls.labscript_device_class_name = cls.__module__.split('.')[-1]
        if cls.labscript_device_class_name == '__main__':
            # User is running the module as __main__. Use the filename instead:
            import __main__
Exemple #25
0
# Copyright 2013, Monash University                                 #
#                                                                   #
# This file is part of labscript_utils, in the labscript suite      #
# (see http://labscriptsuite.org), and is licensed under the        #
# Simplified BSD License. See the license.txt file in the root of   #
# the project for the full license.                                 #
#                                                                   #
#####################################################################
from __future__ import division, unicode_literals, print_function, absolute_import

import sys, os
import logging, logging.handlers
import zmq
from labscript_utils import check_version

check_version('zprocess', '2.8.4', '3.0.0')
import zprocess.zlog
from zprocess import start_daemon
import __main__


_connected_to_zlog = False


def ensure_connected_to_zlog(maxBytes, backupCount):
    """Ensure we are connected to a zlog server. If one is not running, start one with
    the given maxBytes and backupCount."""
    global _connected_to_zlog
    if _connected_to_zlog:
        return
    # setup connection with the zlog server on localhost
import os
import sys
import importlib

__version__ = '2.0.2'

from labscript_utils import check_version

check_version('labscript_utils', '2.2', '3')
check_version('labscript', '2.1', '3')
check_version('blacs', '2.1', '3')


class ClassRegister(object):
    """A register for looking up classes by module name.  Provides a
     decorator and a method for looking up classes decorated with it,
     importing as necessary."""
    def __init__(self, instancename):
        self.registered_classes = {}
        # The name given to the instance in this namespace, so we can use it in error messages:
        self.instancename = instancename

    def __call__(self, cls):
        """Adds the class to the register so that it can be looked up later
        by module name"""
        # Add an attribute to the class so it knows its own name in case
        # it needs to look up other classes in the same module:
        cls.labscript_device_class_name = cls.__module__.split('.')[-1]
        if cls.labscript_device_class_name == '__main__':
            # User is running the module as __main__. Use the filename instead:
            import __main__
Exemple #27
0
#####################################################################
from __future__ import division, unicode_literals, print_function, absolute_import
from labscript_utils import PY2
if PY2:
    str = unicode

import sys
import time
import zprocess
from labscript_utils import check_version
import labscript_utils.shared_drive
# importing this wraps zlock calls around HDF file openings and closings:
import labscript_utils.h5_lock
import h5py
import numpy as np
check_version('zprocess', '1.3.3', '3.0')

# This file implements the protocol for a camera server, that is, a program
# that BLACS can interface with to control cameras. It contains a class that
# acts as a camera server and communicates with BLACS over zeromq. The
# protocol is as below. A user need not implement this protocol themselves,
# they instead should subclass CameraServer and override the
# transition_to_buffered(), transition_to_static(), and abort() methods. An
# example is show at the bottom of this file. Note that the filepath send from
# BLACS to the camera server has a 'network agnostic' prefix - it is assumed
# that BLACS and the camera server may not have the same path to the location
# of the HDF5 file, it may be on a shared drive with different drive
# letters/mount points on the two computers. So BLACS calls
# labscript_utils.shared_drive.path_to_agnostic() on the filepath before
# sending it, and the camera server should call
# labscript_utils.shared_drive.path_to_local() once receiving it. If you
else:
    try:
        from PyQt4.QtCore import *
        from PyQt4.QtGui import *
        from PyQt4.QtCore import pyqtSignal as Signal
    except Exception:
        from PySide.QtCore import *
        from PySide.QtGui import *


try:
    from labscript_utils import check_version
except ImportError:
    raise ImportError('Require labscript_utils > 2.1.0')

check_version('labscript_utils', '2.2', '3')
check_version('qtutils', '1.5.1', '2')
check_version('zprocess', '1.1.2', '2')
check_version('labscript_devices', '2.0', '3')


# Pythonlib imports
### Must be in this order
import zprocess.locking, labscript_utils.h5_lock, h5py
zprocess.locking.set_client_process_name('BLACS')
###
from zprocess import zmq_get, ZMQServer
from labscript_utils.setup_logging import setup_logging
import labscript_utils.shared_drive

# Custom Excepthook
import threading

import labscript_utils.h5_lock, h5py
from labscript_utils.labconfig import LabConfig
import pandas
from numpy import array, ndarray
import types

__version__ = '2.6.0'

try:
    from labscript_utils import check_version
except ImportError:
    raise ImportError('Require labscript_utils > 2.1.0')

check_version('pandas', '0.21.0', '2.0')
check_version('zprocess', '2.2.0', '3.0')
check_version('labscript_utils', '2.14.0', '3.0')
from labscript_utils import PY2, dedent
from labscript_utils.ls_zprocess import zmq_get
if PY2:
    str = unicode

from labscript_utils import labscript_suite_install_dir
from labscript_utils.properties import get_attributes, get_attribute, set_attributes
if labscript_suite_install_dir is not None:
    LYSE_DIR = os.path.join(labscript_suite_install_dir, 'lyse')
else:
    # No labscript install directory found? Fall back to relying on __file__
    LYSE_DIR = os.path.dirname(os.path.realpath(__file__))
if not os.path.isdir(LYSE_DIR):
import labscript_utils.h5_lock, h5py
import pandas
from numpy import array, ndarray
import types

from zprocess import zmq_get

__version__ = '2.1.0'

try:
    from labscript_utils import check_version
except ImportError:
    raise ImportError('Require labscript_utils > 2.1.0')

# require pandas v0.15.0 up to the next major version
check_version('pandas', '0.15.0', '1.0')
check_version('zprocess', '2.2', '3.0')

# If running stand-alone, and not from within lyse, the below two variables
# will be as follows. Otherwise lyse will override them with spinning_top =
# True and path <name of hdf5 file being analysed>:
spinning_top = False

if len(sys.argv) > 1:
    path = sys.argv[1]
else:
    path = None


class _RoutineStorage(object):
    """An empty object that analysis routines can store data in. It will
Exemple #31
0
import signal
# Quit on ctrl-c
signal.signal(signal.SIGINT, signal.SIG_DFL)

import labscript_utils.excepthook

# Set working directory to runviewer folder, resolving symlinks
runviewer_dir = os.path.dirname(os.path.realpath(__file__))
os.chdir(runviewer_dir)

try:
    from labscript_utils import check_version
except ImportError:
    raise ImportError('Require labscript_utils > 2.1.0')

check_version('labscript_utils', '2.0', '3')
check_version('qtutils', '1.5.2', '2')
check_version('zprocess', '1.1.2', '3')

from labscript_utils.setup_logging import setup_logging

logger = setup_logging('runviewer')
labscript_utils.excepthook.set_logger(logger)

from zprocess import zmq_get, ZMQServer
import zprocess.locking, labscript_utils.h5_lock, h5py

zprocess.locking.set_client_process_name('runviewer')

# This must be bumped until after the h5_lock import
# This is because the check imports pyqtgraph, which imports h5py
Exemple #32
0
from __future__ import division, unicode_literals, print_function, absolute_import
from labscript_utils import PY2
if PY2:
    str = unicode

# Custom Excepthook
import labscript_utils.excepthook

import os

try:
    from labscript_utils import check_version
except ImportError:
    raise ImportError('Require labscript_utils > 2.1.0')

check_version('labscript_utils', '2.12.4', '3')
# Splash screen
from labscript_utils.splash import Splash
splash = Splash(os.path.join(os.path.dirname(__file__), 'BLACS.svg'))
splash.show()

splash.update_text('importing standard library modules')
import logging, logging.handlers
import socket
import subprocess
import sys
import time

import signal
# Quit on ctrl-c
signal.signal(signal.SIGINT, signal.SIG_DFL)
    from PyQt4.QtCore import pyqtSignal as Signal
else:
    try:
        from PyQt4.QtCore import *
        from PyQt4.QtGui import *
        from PyQt4.QtCore import pyqtSignal as Signal
    except Exception:
        from PySide.QtCore import *
        from PySide.QtGui import *

try:
    from labscript_utils import check_version
except ImportError:
    raise ImportError('Require labscript_utils > 2.1.0')

check_version('labscript_utils', '2.2.2', '3')
check_version('qtutils', '1.5.1', '2')
check_version('zprocess', '1.1.2', '3')
check_version('labscript_devices', '2.0', '3')

# Pythonlib imports
### Must be in this order
import zprocess.locking, labscript_utils.h5_lock, h5py
zprocess.locking.set_client_process_name('BLACS')
###
from zprocess import zmq_get, ZMQServer
from labscript_utils.setup_logging import setup_logging
import labscript_utils.shared_drive

# Custom Excepthook
import labscript_utils.excepthook
Exemple #34
0
# settings.py                                                       #
#                                                                   #
# Copyright 2013, Monash University                                 #
#                                                                   #
# This file is part of the labscript suite (see                     #
# http://labscriptsuite.org) and is licensed under the Simplified   #
# BSD License. See the license.txt file in the root of the project  #
# for the full license.                                             #
#                                                                   #
#####################################################################
try:
    from labscript_utils import check_version
except ImportError:
    raise ImportError('Require labscript_utils > 2.1.0')

check_version('qtutils', '2.0.0', '3.0.0')

from qtutils.qt.QtCore import *
from qtutils.qt.QtGui import *
from qtutils.qt.QtWidgets import *

import h5_lock, h5py
from labscript_utils.qtwidgets.fingertab import FingerTabWidget


# Create a generic interface for displaying pages of settings
class Settings(object):
    def __init__(self,
                 storage='hdf5',
                 file=None,
                 parent=None,
Exemple #35
0
# BSD License. See the license.txt file in the root of the project  #
# for the full license.                                             #
#                                                                   #
#####################################################################
from __future__ import division, unicode_literals, print_function, absolute_import
from labscript_utils import PY2
if PY2:
    str = unicode

import sys
from socket import gethostbyname
from distutils.version import LooseVersion
import zmq

from labscript_utils import check_version
check_version('zprocess', '2.15.0', '3.0.0')

import zprocess
import zprocess.process_tree
from zprocess.security import SecureContext
from labscript_utils.labconfig import LabConfig
from labscript_utils import dedent
import zprocess.zlog
import zprocess.zlock
import zprocess.remote
from zprocess import KillLock


"""This module is a number of wrappers around zprocess objects that configures them with
the settings in LabConfig with regard to security, and the host and port of the zlock
server. Multiprocessing done with these wrappers will automatically be configured
Exemple #36
0
import threading
import numpy as np
from labscript_utils import dedent
import labscript_utils.h5_lock
import h5py
import labscript_utils.properties
import zmq

from labscript_utils.ls_zprocess import Context
from labscript_utils.shared_drive import path_to_local
from labscript_utils.properties import set_attributes

# Required for knowing the parent device's hostname when running remotely:
from labscript_utils import check_version

check_version('zprocess', '2.12.0', '3')

# Don't import nv yet so as not to throw an error, allow worker to run as a dummy
# device, or for subclasses to import this module to inherit classes without requiring
# nivision
nv = None


def _monkeypatch_imaqdispose():
    """Monkeypatch a fix to a memory leak bug in pynivision. The pynivision project is
    no longer active, so we can't contribute this fix upstream. In the long run,
    hopefully someone (perhaps us) forks it so that bugs can be addressed in the
    normal way"""

    import nivision.core
    import ctypes