srsinst.sr860


Namesrsinst.sr860 JSON
Version 0.3.1 PyPI version JSON
download
home_pageNone
SummaryInstrument driver package for the Lock-In Amplifiers, SR860 series from Stanford Research Systems
upload_time2024-08-29 23:42:45
maintainerNone
docs_urlNone
authorChulhoon Kim
requires_python>=3.7
licenseMIT license
keywords sr860 sr865a srs stanford research systems lock-in amplifier
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Srsinst.sr860

`srsinst.sr860` is a Python package to control and acquire data from  
[Stanford Research Systems (SRS) SR860 series Lock-In Amplifiers](https://thinksrs.com/products/sr865a.html):
SR860, SR865 and SR865A. If you prefer instructional videos, 
watch [these videos](https://www.youtube.com/playlist?list=PLnZT3yqji4iXZsnPbufkaAGROhm99UvKP).

![screenshot](https://github.com/thinkSRS/srsinst.sr860/blob/main/docs/_static/image/SR860_screenshot.png?raw=true " ").

## Installation
You need a working Python 3.7 or later with `pip` (Python package installer) 
installed. If you don't, [install Python](https://www.python.org/) to your system.

To install `srsinst.sr860` as an instrument driver , use Python package installer `pip` from the command line.

    python -m pip install srsinst.sr860

To use it as a GUI application, create a virtual environment, 
if necessary, and install:

    python -m pip install srsinst.sr860[full]

By default, srsinst.sr860 offers RS232 serial and VXI11 interfaces for communication.
To communication over GPIB or USB-TMC interface, PyVisa is required. Refer to 
[PyVisa documentation](https://pyvisa.readthedocs.io/en/latest/) for its installation.

## Run `srsinst.sr860` as GUI application
If the Python Scripts directory is in PATH environment variable,
Start the application by typing from the command line:

    sr860

If not,

    python -m srsinst.sr860

It will start the GUI application.

- Connect to an SR860 from the Instruments menu.
- Select a task from the Task menu.
- Press the green arrow to run the selected task. 

**Srsinst.sr860** is written based on [srsgui](https://pypi.org/project/srsgui/). 
You can write your own task or modify an existing one and run it from the GUI application, too.

## Use `srsinst.sr860` as instrument driver
* Start a Python interpreter, a Jupyter notebook, or an editor of your choice 
to write a Python script.
* import the **SR860** class from `sr860` package.
* Instantiate **SR860** to connect to an SR860 unit.

|

    C:\>python
    Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:37:02) [MSC v.1924 64 bit (AMD64)] on win32
    Type "help", "copyright", "credits" or "license" for more information.    
    >>>
    >>> from srsinst.sr860 import SR860
    >>> lockin = SR860('vxi11', '172.25.70.129')
    Stanford_Research_Systems,SR865A,002725,v1.34
    

**SR860** comprises multiple subcomponents, their associated commands and class methods.
 **Component** class has a convenience attribute `dir` to show its  available attributes 
 and methods in the Python dictionary format.

    >>> lockin.dir.keys()
    dict_keys(['components', 'commands', 'methods'])

**SR860** has more than 10 components holding their remote commands and methods
to configure  and acquire data from a SR860 unit.

    >>> lockin.dir['components'].keys()
    dict_keys(['reference', 'signal', 'output', 'aux', 
    'auto', 'display', 'chart', 'fft', 'scan', 'data', 
    'capture', 'stream', 'status'])

The components in **SR860** are organized in the same categories with 
the programming chapter (Chapter 4) in the 
[operational manual](https://thinksrs.com/downloads/pdfs/manuals/SR860m.pdf) 
for easy reference.

## Configure SR860 components
Let's configure the signal components. It has no subcomponents, and no associated 
class methods. Only commands are available.

    >>> lockin.signal.dir
    {'components': {}, 
     'commands': {'input_mode': ('DictCommand', 'IVMD'),
                  'voltage_input_mode': ('DictCommand', 'ISRC'),
                  'voltage_input_coupling': ('DictCommand', 'ICPL'),
                  'voltage_input_shield': ('DictCommand', 'IGND'), 
                  'voltage_input_range': ('DictCommand', 'IRNG'), 
                  'voltage_sensitivity': ('DictCommand', 'SCAL'), 
                  'current_input_gain': ('DictCommand', 'ICUR'), 
                  'current_sensitivity': ('DictCommand', 'SCAL'), 
                  'time_constant': ('DictCommand', 'OFLT'), 
                  'strength_indicator': ('IntGetCommand', 'ILVL'), 
                  'filter_slope': ('DictCommand', 'OFSL'), 
                  'sync_filter': ('BoolCommand', 'SYNC'), 
                  'advanced_filter': ('BoolCommand', 'ADVFILT'), 
                  'equivalent_noise_bandwidth': ('FloatCommand', 'ENBW')}, 
     'methods': []}
    >>>
    
If a command is a DictCommand instance, it uses mapped keys and values. 
Use get_command_info() to find out the mapping dictionary information.

    >>> lockin.signal.get_command_info('input_mode')
    {'command class': 'DictCommand', 
     'raw remote command': 'IVMD', 
     'conversion_dict': {'voltage': 0, 
                         'current': 1},
     'index_dict': None}
    >>> 

The command `locking.signal.input_mode` encapsulates the raw command 'IVMD' 
explained in the [manual](https://thinksrs.com/downloads/pdfs/manuals/SR860m.pdf)
chapter 4 page 111. Its integer values are mapped to 'voltage' and 'current'.

    >>> 
    >>> lockin.signal.input_mode
    'voltage'
    >>> lockin.signal.input_mode = 'current'
    >>>
    >>> print(lockin.signal.input_mode)
    current
    >>>

You can configure other parameters in the similar way.

    >>> lockin.signal.current_input_gain
    1000000.0
    >>> 
    >>> lockin.signal.current_sensitivity
    2e-08
    >>> lockin.signal.get_command_info('current_sensitivity')
    {'command class': 'DictCommand', 
     'raw remote command': 'SCAL', 
     'conversion_dict': {1e-06: 0, 5e-07: 1, 2e-07: 2, 1e-07: 3, 
                         5e-08: 4, 2e-08: 5, 1e-08: 6, 5e-09: 7, 
                         2e-09: 8, 1e-09: 9, 5e-10: 10, 2e-10: 11, 
                         1e-10: 12, 5e-11: 13, 2e-11: 14, 1e-11: 15, 
                         5e-12: 16, 2e-12: 17, 1e-12: 18, 5e-13: 19, 
                         2e-13: 20, 1e-13: 21, 5e-14: 22, 2e-14: 23, 
                         1e-14: 24, 5e-15: 25, 2e-15: 26, 1e-15: 27}, 
     'index_dict': None}
    >>> 
    >>> lockin.signal.current_input_sensitivity = 1e-7
    >>> lockin.signal.current_input_sensitivity
    1e-07
    >>>     
    >>> lockin.signal.time_constant
    0.001
    >>>     
    
## Data acquisition with SR860
**SR860** provides 3 ways to collect data from a unit: data transfer, 
data capture and data streaming. The usage of DataCapture and DataStreaming 
class is coded as tasks. Refer to the scripts under Tasks directory 
in srsinst.sr860 package. 

Usage of DataTransfer component for simple data transfer is  shown below.

    >>> lockin.data.dir
    {'components': {}, 
     'commands': {'channel_config': ('DictIndexCommand', 'CDSP'), 
                  'channel_value': ('FloatIndexGetCommand', 'OUTR'), 
                  'value': ('FloatIndexGetCommand', 'OUTP')}, 
     'methods': ['get_values', 'get_channel_values']}
    >>>
    >>> lockin.data.get_command_info('value')
    {'command class': 'FloatIndexGetCommand', 
     'raw remote command': 'OUTP', 
     'conversion_dict': None, 
     'index_dict': {'X': 0, 'Y': 1, 'R': 2, 'Theta': 3, 
                    'aux in 1': 4, 'aux in 2': 5, 'aux in 3': 6, 'aux in 4': 7, 
                    'X noise': 8, 'Y noise': 9, 'aux out 1': 10, 'aux out 2': 11, 
                    'Phase': 12, 'amplitude': 13, 'DC level': 14, 
                    'int. freq.': 15, 'ext. freq.': 16}}
    >>>
    >>> lockin.data.value['R']
    1.717368435e-11
    >>> lockin.data.value['Theta']
    115.52829742
    >>> lockin.data.value['int. freq.']
    99999.5
    >>> 

Note that the interaction with SR860s shown above is also available from the terminal 
in the GUI application. 


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "srsinst.sr860",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "SR860, SR865A, SRS, Stanford Research Systems, lock-in amplifier",
    "author": "Chulhoon Kim",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/7f/56/8ccc127d9be98ccb0c57500539f2a8ca13ba86245a0ca09b2c6a61be3132/srsinst_sr860-0.3.1.tar.gz",
    "platform": null,
    "description": "# Srsinst.sr860\r\n\r\n`srsinst.sr860` is a Python package to control and acquire data from  \r\n[Stanford Research Systems (SRS) SR860 series Lock-In Amplifiers](https://thinksrs.com/products/sr865a.html):\r\nSR860, SR865 and SR865A. If you prefer instructional videos, \r\nwatch [these videos](https://www.youtube.com/playlist?list=PLnZT3yqji4iXZsnPbufkaAGROhm99UvKP).\r\n\r\n![screenshot](https://github.com/thinkSRS/srsinst.sr860/blob/main/docs/_static/image/SR860_screenshot.png?raw=true \" \").\r\n\r\n## Installation\r\nYou need a working Python 3.7 or later with `pip` (Python package installer) \r\ninstalled. If you don't, [install Python](https://www.python.org/) to your system.\r\n\r\nTo install `srsinst.sr860` as an instrument driver , use Python package installer `pip` from the command line.\r\n\r\n    python -m pip install srsinst.sr860\r\n\r\nTo use it as a GUI application, create a virtual environment, \r\nif necessary, and install:\r\n\r\n    python -m pip install srsinst.sr860[full]\r\n\r\nBy default, srsinst.sr860 offers RS232 serial and VXI11 interfaces for communication.\r\nTo communication over GPIB or USB-TMC interface, PyVisa is required. Refer to \r\n[PyVisa documentation](https://pyvisa.readthedocs.io/en/latest/) for its installation.\r\n\r\n## Run `srsinst.sr860` as GUI application\r\nIf the Python Scripts directory is in PATH environment variable,\r\nStart the application by typing from the command line:\r\n\r\n    sr860\r\n\r\nIf not,\r\n\r\n    python -m srsinst.sr860\r\n\r\nIt will start the GUI application.\r\n\r\n- Connect to an SR860 from the Instruments menu.\r\n- Select a task from the Task menu.\r\n- Press the green arrow to run the selected task. \r\n\r\n**Srsinst.sr860** is written based on [srsgui](https://pypi.org/project/srsgui/). \r\nYou can write your own task or modify an existing one and run it from the GUI application, too.\r\n\r\n## Use `srsinst.sr860` as instrument driver\r\n* Start a Python interpreter, a Jupyter notebook, or an editor of your choice \r\nto write a Python script.\r\n* import the **SR860** class from `sr860` package.\r\n* Instantiate **SR860** to connect to an SR860 unit.\r\n\r\n|\r\n\r\n    C:\\>python\r\n    Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:37:02) [MSC v.1924 64 bit (AMD64)] on win32\r\n    Type \"help\", \"copyright\", \"credits\" or \"license\" for more information.    \r\n    >>>\r\n    >>> from srsinst.sr860 import SR860\r\n    >>> lockin = SR860('vxi11', '172.25.70.129')\r\n    Stanford_Research_Systems,SR865A,002725,v1.34\r\n    \r\n\r\n**SR860** comprises multiple subcomponents, their associated commands and class methods.\r\n **Component** class has a convenience attribute `dir` to show its  available attributes \r\n and methods in the Python dictionary format.\r\n\r\n    >>> lockin.dir.keys()\r\n    dict_keys(['components', 'commands', 'methods'])\r\n\r\n**SR860** has more than 10 components holding their remote commands and methods\r\nto configure  and acquire data from a SR860 unit.\r\n\r\n    >>> lockin.dir['components'].keys()\r\n    dict_keys(['reference', 'signal', 'output', 'aux', \r\n    'auto', 'display', 'chart', 'fft', 'scan', 'data', \r\n    'capture', 'stream', 'status'])\r\n\r\nThe components in **SR860** are organized in the same categories with \r\nthe programming chapter (Chapter 4) in the \r\n[operational manual](https://thinksrs.com/downloads/pdfs/manuals/SR860m.pdf) \r\nfor easy reference.\r\n\r\n## Configure SR860 components\r\nLet's configure the signal components. It has no subcomponents, and no associated \r\nclass methods. Only commands are available.\r\n\r\n    >>> lockin.signal.dir\r\n    {'components': {}, \r\n     'commands': {'input_mode': ('DictCommand', 'IVMD'),\r\n                  'voltage_input_mode': ('DictCommand', 'ISRC'),\r\n                  'voltage_input_coupling': ('DictCommand', 'ICPL'),\r\n                  'voltage_input_shield': ('DictCommand', 'IGND'), \r\n                  'voltage_input_range': ('DictCommand', 'IRNG'), \r\n                  'voltage_sensitivity': ('DictCommand', 'SCAL'), \r\n                  'current_input_gain': ('DictCommand', 'ICUR'), \r\n                  'current_sensitivity': ('DictCommand', 'SCAL'), \r\n                  'time_constant': ('DictCommand', 'OFLT'), \r\n                  'strength_indicator': ('IntGetCommand', 'ILVL'), \r\n                  'filter_slope': ('DictCommand', 'OFSL'), \r\n                  'sync_filter': ('BoolCommand', 'SYNC'), \r\n                  'advanced_filter': ('BoolCommand', 'ADVFILT'), \r\n                  'equivalent_noise_bandwidth': ('FloatCommand', 'ENBW')}, \r\n     'methods': []}\r\n    >>>\r\n    \r\nIf a command is a DictCommand instance, it uses mapped keys and values. \r\nUse get_command_info() to find out the mapping dictionary information.\r\n\r\n    >>> lockin.signal.get_command_info('input_mode')\r\n    {'command class': 'DictCommand', \r\n     'raw remote command': 'IVMD', \r\n     'conversion_dict': {'voltage': 0, \r\n                         'current': 1},\r\n     'index_dict': None}\r\n    >>> \r\n\r\nThe command `locking.signal.input_mode` encapsulates the raw command 'IVMD' \r\nexplained in the [manual](https://thinksrs.com/downloads/pdfs/manuals/SR860m.pdf)\r\nchapter 4 page 111. Its integer values are mapped to 'voltage' and 'current'.\r\n\r\n    >>> \r\n    >>> lockin.signal.input_mode\r\n    'voltage'\r\n    >>> lockin.signal.input_mode = 'current'\r\n    >>>\r\n    >>> print(lockin.signal.input_mode)\r\n    current\r\n    >>>\r\n\r\nYou can configure other parameters in the similar way.\r\n\r\n    >>> lockin.signal.current_input_gain\r\n    1000000.0\r\n    >>> \r\n    >>> lockin.signal.current_sensitivity\r\n    2e-08\r\n    >>> lockin.signal.get_command_info('current_sensitivity')\r\n    {'command class': 'DictCommand', \r\n     'raw remote command': 'SCAL', \r\n     'conversion_dict': {1e-06: 0, 5e-07: 1, 2e-07: 2, 1e-07: 3, \r\n                         5e-08: 4, 2e-08: 5, 1e-08: 6, 5e-09: 7, \r\n                         2e-09: 8, 1e-09: 9, 5e-10: 10, 2e-10: 11, \r\n                         1e-10: 12, 5e-11: 13, 2e-11: 14, 1e-11: 15, \r\n                         5e-12: 16, 2e-12: 17, 1e-12: 18, 5e-13: 19, \r\n                         2e-13: 20, 1e-13: 21, 5e-14: 22, 2e-14: 23, \r\n                         1e-14: 24, 5e-15: 25, 2e-15: 26, 1e-15: 27}, \r\n     'index_dict': None}\r\n    >>> \r\n    >>> lockin.signal.current_input_sensitivity = 1e-7\r\n    >>> lockin.signal.current_input_sensitivity\r\n    1e-07\r\n    >>>     \r\n    >>> lockin.signal.time_constant\r\n    0.001\r\n    >>>     \r\n    \r\n## Data acquisition with SR860\r\n**SR860** provides 3 ways to collect data from a unit: data transfer, \r\ndata capture and data streaming. The usage of DataCapture and DataStreaming \r\nclass is coded as tasks. Refer to the scripts under Tasks directory \r\nin srsinst.sr860 package. \r\n\r\nUsage of DataTransfer component for simple data transfer is  shown below.\r\n\r\n    >>> lockin.data.dir\r\n    {'components': {}, \r\n     'commands': {'channel_config': ('DictIndexCommand', 'CDSP'), \r\n                  'channel_value': ('FloatIndexGetCommand', 'OUTR'), \r\n                  'value': ('FloatIndexGetCommand', 'OUTP')}, \r\n     'methods': ['get_values', 'get_channel_values']}\r\n    >>>\r\n    >>> lockin.data.get_command_info('value')\r\n    {'command class': 'FloatIndexGetCommand', \r\n     'raw remote command': 'OUTP', \r\n     'conversion_dict': None, \r\n     'index_dict': {'X': 0, 'Y': 1, 'R': 2, 'Theta': 3, \r\n                    'aux in 1': 4, 'aux in 2': 5, 'aux in 3': 6, 'aux in 4': 7, \r\n                    'X noise': 8, 'Y noise': 9, 'aux out 1': 10, 'aux out 2': 11, \r\n                    'Phase': 12, 'amplitude': 13, 'DC level': 14, \r\n                    'int. freq.': 15, 'ext. freq.': 16}}\r\n    >>>\r\n    >>> lockin.data.value['R']\r\n    1.717368435e-11\r\n    >>> lockin.data.value['Theta']\r\n    115.52829742\r\n    >>> lockin.data.value['int. freq.']\r\n    99999.5\r\n    >>> \r\n\r\nNote that the interaction with SR860s shown above is also available from the terminal \r\nin the GUI application. \r\n\r\n",
    "bugtrack_url": null,
    "license": "MIT license",
    "summary": "Instrument driver package for the Lock-In Amplifiers, SR860 series from Stanford Research Systems",
    "version": "0.3.1",
    "project_urls": {
        "homepage": "https://github.com/thinkSRS/srsinst.sr860",
        "repository": "https://github.com/thinkSRS/srsinst.sr860.git"
    },
    "split_keywords": [
        "sr860",
        " sr865a",
        " srs",
        " stanford research systems",
        " lock-in amplifier"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ceddc865c3ea5dd9218fb20aa2940cd30e26f565a3a853756ab17a52eb50ce98",
                "md5": "f113104aa21d1d34d38da3d859d09414",
                "sha256": "50d6697ce1eff75c7277b80974b3baad768ca93bab23f5209024be3f4e6ec5eb"
            },
            "downloads": -1,
            "filename": "srsinst.sr860-0.3.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f113104aa21d1d34d38da3d859d09414",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 47377,
            "upload_time": "2024-08-29T23:42:43",
            "upload_time_iso_8601": "2024-08-29T23:42:43.694302Z",
            "url": "https://files.pythonhosted.org/packages/ce/dd/c865c3ea5dd9218fb20aa2940cd30e26f565a3a853756ab17a52eb50ce98/srsinst.sr860-0.3.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7f568ccc127d9be98ccb0c57500539f2a8ca13ba86245a0ca09b2c6a61be3132",
                "md5": "26f4710eddf5c316a845af5cede93e6c",
                "sha256": "f45dc66774b73d272e9c7e4a19ca00d7a0b528cd54a3fda1600724da90573934"
            },
            "downloads": -1,
            "filename": "srsinst_sr860-0.3.1.tar.gz",
            "has_sig": false,
            "md5_digest": "26f4710eddf5c316a845af5cede93e6c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 259509,
            "upload_time": "2024-08-29T23:42:45",
            "upload_time_iso_8601": "2024-08-29T23:42:45.541895Z",
            "url": "https://files.pythonhosted.org/packages/7f/56/8ccc127d9be98ccb0c57500539f2a8ca13ba86245a0ca09b2c6a61be3132/srsinst_sr860-0.3.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-29 23:42:45",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "thinkSRS",
    "github_project": "srsinst.sr860",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "srsinst.sr860"
}
        
Elapsed time: 0.31788s