srsinst.sr542
srsinst.sr542 is a Python package to control the
SR542 Precision Optical Chopper
from Stanford Research Systems (SRS).
srsinst.sr542 is based on srsgui,
which you do not need to install separately,
but is included with this install.
Installation
You need a working Python 3.7 or later with pip (Python package installer) installed.
If you don't, install Python to your system.
To install srsinst.sr542 as an instrument driver , use Python package installer pip from the command line.
python -m pip install srsinst.sr542
To use it as a GUI application, create a virtual environment, if necessary, and install:
python -m pip install srsinst.sr542[full]
Run srsinst.sr542 as GUI application
If the Python Scripts directory is in your PATH environment variable, start the application by typing from the command line:
sr542
If not,
python -m srsinst.sr542
will start the GUI application.
Once running the GUI, you can:
- Connect to an SR542 from the Instruments menu.
- Select a task from the Task menu.
- Press the green arrow to run the selected task.
You can write your own task(s) or modify an existing one and run it from the GUI application, too.
Use srsinst.sr542 as instrument driver
- Start a Python interpreter, a Jupyter notebook, or an editor of your choice to write a Python script.
- Import the SR542 class from
srsinst.sr542package. - Create an instance of the SR542 and establish a remote connection.
|
C:\>python
Python 3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> from srsinst.sr542 import SR542
>>> chopper = SR542('serial', 'COM4', '115200')
>>> chopper.check_id()
('SR542', 's/n00001005', 'v1.0.5')
SR542 is comprised of multiple Components,
which provides groupings of related commands and class methods.
The Component class has a convenience attribute dir to show available attributes and methods in the Python dictionary format.
>>> chopper.dir.keys()
dict_keys(['components', 'commands', 'methods'])
SR542 has 5 components that contain remote commands and methods as organized in the Remote Operation chapter of the SR542 Operating Manual and Programming Reference.
>>> chopper.dir['components'].keys()
dict_keys(['config', 'operate', 'setup', 'interface', 'status'])
Configure SR542 components
Let's set the chopper Configuration.
>>> chopper.config.dir
{'components': {},
'commands': {'source': ('DictCommand', 'SRCE'),
'sync_edge': ('DictCommand', 'EDGE'),
'control_target': ('DictCommand', 'CTRL'),
'internal_freq': ('FloatCommand', 'IFRQ'),
'phase': ('FloatCommand', 'PHAS'),
'relative_phase': ('BoolCommand', 'RELP'),
'multiplier': ('IntCommand', 'MULT'),
'divisor': ('IntCommand', 'DIVR'),
'vco_frequency': ('FloatCommand', 'VCOS')},
'methods': ['jump_to_internal_frequency']
}
If a command is a DictCommand instance, it uses mapped keys and values.
Use get_command_info() to find out the mapping dictionary information.
>>> chopper.config.get_command_info('source')
{'command class': 'DictCommand',
'raw remote command': 'SRCE',
'set_dict': {'internal': 0, 'vco': 1, 'line': 2, 'external': 3},
'get_dict': {'internal': 0, 'vco': 1, 'line': 2, 'external': 3},
'index_dict': None
}
The command chopper.config.source encapsulates the raw command 'SRCE'
explained in the Setion 3.4.4 of the manual.
The token integers (0, 1, 2, and 3) are mapped to the strings ('internal', 'vco', 'line', and 'external')
>>> chopper.config.source
'internal'
>>> chopper.config.source = 'external'
>>> print(chopper.config.source)
external
You can configure other parameters in the similar way.
>>> chopper.config.internal_freq
100.0
>>> chopper.config.multiplier = 3
>>> chopper.config.get_command_info('sync_edge')
{'command class': 'DictCommand',
'raw remote command': 'EDGE',
'set_dict': {'rise': 0, 'fall': 1, 'sine': 2},
'get_dict': {'rise': 0, 'fall': 1, 'sine': 2},
'index_dict': None
}
>>> chopper.config.sync_edge = 'rise'
Metadata
Release files for srsinst.sr542 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| srsinst.sr542-0.1.0.tar.gz | 12.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| srsinst.sr542-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.5 kB
Release files / srsinst.sr542-0.1.0.tar.gz
| Download URL | srsinst.sr542-0.1.0.tar.gz |
|---|---|
| Size | 12.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fe53f8237e6783b54769260fb5bdc72174d95f67ea69448b7cf2de2f355907c8
|
|
BLAKE2b-256 checksum How to use checksums |
ede218d4599c7c4805db0408811521de5bc58343d04d199edfb5eca289c73af9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.3
|
Release files / srsinst.sr542-0.1.0-py3-none-any.whl
| Download URL | srsinst.sr542-0.1.0-py3-none-any.whl |
|---|---|
| Size | 11.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dda1af6b2482f92b05875ef6a1b28ec0915544bc1b37fb8cde1e36ce4eadc651
|
|
BLAKE2b-256 checksum How to use checksums |
a174b8bbfb50b739035de44410b61bf0744b99eda25ae2acb8a68205c529c368
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.3
|