Modules

#1 – the webcam

Here is the webcamWidget

class control.webcamWidget.LVWorker(main, webcam, *args, **kwargs)

Thread acquiring images from the webcam and sending it to the display widget

Parameters:
  • webcam (cv2.VideoCapture) – the webcam widget using this thread
  • webcam – the opencv instance of the webcam emitting the frames.
run()

Runs the worker. Reads a frame from the webcam every 10ms and sends it to the display with a Qt Signal

setExposure(value)
Parameters:value (float) – the new exposure time parameter
stop()

stops the frame acquisition

class control.webcamWidget.WebcamManager(main)

class handling a webcam and displaying its frames on screen

Parameters:main (TempestaGUI) – the main GUI.
liveview()

Method called when the LiveviewButton is pressed. Starts or Stops Liveview.

liveviewStart()

Starts liveview

liveviewStop()

Stops Liveview

setImage(array)
Parameters:array (numpy.ndarray) – the image to display
updateView()

Image update while in Liveview mode Not used anymore. Kept for archeologic purpose.

#2 – the scan

And here is the Scan widget.

class control.Scan_self_GUI.GraphFrame(pixel_cycle, *args, **kwargs)

Class is child of pg.GraphicsWindow and creats the plot that plots the preview of the pulses. Fcn update() updates the plot of “device” with signal “signal”

class control.Scan_self_GUI.ImageDisplay(main, shape)

Class creating a display for the images obtained either with an APD or PMT

Parameters:
  • main (ScanWidget) – main scan GUI
  • shape (tuple) – width and height of the image.
loadFolder()

Open a window to browse folders, and to select the folder in which images are to be saved.

saveImage()

Saves the current image conainted in self.array under a predefined name containing the main scanning parameters along with the date, under the tiff format.

set_line_value(line)

Inserts line at the proper position in self.array

Parameters:line (numpy.ndarray) – line of data to insert in the image.
set_pixel_value(val)

sets the value of one pixel from an input array. Not used anymore: point by point filling is too slow, we use set_line_value instead.

update_parameters(shape)

reshapes the array with the proper dimensions before acquisition

Parameters:shape (tuple) – width and height of the image.
class control.Scan_self_GUI.Line_scan(sample_rate)

Class creating signals to scan over a line

Parameters:sample_rate (float) – sample rate in samples per second
update(par_values)

creates the signals inside the dictionnary self.sig_dict

class control.Scan_self_GUI.PixelCycle(sample_rate)

Contains the digital signals for the pixel cycle, ie the process repeated for the acquisition of each pixel. The update function takes a parameter_values dict and updates the signal accordingly.

Parameters:sample_rate (float) – sample rate in samples per seconds
class control.Scan_self_GUI.Positionner(main)

This class communicates with the different analog outputs of the nidaq card. When not scanning, it drives the 3 axis x, y and z as well as the PMT sensitivity.

Parameters:main (ScanWidget) – main scan GUI
changePMTsensitivity()

Sets the sensitivity of the PMT to the value specified by the corresponding slider

editx()

Method called when a position for x is entered manually. Repositions the slider and initiates the movement of the stage

edity()

Method called when a position for y is entered manually. Repositions the slider and initiates the movement of the stage

editz()

Method called when a position for z is entered manually. Repositions the slider and initiates the movement of the stage

move()

moves the 3 axis to the positions specified by the sliders

move_x()

Specifies the movement of the x axis.

move_y()

Specifies the movement of the y axis.

move_z()

Specifies the movement of the z axis.

reset_channels()

Method called when the analog output channels need to be used by another resource, typically for scanning. Deactivates the POsitionner when it is active and reactives it when it is not, typically after a scan.

class control.Scan_self_GUI.RecordingThread(display)

Thread recording an image with an APD (Counter input) while the stage is scanning

Parameters:display (ImageDisplay) – ImageDisplay in scanwidget
run()

runs this thread to acquire the data in task

setParameters(n_frames, samples_per_channel, sample_rate)

prepares the thread for data acquisition with the different parameters values.

class control.Scan_self_GUI.RecordingThreadPMT(main)

Thread to record an image with the PMT while the stage is scanning

Parameters:main (ImageDisplay) – ImageDisplay in scanwidget
run()

runs this thread to acquire the data in task

setParameters(sequence_samples, samples_per_channel, sample_rate, samples_per_line)

prepares the thread for data acquisition with the different parameters values

Parameters:
  • sequence_samples (int) – number of samples for acquisition of 1 point
  • samples_per_channel (int) – Total number of samples generated per channel in the scan
  • sample_rate (int) – sample rate in number of samples per second
  • samples_per_line (int) – Total number of samples acquired or generate per line, to go back and forth.
stop()

Stops the worker

class control.Scan_self_GUI.ScanWidget(device, *args, **kwargs)

Class generating the GUI for stage scanning. This GUI is intended to specify the different parameters such as pixel dwell time, step size, scanning width and height etc. This class is intended as a widget in the bigger GUI.

Parameters:device (nidaqmx.Device) – NiDaq card.
AOchannelsChanged()

If one analog output channel is changed by the user, makes sure that 2 tasks are not sent to the same channel.

PrepAndRun()

Prepares Tempesta for scanning then starts the scan.

PreviewScan()

Displays a matplotlib graph representing the scanning’s trajectory.

ScanDone()

Called when sself.scanner is done

update_Scan(devices)

Creates a scan with the new parameters

class control.Scan_self_GUI.Scanner(device, stage_scan, pixel_cycle, current_aochannels, current_dochannels, main, *args, **kwargs)

This class plays the role of interface between the software and the hardware. It writes the different signals to the electronic cards and manages the timing of a scan.

Parameters:
  • device (nidaqmx.Device) – NiDaq card
  • stage_scan (StageScan) – object containing the analog signals to drive the stage
  • pixel_cycle (PixelCycle) – object containing the digital signals to drive the lasers at each pixel acquisition
  • current_aochannels (dict) – available analog output channels
  • current_dochannels (dict) – available digital output channels
  • main (ScanWidget) – main scan GUI
abort()

Stops the current scan. Stops the recording thread and calls the method finalize

done()

Once the different scans are in their initial position, starts again a new scanning session if in continuous scan mode. If not releases the channels for the positionner.

finalize()

Once the scanning is finished, sends the different devices to the position specified by the Positionner.

runScan()

Called when the run button is pressed. Prepares the display, the recording thread for acquisition, and writes the values of the scan in the corresponding tasks

class control.Scan_self_GUI.StageScan(main, sample_rate)

contains the analog signals in sig_dict. The update function takes the parameter_values and updates the signals accordingly It mostly contains a dictionnary containing the different scan types (x-y, x-z or line) acting as a switch case. The scan desired is selected by the user in the ScanWidget

Parameters:
  • main (ScanWidget) – main scan GUI
  • sample_rate (float) – sample rate in samples per second
set_scan_mode(mode)

specifies the scan mode: ‘xy scan’,’xz scan’ or ‘Line scan’

update(par_values)

updates the scan with the new parameter values.

class control.Scan_self_GUI.Wait_Thread(aotask)

Thread regulating the scanning timing. Is used to pass from one step to another after it is finished.

run()

runs until self.aotask is finished, and then emits the waitdoneSignal

stop()

stops the thread, called in case of manual interruption.

class control.Scan_self_GUI.xy_Scan(main, sample_rate)

Scanning in xy

Parameters:
  • main (ScanWidget) – main scan GUI
  • sample_rate (float) – sample rate in samples per second
update(par_values)

creates the signals inside the dictionnary self.sig_dict

:param dict par_values:contains the name and value of the scanning parameters

class control.Scan_self_GUI.xz_Scan(main, sample_rate)

Scanning in xz

update(par_values)

creates the signals inside self.sig_dict

:param dict par_values:contains the name and value of the scanning parameters

#3 – the SLM

class control.slmWidget.ArrowsControl(*args, **kwargs)

This widget creates four buttons able to move a circular phase mask with a tunable number of pixels. Useful to align the phase mask with the incident beam without touching any optics.

class control.slmWidget.SLMParamTree(*args, **kwargs)

Parameter Tree containing the different parameters for the SLM’s phase masks. These parameters are: Radius (int): of circular phase masks, in pixels sigma (float): std of the incident gaussian beam, to determine the inner radius of a top-hat phase mask, in pixels. angle (flaot): in an off-axis configuration. lambda depletion (nm): the wavelength incident on the SLM.

class control.slmWidget.slmWidget(slm, *args, **kwargs)

Class creating a GUI to control the phase pattern displayed by the SLM. In this version, it is optimized to display and address 2 masks independently. The whole image is separated in two: one left part and right part. One part is selected at a time and can be controlled with the arrows from ArrowsControl. :param SLMdisplay slm: instance of a second monitor generatd via slmpy. Communication with the SLM is initiated when Tempesta is started along with all other instruments

apply()

Applies a configuration to the SLM and changes the mask displayed

downClicked()

Moves the current Mask down

leftClicked()

Moves the current Mask left

loadParam()

loads the parameters from a previous configuration

moveMask(x, y)

Sends instruction to both the SLM and the display to move the corresponding mask when one arrow is pressed.

Parameters:
  • x (int) – new x position of the center of the Mask
  • y (int) – new y position of the center of the Mask
rightClicked()

Moves the current Mask right

save()

saves the current SLM configuration, in particular the position of the Masks. The informations are stored in a file ‘informations.bbn’ (arbitrary extension) with the module pickle.

setBlack()

Sets the current mask to a black (null phase) Mask. Useful to check the masks one by one

upClicked()

Moves the current Mask up

update()

When any parameter changes, sends the new image to the SLM and the display

#4 – the oscilloscope

We created this oscilloscope to monitor the signal from a PMT without touching to any cable. It doesn’t work if other analog output/input channels are open at the same time so we don’t use it anymore.

class oscilloscope.Oscilloscope

Class defining an oscilloscope to monitor a signal from a nidaq card

changeChannel(channel)

Switches the recording channel.

getData()

To record and display the signal. This script is called at regular time intervals.

start()

starts/stops the data acquisition