Skip to content

The bh_spc package

The root package of pybhspc.

For low-level control of SPCM-DLL, see the spcm module. Some utility functions are provided here in the root package.

dump_module_state(mod_no: int, *, file=None) -> None

Print (to standard output) the status of one SPC module.

This is a utility intended mostly for troubleshooting.

The module must be initialized.

Parameters:

Name Type Description Default
mod_no int

The SPC module index.

required
file file or None

The stream to print to.

None

dump_state(mod_nos: int | Sequence[int] | None = (0), *, file=None) -> None

Print (to standard output) the status SPC modules.

This is a utility intended mostly for troubleshooting.

SPCM-DLL must have been initialized (spcm.init).

Parameters:

Name Type Description Default
mod_nos int or Sequence[int] or None

The SPC module index or indices for which to dump state. If None, use all modules.

(0)
file file or None

The stream to print to.

None

ini_file(text: str) -> Iterator[str]

Context manager providing a temporary .ini file with the given text.

Parameters:

Name Type Description Default
text str

The desired contents of the .ini file.

required

Yields:

Type Description
str

The path name to the temporary .ini file.

See Also

minimal_spcm_ini Return the text for a minimal SPCM .ini file.

minimal_spcm_ini(mode: int | spcm.DLLOperationMode = 0) -> str

Return the text for a minimal .ini file for use with spcm.init.

The returned .ini text only sets the simulation field (i.e., the DLL operation mode). For all other fields (PCI bus/card number and SPC parameters), defaults will be used.

The return value can be saved to a file and used with spcm.init or as the source .ini file with spcm.save_parameters_to_ini_file.

Parameters:

Name Type Description Default
mode int or DLLOperationMode

The mode in which to initialize SPCM-DLL. Use 0 for hardware; special constants for simulation.

0

Returns:

Type Description
str

The .ini content text.

See Also

ini_file Context manager providing a temporary .ini file.

spcm_dll_version() -> tuple[int, int, int, int] cached

Return the version number of SPCM-DLL.

The information is read from the Windows file version resource of the DLL file.

Returns:

Type Description
tuple[int]

File version number (a 4-tuple) of the spcm64.dll file.