toolbox_scs.misc.laser_utils

Module Contents

Functions

positionToDelay(pos[, origin, invert, reflections])

converts a motor position in mm into optical delay in picosecond

delayToPosition(delay[, origin, invert, reflections])

converts an optical delay in picosecond into a motor position in mm

degToRelPower(x[, theta0])

converts a half-wave plate position in degrees into relative power

fluenceCalibration(hwp, power_mW, npulses, w0x[, w0y, ...])

Given a measurement of relative powers or half wave plate angles

align_ol_to_fel_pId(ds[, ol_dim, fel_dim, offset, ...])

Aligns the optical laser (OL) pulse Ids to the FEL pulse Ids.

toolbox_scs.misc.laser_utils.positionToDelay(pos, origin=0, invert=True, reflections=1)[source]

converts a motor position in mm into optical delay in picosecond Inputs:

pos: array-like delay stage motor position origin: motor position of time zero in mm invert: bool, inverts the sign of delay if True reflections: number of bounces in the delay stage

Output:

delay in picosecond

toolbox_scs.misc.laser_utils.delayToPosition(delay, origin=0, invert=True, reflections=1)[source]

converts an optical delay in picosecond into a motor position in mm Inputs:

delay: array-like delay in ps origin: motor position of time zero in mm invert: bool, inverts the sign of delay if True reflections: number of bounces in the delay stage

Output:

delay in picosecond

toolbox_scs.misc.laser_utils.degToRelPower(x, theta0=0)[source]

converts a half-wave plate position in degrees into relative power between 0 and 1. Inputs:

x: array-like positions of half-wave plate, in degrees theta0: position for which relative power is zero

Output:

array-like relative power

toolbox_scs.misc.laser_utils.fluenceCalibration(hwp, power_mW, npulses, w0x, w0y=None, train_rep_rate=10, fit_order=1, plot=True, xlabel='HWP [%]')[source]

Given a measurement of relative powers or half wave plate angles and averaged powers in mW, this routine calculates the corresponding fluence and fits a polynomial to the data.

Parameters:
  • hwp (array-like (N)) – angle or relative power from the half wave plate

  • power_mW (array-like (N)) – measured power in mW by powermeter

  • npulses (int) – number of pulses per train during power measurement

  • w0x (float) – radius at 1/e^2 in x-axis in meter

  • w0y (float, optional) – radius at 1/e^2 in y-axis in meter. If None, w0y=w0x is assumed.

  • train_rep_rate (float) – repetition rate of the FEL, by default equals to 10 Hz.

  • fit_order (int) – order of the polynomial fit

  • plot (bool) – Plot the results if True

  • xlabel (str) – xlabel for the plot

  • Output

  • ------

  • F (ndarray (N)) – fluence in mJ/cm^2

  • fit_F (ndarray) – coefficients of the fluence polynomial fit

  • E (ndarray (N)) – pulse energy in microJ

  • fit_E (ndarray) – coefficients of the fluence polynomial fit

toolbox_scs.misc.laser_utils.align_ol_to_fel_pId(ds, ol_dim='ol_pId', fel_dim='sa3_pId', offset=0, fill_value=np.nan)[source]

Aligns the optical laser (OL) pulse Ids to the FEL pulse Ids. The new OL coordinates are calculated as ds[ol_dim] + ds[fel_dim][0] + offset. The ol_dim is then removed, and if the number of OL and FEL pulses are different, the missing values are replaced by fill_value (NaN by default).

Parameters:
  • ds (xarray.Dataset) – Dataset containing both OL and FEL dimensions

  • ol_dim (str) – name of the OL dimension

  • fel_dim (str) – name of the FEL dimension

  • offset (int) – offset added to the OL pulse Ids.

  • fill_value ((scalar or dict-like, optional)) – Value to use for newly missing values. If a dict-like, maps variable names to fill values. Use a data array’s name to refer to its values.

  • Output

  • ------

  • ds – The newly aligned dataset