API Reference
This page provides the automatically generated documentation for the core classes and drivers.
Base Classes
Bases: ABC
Abstract Base Class for all instrument drivers following the 'Abstract Hardware' spec.
Source code in src/instrumation/drivers/base.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | |
__getattr__(name)
Dynamic async wrapper for all driver methods.
Source code in src/instrumation/drivers/base.py
25 26 27 28 29 30 31 32 33 34 | |
check_errors()
abstractmethod
Queries SYST:ERR? and updates local error_stack.
Source code in src/instrumation/drivers/base.py
99 100 101 102 | |
clear_status()
abstractmethod
Executes *CLS.
Source code in src/instrumation/drivers/base.py
79 80 81 82 | |
connect()
abstractmethod
Establishes connection and performs identity/option discovery.
Source code in src/instrumation/drivers/base.py
41 42 43 44 | |
disconnect()
abstractmethod
Safely tears down connection.
Source code in src/instrumation/drivers/base.py
46 47 48 49 | |
format_frequency(val)
Ensures input is Hz and formats for SCPI (e.g. 1.5e9 -> '1.5 GHz').
Source code in src/instrumation/drivers/base.py
113 114 115 116 117 118 119 120 121 122 123 | |
load_state(index)
Recalls state from memory.
Source code in src/instrumation/drivers/base.py
108 109 110 | |
query_ascii(command)
Sends command, reads response, and checks for errors.
Source code in src/instrumation/drivers/base.py
64 65 66 | |
query_binary_values(command, datatype='f', is_big_endian=False)
High-speed binary data transfer.
Source code in src/instrumation/drivers/base.py
68 69 70 | |
safe_send(command)
Sends command and immediately checks SYST:ERR?.
Source code in src/instrumation/drivers/base.py
60 61 62 | |
save_state(index)
Saves current state to memory.
Source code in src/instrumation/drivers/base.py
104 105 106 | |
shutdown_safety()
abstractmethod
Emergency shutdown protocol (Outputs OFF, Power/Volt 0).
Source code in src/instrumation/drivers/base.py
94 95 96 97 | |
sync_config()
abstractmethod
Executes CLS and WAI for a clean slate.
Source code in src/instrumation/drivers/base.py
84 85 86 87 | |
wait_ready(timeout=30.0)
abstractmethod
Standard polling loop for *OPC?.
Source code in src/instrumation/drivers/base.py
89 90 91 92 | |
Bases: InstrumentDriver
Source code in src/instrumation/drivers/base.py
293 294 295 296 297 298 299 300 301 302 303 304 305 | |
Bases: InstrumentDriver
Source code in src/instrumation/drivers/base.py
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 | |
get_mode()
Returns the current operation mode (CV, CC, or OFF).
Source code in src/instrumation/drivers/base.py
360 361 362 363 | |
measure_power()
Queries the actual measured output power (Watts).
Source code in src/instrumation/drivers/base.py
343 344 345 346 | |
measure_voltage()
Generalized alias for measure_voltage_actual.
Source code in src/instrumation/drivers/base.py
336 337 338 | |
set_autostart(state)
Sets the Power-ON state (SAFE/OFF or AUTO/ON).
Source code in src/instrumation/drivers/base.py
356 357 358 | |
set_current(current)
Generalized alias for set_current_limit.
Source code in src/instrumation/drivers/base.py
314 315 316 | |
set_foldback_delay(seconds)
Sets the delay for foldback protection.
Source code in src/instrumation/drivers/base.py
352 353 354 | |
set_foldback_mode(mode)
Sets the foldback protection mode (OFF, CC, or CV).
Source code in src/instrumation/drivers/base.py
348 349 350 | |
set_voltage_limit(voltage)
Generalized alias for Over-Voltage Protection (OVP).
Source code in src/instrumation/drivers/base.py
332 333 334 | |
Bases: InstrumentDriver
Source code in src/instrumation/drivers/base.py
365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 | |
get_peak_value()
Helper: Performs peak search and returns marker amplitude.
Source code in src/instrumation/drivers/base.py
385 386 387 388 | |
Bases: InstrumentDriver
Source code in src/instrumation/drivers/base.py
479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 | |
Bases: InstrumentDriver
Abstract Base for Frequency Counters / Timer/Counter instruments.
Source code in src/instrumation/drivers/base.py
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | |
measure_frequency(range='AUTO')
abstractmethod
Measures frequency. Range can be 'AUTO' or a specific range in Hz.
Source code in src/instrumation/drivers/base.py
258 259 260 261 | |
measure_period(range='AUTO')
abstractmethod
Measures period. Range can be 'AUTO' or a specific range in seconds.
Source code in src/instrumation/drivers/base.py
263 264 265 266 | |
measure_time_interval(start_trigger, stop_trigger)
abstractmethod
Measures time interval between two events (e.g. 'CH1', 'CH2').
Source code in src/instrumation/drivers/base.py
268 269 270 271 | |
set_auto_range(state)
abstractmethod
Enables or disables auto-ranging.
Source code in src/instrumation/drivers/base.py
288 289 290 291 | |
set_coupling(dc_ac)
abstractmethod
Sets input coupling — 'DC' or 'AC'.
Source code in src/instrumation/drivers/base.py
283 284 285 286 | |
set_impedance(ohms)
abstractmethod
Sets input impedance (50 or 1e6).
Source code in src/instrumation/drivers/base.py
273 274 275 276 | |
set_trigger_level(volts)
abstractmethod
Sets the trigger level voltage.
Source code in src/instrumation/drivers/base.py
278 279 280 281 | |
Results
Standardized object for measurement results.
Attributes:
| Name | Type | Description |
|---|---|---|
value |
Any
|
The measured value (float, complex, list, or numpy array). |
unit |
str
|
The physical unit of the measurement (e.g., 'V', 'Hz', 'dBm'). |
timestamp |
datetime
|
The time the measurement was taken. |
status |
str
|
Status of the measurement ('OK', 'ERROR', 'OVERLOAD', etc.). |
channel |
Optional[Union[int, str]]
|
Optional channel index for multi-channel instruments. |
metadata |
Optional[Dict[str, Any]]
|
Optional additional information from the driver. |
Source code in src/instrumation/results.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | |
__float__()
Allows direct conversion to float if the value is a scalar.
Source code in src/instrumation/results.py
40 41 42 | |
__format__(format_spec)
Allows MeasurementResult to be used in f-strings with float formatting.
Source code in src/instrumation/results.py
34 35 36 37 38 | |
__getitem__(key)
Allows indexing into the MeasurementResult value.
Source code in src/instrumation/results.py
48 49 50 | |
__iter__()
Allows iterating over the MeasurementResult value.
Source code in src/instrumation/results.py
52 53 54 | |
__len__()
Allows MeasurementResult to be used with len() if the value is a collection.
Source code in src/instrumation/results.py
44 45 46 | |
to_dict()
Converts the result to a JSON-serializable dictionary.
Source code in src/instrumation/results.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | |
to_json()
Returns the JSON string representation of the result.
Source code in src/instrumation/results.py
83 84 85 | |
Factory
Source code in src/instrumation/factory.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | |
Dynamically loads all available instrument drivers.
Source code in src/instrumation/factory.py
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 | |