srsinst.sr542


Namesrsinst.sr542 JSON
Version 0.1.0 PyPI version JSON
download
home_page
SummaryInstrument driver package for precision optical chopper SR542 from Stanford Research Systems
upload_time2023-06-27 00:49:02
maintainer
docs_urlNone
authorChulhoon Kim, Andrew Berger
requires_python>=3.7
licenseMIT license
keywords sr542 srs stanford research systems optical chopper
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # srsinst.sr542

`srsinst.sr542` is a Python package to control the 
[SR542 Precision Optical Chopper](https://thinksrs.com/products/sr542.html)
from [Stanford Research Systems (SRS)](https://thinksrs.com/).

`srsinst.sr542` is based on [srsgui](https://pypi.org/project/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](https://www.python.org/) 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 **Component**s, 
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](https://www.thinksrs.com/downloads/pdfs/manuals/SR542m.pdf#page=44) 
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](https://www.thinksrs.com/downloads/pdfs/manuals/SR542m.pdf#page=51). 
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'




            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "srsinst.sr542",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "SR542,SRS,Stanford Research Systems,optical chopper",
    "author": "Chulhoon Kim, Andrew Berger",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/ed/e2/18d4599c7c4805db0408811521de5bc58343d04d199edfb5eca289c73af9/srsinst.sr542-0.1.0.tar.gz",
    "platform": null,
    "description": "# srsinst.sr542\r\n\r\n`srsinst.sr542` is a Python package to control the \r\n[SR542 Precision Optical Chopper](https://thinksrs.com/products/sr542.html)\r\nfrom [Stanford Research Systems (SRS)](https://thinksrs.com/).\r\n\r\n`srsinst.sr542` is based on [srsgui](https://pypi.org/project/srsgui/),\r\nwhich you do not need to install separately, \r\nbut is included with this install. \r\n\r\n## Installation\r\nYou need a working Python 3.7 or later with `pip` (Python package installer) installed. \r\nIf you don't, [install Python](https://www.python.org/) to your system.\r\n\r\nTo install `srsinst.sr542` as an instrument driver , use Python package installer `pip` from the command line.\r\n\r\n    python -m pip install srsinst.sr542\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.sr542[full]\r\n\r\n\r\n## Run `srsinst.sr542` as GUI application\r\nIf the Python Scripts directory is in your PATH environment variable,\r\nstart the application by typing from the command line:\r\n\r\n    sr542\r\n\r\nIf not,\r\n\r\n    python -m srsinst.sr542\r\n\r\nwill start the GUI application.\r\n\r\nOnce running the GUI, you can:\r\n- Connect to an SR542 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\nYou can write your own task(s) or modify an existing one and run it from the GUI application, too.\r\n\r\n## Use `srsinst.sr542` 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 **SR542** class from `srsinst.sr542` package.\r\n* Create an instance of the **SR542** and establish a remote connection.\r\n\r\n|\r\n\r\n    C:\\>python\r\n    Python 3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)] on win32\r\n    Type \"help\", \"copyright\", \"credits\" or \"license\" for more information. \r\n    >>>\r\n    >>> from srsinst.sr542 import SR542\r\n    >>> chopper = SR542('serial', 'COM4', '115200')\r\n    >>> chopper.check_id()\r\n    ('SR542', 's/n00001005', 'v1.0.5')\r\n    \r\n\r\n**SR542** is comprised of multiple **Component**s, \r\nwhich provides groupings of related commands and class methods.\r\n The **Component** class has a convenience attribute `dir` to show  available attributes and methods in the Python dictionary format.\r\n\r\n    >>> chopper.dir.keys()\r\n    dict_keys(['components', 'commands', 'methods'])\r\n\r\n**SR542** has 5 components that contain remote commands and methods\r\nas organized in the [Remote Operation chapter](https://www.thinksrs.com/downloads/pdfs/manuals/SR542m.pdf#page=44) \r\nof the *SR542 Operating Manual and Programming Reference*.\r\n\r\n    >>> chopper.dir['components'].keys()\r\n    dict_keys(['config', 'operate', 'setup', 'interface', 'status'])\r\n\r\n## Configure SR542 components\r\nLet's set the chopper Configuration.\r\n\r\n    >>> chopper.config.dir\r\n    {'components': {}, \r\n     'commands': {'source': ('DictCommand', 'SRCE'), \r\n                  'sync_edge': ('DictCommand', 'EDGE'), \r\n                  'control_target': ('DictCommand', 'CTRL'),\r\n                  'internal_freq': ('FloatCommand', 'IFRQ'), \r\n                  'phase': ('FloatCommand', 'PHAS'), \r\n                  'relative_phase': ('BoolCommand', 'RELP'), \r\n                  'multiplier': ('IntCommand', 'MULT'), \r\n                  'divisor': ('IntCommand', 'DIVR'), \r\n                  'vco_frequency': ('FloatCommand', 'VCOS')}, \r\n      'methods': ['jump_to_internal_frequency']\r\n    }\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    >>> chopper.config.get_command_info('source')\r\n    {'command class': 'DictCommand', \r\n     'raw remote command': 'SRCE', \r\n     'set_dict': {'internal': 0, 'vco': 1, 'line': 2, 'external': 3},\r\n     'get_dict': {'internal': 0, 'vco': 1, 'line': 2, 'external': 3}, \r\n     'index_dict': None\r\n    }\r\n\r\nThe command `chopper.config.source` encapsulates the raw command 'SRCE' \r\nexplained in the [Setion 3.4.4 of the manual](https://www.thinksrs.com/downloads/pdfs/manuals/SR542m.pdf#page=51). \r\nThe token integers (0, 1, 2, and 3) are mapped to the strings (`'internal'`, `'vco'`, `'line'`, and `'external'`)\r\n\r\n    >>> chopper.config.source\r\n    'internal'\r\n    >>> chopper.config.source = 'external'    \r\n    >>> print(chopper.config.source)\r\n    external    \r\n\r\nYou can configure other parameters in the similar way.\r\n\r\n    >>> chopper.config.internal_freq\r\n    100.0    \r\n    >>> chopper.config.multiplier = 3\r\n    >>> chopper.config.get_command_info('sync_edge')   \r\n    {'command class': 'DictCommand', \r\n     'raw remote command': 'EDGE', \r\n     'set_dict': {'rise': 0, 'fall': 1, 'sine': 2}, \r\n     'get_dict': {'rise': 0, 'fall': 1, 'sine': 2}, \r\n     'index_dict': None\r\n    }  \r\n    >>> chopper.config.sync_edge = 'rise'\r\n\r\n\r\n\r\n",
    "bugtrack_url": null,
    "license": "MIT license",
    "summary": "Instrument driver package for precision optical chopper SR542 from Stanford Research Systems",
    "version": "0.1.0",
    "project_urls": null,
    "split_keywords": [
        "sr542",
        "srs",
        "stanford research systems",
        "optical chopper"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a174b8bbfb50b739035de44410b61bf0744b99eda25ae2acb8a68205c529c368",
                "md5": "65be46318c86244a3af0c7fb9e77b33a",
                "sha256": "dda1af6b2482f92b05875ef6a1b28ec0915544bc1b37fb8cde1e36ce4eadc651"
            },
            "downloads": -1,
            "filename": "srsinst.sr542-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "65be46318c86244a3af0c7fb9e77b33a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 11289,
            "upload_time": "2023-06-27T00:49:01",
            "upload_time_iso_8601": "2023-06-27T00:49:01.465383Z",
            "url": "https://files.pythonhosted.org/packages/a1/74/b8bbfb50b739035de44410b61bf0744b99eda25ae2acb8a68205c529c368/srsinst.sr542-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ede218d4599c7c4805db0408811521de5bc58343d04d199edfb5eca289c73af9",
                "md5": "11f7d30cc930b3eed774266905a2b282",
                "sha256": "fe53f8237e6783b54769260fb5bdc72174d95f67ea69448b7cf2de2f355907c8"
            },
            "downloads": -1,
            "filename": "srsinst.sr542-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "11f7d30cc930b3eed774266905a2b282",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 12162,
            "upload_time": "2023-06-27T00:49:02",
            "upload_time_iso_8601": "2023-06-27T00:49:02.910789Z",
            "url": "https://files.pythonhosted.org/packages/ed/e2/18d4599c7c4805db0408811521de5bc58343d04d199edfb5eca289c73af9/srsinst.sr542-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-27 00:49:02",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "srsinst.sr542"
}
        
Elapsed time: 0.08594s