Skip to main content

A set of APIs to Light Conversion devices

Project 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:

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:

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:

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:

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:

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:

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:

from lightcon.eth_motor_board import EthMotorBoard

emb = EthMotorBoard()

print ('Hardware version:', emb.send('HARDWARE_VERSION'))

Output:

Successfullly connected to Beam alignment(firmware version: 5.5.1)
Hardware version: E04-351-03

CAN extension example:

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:

Successfullly connected to 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:

import lightcon.style

lightcon.style.apply_style()

...plot whatever here...

lightcon.style.add_watermarks()

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lightcon-1.1.61.tar.gz (220.6 kB view details)

Uploaded Source

Built Distribution

lightcon-1.1.61-py3-none-any.whl (233.9 kB view details)

Uploaded Python 3

File details

Details for the file lightcon-1.1.61.tar.gz.

File metadata

  • Download URL: lightcon-1.1.61.tar.gz
  • Upload date:
  • Size: 220.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8

File hashes

Hashes for lightcon-1.1.61.tar.gz
Algorithm Hash digest
SHA256 652bb372b3c3fc073dfaa80c17af823eeeab59b8d3197376a515c381d8a8bf7d
MD5 d8e826780a0bd291f9038cfaa95a99da
BLAKE2b-256 a4f3f65a5881a6e576b014b0ebc22911036421df788ccc45a4c7f8dd10690981

See more details on using hashes here.

File details

Details for the file lightcon-1.1.61-py3-none-any.whl.

File metadata

  • Download URL: lightcon-1.1.61-py3-none-any.whl
  • Upload date:
  • Size: 233.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8

File hashes

Hashes for lightcon-1.1.61-py3-none-any.whl
Algorithm Hash digest
SHA256 40d147d1ccfd69502e3c51e5f84b42aad36822e170c431b28bb6b555fa73d761
MD5 a47af2181b28e67eda285018c08bb2dd
BLAKE2b-256 eeb2bc23eed7ae0cb4bc1b3f11d1d9fd3a0592340f66ed3af78fb4ce02f82aa1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page