srsinst.rga


Namesrsinst.rga JSON
Version 0.3.8 PyPI version JSON
download
home_pageNone
SummaryInstrument driver package for Residual Gas Analyzers (RGA) from Stanford Research Systems
upload_time2025-07-15 22:28:11
maintainerNone
docs_urlNone
authorChulhoon Kim
requires_python>=3.7
licenseMIT license
keywords rga residual gas analyzer srs stanford research systems
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # `srsinst.rga`

`srsinst.rga` provides Python instrument classes to control and acquire mass spectra from 
[Stanford Research Systems (SRS) Residual Gas Analyzers (RGA)](https://thinksrs.com/products/rga.html).
It also provides tasks running in graphic user interface (GUI) environment based on 
[srsgui](https://thinksrs.github.io/srsgui/).  
For safe operation of an SRS RGA with this package, familiarize yourself with the RGA
[manual](https://thinksrs.com/downloads/pdfs/manuals/RGAm.pdf) and
the `srsinst.rga` [documentation](https://thinksrs.github.io/srsinst.rga/).

![screenshot](https://thinksrs.github.io/srsinst.rga/_images/comp-analysis-screenshot.png " ")

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

To use its full GUI application, create a virtual environment, if necessary,
and run Python package installer `pip` with *[full]* option from the command prompt.

    # To create a simple virtual environment (Optional) 
    # The activate command may differ depending on your computer operating systems.
    # Following is for Windows.

    python -m venv venv
    venv\scripts\activate

    # To install full GUI application

    python -m pip install srsinst.rga[full]


To install `srsinst.rga` as an instrument driver only, install WITHOUT the *[full]* option. 
Installation will be faster, because it does NOT install GUI related packages.

    python -m pip install srsinst.rga

To upgrade `srsinst.rga` to the latest version available, run `pip` with *--upgrade* argument.

  python -m pip install --upgrade srsinst.rga

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

    rga

If not,

    python -m srsinst.rga

It will start the GUI application.

- Connect to an RGA from the Instruments menu.
- Select a task from the Task menu.
- Press the apply button, if you change parameters of the task.
- Press the green arrow button to run the selected task. 

You can write your own task or modify an existing one and run it from the application.
Refer to [Custom tasks](https://thinksrs.github.io/srsinst.rga/custom_tasks.html) section
in the [documentation](https://thinksrs.github.io/srsinst.rga/) for details.

## Use `srsinst.rga` as instrument driver
* Start the Python program, or an editor of your choice to write a Python script.
* import the **RGA100** class from `srsinst.rga` package.
* Instantiate **RGA100** to connect to an SRS RGA.

        from srsinst.rga import RGA100

        # for TCPIP communication
        ip_address = '192.168.1.100'
        user_id = 'admin'
        password = 'admin'

        rga1 = RGA100('tcpip', ip_address, user_id, password)

        # for serial communication
        # Baud rate for RGA100 is fixed to 28800
        # rga2 = RGA('serial', /dev/ttyUSB0', 28800)  # for Linux serial communication

        rga2 = RGA('serial', 'COM3', 28800)  # for Windows serial communication

        # or initialize a RGA100 instance without connection, then connect.
        rga3 = RGA100()
        rga3.connect('tcpip', ip_address, user_id, password)

* Control ionizer parameters.

        # Set ionizer values
        rga1.ionizer.electron_energy = 70
        rga1.ionizer.ion_energy = 12
        rga1.ionizer.focus_voltage = 90

        # or
        rga1.ionizer.set_parameters(70, 12, 90)


        # Get the ionizer parameters
        a = rga1.ionizer.electron_energy
        b = rga1.ionizer.ion_energy
        c = rga1.ionizer.focus_voltage

        # or
        a, b, c = rga1.ionizer.get_parameters()


        # Set the filament emsission current.

        rga1.ionizer.emission_current = 1.0  # in the unit of mA
        rga1.ionizer.emission_current = 0.0  # It will turn off the filament.

        # or

        rga1.filament.turn_on()  # Turn on with the default emission cureent of 1 mA.
        rga1.filament.turn_off()


        # Read back the emission current
        a = rga1.ionizer.emission_current

* Control detector parameters.

        # Set CEM voltage to the calibrated CEM voltage, or 0 to turn off
        rga1.cem.voltage = rga1.cem.stored_voltage
        rga1.cem.voltage = 0

        # or simply turn on or off
        rga1.cem.turn_on()
        rga1.cem.turn_off()

        # Read back CEM voltage setting
        a = rga1.cem.voltage

* Control scan parameters.

        # Set scan parameters
        rga1.scan.initial_mass = 1
        rga1.scan.final_mass = 50
        rga1.scan.scan_speed = 3
        rga1.scan.resolution = 10  # steps_per_amu

        # or
        rga1.scan.set_parameters(1, 50, 3, 10)

        # Get scan parameters
        mi, mf, nf, sa = rga1.scan.get_parameters()

* Run an analog scan.

        analog_spectrum  = rga1.scan.get_analog_scan()
        spectrum_in_torr = rga1.scan.get_partial_pressure_corrected_spectrum(analog_spectrum)

        # Get the matching mass axis with the spectrum
        analog_mass_axis = rga1.scan.get_mass_axis(True)  # is it for analog scan? Yes.

* Run a histogram scan.

        histogram_spectrum  = rga1.scan.get_histogram_scan()

        # Get the matching mass axis with the spectrum
        histogram_mass_axis = rga1.get_mass_axis(False)  # is it for analog scan? No.

* Run a PvsT scan.

        masses_of_choice = [2, 18, 28, 32, 44]
        intensities = rga1.scan.get_multiple_mass_scan(masses_of_choice)

* Measure a single mass ion current of nitrogen at 28 amu

        intensity = rga1.scan.get_single_scan(28)

* Save the spectrum to a file.

        with open('spectrum.dat', 'w') as f:
            for x, y in zip(analog_mass_axis, analog_spectrum):
                f.write('{:.2f} {:.4e}\n'.format(x, y))

* Plot with [matplotlib](https://matplotlib.org/stable/users/getting_started/).

        import matplotlib.pyplot as plt
        plt.plot(analog_mass_axis, spectrum_in_torr)
        plt.show()

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "srsinst.rga",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "RGA, residual gas analyzer, SRS, Stanford Research Systems",
    "author": "Chulhoon Kim",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/d9/20/34bf878fae83625cc2bd3a7a09674307b7473f9c5b873823c79dae231a33/srsinst_rga-0.3.8.tar.gz",
    "platform": null,
    "description": "# `srsinst.rga`\r\n\r\n`srsinst.rga` provides Python instrument classes to control and acquire mass spectra from \r\n[Stanford Research Systems (SRS) Residual Gas Analyzers (RGA)](https://thinksrs.com/products/rga.html).\r\nIt also provides tasks running in graphic user interface (GUI) environment based on \r\n[srsgui](https://thinksrs.github.io/srsgui/).  \r\nFor safe operation of an SRS RGA with this package, familiarize yourself with the RGA\r\n[manual](https://thinksrs.com/downloads/pdfs/manuals/RGAm.pdf) and\r\nthe `srsinst.rga` [documentation](https://thinksrs.github.io/srsinst.rga/).\r\n\r\n![screenshot](https://thinksrs.github.io/srsinst.rga/_images/comp-analysis-screenshot.png \" \")\r\n\r\n## Installation\r\nYou need a working Python version 3.7 or later with `pip` (Python package installer) installed. \r\nIf you don't, [install Python 3](https://www.python.org/) to your system.\r\n\r\nTo use its full GUI application, create a virtual environment, if necessary,\r\nand run Python package installer `pip` with *[full]* option from the command prompt.\r\n\r\n    # To create a simple virtual environment (Optional) \r\n    # The activate command may differ depending on your computer operating systems.\r\n    # Following is for Windows.\r\n\r\n    python -m venv venv\r\n    venv\\scripts\\activate\r\n\r\n    # To install full GUI application\r\n\r\n    python -m pip install srsinst.rga[full]\r\n\r\n\r\nTo install `srsinst.rga` as an instrument driver only, install WITHOUT the *[full]* option. \r\nInstallation will be faster, because it does NOT install GUI related packages.\r\n\r\n    python -m pip install srsinst.rga\r\n\r\nTo upgrade `srsinst.rga` to the latest version available, run `pip` with *--upgrade* argument.\r\n\r\n  python -m pip install --upgrade srsinst.rga\r\n\r\n## Run `srsinst.rga` 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    rga\r\n\r\nIf not,\r\n\r\n    python -m srsinst.rga\r\n\r\nIt will start the GUI application.\r\n\r\n- Connect to an RGA from the Instruments menu.\r\n- Select a task from the Task menu.\r\n- Press the apply button, if you change parameters of the task.\r\n- Press the green arrow button to run the selected task. \r\n\r\nYou can write your own task or modify an existing one and run it from the application.\r\nRefer to [Custom tasks](https://thinksrs.github.io/srsinst.rga/custom_tasks.html) section\r\nin the [documentation](https://thinksrs.github.io/srsinst.rga/) for details.\r\n\r\n## Use `srsinst.rga` as instrument driver\r\n* Start the Python program, or an editor of your choice to write a Python script.\r\n* import the **RGA100** class from `srsinst.rga` package.\r\n* Instantiate **RGA100** to connect to an SRS RGA.\r\n\r\n        from srsinst.rga import RGA100\r\n\r\n        # for TCPIP communication\r\n        ip_address = '192.168.1.100'\r\n        user_id = 'admin'\r\n        password = 'admin'\r\n\r\n        rga1 = RGA100('tcpip', ip_address, user_id, password)\r\n\r\n        # for serial communication\r\n        # Baud rate for RGA100 is fixed to 28800\r\n        # rga2 = RGA('serial', /dev/ttyUSB0', 28800)  # for Linux serial communication\r\n\r\n        rga2 = RGA('serial', 'COM3', 28800)  # for Windows serial communication\r\n\r\n        # or initialize a RGA100 instance without connection, then connect.\r\n        rga3 = RGA100()\r\n        rga3.connect('tcpip', ip_address, user_id, password)\r\n\r\n* Control ionizer parameters.\r\n\r\n        # Set ionizer values\r\n        rga1.ionizer.electron_energy = 70\r\n        rga1.ionizer.ion_energy = 12\r\n        rga1.ionizer.focus_voltage = 90\r\n\r\n        # or\r\n        rga1.ionizer.set_parameters(70, 12, 90)\r\n\r\n\r\n        # Get the ionizer parameters\r\n        a = rga1.ionizer.electron_energy\r\n        b = rga1.ionizer.ion_energy\r\n        c = rga1.ionizer.focus_voltage\r\n\r\n        # or\r\n        a, b, c = rga1.ionizer.get_parameters()\r\n\r\n\r\n        # Set the filament emsission current.\r\n\r\n        rga1.ionizer.emission_current = 1.0  # in the unit of mA\r\n        rga1.ionizer.emission_current = 0.0  # It will turn off the filament.\r\n\r\n        # or\r\n\r\n        rga1.filament.turn_on()  # Turn on with the default emission cureent of 1 mA.\r\n        rga1.filament.turn_off()\r\n\r\n\r\n        # Read back the emission current\r\n        a = rga1.ionizer.emission_current\r\n\r\n* Control detector parameters.\r\n\r\n        # Set CEM voltage to the calibrated CEM voltage, or 0 to turn off\r\n        rga1.cem.voltage = rga1.cem.stored_voltage\r\n        rga1.cem.voltage = 0\r\n\r\n        # or simply turn on or off\r\n        rga1.cem.turn_on()\r\n        rga1.cem.turn_off()\r\n\r\n        # Read back CEM voltage setting\r\n        a = rga1.cem.voltage\r\n\r\n* Control scan parameters.\r\n\r\n        # Set scan parameters\r\n        rga1.scan.initial_mass = 1\r\n        rga1.scan.final_mass = 50\r\n        rga1.scan.scan_speed = 3\r\n        rga1.scan.resolution = 10  # steps_per_amu\r\n\r\n        # or\r\n        rga1.scan.set_parameters(1, 50, 3, 10)\r\n\r\n        # Get scan parameters\r\n        mi, mf, nf, sa = rga1.scan.get_parameters()\r\n\r\n* Run an analog scan.\r\n\r\n        analog_spectrum  = rga1.scan.get_analog_scan()\r\n        spectrum_in_torr = rga1.scan.get_partial_pressure_corrected_spectrum(analog_spectrum)\r\n\r\n        # Get the matching mass axis with the spectrum\r\n        analog_mass_axis = rga1.scan.get_mass_axis(True)  # is it for analog scan? Yes.\r\n\r\n* Run a histogram scan.\r\n\r\n        histogram_spectrum  = rga1.scan.get_histogram_scan()\r\n\r\n        # Get the matching mass axis with the spectrum\r\n        histogram_mass_axis = rga1.get_mass_axis(False)  # is it for analog scan? No.\r\n\r\n* Run a PvsT scan.\r\n\r\n        masses_of_choice = [2, 18, 28, 32, 44]\r\n        intensities = rga1.scan.get_multiple_mass_scan(masses_of_choice)\r\n\r\n* Measure a single mass ion current of nitrogen at 28 amu\r\n\r\n        intensity = rga1.scan.get_single_scan(28)\r\n\r\n* Save the spectrum to a file.\r\n\r\n        with open('spectrum.dat', 'w') as f:\r\n            for x, y in zip(analog_mass_axis, analog_spectrum):\r\n                f.write('{:.2f} {:.4e}\\n'.format(x, y))\r\n\r\n* Plot with [matplotlib](https://matplotlib.org/stable/users/getting_started/).\r\n\r\n        import matplotlib.pyplot as plt\r\n        plt.plot(analog_mass_axis, spectrum_in_torr)\r\n        plt.show()\r\n",
    "bugtrack_url": null,
    "license": "MIT license",
    "summary": "Instrument driver package for Residual Gas Analyzers (RGA) from Stanford Research Systems",
    "version": "0.3.8",
    "project_urls": {
        "documentation": "https://thinksrs.github.io/srsinst.rga",
        "homepage": "https://github.com/thinkSRS/srsinst.rga",
        "repository": "https://github.com/thinkSRS/srsinst.rga.git"
    },
    "split_keywords": [
        "rga",
        " residual gas analyzer",
        " srs",
        " stanford research systems"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "20d024759e6a47c8ed25fb9e7eed111bb245ce8a1d81a01a2869ae8af7d06b0a",
                "md5": "a591e06dcd722fe3d6fff797d7201183",
                "sha256": "4ab6539b985fa13920896cb2c9aaa6b5f42437f3ed6586fb1c5d655b5b43d274"
            },
            "downloads": -1,
            "filename": "srsinst_rga-0.3.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a591e06dcd722fe3d6fff797d7201183",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 55133,
            "upload_time": "2025-07-15T22:28:10",
            "upload_time_iso_8601": "2025-07-15T22:28:10.335013Z",
            "url": "https://files.pythonhosted.org/packages/20/d0/24759e6a47c8ed25fb9e7eed111bb245ce8a1d81a01a2869ae8af7d06b0a/srsinst_rga-0.3.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "d92034bf878fae83625cc2bd3a7a09674307b7473f9c5b873823c79dae231a33",
                "md5": "45962dceb17324c1e700cfe5d703eb0e",
                "sha256": "cb5d4cf796d1c6b7ed9b993e70333a077b2e7a49a8063162a84e93443dbd5270"
            },
            "downloads": -1,
            "filename": "srsinst_rga-0.3.8.tar.gz",
            "has_sig": false,
            "md5_digest": "45962dceb17324c1e700cfe5d703eb0e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 429162,
            "upload_time": "2025-07-15T22:28:11",
            "upload_time_iso_8601": "2025-07-15T22:28:11.817257Z",
            "url": "https://files.pythonhosted.org/packages/d9/20/34bf878fae83625cc2bd3a7a09674307b7473f9c5b873823c79dae231a33/srsinst_rga-0.3.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-15 22:28:11",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "thinkSRS",
    "github_project": "srsinst.rga",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "srsinst.rga"
}
        
Elapsed time: 2.32330s