Package: lightcon
lightconInstallationPippip install lightconModuleslightcon.beam_alignmentBeam Alignment App REST clientlightcon.commonTools and converterslightcon.laser_clientsREST API clients for PHAROS and CARBIDE lasersExample:fromlightcon.laser_clientsimportCarbide,Pharosimporttimemy_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+1print("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:Pharosinitializedathttp://192.168.8.113:20020/v1/Pulsepickerratio:1SettingpulsepickertoPP=2...OKSettingpulsepickertoPP=1...OKEnablinglaseroutput...Waitingfor3s...Disablinglaseroutput...lightcon.harpiaHARPIA Service App REST clientlightcon.fast_daqInterface to the fast single-channel DAQ (E13-10023-02 or newer) DLL wrapper
Example:importlightcon.fast_daqfdw=lightcon.fast_daq.FastDaqWrapper()iffdw.is_connected():# sets missing trigger/clock timeout, after which TimeoutException is raisedfdw.set_timeout(1000)# choose channel 'PFI0' for external clocking, 'internal' for internal clocking. Use 'rising' or 'falling' for active_edgefdw.configure_sample_clock(channel='PFI0',active_edge='rising')# choose channel 'PFI0' for external clocking, 'internal' for internal triggeringfdw.configure_start_trigger(channel='internal')# sets external trigger delay for sampling to 100 nsfdw.set_external_trigger_delay(1000)# acquires n = 1000 samples as one-dimensional arraydata=fdw.get_daq_data(10)fdw.close()lightcon.harpia_daqInterface to the universal six-channel DAQ (PE04-005-04 or newer) DLL wrapper
Example:importlightcon.harpia_daq# provide in ascending order to keep plot labels rightenabled_channels=['AI0','AI1','AI3']hdw=lightcon.harpia_daq.HarpiaDaqWrapper()ifhdw.is_connected:# sets missing trigger/clock timeout, after which TimeoutException is raisedhdw.set_timeout(100)# enable analog input channelshdw.enable_channels(enabled_channels)# choose channel 'PFI0' - 'PFI5' for external clocking, 'internal' for internal clocking. Use 'rising' or 'falling' for active_edgehdw.configure_sample_clock(channel='internal',active_edge='falling')# choose channel 'PFI0' - 'PFI5' for external clocking, 'internal' for internal triggeringhdw.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_controllerTiming controller APIExample:importlightcon.timing_controllertc=TimingController()tc.connect()iftc.connected:print('Trigger source','EXTERNAL'iftc.get_trigger_source()==1else'INTERNAL{:}Hz'.format(tc.get_frequency()))print('\n'.join(['Channel{:}, delay{:}ns,{:}'.format(i,tc.get_delay(i),'ENABLED'iftc.get_enabled(i)==1else'DISABLED')foriin[1,2,3,4]]))Output:Connectedtotimer_stopwatchonCOM12(E131001401,firmwareversion:1.0.1)TriggersourceINTERNAL1750HzChannel1,delay0ns,DISABLEDChannel2,delay0ns,DISABLEDChannel3,delay0ns,DISABLEDChannel4,delay0ns,DISABLEDlightcon.eth_motor_boardEthMotorBoard APIExample:fromlightcon.eth_motor_boardimportEthMotorBoardemb=EthMotorBoard()print('Hardware version:',emb.send('HARDWARE_VERSION'))Output:SuccessfulllyconnectedtoEthMotorBoard,name:Beamalignment,firmwareversion:5.5.1Hardwareversion:E04-351-03CAN extension example:fromlightcon.eth_motor_boardimportEthMotorBoardfromlightcon.commonimportBytesArrayToFloatemb=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:SuccessfulllyconnectedtoEthMotorBoard,name:Beamalignment,firmwareversion:5.5.1Responsestatus0Responsedata[54,121,86,64]QuadrantdetectorSUMvoltage3.3511481285095215Vlightcon.wintopasWinTopas REST clientlightcon.camera_app_clientCameraApp REST clientlightcon.styleLight Conversion style for 1D graphsExample:importlightcon.stylelightcon.style.apply_style()...plotwhateverhere...lightcon.style.add_watermarks()