rga


Namerga JSON
Version 0.1.14 PyPI version JSON
download
home_page
SummaryCommunication package for SRS RGA
upload_time2022-12-12 18:19:46
maintainer
docs_urlNone
authorChulhoon Kim
requires_python
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.
            # `rga`

`rga` is a Python 3 package to provide serial and Ethernet communication with 
[Stanford Research Systems (SRS) Residual Gas Analyzers (RGA)](https://thinksrs.com/products/rga.html).
`rga` is designed for multiple threads to access an SRS RGA communication port simultaneously.
To use this package safely, you need to be familiar with SRS RGA. You can download the 
[manual](https://thinksrs.com/downloads/pdfs/manuals/RGAm.pdf) for your reference. 

## Installation
You should have a working Python with `pip` (Python package installer) installed. If you don't, 
[install Python 3](https://realpython.com/installing-python/) to your system.
 
To install `rga`, use Python package installer `pip` from the command line.    

    python -m pip install rga 

## How to use
* Start the Python program, or an editor of your choice to write a Python script.
* import the **RGA** class from `rga` package
* Initialize of an **RGA** instance to connect to an SRS RGA.   
    
        from rga import RGA100 as RGA
        
        # for TCPIP communication
        ip_address = '192.168.1.100'
        user_id = 'admin'
        password = 'admin'
            
        rga1 = RGA('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 Rga instance without connection, then connect.
        rga3 = RGA()
        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.ionizer.turn_on_filament(1.0)  # in the unit of mA
        rga1.ionizer.turn_off_filament()
        
        
        # Get the emission current to check         
        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 mathing 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": "",
    "name": "rga",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "RGA,residual gas analyzer,SRS,Stanford Research Systems",
    "author": "Chulhoon Kim",
    "author_email": "chulhoonk@yahoo.com",
    "download_url": "https://files.pythonhosted.org/packages/a8/f2/45b7277a971ac72d6c78d49ed4bbb9d858210bd6a25caeb3c5c6c00a740f/rga-0.1.14.tar.gz",
    "platform": null,
    "description": "# `rga`\r\n\r\n`rga` is a Python 3 package to provide serial and Ethernet communication with \r\n[Stanford Research Systems (SRS) Residual Gas Analyzers (RGA)](https://thinksrs.com/products/rga.html).\r\n`rga` is designed for multiple threads to access an SRS RGA communication port simultaneously.\r\nTo use this package safely, you need to be familiar with SRS RGA. You can download the \r\n[manual](https://thinksrs.com/downloads/pdfs/manuals/RGAm.pdf) for your reference. \r\n\r\n## Installation\r\nYou should have a working Python with `pip` (Python package installer) installed. If you don't, \r\n[install Python 3](https://realpython.com/installing-python/) to your system.\r\n \r\nTo install `rga`, use Python package installer `pip` from the command line.    \r\n\r\n    python -m pip install rga \r\n\r\n## How to use\r\n* Start the Python program, or an editor of your choice to write a Python script.\r\n* import the **RGA** class from `rga` package\r\n* Initialize of an **RGA** instance to connect to an SRS RGA.   \r\n    \r\n        from rga import RGA100 as RGA\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 = RGA('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 Rga instance without connection, then connect.\r\n        rga3 = RGA()\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.ionizer.turn_on_filament(1.0)  # in the unit of mA\r\n        rga1.ionizer.turn_off_filament()\r\n        \r\n        \r\n        # Get the emission current to check         \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 mathing 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": "Communication package for SRS RGA",
    "version": "0.1.14",
    "split_keywords": [
        "rga",
        "residual gas analyzer",
        "srs",
        "stanford research systems"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "b30a5531d382b38b0b07a6db738b2604",
                "sha256": "e69e037db7d86943954ba643e4584eff000b025c28896b79e1bcdfeb9c719244"
            },
            "downloads": -1,
            "filename": "rga-0.1.14-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b30a5531d382b38b0b07a6db738b2604",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 30253,
            "upload_time": "2022-12-12T18:19:44",
            "upload_time_iso_8601": "2022-12-12T18:19:44.916990Z",
            "url": "https://files.pythonhosted.org/packages/7b/63/3d07f20704d375e9472e3e1a526d7bac0c2d7ed7a87873dada7ceb5c7a79/rga-0.1.14-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "28c60447c28bf01b7c8c33f25709af0a",
                "sha256": "67ac5feb018512118dbcc4036ef54e5c8e48926a4e9cd950bf58a04776879db5"
            },
            "downloads": -1,
            "filename": "rga-0.1.14.tar.gz",
            "has_sig": false,
            "md5_digest": "28c60447c28bf01b7c8c33f25709af0a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 26603,
            "upload_time": "2022-12-12T18:19:46",
            "upload_time_iso_8601": "2022-12-12T18:19:46.372546Z",
            "url": "https://files.pythonhosted.org/packages/a8/f2/45b7277a971ac72d6c78d49ed4bbb9d858210bd6a25caeb3c5c6c00a740f/rga-0.1.14.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-12 18:19:46",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "rga"
}
        
Elapsed time: 0.01867s