bhpy Package

Top-level

Modules

class bhpy.bh_connect.BHConnect(host=None, port=None)[source]

Bases: object

IMAGE_TYPES

alias of Literal[‘1stMoment’, ‘Fit’, ‘Fitted’, ‘TauChannel’]

command(command) str[source]
connect_spcm_instance(host: str = None, port: int = None, service_id: int = None)[source]
disconnect_spcm_instance()[source]
find_spcm_instance(service_id: int = 1)[source]
get_image(window=1, cycle=1, image_type: Literal['1stMoment', 'Fit', 'Fitted', 'TauChannel'] = '1stMoment', fit_config: tuple[str, int] = None, tau_channel: str = None)[source]
get_trace(trace_type=11, trace_number=1)[source]
set_image_size(width, height)[source]
shutdown_spcm_instance()[source]
class bhpy.bh_connect.CustomTCPServer(server_address, request_handler_class, request_handler_queue, done_queue=None, bind_and_activate=True, all_windows=False, file_name=None)[source]

Bases: TCPServer

class bhpy.bh_device_scan_wrapper.BHDeviceScan(dll_path=None)[source]

Bases: object

bh_scan_hardware() list[source]
version_str = ''
version_str_buf = <ctypes.c_char_Array_128 object>
class bhpy.bh_device_scan_wrapper.HardwareScanResult[source]

Bases: Structure

firmwareVersion

Structure/Union member

friendlyName

Structure/Union member

serialNumber

Structure/Union member

class bhpy.bh_lv_wrapper.LVConnectBDU(dll_path: Path | str | None = None, machine_name: str | None = None, default_timeout_s: int = 3, error_string_buffer_len: int = 512, result_string_buffer_len: int = 512)[source]

Bases: object

Wrapper class for interfacing with a BDU laser via the BDU application.

- command(command

INSTRUCTIONS | str, command_arg: str = None) -> str

- close() -> bool
Properties:
  • arming

  • power

  • frequency

Read only properties:
  • firmware_version

  • emission

  • serial_number

  • wavelength

  • frequencies

  • connected

Note that reading or writing any property as well as sending any command without an instance of the BDU application will raise a ChildProcessError.

INSTRUCTIONS

alias of Literal[‘Armed’, ‘GetArmed’, ‘Power’, ‘GetPower’, ‘Frequ’, ‘GetFreq’, ‘GetFreqStrings’, ‘GetEmissionStatus’, ‘GetSN’, ‘GetWL’, ‘GetFwVersion’, ‘Stop’]

property arming: bool

Sets/Returns the state of the arming control in the BDU application.

When enabled the laser and the laser power is set to greater than 0.0 the laser might emit light given that external conditions do not prevent the BDU from doing so.

close() bool[source]

Closes the BDU application.

Returns True on success.

command(command: Literal['Armed', 'GetArmed', 'Power', 'GetPower', 'Frequ', 'GetFreq', 'GetFreqStrings', 'GetEmissionStatus', 'GetSN', 'GetWL', 'GetFwVersion', 'Stop'] | str, command_arg: str = None) str[source]

Sends a command and optional arguments to the connected BDU application.

This can be used to facilitate functionalities/commands that are not yet wrapped by this library.

As long as the application is still loading the command is blocking.

property connected: bool

Returns the connection state of a BDU laser and the BDU application.

property emission: bool

Returns the emission state of the connected BDU.

External factors like laser interlock or external trigger signals can result in a false positive. Meaning the emission state merely indicates the possibility on part of the software for the laser actually emitting light.

property firmware_version: str

Returns the firmware version string of the connected BDU

property frequencies: list[str]

Returns the pulse frequency names (if present including CW) of the connected BDU laser as a list of strings.

These names are the possible names that can be used to set the frequency property.

property frequency: str

Sets/Returns the current pulse frequency of the connected BDU laser.

Raises a ValueError if the given frequency name is not one of the puls frequency names of the connected BDU laser.

property power: float

Sets/Returns the current laser power of the connected BDU laser in %.

Raises a ValueError if set to something outside of the allowed range from 0.0 to 100.0 [%].

property serial_number: str | None

Returns the serial number string of the connected BDU.

property wavelength: float | None

Returns the wavelength of the connected BDU in nm.

class bhpy.bh_lv_wrapper.LVConnectQC008(dll_path: Path | str | None = None, machine_name: str | None = None, default_timeout_s: int = 3, error_string_buffer_len: int = 512, result_string_buffer_len: int = 512)[source]

Bases: object

INSTRUCTIONS

alias of Literal[‘AutoAdjust’, ‘HideAnalysis’, ‘HideCardSettings’, ‘HideCorrelation’, ‘HideDebugInfo’, ‘HideDeltaT’, ‘HideMCS’, ‘LoadAutoSavedSettings’, ‘RepeatMeasurement’, ‘ScanThreshold’, ‘ShowAnalysis’, ‘ShowCardSettings’, ‘ShowCorrelation’, ‘ShowDebugInfo’, ‘ShowDeltaT’, ‘ShowMCS’, ‘StartMeasurement’, ‘StopMeasurement’]

MEASUREMENT_STATUS

alias of Literal[‘repeating’, ‘measuring’, ‘noData’, ‘DataAvailable’]

bool_cmd(cmd: str, boolean: bool)[source]
command(command: Literal['AutoAdjust', 'HideAnalysis', 'HideCardSettings', 'HideCorrelation', 'HideDebugInfo', 'HideDeltaT', 'HideMCS', 'LoadAutoSavedSettings', 'RepeatMeasurement', 'ScanThreshold', 'ShowAnalysis', 'ShowCardSettings', 'ShowCorrelation', 'ShowDebugInfo', 'ShowDeltaT', 'ShowMCS', 'StartMeasurement', 'StopMeasurement'])[source]
disable_sync_filter(disable: bool = True)[source]
property dll_version: str
property file_saving_path: Path
property firmware_version: str
property gap_events: int
property initialized: bool
load_graph(file_name)[source]
load_sdt(file_name)[source]
load_settings(file_name)[source]
property measurement_status: Literal['repeating', 'measuring', 'noData', 'DataAvailable']
property rates: list[int]
save_analysis(file_name)[source]
save_graph(file_name)[source]
save_raw(file_name)[source]
save_sdt(file_name)[source]
save_settings(file_name)[source]
save_time_line(file_name)[source]
screen_print(file_name)[source]
property serial_number: str
set_channel_delays(delays_ns: list[int])[source]
set_channel_polarities(polarities: list[int])[source]
set_channel_thresholds(threshold_mv: list[int])[source]
set_collection_time(time_s: float)[source]
set_correlation_ref(channel_a: int, channel_b: int)[source]
set_correlation_time(time_s: float)[source]
set_count(enable: bool = True)[source]
set_delta_t_ref(channel_a: int, channel_b: int)[source]
set_external(enable: bool = True)[source]
set_max_count(count: int)[source]
set_mcs_ref(channel: int, enable: bool)[source]
set_no_of_bins(bins: int)[source]
set_puls_gen_enables(enables: list[int])[source]
set_resolution(resolution_s: float)[source]
set_start_delay(delay_ns: int)[source]
set_time_range(range_s: float)[source]
set_x_axis_in_bins(enable: bool = True)[source]
class bhpy.spc_tdc_config.Pms800Conf[source]

Bases: object

default_path = 'appdirs.user_data_dir/Pms800/Config.json'
class bhpy.spc_tdc_config.SpcQcX04Conf(config_path: str = 'appdirs.user_data_dir/SpcQcX04/Config.json')[source]

Bases: object

DELTA_TIME_MODE = 'Δt'
NEGATIVE_EDGE =      (falling)'
POSITIVE_EDGE =      (rising)'
POS_NEG_LIST = ['͟     (rising)',      (falling)']
default_path = 'appdirs.user_data_dir/SpcQcX04/Config.json'
load_conf(conf_path=None) None[source]
restore_config() None[source]

Resets the Hardware settings.

Settings that require little or no changes after initial setup because they are tied to the measurement system’s components and their assembly, get set to values that are either the hardware defaults or good starting point

restore_defaults() None[source]

Resets all settings and parameters

Dispatcher call for all different categories of settings and parameters

restore_measurement() None[source]

Resets the measurement parameters

Parameters that are related to the individual measurement, that may be changed according to the need of the test specimen or the expected/desired experiment results

write_conf(conf_path=None) None[source]
class bhpy.spc_tdc_config.SpcQcX08Conf[source]

Bases: object

default_path = 'appdirs.user_data_dir/SpcQcX08/Config.json'
class bhpy.spc_tdc_wrapper.Markers[source]

Bases: TypedDict

frame: bool | Literal['Falling', 'Rising', 0, 1] = 0
line: bool | Literal['Falling', 'Rising', 0, 1] = 0
marker3: bool | Literal['Falling', 'Rising', 0, 1] = 0
pixel: bool | Literal['Falling', 'Rising', 0, 1] = 0
class bhpy.spc_tdc_wrapper.ModuleInit[source]

Bases: Structure

device_nr

Structure/Union member

device_type_str

Structure/Union member

initialized

Structure/Union member

serial_nr_str

Structure/Union member

class bhpy.spc_tdc_wrapper.Pms800(dll_path: Path | str | None = None)[source]

Bases: __8ChannelDllWrapper, __EventStream32Bit

INPUT_MODES

alias of Literal[‘Input’, ‘Gated Input’, ‘Calibration Input’, 0, 1, 2]

property event_count_thresholds
input_modes = {'Calibration Input': 2, 'Gated Input': 1, 'Input': 0}
property inputmodes
modes_input = {0: 'Input', 1: 'Gated Input', 2: 'Calibration Input'}
set_measurement_configuration(operation_mode, time_range, front_clipping, resolution, bin_size)[source]
class bhpy.spc_tdc_wrapper.SpcQcX04(dll_path: Path | str | None = None)[source]

Bases: __EventStream32Bit

property cfd_thresholds: list[float]
property cfd_zero_cross: list[float]
property channel_delays: list[float]
property channel_divider
property dithering_enable
get_events_from_buffer(buffer: numpy.typing.NDArray.numpy.uint32, max_events, card_number, filter_mtos: bool = False)[source]
property hardware_collection_timer_expired
property hardware_fifo_empty
property hardware_fifo_full
property marker_enables: Markers
property marker_polarities
property marker_status
property module_is_armed
property module_is_measuring
property module_status
property routing_compensation
property routing_enables
set_measurement_configuration(operation_mode, time_range, front_clipping, resolution)[source]
property trigger_polarity: Literal['Falling', 'Rising', 0, 1]
property waiting_for_trigger
class bhpy.spc_tdc_wrapper.SpcQcX08(dll_path: Path | str | None = None)[source]

Bases: __8ChannelDllWrapper

INPUT_MODES

alias of Literal[‘Input’, ‘Calibration Input’, 0, 2]

get_event_triplets_from_buffer(buffer: numpy.typing.NDArray.numpy.uint32, card_number: int, max_event_triplets: int | None = None) tuple[numpy.typing.NDArray.numpy.uint32, int][source]
get_event_triplets_from_buffer_to_file(card_number: int, dir_path: str, idx: int, min_event_triplets: int, max_event_triplets: int | None = None, timeout_ms: int = 10000) tuple[str, int][source]
input_modes = {'Calibration Input': 2, 'Input': 0}
property inputmodes
modes_input = {0: 'Input', 2: 'Calibration Input'}
property sync_channel
class bhpy.spc_tdc_wrapper.TdcLiterals[source]

Bases: object

DEFAULT_NAMES

alias of Literal[‘spc_qc_X04’, ‘spc_qc_X08’, ‘pms_800’]

MARKER

alias of Literal[‘pixel’, ‘line’, ‘frame’, ‘marker3’, 0, 1, 2, 3]

POLARITIES

alias of Literal[‘Falling’, ‘Rising’, 0, 1]