femto.waveguide module#

class Waveguide(name=None, scan=1, speed=1.0, samplesize=(100, 50), x_init=-2.0, y_init=0.0, z_init=None, shrink_correction_factor=1.0, lsafe=2.0, speed_closed=5, speed_pos=0.5, cmd_rate_max=1200, acc_max=500, end_off_sample=True, _x=<factory>, _y=<factory>, _z=<factory>, _f=<factory>, _s=<factory>, depth=0.035, radius=15, pitch=0.08, pitch_fa=0.127, int_dist=None, int_length=0.0, arm_length=0.0, dz_bridge=0.007, ltrench=0.0)#

Bases: LaserPath

Class that computes and stores the coordinates of an optical waveguide.

depth: float = 0.035#

Distance for sample’s bottom facet

radius: float = 15#

Curvature radius

pitch: float = 0.08#

Distance between adjacent modes

pitch_fa: float = 0.127#

Distance between fiber arrays’ adjacent modes (for fan-in, fan-out)

int_dist: float | None = None#

Directional Coupler’s interaction distance

int_length: float = 0.0#

Directional Coupler’s interaction length

arm_length: float = 0.0#

Mach-Zehnder interferometer’s length of central arm

dz_bridge: float = 0.007#

Maximum z-height for 3D bridges

ltrench: float = 0.0#

Length of straight segment to accomodate trenches

property dy_bend: float#

y-displacement of an S-bend.

Returns:

The difference between the waveguide pitch and the interaction distance.

Return type:

float

property dx_bend: float#

x-displacement of an S-bend.

Return type:

float

property dx_coupler: float#

x-displacement of a Directional Coupler.

Returns:

Sum of two x-displacements S-bend segments and the interaction distance straight segment.

Return type:

float

property dx_mzi: float#

x-displacement of a Mach-Zehnder Interferometer.

Returns:

Sum of two x-displacements Directional Coupler segments and the arm_length distance straight segment.

Return type:

float

static get_sbend_parameter(dy, radius)#

Compute the rotation angle, and x-displacement for a circular S-bend.

Parameters:
  • dy (float, optional) – Displacement along y-direction [mm].

  • radius (float, optional) – Curvature radius of the S-bend [mm]. The default value is self.radius

Returns:

rotation angle [rad], x-displacement [mm].

Return type:

tuple(float, float)

circ(initial_angle, final_angle, radius=None, shutter=1, speed=None)#

Add a circular curved path to the waveguide.

Computes the points in the xy-plane that connects two angles (initial_angle and final_angle) with a circular arc of a given radius. The transition speed and the shutter state during the movement can be given as input.

Parameters:
  • initial_angle (float) – Starting angle of the circular arc [radians].

  • final_angle (float) – Final angle of the circular arc [radians].

  • radius (float, optional) – Curvature radius [mm]. The default value is self.radius

  • shutter (int) – State of the shutter during the transition (0: ‘OFF’, 1: ‘ON’). The default value is 1.

  • speed (float, optional) – Translation speed [mm/s]. The default value is self.speed.

Return type:

The object itself.

arc_bend(dy, radius=None, shutter=1, speed=None)#

Concatenate two circular arc to make a circular S-bend.

The vertical displacement of the S-bend and the curvature radius are given as input. Starting and ending angles of the arcs are computed automatically.

The sign of dy encodes the direction of the S-bend:

  • dy > 0, upward S-bend

  • dy < 0, downward S-bend

Parameters:
  • dy (float) – Vertical displacement of the waveguide of the S-bend [mm].

  • radius (float, optional) – Curvature radius [mm]. The default value is self.radius.

  • shutter (int) – State of the shutter during the transition (0: ‘OFF’, 1: ‘ON’). The default value is 1.

  • speed (float, optional) – Translation speed [mm/s]. The default value is self.speed.

Return type:

The object itself.

arc_coupler(dy, radius=None, int_length=None, shutter=1, speed=None)#

Concatenates two circular S-bend to make a single mode of a circular Directional Coupler.

Parameters:
  • dy (float) – Vertical displacement of the waveguide of the S-bend [mm].

  • radius (float, optional) – Curvature radius [mm]. The default value is self.radius.

  • int_length (float, optional) – Length of the Directional Coupler’s straight interaction region [mm]. The default is self.int_length.

  • shutter (int) – State of the shutter during the transition (0: ‘OFF’, 1: ‘ON’). The default value is 1.

  • speed (float, optional) – Translation speed [mm/s]. The default value is self.speed.

Return type:

The object itself.

See also

circ

Add a circular curved path to the waveguide.

arc_bend

Concatenate two circular arc to make a circular S-bend.

arc_mzi(dy, radius=None, int_length=None, arm_length=None, shutter=1, speed=None)#

Concatenates two circular Directional Couplers curves to make a single mode of a circular Mach-Zehnder Interferometer.

Parameters:
  • dy (float) – Vertical displacement of the waveguide of the S-bend [mm].

  • radius (float, optional) – Curvature radius [mm]. The default value is self.radius.

  • int_length (float, optional) – Length of the Directional Coupler’s straight interaction region [mm]. The default is self.int_length.

  • arm_length (float) – Length of the Mach-Zehnder Interferometer’s straight arm [mm]. The default is self.arm_length.

  • shutter (int) – State of the shutter during the transition (0: ‘OFF’, 1: ‘ON’). The default value is 1.

  • speed (float, optional) – Translation speed [mm/s]. The default value is self.speed.

Return type:

The object itself.

See also

circ

Add a circular curved path to the waveguide.

arc_bend

Concatenate two circular arc to make a circular S-bend.

arc_coupler

Concatenates two circular S-bend to make a single mode of a circular Directional Coupler.

sin_bridge(dy, dz=None, disp_x=None, flat_peaks=0.0, omega=(1.0, 2.0), radius=None, shutter=1, speed=None)#

Add a sinusoidal curved path to the waveguide.

Combines sinusoidal bend curves in the xy- and xz-plane. The x-displacement between the initial and final point is identical to the one of the (circular) S-bend computed with the same radius.

The sign of the y, z displacement encodes the direction of the sin-bend:

  • d > 0, upward sin-bend

  • d < 0, downward sin-bend

Parameters:
  • dy (float) – y displacement of the sinusoidal-bend [mm].

  • dz (float, optional) – z displacement of the sinusoidal-bend [mm]. The default values is `self.dz_bridge.

  • disp_x (float, optional) – x-displacement for the sinusoidal bend. If the value is None (the default value), the x-displacement is computed with the formula for the circular S-bend.

  • flat_peaks (float) – Parameter that regulates the flatness of the sine’s peaks. The higher the parameter the more the sine function resembles a square function. If flat_peaks == 0 the sine function does not have flat peaks. The default value is 0.

  • omega (tuple(float, float)) – Frequency of the Sin-bend oscillations for y and z coordinates, respectively. The deafult values are fy = 1, fz = 1.

  • radius (float, optional) – Curvature radius [mm]. The default value is self.radius.

  • shutter (int) – State of the shutter during the transition (0: ‘OFF’, 1: ‘ON’). The default value is 1.

  • speed (float, optional) – Translation speed [mm/s]. The default value is self.speed.

Return type:

The object itself.

Notes

The radius is an effective radius. The given radius is used to compute the x displacement using the get_sbend_parameter method. The radius of curvature of the overall curve will be lower (in general) than the specified radius.

See also

get_sbend_parameter

Compute the rotation angle, and x-displacement for a circular S-bend.

sin_bend(dy, *, dz=0.0, disp_x=None, flat_peaks=0.0, omega=(1.0, 2.0), radius=None, shutter=1, speed=None)#
Return type:

Waveguide

sin_comp(dy, *, dz=0.0, disp_x=None, flat_peaks=0.0, omega=(2.0, 2.0), radius=None, shutter=1, speed=None)#
Return type:

Waveguide

sin_coupler(dy, radius=None, flat_peaks=0.0, int_length=None, shutter=1, speed=None)#

Concatenates two sinusoidal S-bend to make a single mode of a circular Directional Coupler.

Parameters:
  • dy (float) – Vertical displacement of the waveguide of the sinusoidal-bend [mm].

  • radius (float, optional) – Curvature radius [mm]. The default value is self.radius.

  • flat_peaks (float) – Parameter that regulates the flatness of the sine’s peaks. The higher the parameter the more the sine function resembles a square function. If flat_peaks == 0 the sine function does not have flat peaks. The default value is 0.

  • int_length (float, optional) – Length of the Directional Coupler’s straight interaction region [mm]. The default is self.int_length.

  • shutter (int) – State of the shutter during the transition (0: ‘OFF’, 1: ‘ON’). The default value is 1.

  • speed (float, optional) – Translation speed [mm/s]. The default value is self.speed.

Return type:

The object itself.

See also

sin_bridge

Add a sinusoidal curved path to the waveguide.

sin_bend

Concatenate two circular arc to make a sinusoidal S-bend.

sin_mzi(dy, radius=None, flat_peaks=0.0, int_length=None, arm_length=None, shutter=1, speed=None)#

Concatenates two sinusoidal Directional Couplers curves to make a single mode of a circular Mach-Zehnder Interferometer.

Parameters:
  • dy (float) – Vertical displacement of the waveguide of the sinusoidal-bend [mm].

  • radius (float, optional) – Curvature radius [mm]. The default value is self.radius.

  • flat_peaks (float) – Parameter that regulates the flatness of the sine’s peaks. The higher the parameter the more the sine function resembles a square function. If flat_peaks == 0 the sine function does not have flat peaks. The default value is 0.

  • int_length (float, optional) – Length of the Directional Coupler’s straight interaction region [mm]. The default is self.int_length.

  • arm_length (float, optional) – Length of the Mach-Zehnder Interferometer’s straight arm [mm]. The default is self.arm_length.

  • shutter (int, optional) – State of the shutter during the transition (0: ‘OFF’, 1: ‘ON’). The default value is 1.

  • speed (float, optional) – Translation speed [mm/s]. The default value is self.speed.

Return type:

The object itself.

See also

sin_bridge

Add a sinusoidal curved path to the waveguide.

sin_bend

Concatenate two circular arc to make a sinusoidal S-bend.

sin_coupler

Concatenates two sinusoidal S-bend to make a single mode of a circular Directional Coupler.

spline(dy, dz=0.0, disp_x=None, y_derivatives=((0.0, 0.0), (0.0, 0.0)), z_derivatives=((0.0, 0.0), (0.0, 0.0)), radius=None, shutter=1, speed=None)#

The function construct a piecewise 3D polynomial in the Bernstein basis, compatible with the specified values and derivatives at breakpoints. The user can specify the y and z displacements as well as the values of the first and second derivatives at the initial and final points (separaterly for the y and z coordinates).

Parameters:
  • dy (float) – y-displacement from initial position [mm].

  • dz (float, optional) – z-displacement from initial position [mm]. The default value is 0.0.

  • disp_x (float, optional) – The displacement along the x-axis. If not specified, it is calculated using the`get_sbend_parameter` method of the Waveguide class.

  • y_derivatives (tuple(tuple(float))) – Tuple containing the derivates for the y coordinate for the initial and final point. The number of derivatives is arbitrary. For example y_derivatives=((0.0, 1.0, 2.0), (0.0,-1.0,-0.2)) generates a polynomial spline curve f(x) such that f’(x0) = 0.0, f’’(x0) = 1.0, f’’’(x0) = 2.0, f’(x0+dx) = 0.0, f’’(x0+dx) = -1.0 and f’’’(x0+dx) = -0.2. The default value is ((0.0, 0.0), (0.0, 0.0)).

  • z_derivatives (tuple(tuple(float))) – Tuple containing the derivates for the z coordinate for the initial and final point. The number of derivatives is arbitrary. For example z_derivatives=((0.0, 1.0, 2.0), (0.0,-1.0,-0.2)) generates a polynomial spline curve f(x) such that f’(x0) = 0.0, f’’(x0) = 1.0, f’’’(x0) = 2.0, f’(x0+dx) = 0.0, f’’(x0+dx) = -1.0 and f’’’(x0+dx) = -0.2. The default value is ((0.0, 0.0), (0.0, 0.0)).

  • radius (float, optional) – Curvature radius [mm]. The default value is self.radius.

  • shutter (int) – State of the shutter during the transition (0: ‘OFF’, 1: ‘ON’). The default value is 1.

  • speed (float, optional) – Translation speed [mm/s]. The default value is self.speed.

Return type:

The object itself.

See also

scipy.interpolate.BPoly.from_derivatives

Construct piecewise polymonial from derivatives at breakpoints.

poly_bend(dy, dz=0.0, disp_x=None, *, y_derivatives=((0.0, 0.0), (0.0, 0.0)), z_derivatives=((0.0, 0.0), (0.0, 0.0)), radius=None, shutter=1, speed=None)#
Return type:

Waveguide

spline_bridge(dy, dz, disp_x=None, radius=None, shutter=1, speed=None)#

Connect two points in the xy plane with a Bezier curve bridge.

It takes in an initial position (x_0, y_0, z_0) and linear displacements in the x, y, and z directions. The final point of the curved is computed as (x_0 +d_x, y_0 +d_y, z_0 +d_z). The points are connected with a sequence of two spline segments.

The spline segments join at the peak of the bridge. In this point it is required to have a derivative along the z direction of df(x, z)/dz = 0 and a derivative along the y direction that is contiunous. This latter value is fixed to be df(x, y)/dx = disp_y/disp_y. The values of the first derivatives df(x, y)/dx, df(x, z)/dx are set to zero in the initial and final point of the spline bridge.

Parameters:
  • dy (float) – y-displacement from initial position [mm].

  • dz (float) – z-displacement from initial position [mm].

  • disp_x (float, optional) – x-displacement from initial position [mm].

  • radius (float, optional) – Curvature radius [mm]. The default value is self.radius.

  • shutter (int) – State of the shutter during the transition (0: ‘OFF’, 1: ‘ON’). The default value is 1.

  • speed (float, optional) – Translation speed [mm/s]. The default value is self.speed.

Return type:

The object itself.

See also

CubicSpline

Cubic spline data interpolator.

InterpolatedUnivariateSpline

1-D interpolating spline for a given set of data points.

spline

Connect the current position to a new point with a Bezier curve.

class NasuWaveguide(name=None, scan=1, speed=1.0, samplesize=(100, 50), x_init=-2.0, y_init=0.0, z_init=None, shrink_correction_factor=1.0, lsafe=2.0, speed_closed=5, speed_pos=0.5, cmd_rate_max=1200, acc_max=500, end_off_sample=True, _x=<factory>, _y=<factory>, _z=<factory>, _f=<factory>, _s=<factory>, depth=0.035, radius=15, pitch=0.08, pitch_fa=0.127, int_dist=None, int_length=0.0, arm_length=0.0, dz_bridge=0.007, ltrench=0.0, adj_scan_shift=(0, 0.0004, 0), adj_scan=5)#

Bases: Waveguide

Class that computes and stores the coordinates of a Nasu optical waveguide [1].

References

adj_scan_shift: tuple[float, float, float] = (0, 0.0004, 0)#

(x, y, z)-shifts between adjacent passes

adj_scan: int = 5#

Number of adjacent scans

property adj_scan_order: list[float]#

Scan order.

Given the number of adjacent scans it computes the list of adjacent scans as:

  • if self.adj_scan is odd

    [0, 1, -1, 2, -2, ...]

  • if self.adj_scan is even

    [0.5, -0.5, 1.5, -1.5, 2.5, -2.5, ...]

Returns:

Ordered list of adjacent scans.

Return type:

list(float)

coupler(param, nasu=False)#

Directional coupler.

Creates the two modes of a Directional Coupler. Waveguides can be standard multi-scan waveguides or Nasu Waveguides. The interaction region of the coupler is in the center of the sample.

Parameters:
  • param (dict) – Set of Waveguide parameters.

  • nasu (bool, optional) – Flag value for selecting Nasu Waveguide over standard multi-scan Waveguides. The default value is False.

Returns:

List of the two modes of the Directional Coupler.

Return type:

list(Waveguide) or list(NasuWaveguide)