LINCam Python Interface
The LINCamRemote class provides remote control of the LINCam TCSPC camera
over gRPC. It communicates with the LINCam Capture desktop application, which
must be running and accessible on the network.
Connection
from photonscore.LINCam.LINCamRemote import LINCamRemote
# Connect to LINCam Capture running on the same machine
cam = LINCamRemote() # default: localhost:50051
# Or connect to a remote host
cam = LINCamRemote("192.168.1.42:50051")
After construction the object immediately synchronises with the device, so all status properties are available right away.
Quick Start
from photonscore.LINCam.LINCamRemote import LINCamRemote
import matplotlib.pyplot as plt
cam = LINCamRemote()
print(cam) # show live count rates and settings
# Point the device at the right hardware unit
cam.device_url = "192.168.1.10:5000"
cam.tdc_slopes = "//" # rising edge on start and stop
cam.photocathode_on = True
cam.sync() # push changes and refresh status
# Acquire a 512×512 spatial image
cam.sync_histograms(xy_bins=512)
plt.imshow(cam.hist_2d)
plt.colorbar()
plt.show()
Settings Diff Pattern
Every settable property stages a change locally. Nothing is sent to the
device until you call sync(). After sync() all read-only status
properties (count rates, temperatures, …) are refreshed.
cam.time_gate = [10.0, 50.0] # gate from 10 ns to 50 ns
cam.time_binnig = 50 # 50 ps / channel
cam.sync() # commit both changes in one RPC call
print(cam.acquired_cps) # now reflects gated count rate
Device Handle
LINCam.LINCamRemote.LINCamRemote
Remote control handle for a LINCam TCSPC camera.
Wraps the gRPC LINCamRemote service exposed by the LINCam Capture
application. All settable parameters are Python properties that stage
changes locally; call :meth:sync to commit and read back device state.
After construction the object immediately calls :meth:sync so that
all read-only properties (serial number, count rates, temperatures, …)
are populated.
Attributes:
| Name | Type | Description |
|---|---|---|
hist_2d |
Last acquired 2-D spatial histogram as a square numpy array.
Updated by :meth: |
|
hist_dt |
Last acquired timing histogram (delta-t) as a 1-D numpy array.
Updated by :meth: |
Source code in LINCam/LINCamRemote.py
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 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 296 297 298 299 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 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 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 | |
__init__(target=None)
Connect to the LINCam Capture gRPC server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
str | None
|
Host and port of the gRPC server, e.g. |
None
|
Source code in LINCam/LINCamRemote.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | |
sync()
Push pending settings to the device and refresh all status fields.
Sends the accumulated new_settings diff to the server. The server
returns the full current device state which is stored in
read_settings. After the call new_settings is reset so the
next :meth:sync only sends newly staged changes.
Source code in LINCam/LINCamRemote.py
77 78 79 80 81 82 83 84 85 86 | |
sync_histograms(xy_bins=512, clear_after=False)
Fetch the current 2-D spatial image and timing histogram from the device.
The acquired data is stored in :attr:hist_2d (2-D numpy array, shape
[xy_bins, xy_bins]) and :attr:hist_dt (1-D numpy array with the
delta-t histogram).
The xy_bins parameter is rounded down to the nearest supported
resolution: 256, 512, 1024, 2048, or 4096 pixels per side.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xy_bins
|
int | None
|
Requested edge length of the square spatial image in pixels.
Supported values: 256, 512 (default), 1024, 2048, 4096.
Pass |
512
|
clear_after
|
bool
|
If |
False
|
Source code in LINCam/LINCamRemote.py
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 | |
setup_recording(filename, filenumber=0, seconds=0, continious=False)
Stage file recording parameters (call :meth:sync to apply).
After calling this method set :attr:is_recording to True and
call :meth:sync to start saving photon data to disk.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Base path for the output |
required |
filenumber
|
int
|
Numeric suffix appended to the filename (default 0). |
0
|
seconds
|
int
|
Chunk duration in seconds. |
0
|
continious
|
bool
|
If |
False
|
Source code in LINCam/LINCamRemote.py
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 | |
Device Controls
Properties that configure device behaviour. Stage changes then call sync().
| Property | Type | Description |
|---|---|---|
device_url |
str | IP:port of the physical LINCam hardware |
photocathode_on |
bool | Enable / disable photocathode HV |
tdc_slopes |
str | Edge polarity: "//", "/\\", "\\/", "\\\\" |
tdc_start_rise |
bool | Start channel — rising edge |
tdc_stop_rise |
bool | Stop channel — rising edge |
stop_threshold |
int | CFD threshold voltage (DAC counts) |
stop_zero_cross |
int | CFD zero-crossing voltage (DAC counts) |
test_generator |
int | Internal test pulses: 0, 10, 100, 1000 kHz |
Remote control handle for a LINCam TCSPC camera.
Wraps the gRPC LINCamRemote service exposed by the LINCam Capture
application. All settable parameters are Python properties that stage
changes locally; call :meth:sync to commit and read back device state.
After construction the object immediately calls :meth:sync so that
all read-only properties (serial number, count rates, temperatures, …)
are populated.
Attributes:
| Name | Type | Description |
|---|---|---|
hist_2d |
Last acquired 2-D spatial histogram as a square numpy array.
Updated by :meth: |
|
hist_dt |
Last acquired timing histogram (delta-t) as a 1-D numpy array.
Updated by :meth: |
Source code in LINCam/LINCamRemote.py
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 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 296 297 298 299 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 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 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 | |
device_url
property
writable
str: IP address and port of the physical LINCam device (e.g. "192.168.1.42:5000").
Setting this tells LINCam Capture which hardware unit to connect to.
Takes effect on the next :meth:sync.
photocathode_on
property
writable
bool: Commanded photocathode state.
Setting to True requests the detector to enable the photocathode
high voltage. The actual on/off status is reflected in
:attr:photocathode_on_status after the next :meth:sync.
.. warning:: Do not expose the photocathode to ambient light without appropriate neutral density filters or the protective lens cap.
tdc_slopes
property
writable
str: Compact slope notation for start and stop channels.
A two-character string where "/" means rising and "\" means
falling edge. For example "/\" means start-rising, stop-falling.
Setting this property updates :attr:tdc_start_rise and
:attr:tdc_stop_rise simultaneously.
tdc_start_rise
property
writable
bool: TDC start channel edge polarity — True = rising, False = falling.
tdc_stop_rise
property
writable
bool: TDC stop channel edge polarity — True = rising, False = falling.
stop_threshold
property
writable
int: CFD stop-channel threshold voltage in DAC counts.
stop_zero_cross
property
writable
int: CFD stop-channel zero-crossing voltage in DAC counts.
test_generator
property
writable
int: Internal test pulse rate in kHz, or 0 if disabled.
Accepted set values: 0 (off), 10, 100, 1000 kHz.
Useful for verifying the timing chain without an external light source.
Timing
| Property | Type | Description |
|---|---|---|
time_offset |
float | Global timing offset in ns |
time_binnig |
int | Bin size in ps/channel |
time_gate |
list[float] | Gate [start_ns, stop_ns]; set None to disable |
time_gate_on |
bool | Gate enable/disable |
time_gate_a |
float | Gate start in ns |
time_gate_b |
float | Gate stop in ns |
Remote control handle for a LINCam TCSPC camera.
Wraps the gRPC LINCamRemote service exposed by the LINCam Capture
application. All settable parameters are Python properties that stage
changes locally; call :meth:sync to commit and read back device state.
After construction the object immediately calls :meth:sync so that
all read-only properties (serial number, count rates, temperatures, …)
are populated.
Attributes:
| Name | Type | Description |
|---|---|---|
hist_2d |
Last acquired 2-D spatial histogram as a square numpy array.
Updated by :meth: |
|
hist_dt |
Last acquired timing histogram (delta-t) as a 1-D numpy array.
Updated by :meth: |
Source code in LINCam/LINCamRemote.py
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 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 296 297 298 299 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 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 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 | |
time_offset
property
writable
float: Global timing offset applied to all events, in nanoseconds.
time_binnig
property
writable
int: TDC bin size in picoseconds per channel.
time_gate
property
writable
list[float]: Timing gate [start_ns, stop_ns], or disables gate on set failure.
Assign a two-element sequence [a, b] to set both edges and enable
the gate. Assign anything else (e.g. None) to disable the gate.
time_gate_on
property
writable
bool: Whether the timing gate is active.
time_gate_a
property
writable
float: Timing gate start edge in nanoseconds.
time_gate_b
property
writable
float: Timing gate stop edge in nanoseconds.
Recording
cam.setup_recording("/data/run01", filenumber=0, seconds=10)
cam.is_recording = True
cam.sync()
# ... wait ...
cam.is_recording = False
cam.sync()
Remote control handle for a LINCam TCSPC camera.
Wraps the gRPC LINCamRemote service exposed by the LINCam Capture
application. All settable parameters are Python properties that stage
changes locally; call :meth:sync to commit and read back device state.
After construction the object immediately calls :meth:sync so that
all read-only properties (serial number, count rates, temperatures, …)
are populated.
Attributes:
| Name | Type | Description |
|---|---|---|
hist_2d |
Last acquired 2-D spatial histogram as a square numpy array.
Updated by :meth: |
|
hist_dt |
Last acquired timing histogram (delta-t) as a 1-D numpy array.
Updated by :meth: |
Source code in LINCam/LINCamRemote.py
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 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 296 297 298 299 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 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 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 | |
is_recording
property
writable
bool: Whether the device is currently writing photon data to disk.
setup_recording(filename, filenumber=0, seconds=0, continious=False)
Stage file recording parameters (call :meth:sync to apply).
After calling this method set :attr:is_recording to True and
call :meth:sync to start saving photon data to disk.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Base path for the output |
required |
filenumber
|
int
|
Numeric suffix appended to the filename (default 0). |
0
|
seconds
|
int
|
Chunk duration in seconds. |
0
|
continious
|
bool
|
If |
False
|
Source code in LINCam/LINCamRemote.py
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 | |
Status (Read-Only)
All status properties are updated on every sync() call.
| Property | Type | Description |
|---|---|---|
device_connected |
bool | Hardware connection active |
device_sn |
str | Device serial number |
device_uptime |
str | Application uptime |
photocathode_on_status |
bool | Actual HV state (may differ from commanded) |
mcp_cps |
float | Total MCP count rate (Hz) |
stop_cps |
float | CFD stop-channel rate (Hz) |
acquired_cps |
float | Net acquired rate after gates (Hz) |
fpga_temperature |
float | FPGA temperature (°C) |
detector_temperature |
float | Detector temperature (°C) |
Remote control handle for a LINCam TCSPC camera.
Wraps the gRPC LINCamRemote service exposed by the LINCam Capture
application. All settable parameters are Python properties that stage
changes locally; call :meth:sync to commit and read back device state.
After construction the object immediately calls :meth:sync so that
all read-only properties (serial number, count rates, temperatures, …)
are populated.
Attributes:
| Name | Type | Description |
|---|---|---|
hist_2d |
Last acquired 2-D spatial histogram as a square numpy array.
Updated by :meth: |
|
hist_dt |
Last acquired timing histogram (delta-t) as a 1-D numpy array.
Updated by :meth: |
Source code in LINCam/LINCamRemote.py
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 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 296 297 298 299 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 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 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 | |
device_connected
property
bool: True if LINCam Capture has an active connection to the hardware.
device_sn
property
str: Hardware serial number reported by the device.
device_uptime
property
str: Human-readable uptime of the LINCam Capture application.
photocathode_on_status
property
bool: Actual photocathode high-voltage state as reported by the hardware.
Unlike :attr:photocathode_on (the commanded state), this reflects
whether the HV is actually present. The overexposure protection
circuit can disable it even when :attr:photocathode_on is True.
mcp_cps
property
float: Total MCP anode count rate in Hz (all photon events, pre-filter).
stop_cps
property
float: CFD stop-channel count rate in Hz.
acquired_cps
property
float: Net acquired photon count rate in Hz (after all filters/gates).
fpga_temperature
property
float: FPGA die temperature in °C.
detector_temperature
property
float: Detector housing temperature in °C.