herosdevices.hardware.thorlabs.pm100 ==================================== .. py:module:: herosdevices.hardware.thorlabs.pm100 .. autoapi-nested-parse:: Device driver for Thorlabs PM100 series optical power and energy meters. Module Contents --------------- .. py:function:: usbtmc_address_to_resource(address: str) -> str Convert a Linux usbtmc device address into a VISA resource string. If the given device node does not exist, the kernel usbtmc driver is probably not bound to the device anymore: userspace VISA access (pyvisa-py) detaches the kernel driver and it is only re-attached when the device is reconnected. In this case the USB bus is scanned for USBTMC devices instead. If exactly one is found, it is used, otherwise an error is raised. :param address: Path of the usbtmc device, e.g. ``/dev/usbtmc0``. :returns: The VISA resource string of the device. .. py:class:: PM100(resource: str, keep_alive: bool = True, **kwargs) Bases: :py:obj:`herosdevices.core.templates.VisaDeviceTemplate`, :py:obj:`herosdevices.interfaces.atomiq.Measurable` Device driver for the Thorlabs PM100A/D optical power and energy meter. The device is controlled via SCPI commands over a VISA connection (typically USBTMC). :param resource: Resource of the device. Either a Linux usbtmc device (e.g. ``/dev/usbtmc0``), which is automatically resolved to the corresponding VISA resource string, or a VISA resource string directly (e.g. ``USB::0x1313::0x8078::P0019289::INSTR``). :param keep_alive: Keep the VISA connection open between operations. .. warning:: Note, that if a device file (``/dev/usbtmc0``) is used, the device can not be restarted and needs to be reconnected to the host due to the PyVISA backend removing the ``/dev/usbtmc0`` link upon access. You need to use a VISA string (printed on startup of the device) to be able to restart it for example via BOSS. .. py:attribute:: measure_target :type: str :value: 'power' Set what the :py:meth:`PM100.measure` method returns. Can be "power", "voltage" or "frequency" .. py:attribute:: power :type: float Optical power in W (or dBm if :code:`power_unit` is set to "DBM"). .. py:attribute:: voltage :type: float Voltage in V. .. py:attribute:: wavelength :type: float Operation wavelength for the wavelength correction in nm. Only settable if the sensor supports it. .. py:attribute:: frequency :type: float Pulse repetition rate in Hz. .. py:attribute:: beam_diameter :type: float Beam diameter in mm, used for power/energy density calculations. .. py:attribute:: attenuation :type: float User attenuation (positive) / gain (negative) factor in dB. .. py:attribute:: averaging_rate :type: int Averaging rate, one sample takes approximately 3 ms (3000 averages take approximately 1 s). .. py:attribute:: power_unit :type: str Unit for power readings, either "W" or "DBM". .. py:attribute:: power_range :type: float Upper limit of the power measurement range in W. .. py:attribute:: voltage_range :type: float Upper limit of the voltage measurement range in V. .. py:attribute:: power_autorange :type: int on). :type: Auto-ranging of the power measurement (0 :type: off, 1 .. py:attribute:: voltage_autorange :type: int on). :type: Auto-ranging of the voltage measurement (0 :type: off, 1 .. py:attribute:: sensor_type :type: int Type of the connected sensor as reported by the device. .. py:method:: zero_adjust() -> None Run the zero adjustment (dark offset) routine. Make sure the sensor is blocked from all light of the beam source during this routine, otherwise all subsequent measurements will have an offset. .. py:method:: measure() -> float Perform a measurement depending on the setting of :py:attr:`PM100.measure_target`. :returns: The measured quantity in SI base units ("W", "V" or "Hz") .. py:attribute:: resource .. py:attribute:: connection