Instrument
An Instrument is a reference to an instrument attached to your session, uniquely identified by its serial number (GUID). Instrument gives read access to an instrument's metadata, status, and configuration.
To start a measurement or configure parameters, you must first claim an instrument.
An active InstrumentClaim locks the instrument to your session. All control operations (start_measurement, set_potential, configure, pause / resume / abort, ...) are only accessible on a claimed instrument.
You can use the claim as a context manager. The instrument is released when the block exits, even if it raises an exception:
async with await instrument.claim() as claim:
await claim.set_current_range('1 mA')
job = await claim.start_measurement(method=method)
measurement = await job # claim released here
To claim several instruments at once, use Session.claim. This returns InstrumentClaimBatch that releases every claim when its block exits.
Classes:
pypalmsens.lablink.Instrument
A reference to an instrument.
Methods:
-
claim–Claim this instrument.
-
get_active_measurement–Return the active measurement, if any.
-
get_capabilities–Fetch the capabilities of this instrument.
-
get_configuration–Get the current configuration for this instrument.
-
get_info–Get info for instrument.
-
get_signalr_url–Return the signal rate URL for this instrument.
-
get_state–Fetch the current state of this instrument.
Attributes:
-
info(dict[str, Any]) –The instrument info from the most recent get_info call.
-
serial_number(str) –The serial number of the instrument.
Source code in src/pypalmsens/lablink/_instrument.py
161 162 163 | |
info
property
The instrument info from the most recent get_info call.
May be stale or empty.
claim
async
claim(*, auto_release: bool = False) -> InstrumentClaim
Claim this instrument.
The claim is held until you release it, or until the enclosing
async with block exits.
Parameters:
-
(auto_releasebool, default:False) –If True, the server releases the claim after measurement ends.
Returns:
-
claim(InstrumentClaim) –Claimed instrument
Source code in src/pypalmsens/lablink/_instrument.py
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | |
get_active_measurement
async
get_active_measurement() -> Measurement
Return the active measurement, if any.
Returns:
-
measurement(Measurement) –Reference to the active measurement
Raises:
-
NoActiveMeasurementError–If there is no active measurement.
Source code in src/pypalmsens/lablink/_instrument.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | |
get_capabilities
async
Fetch the capabilities of this instrument.
Returns:
Source code in src/pypalmsens/lablink/_instrument.py
109 110 111 112 113 114 115 116 117 118 119 | |
get_configuration
async
Get the current configuration for this instrument.
Returns:
Source code in src/pypalmsens/lablink/_instrument.py
97 98 99 100 101 102 103 104 105 106 107 | |
get_info
async
Get info for instrument.
Returns:
Source code in src/pypalmsens/lablink/_instrument.py
74 75 76 77 78 79 80 81 82 83 | |
get_signalr_url
async
get_signalr_url() -> str
Return the signal rate URL for this instrument.
Returns:
-
url(str) –Generated signalr url for this instrument.
Source code in src/pypalmsens/lablink/_instrument.py
85 86 87 88 89 90 91 92 93 94 95 | |
get_state
async
Fetch the current state of this instrument.
Returns:
Source code in src/pypalmsens/lablink/_instrument.py
141 142 143 144 145 146 147 148 149 150 151 | |
pypalmsens.lablink.InstrumentClaim
A reference to a claimed instrument.
Can also be used as a context manager for a claiming an instrument.
Methods:
-
abort_measurement–Stop and release a running measurement.
-
configure–Configure this instrument.
-
get_active_measurement–Return the active measurement, if any.
-
get_capabilities–Fetch the capabilities of this instrument.
-
get_configuration–Get the current configuration for this instrument.
-
get_info–Get info for instrument.
-
get_signalr_url–Return the signal rate URL for this instrument.
-
get_state–Fetch the current state of this instrument.
-
pause_measurement–Pause a running measurement.
-
release–Release the instrument claim.
-
resume_measurement–Resume a previously paused measurement.
-
set_bipot_current_range–Set the current range of the second working electrode (bipot, WE2).
-
set_bipot_enabled–Enable or disable the second working electrode (bipot, WE2).
-
set_bipot_mode–Set how the second working electrode (WE2) is coupled to WE1.
-
set_bipot_potential–Set the potential of the second working electrode (WE2).
-
set_cell_mode–Set active measurement mode of the instrument.
-
set_cell_state–Sets the cell state.
-
set_current–Set the cell current (galvanostatic mode).
-
set_current_range–Set the current measurement range.
-
set_custom_name–Set a custom display name for the instrument.
-
set_potential–Set the working electrode (WE) potential relative to the reference
-
set_potential_range–Set the potential measurement range.
-
skip_pre_measurement_stage–Skip the initial pre-measurement setup step.
-
start_measurement–Start a measurement.
-
start_workflow–Start a workflow on the instrument.
Attributes:
-
info(dict[str, Any]) –The instrument info from the most recent get_info call.
-
serial_number(str) –The serial number of the claimed instrument.
Source code in src/pypalmsens/lablink/_instrument.py
209 210 211 | |
info
property
The instrument info from the most recent get_info call.
May be stale or empty.
abort_measurement
async
abort_measurement() -> None
Stop and release a running measurement.
The instrument resets to the pre-measurement state after aborting.
Source code in src/pypalmsens/lablink/_instrument.py
303 304 305 306 307 308 | |
configure
async
configure(mains_frequency: Literal['auto', 50, 60] | None = None, signal_train: Literal['lowspeed', 'highspeed', 'maximumrange'] | None = None, multichannel_role: Literal['standalone', 'main', 'follower'] | None = None) -> None
Configure this instrument.
Parameters:
-
(mains_frequencyint or None, default:None) –Set the DC mains frequency in to 50 or 60 Hz, depending on your region. Use 'auto' for automatic determination of the mains frequency.
The mains frequency of the power grid couples into the measured current. The instrument filters sampling at that frequency.
-
(signal_trainstr or None, default:None) –Speed of the analog input train (e.g. 'lowSpeed', 'highSpeed').
-
(multichannel_rolestr or None, default:None) –Role for multi-channel mode ('standalone', 'main', 'follower').
Source code in src/pypalmsens/lablink/_instrument.py
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 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 | |
get_active_measurement
async
get_active_measurement() -> Measurement
Return the active measurement, if any.
Returns:
-
measurement(Measurement) –Reference to the active measurement
Raises:
-
NoActiveMeasurementError–If there is no active measurement.
Source code in src/pypalmsens/lablink/_instrument.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | |
get_capabilities
async
Fetch the capabilities of this instrument.
Returns:
Source code in src/pypalmsens/lablink/_instrument.py
109 110 111 112 113 114 115 116 117 118 119 | |
get_configuration
async
Get the current configuration for this instrument.
Returns:
Source code in src/pypalmsens/lablink/_instrument.py
97 98 99 100 101 102 103 104 105 106 107 | |
get_info
async
Get info for instrument.
Returns:
Source code in src/pypalmsens/lablink/_instrument.py
74 75 76 77 78 79 80 81 82 83 | |
get_signalr_url
async
get_signalr_url() -> str
Return the signal rate URL for this instrument.
Returns:
-
url(str) –Generated signalr url for this instrument.
Source code in src/pypalmsens/lablink/_instrument.py
85 86 87 88 89 90 91 92 93 94 95 | |
get_state
async
Fetch the current state of this instrument.
Returns:
Source code in src/pypalmsens/lablink/_instrument.py
141 142 143 144 145 146 147 148 149 150 151 | |
pause_measurement
async
pause_measurement() -> None
Pause a running measurement.
The instrument holds its current state and resumes later.
Source code in src/pypalmsens/lablink/_instrument.py
292 293 294 295 296 297 | |
release
async
release() -> None
Release the instrument claim.
Source code in src/pypalmsens/lablink/_instrument.py
233 234 235 | |
resume_measurement
async
resume_measurement() -> None
Resume a previously paused measurement.
Source code in src/pypalmsens/lablink/_instrument.py
299 300 301 | |
set_bipot_current_range
async
set_bipot_current_range(current_range: AllowedCurrentRanges) -> None
Set the current range of the second working electrode (bipot, WE2).
Parameters:
-
(current_rangeAllowedCurrentRanges) –Desired WE2 current range as a string (e.g. '1 mA').
Source code in src/pypalmsens/lablink/_instrument.py
460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 | |
set_bipot_enabled
async
Enable or disable the second working electrode (bipot, WE2).
Parameters:
-
(statebool) –True = bipotentiostat on (WE2 active), False = off.
Source code in src/pypalmsens/lablink/_instrument.py
450 451 452 453 454 455 456 457 458 | |
set_bipot_mode
async
Set how the second working electrode (WE2) is coupled to WE1.
constant: WE2 is held at a fixed potential vs. the RE while WE1 is stepped or swept independently.offset: WE2 tracks WE1, maintained at a fixed potential difference from WE1 as WE1 changes.
Parameters:
-
(modestr) –Coupling mode: 'constant' or 'offset'.
Source code in src/pypalmsens/lablink/_instrument.py
478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 | |
set_bipot_potential
async
Set the potential of the second working electrode (WE2).
Parameters:
-
(potentialfloat) –WE2 setpoint in volts. Absolute vs. RE in constant mode, or the WE1-relative offset in offset mode.
Source code in src/pypalmsens/lablink/_instrument.py
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 | |
set_cell_mode
async
Set active measurement mode of the instrument.
Parameters:
-
(modestr) –One of 'potentiostatic' or 'galvanostatic'.
Source code in src/pypalmsens/lablink/_instrument.py
237 238 239 240 241 242 243 244 245 246 | |
set_cell_state
async
Sets the cell state.
Parameters:
-
(statestr) –Set the cell 'on' or 'off'
Source code in src/pypalmsens/lablink/_instrument.py
248 249 250 251 252 253 254 255 256 257 | |
set_current
async
Set the cell current (galvanostatic mode).
Parameters:
-
(currentfloat) –Current value in µA.
Source code in src/pypalmsens/lablink/_instrument.py
423 424 425 426 427 428 429 430 431 432 433 434 | |
set_current_range
async
set_current_range(current_range: AllowedCurrentRanges) -> None
Set the current measurement range.
Parameters:
-
(current_rangeAllowedCurrentRanges) –The desired range as a string (e.g. '1 mA').
Source code in src/pypalmsens/lablink/_instrument.py
390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 | |
set_custom_name
async
Set a custom display name for the instrument.
Parameters:
-
(namestr) –Custom name to assign to the instrument
Source code in src/pypalmsens/lablink/_instrument.py
310 311 312 313 314 315 316 317 318 | |
set_potential
async
Set the working electrode (WE) potential relative to the reference electrode (RE).
Parameters:
-
(potentialfloat) –WE potential in volts.
Source code in src/pypalmsens/lablink/_instrument.py
436 437 438 439 440 441 442 443 444 445 446 447 448 | |
set_potential_range
async
set_potential_range(potential_range: AllowedPotentialRanges) -> None
Set the potential measurement range.
Parameters:
-
(potential_rangeAllowedPotentialRanges) –The desired range as a string (e.g. '100 mV').
Source code in src/pypalmsens/lablink/_instrument.py
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 | |
skip_pre_measurement_stage
async
skip_pre_measurement_stage() -> None
Skip the initial pre-measurement setup step.
Useful when you want to begin measuring without running through all calibration steps.
Source code in src/pypalmsens/lablink/_instrument.py
284 285 286 287 288 289 290 | |
start_measurement
async
start_measurement(method: MethodTypeCompatible) -> MeasurementJob
Start a measurement.
Parameters:
-
(methodMethodTypeCompatible) –The measurement technique and parameters to run.
Returns:
-
job(MeasurementJob) –Reference to the measurement job
Source code in src/pypalmsens/lablink/_instrument.py
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 | |
start_workflow
async
Start a workflow on the instrument.
Parameters:
-
(workflowstr) –Name of the workfrow to execute on the instrument.
Source code in src/pypalmsens/lablink/_instrument.py
380 381 382 383 384 385 386 387 388 | |
pypalmsens.lablink.InstrumentClaimBatch
InstrumentClaimBatch(claims: list[InstrumentClaim])
A batch of claimed instruments.
Use as an async context manager. All claims are released when the context exits.
Parameters:
-
(claimslist of InstrumentClaim) –The list of instrument claims to manage.
Methods:
-
release–Release all instrument claims in this batch.
Source code in src/pypalmsens/lablink/_instrument.py
526 527 | |
release
async
release() -> None
Release all instrument claims in this batch.
Source code in src/pypalmsens/lablink/_instrument.py
553 554 555 556 | |