# lightcon
## Installation
### Pip
```pip install lightcon```
<!--
## Changelog
### 1.1
#### Added
fast_daq module
examples/fast_daq_wrapper_example.py
#### Fixed
#### Removed
### 1.0
Initial release
<!--
#### Added
#### Fixed
#### Removed
-->
## Modules
### `lightcon.beam_alignment`
Beam Alignment App REST client
### `lightcon.common`
Tools and converters
### `lightcon.laser_clients`
REST API clients for PHAROS and CARBIDE lasers
Example:
```python
from lightcon.laser_clients import Carbide, Pharos
import time
my_laser = Pharos('192.168.8.113')
# my_laser = Carbide('192.168.8.113')
pp_ratio = my_laser.get_pp()
print("Pulse picker ratio: {:d}".format(pp_ratio))
target_pp_ratio = pp_ratio + 1
print("Setting pulse picker to PP={:d}...".format(
target_pp_ratio), end='', flush=True)
my_laser.set_pp(target_pp_ratio, blocking=True)
print("OK", flush=True)
print("Setting pulse picker to PP={:d}...".format(pp_ratio), end='', flush=True)
my_laser.set_pp(pp_ratio, blocking=True)
print("OK", flush=True)
print("Enabling laser output...")
my_laser.enable_output()
print("Waiting for 3s...")
time.sleep(3)
print("Disabling laser output...")
my_laser.close_output()
```
Output:
```python console
Pharos initialized at http://192.168.8.113:20020/v1/
Pulse picker ratio: 1
Setting pulse picker to PP=2...OK
Setting pulse picker to PP=1...OK
Enabling laser output...
Waiting for 3s...
Disabling laser output...
```
### `lightcon.harpia`
HARPIA Service App REST client
### `lightcon.fast_daq`
Interface to the fast single-channel DAQ (E13-10023-02 or newer) DLL wrapper
Example:
```python
import lightcon.fast_daq
fdw = lightcon.fast_daq.FastDaqWrapper()
if fdw.is_connected():
# sets missing trigger/clock timeout, after which TimeoutException is raised
fdw.set_timeout(1000)
# choose channel 'PFI0' for external clocking, 'internal' for internal clocking. Use 'rising' or 'falling' for active_edge
fdw.configure_sample_clock(channel = 'PFI0', active_edge = 'rising')
# choose channel 'PFI0' for external clocking, 'internal' for internal triggering
fdw.configure_start_trigger(channel = 'internal')
# sets external trigger delay for sampling to 100 ns
fdw.set_external_trigger_delay(1000)
# acquires n = 1000 samples as one-dimensional array
data = fdw.get_daq_data(10)
fdw.close()
```
### `lightcon.harpia_daq`
Interface to the universal six-channel DAQ (PE04-005-04 or newer) DLL wrapper
Example:
```python
import lightcon.harpia_daq
# provide in ascending order to keep plot labels right
enabled_channels = ['AI0', 'AI1', 'AI3']
hdw = lightcon.harpia_daq.HarpiaDaqWrapper()
if hdw.is_connected:
# sets missing trigger/clock timeout, after which TimeoutException is raised
hdw.set_timeout(100)
# enable analog input channels
hdw.enable_channels(enabled_channels)
# choose channel 'PFI0' - 'PFI5' for external clocking, 'internal' for internal clocking. Use 'rising' or 'falling' for active_edge
hdw.configure_sample_clock(channel = 'internal', active_edge = 'falling')
# choose channel 'PFI0' - 'PFI5' for external clocking, 'internal' for internal triggering
hdw.configure_start_trigger(channel = 'PFI0')
# acquires n=1000 samples and arranges to (m,n) two-dimensonal array, where m is number of enabled channels (in ascending order)
data = hdw.get_daq_data(1000)
```
### `lightcon.timing_controller`
Timing controller API
Example:
```python
import lightcon.timing_controller
tc = TimingController()
tc.connect()
if tc.connected:
print ('Trigger source', 'EXTERNAL' if tc.get_trigger_source() == 1 else 'INTERNAL {:} Hz'.format(tc.get_frequency()))
print ('\n'.join(['Channel {:}, delay {:} ns, {:}'.format(i, tc.get_delay(i), 'ENABLED' if tc.get_enabled(i)==1 else 'DISABLED') for i in [1,2,3,4]]))
```
Output:
```python console
Connected to timer_stopwatch on COM12 (E131001401, firmware version: 1.0.1)
Trigger source INTERNAL 1750 Hz
Channel 1, delay 0 ns, DISABLED
Channel 2, delay 0 ns, DISABLED
Channel 3, delay 0 ns, DISABLED
Channel 4, delay 0 ns, DISABLED
```
### `lightcon.eth_motor_board`
EthMotorBoard API
Example:
```python
from lightcon.eth_motor_board import EthMotorBoard
emb = EthMotorBoard()
print ('Hardware version:', emb.send('HARDWARE_VERSION'))
```
Output:
```python console
Successfullly connected to EthMotorBoard, name: Beam alignment, firmware version: 5.5.1
Hardware version: E04-351-03
```
CAN extension example:
```python
from lightcon.eth_motor_board import EthMotorBoard
from lightcon.common import BytesArrayToFloat
emb = EthMotorBoard()
can_output = emb.GetRegister(0x180, 0x0201, 2)
print ('Response status', can_output[0])
print ('Response data', can_output[1])
print ('Quadrant detector SUM voltage', BytesArrayToFloat(can_output[1]), 'V')
```
Output:
```python
Successfullly connected to EthMotorBoard, name: Beam alignment, firmware version: 5.5.1
Response status 0
Response data [54, 121, 86, 64]
Quadrant detector SUM voltage 3.3511481285095215 V
```
### `lightcon.wintopas`
WinTopas REST client
### `lightcon.camera_app_client`
CameraApp REST client
### `lightcon.style`
Light Conversion style for 1D graphs
Example:
```python
import lightcon.style
lightcon.style.apply_style()
...plot whatever here...
lightcon.style.add_watermarks()
```
Raw data
{
"_id": null,
"home_page": "https://bitbucket.org/harpiasoftware/light-conversion-apis.git",
"name": "lightcon",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": null,
"author": "Vytautas Butkus",
"author_email": "vytautas.butkus@lightcon.com",
"download_url": "https://files.pythonhosted.org/packages/5d/17/ae9030160bcee96f61b51a347339dd8c5350194e42f646cf8360ede45204/lightcon-1.5.9.tar.gz",
"platform": null,
"description": "# lightcon\r\n\r\n## Installation\r\n### Pip\r\n```pip install lightcon```\r\n<!--\r\n## Changelog\r\n### 1.1\r\n#### Added\r\nfast_daq module\r\nexamples/fast_daq_wrapper_example.py\r\n#### Fixed\r\n#### Removed\r\n\r\n### 1.0\r\nInitial release\r\n<!--\r\n#### Added\r\n#### Fixed\r\n#### Removed\r\n-->\r\n\r\n## Modules\r\n\r\n### `lightcon.beam_alignment`\r\nBeam Alignment App REST client\r\n\r\n### `lightcon.common`\r\nTools and converters\r\n\r\n### `lightcon.laser_clients`\r\nREST API clients for PHAROS and CARBIDE lasers\r\n\r\nExample:\r\n```python\r\nfrom lightcon.laser_clients import Carbide, Pharos\r\nimport time\r\n\r\nmy_laser = Pharos('192.168.8.113')\r\n# my_laser = Carbide('192.168.8.113')\r\n\r\npp_ratio = my_laser.get_pp()\r\nprint(\"Pulse picker ratio: {:d}\".format(pp_ratio))\r\n\r\ntarget_pp_ratio = pp_ratio + 1\r\nprint(\"Setting pulse picker to PP={:d}...\".format(\r\n target_pp_ratio), end='', flush=True)\r\n\r\nmy_laser.set_pp(target_pp_ratio, blocking=True)\r\nprint(\"OK\", flush=True)\r\n\r\nprint(\"Setting pulse picker to PP={:d}...\".format(pp_ratio), end='', flush=True)\r\nmy_laser.set_pp(pp_ratio, blocking=True)\r\nprint(\"OK\", flush=True)\r\n\r\nprint(\"Enabling laser output...\")\r\nmy_laser.enable_output()\r\n\r\nprint(\"Waiting for 3s...\")\r\ntime.sleep(3)\r\n\r\nprint(\"Disabling laser output...\")\r\nmy_laser.close_output()\r\n```\r\n\r\nOutput:\r\n```python console\r\nPharos initialized at http://192.168.8.113:20020/v1/\r\nPulse picker ratio: 1\r\nSetting pulse picker to PP=2...OK\r\nSetting pulse picker to PP=1...OK\r\nEnabling laser output...\r\nWaiting for 3s...\r\nDisabling laser output...\r\n```\r\n\r\n\r\n### `lightcon.harpia`\r\nHARPIA Service App REST client\r\n\r\n### `lightcon.fast_daq`\r\nInterface to the fast single-channel DAQ (E13-10023-02 or newer) DLL wrapper\r\nExample:\r\n```python\r\nimport lightcon.fast_daq\r\n\r\nfdw = lightcon.fast_daq.FastDaqWrapper()\r\n\r\nif fdw.is_connected():\r\n # sets missing trigger/clock timeout, after which TimeoutException is raised\r\n fdw.set_timeout(1000)\r\n \r\n # choose channel 'PFI0' for external clocking, 'internal' for internal clocking. Use 'rising' or 'falling' for active_edge\r\n fdw.configure_sample_clock(channel = 'PFI0', active_edge = 'rising')\r\n \r\n # choose channel 'PFI0' for external clocking, 'internal' for internal triggering\r\n fdw.configure_start_trigger(channel = 'internal')\r\n \r\n # sets external trigger delay for sampling to 100 ns\r\n fdw.set_external_trigger_delay(1000)\r\n \r\n # acquires n = 1000 samples as one-dimensional array\r\n data = fdw.get_daq_data(10)\r\n \r\n fdw.close()\r\n```\r\n\r\n### `lightcon.harpia_daq`\r\nInterface to the universal six-channel DAQ (PE04-005-04 or newer) DLL wrapper\r\nExample:\r\n```python\r\nimport lightcon.harpia_daq\r\n\r\n# provide in ascending order to keep plot labels right\r\nenabled_channels = ['AI0', 'AI1', 'AI3']\r\nhdw = lightcon.harpia_daq.HarpiaDaqWrapper()\r\n \r\nif hdw.is_connected:\r\n # sets missing trigger/clock timeout, after which TimeoutException is raised\r\n hdw.set_timeout(100)\r\n \r\n # enable analog input channels\r\n hdw.enable_channels(enabled_channels)\r\n \r\n # choose channel 'PFI0' - 'PFI5' for external clocking, 'internal' for internal clocking. Use 'rising' or 'falling' for active_edge\r\n hdw.configure_sample_clock(channel = 'internal', active_edge = 'falling')\r\n \r\n # choose channel 'PFI0' - 'PFI5' for external clocking, 'internal' for internal triggering\r\n hdw.configure_start_trigger(channel = 'PFI0')\r\n \r\n # acquires n=1000 samples and arranges to (m,n) two-dimensonal array, where m is number of enabled channels (in ascending order)\r\n data = hdw.get_daq_data(1000) \r\n```\r\n\r\n### `lightcon.timing_controller`\r\nTiming controller API\r\n\r\nExample:\r\n```python\r\nimport lightcon.timing_controller\r\n\r\ntc = TimingController()\r\ntc.connect()\r\n\r\nif tc.connected:\r\n print ('Trigger source', 'EXTERNAL' if tc.get_trigger_source() == 1 else 'INTERNAL {:} Hz'.format(tc.get_frequency()))\r\n print ('\\n'.join(['Channel {:}, delay {:} ns, {:}'.format(i, tc.get_delay(i), 'ENABLED' if tc.get_enabled(i)==1 else 'DISABLED') for i in [1,2,3,4]]))\r\n```\r\n\r\nOutput:\r\n```python console\r\nConnected to timer_stopwatch on COM12 (E131001401, firmware version: 1.0.1)\r\nTrigger source INTERNAL 1750 Hz\r\nChannel 1, delay 0 ns, DISABLED\r\nChannel 2, delay 0 ns, DISABLED\r\nChannel 3, delay 0 ns, DISABLED\r\nChannel 4, delay 0 ns, DISABLED\r\n```\r\n\r\n### `lightcon.eth_motor_board`\r\nEthMotorBoard API\r\n\r\nExample:\r\n```python\r\nfrom lightcon.eth_motor_board import EthMotorBoard\r\n\r\nemb = EthMotorBoard()\r\n\r\nprint ('Hardware version:', emb.send('HARDWARE_VERSION'))\r\n```\r\n\r\nOutput:\r\n```python console\r\nSuccessfullly connected to EthMotorBoard, name: Beam alignment, firmware version: 5.5.1\r\nHardware version: E04-351-03\r\n```\r\n\r\nCAN extension example:\r\n```python\r\nfrom lightcon.eth_motor_board import EthMotorBoard\r\nfrom lightcon.common import BytesArrayToFloat\r\n\r\nemb = EthMotorBoard()\r\n\r\ncan_output = emb.GetRegister(0x180, 0x0201, 2)\r\nprint ('Response status', can_output[0])\r\nprint ('Response data', can_output[1])\r\nprint ('Quadrant detector SUM voltage', BytesArrayToFloat(can_output[1]), 'V')\r\n```\r\n\r\nOutput:\r\n```python\r\nSuccessfullly connected to EthMotorBoard, name: Beam alignment, firmware version: 5.5.1\r\nResponse status 0\r\nResponse data [54, 121, 86, 64]\r\nQuadrant detector SUM voltage 3.3511481285095215 V\r\n```\r\n\r\n\r\n### `lightcon.wintopas`\r\nWinTopas REST client\r\n\r\n### `lightcon.camera_app_client`\r\nCameraApp REST client\r\n\r\n### `lightcon.style`\r\nLight Conversion style for 1D graphs\r\n\r\n\r\nExample:\r\n```python\r\nimport lightcon.style\r\n\r\nlightcon.style.apply_style()\r\n\r\n...plot whatever here...\r\n\r\nlightcon.style.add_watermarks()\r\n```\r\n\r\n\r\n\r\n",
"bugtrack_url": null,
"license": null,
"summary": "A set of APIs to Light Conversion devices",
"version": "1.5.9",
"project_urls": {
"Documentation": "https://lightconupdater.blob.core.windows.net/documentation/lightcon/index.html",
"Homepage": "https://bitbucket.org/harpiasoftware/light-conversion-apis.git"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b02b3bdf778a8ff87c5d520b6b3700a99bf8f565caee4d9691d147c2374094eb",
"md5": "c8c7b6483b0e597b8556a0fc94468543",
"sha256": "bb2a45a792ef02e484a3e39202919a4e91bcb0ccf11b549290946c9cea302a00"
},
"downloads": -1,
"filename": "lightcon-1.5.9-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c8c7b6483b0e597b8556a0fc94468543",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 179772,
"upload_time": "2024-11-21T11:07:22",
"upload_time_iso_8601": "2024-11-21T11:07:22.913569Z",
"url": "https://files.pythonhosted.org/packages/b0/2b/3bdf778a8ff87c5d520b6b3700a99bf8f565caee4d9691d147c2374094eb/lightcon-1.5.9-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5d17ae9030160bcee96f61b51a347339dd8c5350194e42f646cf8360ede45204",
"md5": "fcc07c53b8b648470699c633a94f8c54",
"sha256": "afaf4f9e58f6e262af9278762344e5182444593099fe32d65a00fd4694157825"
},
"downloads": -1,
"filename": "lightcon-1.5.9.tar.gz",
"has_sig": false,
"md5_digest": "fcc07c53b8b648470699c633a94f8c54",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 165237,
"upload_time": "2024-11-21T11:07:25",
"upload_time_iso_8601": "2024-11-21T11:07:25.007604Z",
"url": "https://files.pythonhosted.org/packages/5d/17/ae9030160bcee96f61b51a347339dd8c5350194e42f646cf8360ede45204/lightcon-1.5.9.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-21 11:07:25",
"github": false,
"gitlab": false,
"bitbucket": true,
"codeberg": false,
"bitbucket_user": "harpiasoftware",
"bitbucket_project": "light-conversion-apis",
"lcname": "lightcon"
}