Skip to main content

Instrument driver package for precision optical chopper SR542 from Stanford Research Systems

Project description

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.sr542 package.
  • 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'

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

srsinst.sr542-0.1.0.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

srsinst.sr542-0.1.0-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file srsinst.sr542-0.1.0.tar.gz.

File metadata

  • Download URL: srsinst.sr542-0.1.0.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.3

File hashes

Hashes for srsinst.sr542-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fe53f8237e6783b54769260fb5bdc72174d95f67ea69448b7cf2de2f355907c8
MD5 11f7d30cc930b3eed774266905a2b282
BLAKE2b-256 ede218d4599c7c4805db0408811521de5bc58343d04d199edfb5eca289c73af9

See more details on using hashes here.

File details

Details for the file srsinst.sr542-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for srsinst.sr542-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dda1af6b2482f92b05875ef6a1b28ec0915544bc1b37fb8cde1e36ce4eadc651
MD5 65be46318c86244a3af0c7fb9e77b33a
BLAKE2b-256 a174b8bbfb50b739035de44410b61bf0744b99eda25ae2acb8a68205c529c368

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page