How to use the hardware.opas.opas.hardwares function in hardware

To help you get started, we’ve selected a few hardware examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wright-group / PyCMDS / somatic / modules / motortune.py View on Github external
def create_frame(self):
        # shared settings
        input_table = pw.InputTable()
        allowed = [hardware.name for hardware in opas.hardwares]
        self.opa_combo = pc.Combo(allowed)
        input_table.add('OPA', self.opa_combo)
        self.opa_combo.updated.connect(self.on_opa_combo_updated)
        self.use_tune_points = pc.Bool(initial_value=True)
        input_table.add('Use Tune Points', self.use_tune_points)
        self.layout.addWidget(input_table)
        # motor settings
        self.opa_guis = [OPA_GUI(hardware, self.layout, self.use_tune_points) for hardware in opas.hardwares]
        self.opa_guis[0].show()
        # mono settings
        allowed = ['Set', 'Scan', 'Static']
        self.mono_method_combo = pc.Combo(allowed, disable_under_module_control=True)
        self.mono_method_combo.updated.connect(self.update_mono_settings)
        self.mono_center = pc.Number(initial_value=7000, units='wn', disable_under_module_control=True)
        self.mono_width = pc.Number(initial_value=500, units='wn', disable_under_module_control=True)
        self.mono_width.set_disabled_units(True)
        self.mono_npts = pc.Number(initial_value=51, decimals=0, disable_under_module_control=True)
        input_table = pw.InputTable()
        input_table.add('Spectrometer', None)
        input_table.add('Method', self.mono_method_combo)
        input_table.add('Center', self.mono_center)
        input_table.add('Width', self.mono_width)
        input_table.add('Number', self.mono_npts)
        self.layout.addWidget(input_table)
github wright-group / PyCMDS / somatic / modules / autotune.py View on Github external
def run(self):
        opa_names = [opa.name for opa in opas.hardwares]
        opa_name = self.aqn.read('OPA', 'name')
        opa_index = opa_names.index(opa_name)
        opa = opas.hardwares[opa_index]
        opa.run_auto_tune(self)
github wright-group / PyCMDS / somatic / modules / poynting_tune.py View on Github external
def create_frame(self):
        input_table = pw.InputTable()
        # opa combo
        allowed = [hardware.name for hardware in opas.hardwares if hardware.driver.poynting_type is not None]
        if len(allowed) == 0:
            return
        self.opa_combo = pc.Combo(allowed)
        self.opa_combo.updated.connect(self.on_opa_combo_updated)
        input_table.add('OPA', self.opa_combo)

        self.do_2D_scans = pc.Bool()
        input_table.add("Do 2D scans", self.do_2D_scans)
        self.do_2D_scans.updated.connect(self.on_do_2D_scans_updated)

        self.layout.addWidget(input_table)

        # motor selection
        self.opa_guis = [OPA_GUI(hardware, self.layout) for hardware in opas.hardwares if hardware.driver.poynting_type is not None]
        self.opa_guis[0].show()
github wright-group / PyCMDS / somatic / modules / poynting_tune.py View on Github external
def run(self):
        axes = []
        possible_axes = {}
        # OPA
        opa_name = self.aqn.read('opa', 'opa')
        opa_names = [opa.name for opa in opas.hardwares]
        opa_index = opa_names.index(opa_name)
        opa_hardware = opas.hardwares[opa_index]

        curve = opa_hardware.curve.copy()
        curve.convert('wn')

        axis = acquisition.Axis(curve.setpoints[:], 'wn', opa_name, opa_name)
        possible_axes[opa_name] = axis

        self.do_2D = self.aqn.read('processing', 'do_2D_scans')
        # mono
        for spec in spectrometers.hardwares:
            spec.set_position(0)
            

        for section in self.aqn.sections:
            if section not in ['opa','processing','device settings', 'Virtual', 'info', 'PCI-6251']:
                    if self.aqn.read(section, 'do'):
github wright-group / PyCMDS / somatic / queue.py View on Github external
import configparser as configparser

from PySide2 import QtCore, QtWidgets

import WrightTools as wt

import project.project_globals as g
import project.classes as pc
import project.widgets as pw
import project.file_dialog_handler as file_dialog_handler

import hardware.spectrometers.spectrometers as spectrometers
import hardware.delays.delays as delays
import hardware.opas.opas as opas
import hardware.filters.filters as filters
all_hardwares = opas.hardwares + spectrometers.hardwares + delays.hardwares + filters.hardwares

### define ####################################################################


app = g.app.read()

main_window = g.main_window.read()

somatic_folder = os.path.dirname(__file__)
saved_folder = os.path.join(somatic_folder, 'saved')
data_folder = main_window.data_folder


### ensure folders exist ######################################################
github wright-group / PyCMDS / somatic / modules / zero_tune.py View on Github external
def create_frame(self):
        input_table = pw.InputTable()
        # opa combo
        allowed = [hardware.name for hardware in opas.hardwares]
        self.opa_combo = pc.Combo(allowed)
        input_table.add('OPA', None)
        input_table.add('OPA', self.opa_combo)
        self.npts_opa = pc.Number(decimals=0, initial_value=21)
        input_table.add("npts", self.npts_opa)
        # delay
        self.delay = ScanAxisGUI('delay', "")
        self.delay.start.write(-3)
        self.delay.stop.write(3)
        self.delay.number.write(21)
        input_table.add('Delay', None)
        self.layout.addWidget(input_table)
        self.layout.addWidget(self.delay.widget)
        # constants
        self.constants = []
        input_table = pw.InputTable()
github wright-group / PyCMDS / autonomic / coset.py View on Github external
def create_frame(self):
        # get parent layout
        parent_widget = g.coset_widget.read()
        parent_widget.setLayout(QtWidgets.QHBoxLayout())
        parent_widget.layout().setContentsMargins(0, 10, 0, 0)
        parent_layout = parent_widget.layout()
        # create own layout
        self.tabs = QtWidgets.QTabWidget()
        # OPAs
        if len(opas.hardwares) > 0:
            self.create_hardware_frame('OPAs', opas.hardwares)
        # spectrometers
        if len(spectrometers.hardwares) > 0:
            self.create_hardware_frame('Spectrometers', spectrometers.hardwares)
        # delays
        if len(delays.hardwares) > 0:
            self.create_hardware_frame('Delays', delays.hardwares)
        # filters
        if len(filters.hardwares) > 0:
            self.create_hardware_frame('Filters', filters.hardwares)
        parent_layout.addWidget(self.tabs)
github wright-group / PyCMDS / autonomic / coset.py View on Github external
from PySide2 import QtWidgets, QtCore

import WrightTools as wt
import attune

import project
import project.classes as pc
import project.widgets as pw
import project.project_globals as g

# hardwares (also ensure present in GUI)
import hardware.opas.opas as opas
import hardware.spectrometers.spectrometers as spectrometers
import hardware.delays.delays as delays
import hardware.filters.filters as filters
all_hardwares = opas.hardwares + spectrometers.hardwares + delays.hardwares + filters.hardwares

main_dir = g.main_dir.read()
ini = project.ini_handler.Ini(os.path.join(main_dir, 'autonomic', 'coset.ini'))
ini.return_raw = True

# ensure that all elements are in the ini file
all_hardware_names = [hw.name for hw in all_hardwares]
ini.config.read(ini.filepath)
for section in all_hardware_names:
    if not ini.config.has_section(section):
        ini.config.add_section(section)
        ini.write(section, 'offset', 0.)
    # 'use' bool
    if not ini.config.has_option(section, 'use'):
        ini.write(section, 'use', False)
    # hardware names
github wright-group / PyCMDS / somatic / modules / motortune.py View on Github external
def run(self):
        # assemble axes
        axes = []
        # get OPA properties
        opa_name = self.aqn.read('motortune', 'opa name')
        opa_names = [h.name for h in opas.hardwares]
        opa_index = opa_names.index(opa_name)
        opa_hardware = opas.hardwares[opa_index]
        opa_friendly_name = opa_hardware.name
        curve = opa_hardware.curve
        motor_names = self.aqn.read('motortune', 'motor names')
        # tune points        
        if self.aqn.read('motortune', 'use tune points'):
            motors_excepted = []  # list of indicies  
            for motor_name in motor_names:
                if not self.aqn.read(motor_name, 'method') == 'Set':
                    motors_excepted.append(motor_name)
            if self.aqn.read('spectrometer', 'method') == 'Set':
                identity = opa_friendly_name + '=wm'
                hardware_dict = {opa_friendly_name: [opa_hardware, 'set_position_except', ['destination', motors_excepted]],
                                 'wm': [spectrometers.hardwares[0], 'set_position', None]}
                axis = acquisition.Axis(curve.setpoints[:], curve.setpoints.units, opa_friendly_name, identity, hardware_dict)
github wright-group / PyCMDS / somatic / modules / home.py View on Github external
def run(self):
        # get OPA properties
        opa_name = self.aqn.read('home', 'opa name')
        opa_names = [h.name for h in opas.hardwares]
        opa_index = opa_names.index(opa_name)
        opa_hardware = opas.hardwares[opa_index]
        opa_friendly_name = opa_hardware.name
        curve = opa_hardware.curve
        motor_names = self.aqn.read('home', 'motor names')
        # motor
        for motor_index, motor_name in enumerate(motor_names):
            if self.aqn.read(motor_name, 'home'):
                opa_hardware.home_motor([motor_name])
        opa_hardware.wait_until_still()
        if not self.stopped.read():
            self.finished.write(True)  # only if acquisition successfull