Photonscore. Contact
Home / Documentation / LINCam Python Interface
Software Documentation

LINCam Python Interface

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

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().

PropertyTypeDescription
device_urlstrIP:port of the physical LINCam hardware
photocathode_onboolEnable / disable photocathode HV
tdc_slopesstrEdge polarity: "//", "/\\", "\\/", "\\\\"
tdc_start_riseboolStart channel — rising edge
tdc_stop_riseboolStop channel — rising edge
stop_thresholdintCFD threshold voltage (DAC counts)
stop_zero_crossintCFD zero-crossing voltage (DAC counts)
test_generatorintInternal 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

PropertyTypeDescription
time_offsetfloatGlobal timing offset in ns
time_binnigintBin size in ps/channel
time_gatelist[float]Gate [start_ns, stop_ns]; set None to disable
time_gate_onboolGate enable/disable
time_gate_afloatGate start in ns
time_gate_bfloatGate 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_transformview 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()
PropertyTypeDescription
position_transformlist[float] \Transform2DView-only 2×3 affine matrix [m00, m10, m01, m11, m02, m12]
position_transform_devicelist[float] \Transform2DSame, 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.

PropertyTypeDescription
device_connectedboolHardware connection active
device_snstrDevice serial number
device_uptimestrApplication uptime
photocathode_on_statusboolActual HV state (may differ from commanded)
mcp_cpsfloatTotal MCP count rate (Hz)
stop_cpsfloatCFD stop-channel rate (Hz)
acquired_cpsfloatNet acquired rate after gates (Hz)
fpga_temperaturefloatFPGA temperature (°C)
detector_temperaturefloatDetector 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