dummy_opus_interface
frog.hardware.plugins.spectrometer.dummy_opus_interface
¤
Provides a dummy EM27 device for interfacing with.
Classes¤
DummyOPUSInterface(measure_duration=1.0)
¤
Bases: OPUSInterfaceBase
A mock version of the OPUS API for testing purposes.
Create a new DummyOPUSInterface.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
measure_duration
|
float
|
How long a single measurement takes (seconds) |
1.0
|
Source code in frog/hardware/plugins/spectrometer/dummy_opus_interface.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
|
Attributes¤
state_machine = OPUSStateMachine(measure_duration)
instance-attribute
¤
An object representing the internal state of the device.
Functions¤
close()
¤
Close the device.
If a measurement is running, cancel it.
Source code in frog/hardware/plugins/spectrometer/dummy_opus_interface.py
136 137 138 139 140 141 142 |
|
on_enter_state(target)
¤
Broadcast state changes via pubsub.
Source code in frog/hardware/plugins/spectrometer/dummy_opus_interface.py
172 173 174 |
|
request_command(command)
¤
Execute the specified command on the device.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
command
|
str
|
The command to run |
required |
Raises: OPUSError: If the device is in the wrong state for this command
Source code in frog/hardware/plugins/spectrometer/dummy_opus_interface.py
159 160 161 162 163 164 165 166 167 168 169 170 |
|
OPUSErrorInfo
¤
Bases: Enum
Represents an error code and description for OPUS errors.
The codes and descriptions are taken from the manual.
OPUSStateMachine(measure_duration)
¤
Bases: StateMachine
An FSM for keeping track of the internal state of the mock device.
Create a new OPUSStateMachine.
The state diagram looks like this:
Parameters:
Name | Type | Description | Default |
---|---|---|---|
measure_duration
|
float
|
How long a single measurement takes (seconds) |
required |
Source code in frog/hardware/plugins/spectrometer/dummy_opus_interface.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
|
Attributes¤
measure_timer = QTimer()
instance-attribute
¤
Timer signalling the end of a measurement.
Functions¤
connect()
¤
Connect to the device.
Source code in frog/hardware/plugins/spectrometer/dummy_opus_interface.py
79 80 81 82 |
|
on_enter_measuring()
¤
Start the measurement timer.
Source code in frog/hardware/plugins/spectrometer/dummy_opus_interface.py
95 96 97 |
|
on_exit_measuring()
¤
Stop the measurement timer.
Source code in frog/hardware/plugins/spectrometer/dummy_opus_interface.py
99 100 101 |
|
stop()
¤
Stop the current measurement.
Source code in frog/hardware/plugins/spectrometer/dummy_opus_interface.py
84 85 86 87 88 |
|