Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Convenience wrapper of Toptica Laser SDK for controlling a Toptica CTL with a DLCpro

License

NotificationsYou must be signed in to change notification settings

asvela/dlc-control

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CodeFactor GradeMIT License

Convenience wrapper of Toptica Laser SDK for controlling a Toptica CTL with a DLCpro

Word of caution: This module controls potentially Class 4 lasers.Use is entirely on your own risk.

API documentation availablehere.Docs can be built withpython3 -m pdoc --html -o ./docs dlccontrol.py (needspdoc3 to be installed).

TheDLCcontrol class can read and control:

  • laser current on/off
  • wavelength setpoint for lasers that have this option
  • laser diode setpoint for lasers that have this option
  • analogue remote control settings (can control laser current and/or piezo simultaneously)
    • enable/disable
    • select input channel
    • set multiplier factor of the input voltage
  • internal scan settings (both for scanning the piezo and lasercurrent)
    • scan start
    • scan end
    • scan offset
    • scan amplitude
  • user level (normal, maintenance, service)
  • any other setting using theDLCcontrol.client attribute

The class will check that the wavelength/temperature setpoint and internal scansettings are within acceptable ranges (and raise aOutOfRangeError if not).

The module also provides some convenient dictionaries with all the settings itcan modify, these dictionaries can be saved with measurement data to make sureall settings are recorded. TheDLCcontrol class can dump these dicts tojson files.

Here are the parameters that can be saved, queried from the instrument andprinted withDLCcontrol.get_all_parameters(verbose=True):

-------------------------------------------------------timestamp      : 2021-11-29 22:42:02.707762scan: | enabled       : True | output channel: OutputChannel.PC | frequency     : 50.0000290562942 | amplitude     : 21.0 | offset        : 61.0 | start         : 50.5 | end           : 71.5analogue remote: | cc: |  | enabled: False |  | factor : 10.0 |  | signal : InputChannel.Fine1 | pc: |  | enabled: False |  | factor : 10.0 |  | signal : InputChannel.Fine2wavelength: | wl setpoint: 1550.46 | wl actual  : 1550.460841087153temperatures: | temp setpoint: None | temp actual  : None-------------------------------------------------------

Comparison to the Topica laser SDK

The module uses properties extensively (listed asInstance variables in thedocs), which means class attributes have setter and getter functions,which can be used like this:

importdlccontrolasctrlwithctrl.DLCcontrol("xx.xx.xx.xx")asdlc:# Change wavelength or laser diode temperature depending on how the unit is# controlledifdlc.wl_setting_present:dlc.wavelength_setpoint=1550actual_wl=dlc.wavelength_actualifdlc.temp_setting_present:dlc.temp_setpoint=20actual_temp=dlc.temp_actual# Set up a the analogue remote control sweeping the current with the# on input Fine1dlc.remote_select="CC"dlc.remote_signal="Fine1"dlc.remote_factor=10dlc.remote_enable=True# Use the internal voltage scan and gradually increase the scan amplitudedlc.scan_output_channel="PC"initial_amplitude=dlc.scan_amplitudedlc.scan_frequency=20foriinrange(10):dlc.scan_amplitude=idlc.scan_amplitude=initial_amplitude

Doing the same with the Toptica SDK would look like this (and this moduleis providing other features in addition to simplifying the syntax)

importtoptica.lasersdk.dlcpro.v2_4_0astopticaimporttoptica.lasersdk.decopasdecopwithtoptica.DLCpro(toptica.NetworkConnection("xx.xx.xx.xx"))asdlc:try:dlc.laser1.ctl.wavelength_set.set(float(1550))actual_wl=dlc.laser1.ctl.wavelength_act.get()exceptdecop.DecopError:passtry:dlc.laser1.dl.tc.temp_set(float(20))actual_temp=dlc.laser1.dl.tc.temp_act.get()exceptdecop.DecopError:pass# Set up a the analogue remote control sweeping the current with the# on input Fine1dlc.laser1.dl.cc.external_input.signal.set(0)dlc.laser1.dl.cc.external_input.factor.set(10)dlc.laser1.dl.cc.external_input.enable.set(True)# Use the internal voltage scan and gradually increase the scan amplitudedlc.laser1.scan.output_channel.set(50)initial_amplitude=dlc.laser1.scan.amplitude.get()dlc.laser1.scan.frequency.set(20)foriinrange(10):dlc.laser1.scan.amplitude.set(float(i))dlc.laser1.scan.amplitude.set(initial_amplitude)

Access any setting withclient

If you want to access other settings than what the wrapper conveniently offers,theDLCcontrol.client attribute is useful as it can give you access to any other setting:

importdlccontrolasctrlwithctrl.DLCcontrol("xx.xx.xx.xx")asdlc:print(dlc.client.get("serial-number"))# Need higher privilige to access the following commandsdlc.set_user_level(1,"password from manual")dlc.client.set("laser1:dl:cc:current-clip",250)dlc.client.set("laser1:dl:factory-settings:cc:current-clip",250)dlc.client.exec("laser-common:store-all")

Note also theDLCcontrol.set_user_level() function to elevate the connection for accessto protected settings.

More examples are in theexamples.py module.

Todos & known issues

  • The upper frequency limit for internal scan is set very low, find out whatthe actual limits are for the voltage and current scan
  • Handle limits for scan outputs toOutA andOutB (they can currentlybe used, just no checks on the range)
  • Make update of interdependent scan settings update all relevant privatedictionary entries
  • Set parameters from dict/file
  • Add property for setting the laser current when not scanning
  • Tests would be helpful...

Source, contributions & license

The source is available onGithub,please report issues there. Contributions are also welcome.The source code is licensed under the MIT license.

Changelog

  • v0.2.0 Nov 2021:
    • Added support for temperature tuned lasers, automatic discovery of whetherthe laser is wavelength or temperature controlled
    • Adding aclient attribute to theDLCcontrol class to access any laserattribute
    • Methods for setting and getting the user level for enabling change ofrestricted parameters
    • Parameters dictionary now includes timestamp of the parameter set
    • Black formatting

[8]ページ先頭

©2009-2025 Movatter.jp