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 rateDevice Handle
Note
The reference for LINCam.LINCamRemote.LINCamRemote is generated from the Python docstrings and inserted here automatically. Do not write it out by hand.
options: show_root_heading: true show_root_toc_entry: true heading_level: 3 members:
- __init__
- sync
- sync_histograms
- setup_recording
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 |
Note
The reference for LINCam.LINCamRemote.LINCamRemote is generated from the Python docstrings and inserted here automatically. Do not write it out by hand.
options: show_root_heading: false heading_level: 4 members:
- device_url
- photocathode_on
- tdc_slopes
- tdc_start_rise
- tdc_stop_rise
- stop_threshold
- stop_zero_cross
- test_generator
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 |
Note
The reference for LINCam.LINCamRemote.LINCamRemote is generated from the Python docstrings and inserted here automatically. Do not write it out by hand.
options: show_root_heading: false heading_level: 4 members:
- time_offset
- time_binnig
- time_gate
- time_gate_on
- time_gate_a
- time_gate_b
Position Transform
A 2-D affine transform can be applied to the XY positions of the spatial image, letting you rotate, translate, or scale it. There are two independent transforms:
position_transform— view only: transforms the displayed and
downloaded histograms (see sync_histograms). Recorded photon data is not affected, and other connected clients are not affected. Resets to identity when LINCam Capture restarts.
position_transform_device— applied in the camera driver to the
photon stream itself, so it affects recorded photon data and every connected client alike. Resets to identity on driver restart.
Both use the same matrix layout shown below.
The matrix is a 2×3 affine, stored column-major as [m00, m10, m01, m11, m02, m12]. Build one with the Transform2D helper, whose operations chain so the last one is applied to the point first. The image spans 0…4095 on both axes, so rotations are usually composed about the centre (2048, 2048):
from photonscore import Transform2D
# Rotate the image by 10 degrees about its centre
cam.position_transform = (
Transform2D().move(2048, 2048).rotate(10).move(-2048, -2048))
cam.sync()
cam.sync_histograms(xy_bins=512) # cam.hist_2d is now rotated
# A plain 6-element sequence works too; identity resets the view
cam.position_transform = [1, 0, 0, 1, 0, 0]
cam.sync()
# To transform the photon stream itself (recordings + all clients),
# use the device transform with the same matrix layout:
cam.position_transform_device = (
Transform2D().move(2048, 2048).rotate(10).move(-2048, -2048))
cam.sync()| Property | Type | Description | |
|---|---|---|---|
position_transform | list[float] \ | Transform2D | View-only 2×3 affine matrix [m00, m10, m01, m11, m02, m12] |
position_transform_device | list[float] \ | Transform2D | Same, applied in the device driver (affects recordings + all clients) |
Note
The reference for LINCam.LINCamRemote.LINCamRemote is generated from the Python docstrings and inserted here automatically. Do not write it out by hand.
options: show_root_heading: false heading_level: 4 members:
- position_transform
- position_transform_device
Transform2D
Note
The reference for transform2d.Transform2D is generated from the Python docstrings and inserted here automatically. Do not write it out by hand.
options: show_root_heading: true heading_level: 4 members:
- move
- rotate
- rotate_radians
- scale
- apply
- map
Recording
cam.setup_recording("/data/run01", filenumber=0, seconds=10)
cam.is_recording = True
cam.sync()
# ... wait ...
cam.is_recording = False
cam.sync()Note
The reference for LINCam.LINCamRemote.LINCamRemote is generated from the Python docstrings and inserted here automatically. Do not write it out by hand.
options: show_root_heading: false heading_level: 4 members:
- setup_recording
- is_recording
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) |
Note
The reference for LINCam.LINCamRemote.LINCamRemote is generated from the Python docstrings and inserted here automatically. Do not write it out by hand.
options: show_root_heading: false heading_level: 4 members:
- device_connected
- device_sn
- device_uptime
- photocathode_on_status
- mcp_cps
- stop_cps
- acquired_cps
- fpga_temperature
- detector_temperature