From a4eed3fba6a92aaee59752cc37fb3916383708f5 Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Wed, 17 May 2023 04:34:24 +0000 Subject: automatic import of python-lightcon --- .gitignore | 1 + python-lightcon.spec | 746 +++++++++++++++++++++++++++++++++++++++++++++++++++ sources | 1 + 3 files changed, 748 insertions(+) create mode 100644 python-lightcon.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore index e69de29..8d74c77 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/lightcon-1.3.2.tar.gz diff --git a/python-lightcon.spec b/python-lightcon.spec new file mode 100644 index 0000000..8bfafb6 --- /dev/null +++ b/python-lightcon.spec @@ -0,0 +1,746 @@ +%global _empty_manifest_terminate_build 0 +Name: python-lightcon +Version: 1.3.2 +Release: 1 +Summary: A set of APIs to Light Conversion devices +License: MIT License +URL: https://bitbucket.org/harpiasoftware/light-conversion-apis.git +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/3e/1d/823ffc77c8a3290924f6ac9d0c1e1de39d21ce531e1527d87b234863fb4f/lightcon-1.3.2.tar.gz +BuildArch: noarch + +Requires: python3-pythonnet +Requires: python3-pyserial +Requires: python3-numpy +Requires: python3-matplotlib +Requires: python3-requests +Requires: python3-pytest +Requires: python3-scipy +Requires: python3-pillow + +%description +# lightcon + +## Installation +### Pip +```pip install lightcon``` + + +## 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() +``` + + + + + +%package -n python3-lightcon +Summary: A set of APIs to Light Conversion devices +Provides: python-lightcon +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-lightcon +# lightcon + +## Installation +### Pip +```pip install lightcon``` + + +## 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() +``` + + + + + +%package help +Summary: Development documents and examples for lightcon +Provides: python3-lightcon-doc +%description help +# lightcon + +## Installation +### Pip +```pip install lightcon``` + + +## 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() +``` + + + + + +%prep +%autosetup -n lightcon-1.3.2 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-lightcon -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed May 17 2023 Python_Bot - 1.3.2-1 +- Package Spec generated diff --git a/sources b/sources new file mode 100644 index 0000000..8e065e6 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +ae63bcd0833b2093c5a123cdf1409292 lightcon-1.3.2.tar.gz -- cgit v1.2.3