electronsourcecontroller2-tspspi


Nameelectronsourcecontroller2-tspspi JSON
Version 0.0.46 PyPI version JSON
download
home_pagehttps://github.com/tspspi/electronSourceController2
SummaryPython library and CLI for our custom electron gun slow-control system
upload_time2023-10-18 11:31:36
maintainer
docs_urlNone
authorThomas Spielauer
requires_python>=3.6
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Custom electron gun slow control Python communication library and GUI utlity

__Work in progress__

## Communication library

The communication library from ```eguncom.py``` implements most of the
communication protocol with the electron beam slow-control system.

### ```class ElectronGunControl```

The ```ElectronGunControl``` class implements asynchronous and synchronous
communication with the serially / USB attached control system. The port file
is passed to the constructor

```
ctrl = ElectronGunNotConnected(portFile = '/dev/...')
```

When no port file is passed it defaults to ```/dev/ttyU0```.

The exposed public methods are:

| Method                            | Description                                                                                                        | Synchronous      | Asynchronous callback                                |
| --------------------------------- | ------------------------------------------------------------------------------------------------------------------ | ---------------- | ---------------------------------------------------- |
| id()                              | Queries the current version                                                                                        | with sync = True | cbIdentify(controller, versionDate, versionRevision) |
| getPSUVoltage(channel)            | Queries the current voltage on the given channel                                                                   | with sync = True | cbVoltage(controller, channel, voltageVolts)         |
| getPSUCurrent(channel)            | Queries the current current on the given channel                                                                   | with sync = True | cbCurrent(controller, channel, currentMicroamps)     |
| getPSUModes()                     | Checks if PSUs are off, in voltage limited or current limited mode                                                 | with sync = True | cbPSUMode(controller, states)                        |
| getFilamentCurrent()              | Queries the filament current                                                                                       | with sync = True | cbFilamentCurrent(controller, current)               |
| off()                             | Disabled all high voltage and filament currents                                                                    |                  |                                                      |
| setPSUPolarity(channel, polarity) | Sets polarity to POLARITY_POS or POLARITY_NEG                                                                      |                  |                                                      |
| setPSUEnable(channel)             | Enables the given PSU channel                                                                                      |                  |                                                      |
| setPSUDisable(channel)            | Disables the given PSU channel                                                                                     |                  |                                                      |
| setPSUVoltage(channel, voltage)   | Sets the given channel to the given voltage                                                                        |                  |                                                      |
| setFilamentCurrent(currentMa)     | Sets the filament current or target current to the specified milliamps                                             |                  |                                                      |
| setFilamentOn()                   | Enabled the filament supply                                                                                        |                  |                                                      |
| setFilamentOff()                  | Disabled the filament supply                                                                                       |                  |                                                      |
| runInsulationTest()               | Runs an insulation test with low current limits                                                                    | with sync = True | cbInsulation(isOk, listOfShorts)                     |
| beamOn()                          | Runs the slow beam on sequence (slowly heating filament to previously set setFilamentCurrent, ramping up voltages) | with sync = True | cbBeamon()                                           |

### Usage example

#### Synchronous sample (USB / serial)

Example to perform a __synchronous__:

* Insulation check
* Startup for 100 mA beam current
* Looping through focus voltages
* Shutting down

```
with ElectronGunControl() as ctrl:
    # Currently a hack to wait for the control system to reset when using the
    # primary port

    time.sleep(5)

    # We want to see the voltages reported by the system so we
    # define a lambda that just prints the voltages while ramping up
    # during insulation test and beam on sequence

    ctrl.cbVoltage = lambda c,chan,v : print("Voltage for channel {} is {} V".format(chan, v))

    # Query it's identity
    ret = ctrl.id(sync = True)
    print("ID call returned {}".format(ret))

    # Run insulation test
    print("Running insulation test")
    ret = ctrl.runInsulationTest(sync = True)
    print("Insulation test returned: {}".format(ret))

    # Run beam on sequence ...
    ret = ctrl.beamOn(sync = True)
    print("Beam on successfully returned: {}".format(ret))

    print("Sweeping focus voltage")
    for focusVoltage in range(1750,1950):
        print("New focus voltage {}".format(focusVoltage))
        ctrl.setPSUVoltage(3, focusVoltage)
        time.sleep(1)

    ctrl.off()
    print("Off, done ...")
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/tspspi/electronSourceController2",
    "name": "electronsourcecontroller2-tspspi",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "",
    "author": "Thomas Spielauer",
    "author_email": "pypipackages01@tspi.at",
    "download_url": "https://files.pythonhosted.org/packages/0b/e6/29b72570482da5e7b3c2de0fcb7a273708681672ab5fe76b09e3885b86a9/electronsourcecontroller2-tspspi-0.0.46.tar.gz",
    "platform": null,
    "description": "# Custom electron gun slow control Python communication library and GUI utlity\n\n__Work in progress__\n\n## Communication library\n\nThe communication library from ```eguncom.py``` implements most of the\ncommunication protocol with the electron beam slow-control system.\n\n### ```class ElectronGunControl```\n\nThe ```ElectronGunControl``` class implements asynchronous and synchronous\ncommunication with the serially / USB attached control system. The port file\nis passed to the constructor\n\n```\nctrl = ElectronGunNotConnected(portFile = '/dev/...')\n```\n\nWhen no port file is passed it defaults to ```/dev/ttyU0```.\n\nThe exposed public methods are:\n\n| Method                            | Description                                                                                                        | Synchronous      | Asynchronous callback                                |\n| --------------------------------- | ------------------------------------------------------------------------------------------------------------------ | ---------------- | ---------------------------------------------------- |\n| id()                              | Queries the current version                                                                                        | with sync = True | cbIdentify(controller, versionDate, versionRevision) |\n| getPSUVoltage(channel)            | Queries the current voltage on the given channel                                                                   | with sync = True | cbVoltage(controller, channel, voltageVolts)         |\n| getPSUCurrent(channel)            | Queries the current current on the given channel                                                                   | with sync = True | cbCurrent(controller, channel, currentMicroamps)     |\n| getPSUModes()                     | Checks if PSUs are off, in voltage limited or current limited mode                                                 | with sync = True | cbPSUMode(controller, states)                        |\n| getFilamentCurrent()              | Queries the filament current                                                                                       | with sync = True | cbFilamentCurrent(controller, current)               |\n| off()                             | Disabled all high voltage and filament currents                                                                    |                  |                                                      |\n| setPSUPolarity(channel, polarity) | Sets polarity to POLARITY_POS or POLARITY_NEG                                                                      |                  |                                                      |\n| setPSUEnable(channel)             | Enables the given PSU channel                                                                                      |                  |                                                      |\n| setPSUDisable(channel)            | Disables the given PSU channel                                                                                     |                  |                                                      |\n| setPSUVoltage(channel, voltage)   | Sets the given channel to the given voltage                                                                        |                  |                                                      |\n| setFilamentCurrent(currentMa)     | Sets the filament current or target current to the specified milliamps                                             |                  |                                                      |\n| setFilamentOn()                   | Enabled the filament supply                                                                                        |                  |                                                      |\n| setFilamentOff()                  | Disabled the filament supply                                                                                       |                  |                                                      |\n| runInsulationTest()               | Runs an insulation test with low current limits                                                                    | with sync = True | cbInsulation(isOk, listOfShorts)                     |\n| beamOn()                          | Runs the slow beam on sequence (slowly heating filament to previously set setFilamentCurrent, ramping up voltages) | with sync = True | cbBeamon()                                           |\n\n### Usage example\n\n#### Synchronous sample (USB / serial)\n\nExample to perform a __synchronous__:\n\n* Insulation check\n* Startup for 100 mA beam current\n* Looping through focus voltages\n* Shutting down\n\n```\nwith ElectronGunControl() as ctrl:\n    # Currently a hack to wait for the control system to reset when using the\n    # primary port\n\n    time.sleep(5)\n\n    # We want to see the voltages reported by the system so we\n    # define a lambda that just prints the voltages while ramping up\n    # during insulation test and beam on sequence\n\n    ctrl.cbVoltage = lambda c,chan,v : print(\"Voltage for channel {} is {} V\".format(chan, v))\n\n    # Query it's identity\n    ret = ctrl.id(sync = True)\n    print(\"ID call returned {}\".format(ret))\n\n    # Run insulation test\n    print(\"Running insulation test\")\n    ret = ctrl.runInsulationTest(sync = True)\n    print(\"Insulation test returned: {}\".format(ret))\n\n    # Run beam on sequence ...\n    ret = ctrl.beamOn(sync = True)\n    print(\"Beam on successfully returned: {}\".format(ret))\n\n    print(\"Sweeping focus voltage\")\n    for focusVoltage in range(1750,1950):\n        print(\"New focus voltage {}\".format(focusVoltage))\n        ctrl.setPSUVoltage(3, focusVoltage)\n        time.sleep(1)\n\n    ctrl.off()\n    print(\"Off, done ...\")\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Python library and CLI for our custom electron gun slow-control system",
    "version": "0.0.46",
    "project_urls": {
        "Homepage": "https://github.com/tspspi/electronSourceController2"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c07532258ffd2b7e5e75fc6e97c530fe38793f3625f4c6373714717a50f92a4b",
                "md5": "19742d8c9ea97b128e8cb5105902dad9",
                "sha256": "de27b60e9be2d7ace7546c7ef50019a8d734188cfa0582d7add8ff69df504e78"
            },
            "downloads": -1,
            "filename": "electronsourcecontroller2_tspspi-0.0.46-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "19742d8c9ea97b128e8cb5105902dad9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 17526,
            "upload_time": "2023-10-18T11:31:34",
            "upload_time_iso_8601": "2023-10-18T11:31:34.344320Z",
            "url": "https://files.pythonhosted.org/packages/c0/75/32258ffd2b7e5e75fc6e97c530fe38793f3625f4c6373714717a50f92a4b/electronsourcecontroller2_tspspi-0.0.46-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0be629b72570482da5e7b3c2de0fcb7a273708681672ab5fe76b09e3885b86a9",
                "md5": "311a913199e74ec37da123ced0ca373c",
                "sha256": "d997f614dba74d751f77167c7c543b993693efa670957e79db7518b55b875020"
            },
            "downloads": -1,
            "filename": "electronsourcecontroller2-tspspi-0.0.46.tar.gz",
            "has_sig": false,
            "md5_digest": "311a913199e74ec37da123ced0ca373c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 18020,
            "upload_time": "2023-10-18T11:31:36",
            "upload_time_iso_8601": "2023-10-18T11:31:36.210800Z",
            "url": "https://files.pythonhosted.org/packages/0b/e6/29b72570482da5e7b3c2de0fcb7a273708681672ab5fe76b09e3885b86a9/electronsourcecontroller2-tspspi-0.0.46.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-18 11:31:36",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tspspi",
    "github_project": "electronSourceController2",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "electronsourcecontroller2-tspspi"
}
        
Elapsed time: 0.12649s