8.5.17. pymodaq_utils.plugin_scaffold module
Helper to add a new, correctly named, instrument to a PyMoDAQ plugin package (pymodaq_plugins_*).
It is a development helper, independent of the plugin checks (see pymodaq_utils.plugin_checks). The generated
module follows the naming convention, derives from the right base class, declares the mandatory attributes and
methods, and holds TODO comments (and NotImplementedError) where the instrument specific code goes:
python -m pymodaq_utils.plugin_scaffold move Xxxx # actuator: daq_move_Xxxx.py, class DAQ_Move_Xxxx
python -m pymodaq_utils.plugin_scaffold 1D Xxxx # 1D detector: daq_1Dviewer_Xxxx.py, class DAQ_1DViewer_Xxxx
from the root of the plugin repository (or use --folder to give the package folder). The same is available from
python with create_instrument().
Added in version 5.3.1.
- pymodaq_utils.plugin_scaffold.create_instrument(kind, name, package_folder=None)[source]
Create the module of a new instrument in a plugin package
- Parameters:
kind (
str) – ‘move’ for an actuator, or ‘0D’, ‘1D’, ‘2D’, ‘ND’ for a detectorname (
str) – name of the instrument, starting with a capital letter (the module is daq_move_<name> or daq_<kind>viewer_<name>, the class DAQ_Move_<name> or DAQ_<kind>Viewer_<name>)package_folder (
Optional[Path]) – the folder of the plugin python package. Searched from the current folder if not given
- Returns:
Path
- Return type:
- Raises:
ValueError – for an invalid kind, name or package
FileExistsError – if the module already exists