Lablink
Use this module to connect to your lablink server, manage instruments, start experiments, and retrieve data.
Basic usage:
import asyncio
import pypalmsens as ps
from pypalmsens import lablink
async def main():
method = ps.CyclicVoltammetry()
local = lablink.Instance('https://127.0.0.1/')
await local.fetch_metadata()
session = await local.login('test', 'test')
# Grab first instrument
instrument, _* = session.instruments
async with await session.claim(instrument) as claim:
job = await session.start(claim, method=method)
measurement = await job
print(measurement)
data = measurement[0].xarray()
if __name__ == '__main__':
asyncio.run(main())
pypalmsens.lablink
Connect, manage, and start measurements on Lablink instances.
Modules:
-
models–
Classes:
-
Instance–A reference to a Lablink instance.
-
Instrument–A reference to an instrument.
-
InstrumentClaim–A reference to a claimed instrument.
-
InstrumentClaimBatch–A batch of claimed instruments.
-
LablinkApiError–Base class for errors returned by the Lablink API.
-
LablinkClientError–4xx client error.
-
LablinkServerError–5xx server error.
-
Measurement–A reference to a measurement.
-
MeasurementJob–A job representing an ongoing measurement.
-
NoActiveMeasurementError–The instrument has no active measurement.
-
Session–A session managing a connection to a Lablink instance.
Functions:
-
discover–Browse the local network for LabLink devices for a fixed duration.
Instance
A reference to a Lablink instance.
Exposes basic metadata through properties and provides get_info to refresh that information. Use login for an authenticated session.
Parameters:
-
(addressstr, default:'https://127.0.0.1') –The address of the instance (default is 'https://127.0.0.1').
-
(portint, default:5000) –Port to use on the instance (default is 5000).
Methods:
-
get_info–Fetch instance metadata from the lablink server.
-
login–Start an authenticated session with this lablink instance.
-
register_new_user–Register a new user account.
Attributes:
-
address(str) –The address of the instance.
-
info(LablinkInfo | None) –Last fetched metadata, or
Noneif not yet fetched.
Source code in src/pypalmsens/lablink/_instance.py
35 36 37 38 | |
info
property
info: LablinkInfo | None
Last fetched metadata, or None if not yet fetched.
May be stale or empty.
See get_info to (re)populate this.
get_info
async
get_info() -> LablinkInfo
Fetch instance metadata from the lablink server.
Returns:
-
LablinkInfo–Instance metadata including name, version and serial number.
Source code in src/pypalmsens/lablink/_instance.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | |
login
async
Start an authenticated session with this lablink instance.
Parameters:
Returns:
-
Session–A new session object for this instance.
Source code in src/pypalmsens/lablink/_instance.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | |
register_new_user
async
Register a new user account.
Parameters:
Source code in src/pypalmsens/lablink/_instance.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
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 | |
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 | |
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 | |
LablinkApiError
LablinkApiError(message: str, *, status_code: int | None = None, resource_key: str | None = None, dictionary: str | None = None, serial: str | None = None, parameters: list[Any] | None = None, response: Any = None)
Base class for errors returned by the Lablink API.
Source code in src/pypalmsens/lablink/_errors.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | |
LablinkClientError
LablinkClientError(message: str, *, status_code: int | None = None, resource_key: str | None = None, dictionary: str | None = None, serial: str | None = None, parameters: list[Any] | None = None, response: Any = None)
4xx client error.
Source code in src/pypalmsens/lablink/_errors.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | |
LablinkServerError
LablinkServerError(message: str, *, status_code: int | None = None, resource_key: str | None = None, dictionary: str | None = None, serial: str | None = None, parameters: list[Any] | None = None, response: Any = None)
5xx server error.
Source code in src/pypalmsens/lablink/_errors.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | |
Measurement
A reference to a measurement.
Holds the GUID of a stored measurement and an optional session link.
Methods:
-
delete–Delete this measurement from the server.
-
get_data–Retrieve recorded data for this measurement.
-
get_info–Get metadata for this measurement (not yet implemented).
Attributes:
Source code in src/pypalmsens/lablink/_measurement.py
32 33 34 | |
delete
async
delete() -> None
Delete this measurement from the server.
Raises:
-
ConnectionError–If this reference is detached from a session.
Source code in src/pypalmsens/lablink/_measurement.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | |
get_data
async
Retrieve recorded data for this measurement.
Returns:
-
Dataset or DataTree–Measurement data. A
Datasetis returned for a single measurement, aDataTreewhen the measurement contains repeated/stacked runs.
Raises:
-
ConnectionError–If this reference is detached from a session.
Source code in src/pypalmsens/lablink/_measurement.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | |
get_info
async
get_info() -> None
Get metadata for this measurement (not yet implemented).
Raises:
-
ConnectionError–If no session is attached. Reattach via
session.get_measurement(ref)before calling.
Source code in src/pypalmsens/lablink/_measurement.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |
MeasurementJob
MeasurementJob(guid: str, *, claim: InstrumentClaim)
A job representing an ongoing measurement.
Holds the GUID of a measurement in progress and its instrument claim.
Methods:
-
abort–Abort the measurement.
-
pause–Pause the measurement.
-
result–Wait for the measurement to finish and return a reference.
-
resume–Resume the measurement.
Attributes:
-
claim(InstrumentClaim) –The instrument claim associated with the measurement job.
-
guid(str) –The unique identifier of the measurement being performed.
-
is_finished(bool) –True if the measurement has finished.
-
serial_number(str) –Serial number of the instrument carrying out the measurement.
Source code in src/pypalmsens/lablink/_measurement.py
115 116 117 118 | |
guid
property
guid: str
serial_number
property
serial_number: str
Serial number of the instrument carrying out the measurement.
abort
async
abort() -> None
Abort the measurement.
Source code in src/pypalmsens/lablink/_measurement.py
216 217 218 | |
pause
async
pause() -> None
Pause the measurement.
Source code in src/pypalmsens/lablink/_measurement.py
220 221 222 | |
result
async
result(*, initial: float = 1.0, cap: float = 30.0, factor: float = 2.0, jitter: float = 0.15, timeout: float | None = None) -> Measurement
Wait for the measurement to finish and return a reference.
Polls claim.get_active_measurement() with exponential backoff so
short jobs are caught quickly while long ones stay cheap.
Parameters:
-
(initialfloat, default:1.0) –Delay before the first retry, in seconds. Defaults to 1.0.
-
(capfloat, default:30.0) –Maximum delay between polls, in seconds. Defaults to 30.0.
-
(factorfloat, default:2.0) –Multiplier applied to the delay after each poll. Defaults to 2.0.
-
(jitterfloat, default:0.15) –Fractional randomness added to each delay (e.g., 0.15 for +/-15%). Defaults to 0.15.
-
(timeoutfloat or None, default:None) –Total seconds to wait before giving up; None waits indefinitely. Defaults to None.
Returns:
-
MeasurementRef–A reference to the finished measurement.
Raises:
-
TimeoutError–If
timeoutis set and the measurement does not finish in time.
Source code in src/pypalmsens/lablink/_measurement.py
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 | |
resume
async
resume() -> None
Resume the measurement.
Source code in src/pypalmsens/lablink/_measurement.py
224 225 226 | |
NoActiveMeasurementError
NoActiveMeasurementError(message: str, *, status_code: int | None = None, resource_key: str | None = None, dictionary: str | None = None, serial: str | None = None, parameters: list[Any] | None = None, response: Any = None)
The instrument has no active measurement.
Source code in src/pypalmsens/lablink/_errors.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | |
Session
A session managing a connection to a Lablink instance.
Use Session.list_instruments to list instruments, Session.claim to claim them, and Session.start_measurement to run measurements.
Parameters:
-
(hoststr) –Base URL of the Lablink instance (e.g. 'lablink.example.com').
-
(tokenstr) –Token used to authenticate API calls.
-
(portint, default:5000) –Port for the API server, defaults to 5000.
Methods:
-
abort_measurement–Abort a running measurement and cancel job.
-
claim–Claim multiple instruments.
-
delete_measurements–Delete measurement data from Lablink.
-
delete_user–Delete a user by their identifier.
-
get_info–Fetch metadata for this instance.
-
get_instrument_info–Get info dictionary for currently attached instruments.
-
get_measurement–Fetch a specific measurement by its reference ID.
-
list_instruments–List currently attached instruments.
-
list_measurements–List all measurements.
-
list_users–Get list of users.
-
pause_measurement–Pause running measurements on the given jobs.
-
release–Release the given instruments back to Lablink.
-
resume_measurement–Resume a measurement that was previously paused.
-
skip_pre_measurement_stage–Skip the pre-measurement stage on the given measurement jobs.
-
start_measurement–Start a measurement on each of the claimed instruments.
-
start_workflow–Start a workflow on the given instruments.
Attributes:
-
info(LablinkInfo | None) –Last fetched metadata, or
Noneif not yet fetched. -
instrument_info(dict[str, dict[str, Any]]) –The instrument info from the most recent get_instrument_info call.
-
instruments(list[Instrument]) –The instruments from the most recent list_instruments call.
Source code in src/pypalmsens/lablink/_session.py
51 52 53 54 55 56 57 | |
info
property
info: LablinkInfo | None
Last fetched metadata, or None if not yet fetched.
Use get_info to (re)populate this.
instrument_info
property
The instrument info from the most recent get_instrument_info call.
May be stale or empty. Use list_instruments or get_instrument_info to update the cache.
instruments
property
instruments: list[Instrument]
The instruments from the most recent list_instruments call.
May be stale or empty. Use list_instruments or get_instrument_info update the cache.
abort_measurement
async
abort_measurement(jobs: Sequence[MeasurementJob]) -> None
Abort a running measurement and cancel job.
Parameters:
-
(jobsSequence[MeasurementJob]) –The measurement to abort.
Source code in src/pypalmsens/lablink/_session.py
383 384 385 386 387 388 389 390 391 392 393 394 395 396 | |
claim
async
claim(instruments: Sequence[Instrument], *, auto_release: bool = False) -> InstrumentClaimBatch
Claim multiple instruments.
The claim is held until you release it, or until the enclosing
async with block exits.
Parameters:
-
(instrumentsSequence[Instrument]) –The instruments to claim.
-
(auto_releasebool, default:False) –If True, the server releases the claims after measurement ends.
Returns:
-
claims(ClaimBatch) –A batch containing the instrument claims.
Source code in src/pypalmsens/lablink/_session.py
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 | |
delete_measurements
async
delete_measurements(measurements: list[Measurement | str]) -> None
Delete measurement data from Lablink.
Measurements are deleted by their unique identifier (GUID),
either using the guid attribute from the Measurement instance or
directly as a string.
Parameters:
-
(measurementslist[Measurement | str]) –A list of measurements to delete. Each item in the list can be either an instance of
Measurementor a GUID string.
Source code in src/pypalmsens/lablink/_session.py
450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 | |
delete_user
async
Delete a user by their identifier.
Users are deleted using their unique identifier (GUID),
either using the guid attribute from the UserInfo instance or
directly as a string.
Parameters:
-
(userUserInfo | str) –The identifier for the user to delete. This can be either an instance of UserInfo, or a GUID string.
Source code in src/pypalmsens/lablink/_session.py
430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 | |
get_info
async
get_info() -> LablinkInfo
Fetch metadata for this instance.
Source code in src/pypalmsens/lablink/_session.py
82 83 84 85 86 | |
get_instrument_info
async
Get info dictionary for currently attached instruments.
Refreshes the instrument_info dictionary and caches it in-place.
Returns:
-
dict[str, dict[str, Any]]–A mapping from serial number to instrument info for each currently attached instrument.
Source code in src/pypalmsens/lablink/_session.py
114 115 116 117 118 119 120 121 122 123 124 125 126 | |
get_measurement
async
get_measurement(measurement: Measurement | str) -> Dataset | DataTree
Fetch a specific measurement by its reference ID.
Parameters:
-
(measurementMeasurementRef | str) –The measurement to fetch. Can be a MeasurementRef or its string ID.
Returns:
Source code in src/pypalmsens/lablink/_session.py
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 296 297 298 | |
list_instruments
async
list_instruments() -> list[Instrument]
List currently attached instruments.
Refreshes the instruments list.
Returns:
-
list of Instrument–A list of currently attached instruments.
Source code in src/pypalmsens/lablink/_session.py
128 129 130 131 132 133 134 135 136 137 138 139 | |
list_measurements
async
list_measurements() -> list[Measurement]
List all measurements.
Returns:
-
list of MeasurementRef–A list of measurement references.
Source code in src/pypalmsens/lablink/_session.py
188 189 190 191 192 193 194 195 196 197 198 199 | |
list_users
async
list_users() -> list[UserInfo]
Get list of users.
Returns:
-
users(list[UserInfo]) –List of user info
Source code in src/pypalmsens/lablink/_session.py
419 420 421 422 423 424 425 426 427 428 | |
pause_measurement
async
pause_measurement(jobs: Sequence[MeasurementJob]) -> None
Pause running measurements on the given jobs.
Parameters:
-
(jobsSequence[MeasurementJob]) –The measurement jobs to pause.
Source code in src/pypalmsens/lablink/_session.py
353 354 355 356 357 358 359 360 361 362 363 364 365 366 | |
release
async
release(instruments: Sequence[InstrumentClaim]) -> None
Release the given instruments back to Lablink.
Parameters:
-
(instrumentsSequence[InstrumentClaim]) –Claimed instruments to release.
Source code in src/pypalmsens/lablink/_session.py
173 174 175 176 177 178 179 180 181 182 183 184 185 186 | |
resume_measurement
async
resume_measurement(jobs: Sequence[MeasurementJob]) -> None
Resume a measurement that was previously paused.
Parameters:
-
(jobsSequence[MeasurementJob]) –The measurement jobs to resume.
Source code in src/pypalmsens/lablink/_session.py
368 369 370 371 372 373 374 375 376 377 378 379 380 381 | |
skip_pre_measurement_stage
async
skip_pre_measurement_stage(jobs: Sequence[MeasurementJob]) -> None
Skip the pre-measurement stage on the given measurement jobs.
Parameters:
-
(jobsSequence[MeasurementJob]) –The running measurements to skip the pre-stage of.
Source code in src/pypalmsens/lablink/_session.py
338 339 340 341 342 343 344 345 346 347 348 349 350 351 | |
start_measurement
async
start_measurement(instruments: Sequence[InstrumentClaim], *, method: MethodTypeCompatible) -> list[MeasurementJob]
Start a measurement on each of the claimed instruments.
Parameters:
-
(instrumentsSequence[InstrumentClaim]) –Instruments (claimed) to start measuremeents on.
-
(methodMethodTypeCompatible) –The measurement method to apply.
Returns:
-
list[MeasurementJob]–One job per instrument, each with an associated MeasurementJob.
Source code in src/pypalmsens/lablink/_session.py
300 301 302 303 304 305 306 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 | |
start_workflow
async
start_workflow(instruments: Sequence[InstrumentClaim], *, workflow: str) -> None
Start a workflow on the given instruments.
Parameters:
-
(instrumentsSequence[InstrumentClaim]) –The claimed instruments that will run the workflow.
-
(workflowstr) –Name of the workflow to start.
Source code in src/pypalmsens/lablink/_session.py
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 | |
discover
async
Browse the local network for LabLink devices for a fixed duration.
Uses zeroconf to browse for the _lablink._tcp.local. service type.
Each discovered device is resolved into a dictionary of properties
(hostname, addresses, TXT record fields) and appended to the results list.
Parameters:
-
(ip_versionIPVersion, default:All) –IP protocol version for browsing/name resolution. Defaults to
zeroconf.IPVersion.All. -
(timeoutfloat, default:10) –How many seconds to browse before stopping. Default is 10.
Returns:
-
list[dict]–One dictionary per discovered LabLink device. Each dict contains:
- server: fully qualified host name (e.g. "lablink-01.local.")
- addresses: parsed scoped IP address strings
- other TXT record fields as-is, e.g. name, serial, version
The list is empty if no devices are discovered within the timeout.
Examples:
>>> import asyncio
>>> devices = asyncio.run(discover(timeout=10))
>>> device, _* = devices
>>> devices["name"]
'lablink-01'
>>> devices["addresses"]
['192.168.1.42', ...]
Source code in src/pypalmsens/lablink/_discover.py
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 | |