Skip to content

WinCamD¤

Connect to a beam-profiling camera from DataRay.

Tested with the WinCamD-LCM-8.0E45 (x64) software version.

DataRay (SDK) ¤

DataRay(equipment: Equipment)

              flowchart LR
              msl.equipment_resources.dataray.wincamd.DataRay[DataRay]
              msl.equipment.interfaces.sdk.SDK[SDK]
              msl.equipment.schema.Interface[Interface]

                              msl.equipment.interfaces.sdk.SDK --> msl.equipment_resources.dataray.wincamd.DataRay
                                msl.equipment.schema.Interface --> msl.equipment.interfaces.sdk.SDK
                



              click msl.equipment_resources.dataray.wincamd.DataRay href "" "msl.equipment_resources.dataray.wincamd.DataRay"
              click msl.equipment.interfaces.sdk.SDK href "" "msl.equipment.interfaces.sdk.SDK"
              click msl.equipment.schema.Interface href "" "msl.equipment.schema.Interface"
            

Connect to a beam-profiling camera from DataRay.

The bitness (32 or 64 bit) of the DataRay Beam Profiling Software that is installed must match the bitness of the Python interpreter that is used to load the DATARAYOCX library.

Regular-expression patterns that are used to select this Resource when connect() is called.

manufacturer=r"Data\s*Ray"
model=r""

Parameters:

Name Type Description Default
equipment Equipment

An Equipment instance.

required

A Connection instance supports the following properties for the DataRay class.

Connection Properties:

Name Type Description
area_filter int | None

Area filter:

  • 1: 1 pixel
  • 2: 3 pixels
  • 3: 5 pixels
  • 4: 7 pixels
  • 5: 9 pixels

If None, use the value saved in the device firmware. Default: None

camera_index int

The camera to use (between 0 and 7). Default: 0

centroid_method int | None

The centroid method to use (0, 1 or 2). If None, use the value saved in the device firmware. Default: None

full_scale_filter float | None

Percent full scale filter (0, 0.1, 0.2, 0.5, 1, 2, 5 or 10). If None, use the value saved in the device firmware. Default: None

major_minor_method int | None

The major/minor method to use (0, 1 or 2). If None, use the value saved in the device firmware. Default: None

plateau_uniformity bool | None

Whether to enable or disable plateau uniformity. If None, use the value saved in the device firmware. Default: None

wavelength float | None

The wavelength, in nm, of the incident light. If None, use the value saved in the device firmware. Default: None

ui_size int

The height, in pixels, of a button for the user interface. Default: 25

Source code in packages/resources/src/msl/equipment_resources/dataray/wincamd.py
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
def __init__(self, equipment: Equipment) -> None:
    r"""Connect to a beam-profiling camera from DataRay.

    The bitness (32 or 64 bit) of the DataRay Beam Profiling Software that
    is installed must match the bitness of the Python interpreter that is used
    to load the `DATARAYOCX` library.

    Regular-expression patterns that are used to select this Resource when
    [connect()][msl.equipment.schema.Equipment.connect] is called.
    ```python
    manufacturer=r"Data\s*Ray"
    model=r""
    ```

    Args:
        equipment: An [Equipment][] instance.

    A [Connection][msl.equipment.schema.Connection] instance supports the following _properties_
    for the `DataRay` class.

    Attributes: Connection Properties:
        area_filter (int | None): Area filter:

            * `1`: 1 pixel
            * `2`: 3 pixels
            * `3`: 5 pixels
            * `4`: 7 pixels
            * `5`: 9 pixels

            If `None`, use the value saved in the device firmware. _Default: `None`_
        camera_index (int): The camera to use (between 0 and 7). _Default: `0`_
        centroid_method (int | None): The centroid method to use (0, 1 or 2).
            If `None`, use the value saved in the device firmware. _Default: `None`_
        full_scale_filter (float | None): Percent full scale filter (0, 0.1, 0.2, 0.5, 1, 2, 5 or 10).
            If `None`, use the value saved in the device firmware. _Default: `None`_
        major_minor_method (int | None): The major/minor method to use (0, 1 or 2).
            If `None`, use the value saved in the device firmware. _Default: `None`_
        plateau_uniformity (bool | None): Whether to enable or disable plateau uniformity.
            If `None`, use the value saved in the device firmware. _Default: `None`_
        wavelength (float | None): The wavelength, in nm, of the incident light.
            If `None`, use the value saved in the device firmware. _Default: `None`_
        ui_size (int): The height, in pixels, of a button for the user interface. _Default: `25`_
    """
    from msl.loadlib.activex import WindowClassStyle  # noqa: PLC0415

    assert equipment.connection is not None  # noqa: S101
    prefix = equipment.connection.address[len("SDK::") :]
    super().__init__(
        equipment, libtype="activex", path=f"{prefix}.GetDataCtrl.1", class_style=WindowClassStyle.NOCLOSE
    )

    assert self.application is not None  # noqa: S101
    p = equipment.connection.properties

    self._ocx: _WinCam = _WinCam(
        app=self.application,
        sdk=self.sdk,
        prefix=prefix,
        camera_index=p.get("camera_index", 0),
        major_minor_method=p.get("major_minor_method"),
        centroid_method=p.get("centroid_method"),
        area_filter=p.get("area_filter"),
        full_scale_filter=p.get("full_scale_filter"),
        ui_size=p.get("ui_size", 25),
        plateau_uniformity=p.get("plateau_uniformity"),
    )

    wavelength = p.get("wavelength")
    if wavelength:
        self.wavelength = wavelength

    if not self.sdk.StartDriver():
        msg = "Cannot start the DataRay driver"
        raise RuntimeError(msg)

adc_peak_percent property ¤

adc_peak_percent: float

Returns the peak value as a percentage of the maximum possible ADC level.

centroid property ¤

centroid: tuple[float, float]

Returns the (x, y) coordinate of the centroid.

crosshair property ¤

crosshair: float

Returns the angle between the horizontal x-axis and the solid crosshair line, in degrees.

effective_2w property ¤

effective_2w: float

Returns the effective beam size, in um.

ellipticity property ¤

ellipticity: float

Returns the ratio between the minor/major axis.

exposure_time property ¤

exposure_time: float

Returns the exposure time, in ms.

homogeneity property ¤

homogeneity: float

Returns the 2D homogeneity of the beam (between 0 and 1).

image property ¤

image: NDArray[int64]

Returns the image data.

major property ¤

major: float

Returns the beam size along the major axis, in um.

major_iso property ¤

major_iso: float

Returns the ISO 11146 beam size along the major axis, in um.

The camera must be configured for ISO 11146 mode.

mean property ¤

mean: float

Returns the mean beam size, in um.

mean_theta property ¤

mean_theta: float

Returns the DXX mean angle, in radians.

The camera must be configured for DXX mode.

minor property ¤

minor: float

Returns the beam size along the minor axis, in um.

minor_iso property ¤

minor_iso: float

Returns the ISO 11146 beam size along the minor axis, in um.

The camera must be configured for ISO 11146 mode.

orientation property ¤

orientation: float

Returns the angle between the x-axis and the major or minor axis closest to the x-axis, in degrees.

pixel_size property ¤

pixel_size: tuple[float, float]

Returns the (width, height) size, in um, of a pixel.

pk_to_avg property ¤

pk_to_avg: float

Returns the peak to average value.

plateau_uniformity property ¤

plateau_uniformity: float

Returns the flatness of the plateau.

A value between 0 and 1 denoting how closely the beam resembles a theoretically perfect flat-top beam.

profile_x property ¤

profile_x: NDArray[int64]

Returns the profile data along X.

profile_y property ¤

profile_y: NDArray[int64]

Returns the profile data along Y.

rc property ¤

rc: float

Returns the radial distance from the center of the sensor to the center of the crosshair position.

roi property ¤

roi: tuple[int, int, int, int]

Returns the region of interest (x, y, width, height).

wavelength property writable ¤

wavelength: float

Get/Set the wavelength, in nm, of the incident light.

xc property ¤

xc: float

Returns the centroid position along X, in um.

xg property ¤

xg: float

Returns the geometric centroid position along X, in um.

xp property ¤

xp: float

Returns the peak-intensity centroid position along X, in um.

yc property ¤

yc: float

Returns the centroid position along Y, in um.

yg property ¤

yg: float

Returns the geometric centroid position along Y, in um.

yp property ¤

yp: float

Returns the peak-intensity centroid position along Y, in um.

zoom_factor property ¤

zoom_factor: float

Returns the zoom factor of the image.

capture ¤

capture(timeout: float | None = None) -> None

Capture image.

Parameters:

Name Type Description Default
timeout float | None

The maximum number of seconds to wait to capture the image.

None
Source code in packages/resources/src/msl/equipment_resources/dataray/wincamd.py
111
112
113
114
115
116
117
118
119
120
def capture(self, timeout: float | None = None) -> None:
    """Capture image.

    Args:
        timeout: The maximum number of seconds to wait to capture the image.
    """
    try:
        self._ocx.capture(timeout)
    except (RuntimeError, TimeoutError) as e:
        raise MSLConnectionError(self, message=str(e)) from None

disconnect ¤

disconnect() -> None

Disconnect from the DATARAYOCX library.

Source code in packages/resources/src/msl/equipment_resources/dataray/wincamd.py
122
123
124
125
126
127
def disconnect(self) -> None:  # pyright: ignore[reportImplicitOverride]
    """Disconnect from the `DATARAYOCX` library."""
    if hasattr(self, "_ocx") and self.application is not None:
        self._ocx.stop_device()
        self.application.close()
        super().disconnect()

wait_to_configure ¤

wait_to_configure() -> None

Wait until the camera has been configured.

This is a blocking call and waits until the popup window is closed.

Source code in packages/resources/src/msl/equipment_resources/dataray/wincamd.py
257
258
259
260
261
262
def wait_to_configure(self) -> None:
    """Wait until the camera has been configured.

    This is a blocking call and waits until the popup window is closed.
    """
    self._ocx.wait_to_configure()