Skip to content

LINTag Python Interface

The python submodule to remotely control LINTag Capture.

Usage

import photonscore as pe

LINTagDevice = pe.LINTag("localhost:5556")

Examples

see here

The Device Handle

LINTag

A class representing a LINTag TDC to remote control the LINTag Capture Application

Attributes:

Name Type Description
correlator CorrelatorClass

Subclass for controlling the Correlator of LINTag Capture.

file_writer FileWriterClass

Subclass for representing the FileWriter module of LINTag Capture.

status StatusClass

Subclass for representing the status of the LINTag.

settings SettingsClass

Subclass for getting and setting the settings of the LINTag.

Source code in LINTag/LINTag.py
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
class LINTag:
  """
    ## LINTag

    A class representing a LINTag TDC to remote control the LINTag Capture Application

    Attributes:
        correlator (CorrelatorClass): Subclass for controlling the Correlator of LINTag Capture.
        file_writer (FileWriterClass): Subclass for representing the FileWriter module of LINTag Capture.
        status (StatusClass): Subclass for representing the status of the LINTag.
        settings (SettingsClass): Subclass for getting and setting the settings of the LINTag.
    """

  __address = ""
  __channel = ""
  __stub = ""

  correlator = ""
  file_writer = ""
  status = ""
  settings = ""

  def __init__(self, address = "localhost:5556", grpc_channel_options = None):
    """
         Initializes a LINTag object.

         Parameters:
             address (str): The address under which the gRPC server of LINTag capture is running
         """
    self.__address = address
    self.__channel = grpc.insecure_channel(address, grpc_channel_options)
    self.__stub = LinkerService(self.__channel)
    self.correlator = CorrelatorClass(self.__channel, self.__stub)
    self.status = StatusClass(self.__channel, self.__stub)
    self.settings = SettingsClass(self.__channel, self.__stub)
    self.file_writer = FileWriterClass(self.__channel, self.__stub)

__init__(address='localhost:5556', grpc_channel_options=None)

Initializes a LINTag object.

Parameters:

Name Type Description Default
address str

The address under which the gRPC server of LINTag capture is running

'localhost:5556'
Source code in LINTag/LINTag.py
36
37
38
39
40
41
42
43
44
45
46
47
48
49
def __init__(self, address = "localhost:5556", grpc_channel_options = None):
  """
       Initializes a LINTag object.

       Parameters:
           address (str): The address under which the gRPC server of LINTag capture is running
       """
  self.__address = address
  self.__channel = grpc.insecure_channel(address, grpc_channel_options)
  self.__stub = LinkerService(self.__channel)
  self.correlator = CorrelatorClass(self.__channel, self.__stub)
  self.status = StatusClass(self.__channel, self.__stub)
  self.settings = SettingsClass(self.__channel, self.__stub)
  self.file_writer = FileWriterClass(self.__channel, self.__stub)

Controlling the correlator

LINTag.LINTag.CorrelatorClass

A class that interfaces with the correlator of LINTag Capture to remotely control it

Source code in LINTag/LINTag.py
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
class CorrelatorClass:
  """
    A class that interfaces with the correlator of LINTag Capture to remotely control it
    """
  __channel = ""
  __stub = ""

  def __init__(self, channel, stub):
    self.__channel = channel
    self.__stub = stub

  def clear_histogram(self):
    """
        Clears the histogram currently displayed in LINTag Capture.
        Returns: None
        """
    ccrq = CorrelatorClearRequest()
    self.__stub.SendCorrelatorClear(ccrq)

  def get_histogram(self) -> tuple[np.ndarray, np.ndarray]:
    """
        Gets the current histogram displayed in LINTag Capture.
        Returns:
            Bins: Numpy array of doubles describing the bins
            Values: Numpy array of uint32, describing the values of the histogram

        """
    chrq = CorrelatorHistogramRequest()
    raw_histogram = self.__stub.GetCorrelatorHistogram(chrq)
    bins = np.array(raw_histogram.time_bins)
    values = np.array(raw_histogram.bins)
    return bins, values

  def get_correlator_settings(self, integers_for_enums = False) -> dict:
    """
        Retrieves the current state of the correlator module in LINTag capture

        Returns: A Dictionary containing the current correlator settings

        """
    csrq = CorrelatorSettingsRequest()
    correlator_settings = self.__stub.GetCorrelatorSettings(csrq)
    return MessageToDict(
      correlator_settings,
      preserving_proto_field_name = True,
      use_integers_for_enums = integers_for_enums,
      including_default_value_fields = True,
    )

  def set_correlator_settings(
    self,
    start_channel = None,
    start_slope = None,
    stop_channel = None,
    stop_slope = None,
    window_ps = None,
    correlator_type = None,
    bin_size = None,
    is_correlating = None
  ) -> None:
    """This function is used to change the settings of the histogram in LINTag Capture.

            Parameters:
                start_channel (uint): Integer from 0 to 7, specifying the start channel
                start_slope (str): can be `RISING` or `FALLING`
                stop_channel (uint): Integer from 0 to 7
                stop_slope (str): can be `RISING` or `FALLING`
                window_ps (uint): Integer from 3000 to 1000000
                correlator_type (str): Can be `START_STOP` or `MULTI_START_STOP`
                bin_size (str): Can be `ONE_PS`, `FIVE_PS`, `TEN_PS`, `TWENTYFIVE_PS`, `FIFTY_PS`, `HUNDRED_PS`
                is_correlating (bool): Sets if the correlator is running online
        """
    # specify which kwargs are allowed
    list_of_keys = [
      "start_channel",
      "start_slope",
      "stop_channel",
      "stop_slope",
      "window_ps",
      "correlator_type",
      "bin_size",
      "is_correlating",
    ]
    # specify for string/enum fields, which values are allowed
    allowed_vals_for_keys = {
      "start_slope": {
        "RISING": 1,
        "FALLING": 2,
      },
      "stop_slope": {
        "RISING": 1,
        "FALLING": 2,
      },
      "correlator_type": {
        "START_STOP": 1,
        "MULTI_START_STOP": 2,
      },
      "bin_size":
        {
          "ONE_PS": 1,
          "FIVE_PS": 2,
          "TEN_PS": 3,
          "TWENTYFIVE_PS": 4,
          "FIFTY_PS": 5,
          "HUNDRED_PS": 6,
        }
    }
    # not the best solutiom ,but works
    all_values = locals()

    # retrieve the current state
    current_settings = self.get_correlator_settings(True)
    # match it with given input
    for key in list_of_keys:
      value = all_values[key]
      if value is None:
        continue
      # check if settings are allowed!
      if key not in list_of_keys:
        raise ValueError(
          "Settings Error: Only the following settings can be addressed: " +
          ", ".join(list_of_keys)
        )
      # deal with enums
      if key in allowed_vals_for_keys:
        # retrieve enum
        map = allowed_vals_for_keys[key]
        if value not in map.keys():
          raise ValueError(
            "Value Error for " + key +
            ": Only the following values are allowed: " + ", ".join(map.keys())
          )
        current_settings[key] = map[value]
        continue

      # just flush the other values and hope for the best
      current_settings[key] = value

    # create new gRPC transfer object
    transfer_object = CorrelatorSettings()
    for key in list_of_keys:
      setattr(transfer_object, key, current_settings[key])
    # send it
    self.__stub.SetCorrelatorSettings(transfer_object)

clear_histogram()

Clears the histogram currently displayed in LINTag Capture. Returns: None

Source code in LINTag/LINTag.py
238
239
240
241
242
243
244
def clear_histogram(self):
  """
      Clears the histogram currently displayed in LINTag Capture.
      Returns: None
      """
  ccrq = CorrelatorClearRequest()
  self.__stub.SendCorrelatorClear(ccrq)

get_correlator_settings(integers_for_enums=False)

Retrieves the current state of the correlator module in LINTag capture

Returns: A Dictionary containing the current correlator settings

Source code in LINTag/LINTag.py
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
def get_correlator_settings(self, integers_for_enums = False) -> dict:
  """
      Retrieves the current state of the correlator module in LINTag capture

      Returns: A Dictionary containing the current correlator settings

      """
  csrq = CorrelatorSettingsRequest()
  correlator_settings = self.__stub.GetCorrelatorSettings(csrq)
  return MessageToDict(
    correlator_settings,
    preserving_proto_field_name = True,
    use_integers_for_enums = integers_for_enums,
    including_default_value_fields = True,
  )

get_histogram()

Gets the current histogram displayed in LINTag Capture. Returns: Bins: Numpy array of doubles describing the bins Values: Numpy array of uint32, describing the values of the histogram

Source code in LINTag/LINTag.py
246
247
248
249
250
251
252
253
254
255
256
257
258
def get_histogram(self) -> tuple[np.ndarray, np.ndarray]:
  """
      Gets the current histogram displayed in LINTag Capture.
      Returns:
          Bins: Numpy array of doubles describing the bins
          Values: Numpy array of uint32, describing the values of the histogram

      """
  chrq = CorrelatorHistogramRequest()
  raw_histogram = self.__stub.GetCorrelatorHistogram(chrq)
  bins = np.array(raw_histogram.time_bins)
  values = np.array(raw_histogram.bins)
  return bins, values

set_correlator_settings(start_channel=None, start_slope=None, stop_channel=None, stop_slope=None, window_ps=None, correlator_type=None, bin_size=None, is_correlating=None)

This function is used to change the settings of the histogram in LINTag Capture.

Parameters:

Name Type Description Default
start_channel uint

Integer from 0 to 7, specifying the start channel

None
start_slope str

can be RISING or FALLING

None
stop_channel uint

Integer from 0 to 7

None
stop_slope str

can be RISING or FALLING

None
window_ps uint

Integer from 3000 to 1000000

None
correlator_type str

Can be START_STOP or MULTI_START_STOP

None
bin_size str

Can be ONE_PS, FIVE_PS, TEN_PS, TWENTYFIVE_PS, FIFTY_PS, HUNDRED_PS

None
is_correlating bool

Sets if the correlator is running online

None
Source code in LINTag/LINTag.py
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
def set_correlator_settings(
  self,
  start_channel = None,
  start_slope = None,
  stop_channel = None,
  stop_slope = None,
  window_ps = None,
  correlator_type = None,
  bin_size = None,
  is_correlating = None
) -> None:
  """This function is used to change the settings of the histogram in LINTag Capture.

          Parameters:
              start_channel (uint): Integer from 0 to 7, specifying the start channel
              start_slope (str): can be `RISING` or `FALLING`
              stop_channel (uint): Integer from 0 to 7
              stop_slope (str): can be `RISING` or `FALLING`
              window_ps (uint): Integer from 3000 to 1000000
              correlator_type (str): Can be `START_STOP` or `MULTI_START_STOP`
              bin_size (str): Can be `ONE_PS`, `FIVE_PS`, `TEN_PS`, `TWENTYFIVE_PS`, `FIFTY_PS`, `HUNDRED_PS`
              is_correlating (bool): Sets if the correlator is running online
      """
  # specify which kwargs are allowed
  list_of_keys = [
    "start_channel",
    "start_slope",
    "stop_channel",
    "stop_slope",
    "window_ps",
    "correlator_type",
    "bin_size",
    "is_correlating",
  ]
  # specify for string/enum fields, which values are allowed
  allowed_vals_for_keys = {
    "start_slope": {
      "RISING": 1,
      "FALLING": 2,
    },
    "stop_slope": {
      "RISING": 1,
      "FALLING": 2,
    },
    "correlator_type": {
      "START_STOP": 1,
      "MULTI_START_STOP": 2,
    },
    "bin_size":
      {
        "ONE_PS": 1,
        "FIVE_PS": 2,
        "TEN_PS": 3,
        "TWENTYFIVE_PS": 4,
        "FIFTY_PS": 5,
        "HUNDRED_PS": 6,
      }
  }
  # not the best solutiom ,but works
  all_values = locals()

  # retrieve the current state
  current_settings = self.get_correlator_settings(True)
  # match it with given input
  for key in list_of_keys:
    value = all_values[key]
    if value is None:
      continue
    # check if settings are allowed!
    if key not in list_of_keys:
      raise ValueError(
        "Settings Error: Only the following settings can be addressed: " +
        ", ".join(list_of_keys)
      )
    # deal with enums
    if key in allowed_vals_for_keys:
      # retrieve enum
      map = allowed_vals_for_keys[key]
      if value not in map.keys():
        raise ValueError(
          "Value Error for " + key +
          ": Only the following values are allowed: " + ", ".join(map.keys())
        )
      current_settings[key] = map[value]
      continue

    # just flush the other values and hope for the best
    current_settings[key] = value

  # create new gRPC transfer object
  transfer_object = CorrelatorSettings()
  for key in list_of_keys:
    setattr(transfer_object, key, current_settings[key])
  # send it
  self.__stub.SetCorrelatorSettings(transfer_object)

Evaluating the Status

LINTag.LINTag.StatusClass

A class that interfaces with the current LINTag status

Source code in LINTag/LINTag.py
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
class StatusClass:
  """
    A class that interfaces with the current LINTag status
    """
  __channel = ""
  __stub = ""

  def __init__(self, channel, stub):
    self.__channel = channel
    self.__stub = stub

  def get_telemetry(self, integers_for_enums = False):
    """
        Retrieves the current telemetry sent by the LINTag

        Returns: A Dictionary containing the current LINTag telemetry

        """
    strq = StateRequest()
    raw_state = self.__stub.GetState(strq)
    parsed_state = MessageToDict(
      raw_state,
      preserving_proto_field_name = True,
      use_integers_for_enums = integers_for_enums,
      including_default_value_fields = True,
    )
    return parsed_state["telemetry"]

  def get_profile(self, integers_for_enums = False):
    """
                Retrieves the current profile sent by the LINTag

                Returns: A Dictionary containing the current LINTag profile

                """
    strq = StateRequest()
    raw_state = self.__stub.GetState(strq)
    parsed_state = MessageToDict(
      raw_state,
      preserving_proto_field_name = True,
      use_integers_for_enums = integers_for_enums,
      including_default_value_fields = True,
    )
    return parsed_state["profile"]

get_profile(integers_for_enums=False)

Retrieves the current profile sent by the LINTag

Returns: A Dictionary containing the current LINTag profile

Source code in LINTag/LINTag.py
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
def get_profile(self, integers_for_enums = False):
  """
              Retrieves the current profile sent by the LINTag

              Returns: A Dictionary containing the current LINTag profile

              """
  strq = StateRequest()
  raw_state = self.__stub.GetState(strq)
  parsed_state = MessageToDict(
    raw_state,
    preserving_proto_field_name = True,
    use_integers_for_enums = integers_for_enums,
    including_default_value_fields = True,
  )
  return parsed_state["profile"]

get_telemetry(integers_for_enums=False)

Retrieves the current telemetry sent by the LINTag

Returns: A Dictionary containing the current LINTag telemetry

Source code in LINTag/LINTag.py
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
def get_telemetry(self, integers_for_enums = False):
  """
      Retrieves the current telemetry sent by the LINTag

      Returns: A Dictionary containing the current LINTag telemetry

      """
  strq = StateRequest()
  raw_state = self.__stub.GetState(strq)
  parsed_state = MessageToDict(
    raw_state,
    preserving_proto_field_name = True,
    use_integers_for_enums = integers_for_enums,
    including_default_value_fields = True,
  )
  return parsed_state["telemetry"]

Changing Settings

LINTag.LINTag.SettingsClass

A class that interfaces with the current LINTag settings in order to control it

Source code in LINTag/LINTag.py
 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
class SettingsClass:
  """
    A class that interfaces with the current LINTag settings in order to control it
    """
  __channel = ""
  __stub = ""

  def __init__(self, channel, stub):
    self.__channel = channel
    self.__stub = stub

  def set_lintag_ip_address(self, ip_address):
    """
        Sets the IP-Address of the LINTag to connect to in the used LINTag Capture

        Parameters:
            ip_address (str): A valid LINTag IP-Address in the shape `http://192.168.8.31:10032`

        """
    siprq = SetIpRequest()
    siprq.ip_address = ip_address
    self.__stub.SetLintagIpAddress(siprq)

  def get_channel(self, channel, integers_for_enums = False):
    """
        Retrieves the current settings of the LINTag

        Parameters:
             channel (int): Specifies the channel to fetch, between 0 and 7

        Returns: A Dictionary containing the current LINTag settings

        """
    if channel not in [0, 1, 2, 3, 4, 5, 6, 7]:
      raise ValueError("Valid channels range from 0 to 7!")
    strq = StateRequest()
    raw_state = self.__stub.GetState(strq)
    parsed_state = MessageToDict(
      raw_state,
      preserving_proto_field_name = True,
      use_integers_for_enums = integers_for_enums,
      including_default_value_fields = True,
    )
    full_setting = parsed_state["settings"]
    # create a new dict, only showing the infos for the given channel
    ch_str = str(channel)
    ch_falling_str = str(channel + 8)
    channel_settings = {
      'nim_nttl': full_setting['nim_nttl'][ch_str],
      'threshold_v': full_setting['threshold_v'][ch_str],
      "rising_edge": not full_setting['supress'][ch_str],
      "falling_edge": not full_setting['supress'][ch_falling_str],
      "offset_ps": full_setting['offset_ps'][ch_str],
      "dead_time_ps": full_setting['dead_time_ps'][ch_str],
      "prolonged_dead_time": full_setting['prolonged_dead_time'][ch_str],
      "static_calibration": full_setting['static_calibration'][ch_str]
    }
    return channel_settings

  def set_channel(
    self,
    channel,
    threshold_v = None,
    nim_nttl = None,
    rising_edge = None,
    falling_edge = None,
    offset_ps = None,
    dead_time_ps = None,
    prolonged_dead_time = None,
    static_calibration = None
  ):
    """
        Function to change the settings of the specified channel

        Parameters:
             channel (int): Specifies the channel to fetch, between 0 and 7
             threshold_v (double): Specifies the threshold of the channel, from -2.0 to 2.5
             nim_nttl (bool): Specify impedance of channel, `True`is 50 Ohm, `False` is HiZ
             rising_edge (bool): The rising edge is tracked and sent to the network interface
             falling_edge (bool): The falling edge is tracked and sent to the network interface
             offset_ps (long): Specify offset of the channel in ps
             dead_time_ps (int): Specifies the artifical dead time for the channel in ps
             prolonged_dead_time (bool): If set to `True`, the deadtime will be prolonged for events detected during the deadtime
             static_calibration (bool): If set to `True` the channel calibration will be fixed. Needed for signals, correlated to the clock of the LINTag
        """
    if channel not in [0, 1, 2, 3, 4, 5, 6, 7]:
      raise ValueError("Valid channels range from 0 to 7!")
    ch = channel
    ch_falling = channel + 8
    proxy_settings = Settings()
    # populate the settings accordingly
    if threshold_v is not None:
      if threshold_v < -2.0 or threshold_v > 2.5:
        raise ValueError("Allowed range for threshold is -2.0 to 2.5")
      proxy_settings.threshold_v[ch] = threshold_v
    if nim_nttl is not None:
      proxy_settings.nim_nttl[ch] = nim_nttl
    if rising_edge is not None:
      proxy_settings.supress[ch] = not rising_edge
    if falling_edge is not None:
      proxy_settings.supress[ch_falling] = not falling_edge
    if offset_ps is not None:
      proxy_settings.offset_ps[ch] = offset_ps
      proxy_settings.offset_ps[ch_falling] = offset_ps
    if dead_time_ps is not None:
      proxy_settings.dead_time_ps[ch] = dead_time_ps
      proxy_settings.dead_time_ps[ch_falling] = dead_time_ps
    if prolonged_dead_time is not None:
      proxy_settings.prolonged_dead_time[ch] = prolonged_dead_time
      proxy_settings.prolonged_dead_time[ch_falling] = prolonged_dead_time
    if static_calibration is not None:
      proxy_settings.static_calibration[ch] = static_calibration
      proxy_settings.static_calibration[ch_falling] = static_calibration

    self.__stub.SetSettings(proxy_settings)

get_channel(channel, integers_for_enums=False)

Retrieves the current settings of the LINTag

Parameters:

Name Type Description Default
channel int

Specifies the channel to fetch, between 0 and 7

required

Returns: A Dictionary containing the current LINTag settings

Source code in LINTag/LINTag.py
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
def get_channel(self, channel, integers_for_enums = False):
  """
      Retrieves the current settings of the LINTag

      Parameters:
           channel (int): Specifies the channel to fetch, between 0 and 7

      Returns: A Dictionary containing the current LINTag settings

      """
  if channel not in [0, 1, 2, 3, 4, 5, 6, 7]:
    raise ValueError("Valid channels range from 0 to 7!")
  strq = StateRequest()
  raw_state = self.__stub.GetState(strq)
  parsed_state = MessageToDict(
    raw_state,
    preserving_proto_field_name = True,
    use_integers_for_enums = integers_for_enums,
    including_default_value_fields = True,
  )
  full_setting = parsed_state["settings"]
  # create a new dict, only showing the infos for the given channel
  ch_str = str(channel)
  ch_falling_str = str(channel + 8)
  channel_settings = {
    'nim_nttl': full_setting['nim_nttl'][ch_str],
    'threshold_v': full_setting['threshold_v'][ch_str],
    "rising_edge": not full_setting['supress'][ch_str],
    "falling_edge": not full_setting['supress'][ch_falling_str],
    "offset_ps": full_setting['offset_ps'][ch_str],
    "dead_time_ps": full_setting['dead_time_ps'][ch_str],
    "prolonged_dead_time": full_setting['prolonged_dead_time'][ch_str],
    "static_calibration": full_setting['static_calibration'][ch_str]
  }
  return channel_settings

set_channel(channel, threshold_v=None, nim_nttl=None, rising_edge=None, falling_edge=None, offset_ps=None, dead_time_ps=None, prolonged_dead_time=None, static_calibration=None)

Function to change the settings of the specified channel

Parameters:

Name Type Description Default
channel int

Specifies the channel to fetch, between 0 and 7

required
threshold_v double

Specifies the threshold of the channel, from -2.0 to 2.5

None
nim_nttl bool

Specify impedance of channel, Trueis 50 Ohm, False is HiZ

None
rising_edge bool

The rising edge is tracked and sent to the network interface

None
falling_edge bool

The falling edge is tracked and sent to the network interface

None
offset_ps long

Specify offset of the channel in ps

None
dead_time_ps int

Specifies the artifical dead time for the channel in ps

None
prolonged_dead_time bool

If set to True, the deadtime will be prolonged for events detected during the deadtime

None
static_calibration bool

If set to True the channel calibration will be fixed. Needed for signals, correlated to the clock of the LINTag

None
Source code in LINTag/LINTag.py
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
def set_channel(
  self,
  channel,
  threshold_v = None,
  nim_nttl = None,
  rising_edge = None,
  falling_edge = None,
  offset_ps = None,
  dead_time_ps = None,
  prolonged_dead_time = None,
  static_calibration = None
):
  """
      Function to change the settings of the specified channel

      Parameters:
           channel (int): Specifies the channel to fetch, between 0 and 7
           threshold_v (double): Specifies the threshold of the channel, from -2.0 to 2.5
           nim_nttl (bool): Specify impedance of channel, `True`is 50 Ohm, `False` is HiZ
           rising_edge (bool): The rising edge is tracked and sent to the network interface
           falling_edge (bool): The falling edge is tracked and sent to the network interface
           offset_ps (long): Specify offset of the channel in ps
           dead_time_ps (int): Specifies the artifical dead time for the channel in ps
           prolonged_dead_time (bool): If set to `True`, the deadtime will be prolonged for events detected during the deadtime
           static_calibration (bool): If set to `True` the channel calibration will be fixed. Needed for signals, correlated to the clock of the LINTag
      """
  if channel not in [0, 1, 2, 3, 4, 5, 6, 7]:
    raise ValueError("Valid channels range from 0 to 7!")
  ch = channel
  ch_falling = channel + 8
  proxy_settings = Settings()
  # populate the settings accordingly
  if threshold_v is not None:
    if threshold_v < -2.0 or threshold_v > 2.5:
      raise ValueError("Allowed range for threshold is -2.0 to 2.5")
    proxy_settings.threshold_v[ch] = threshold_v
  if nim_nttl is not None:
    proxy_settings.nim_nttl[ch] = nim_nttl
  if rising_edge is not None:
    proxy_settings.supress[ch] = not rising_edge
  if falling_edge is not None:
    proxy_settings.supress[ch_falling] = not falling_edge
  if offset_ps is not None:
    proxy_settings.offset_ps[ch] = offset_ps
    proxy_settings.offset_ps[ch_falling] = offset_ps
  if dead_time_ps is not None:
    proxy_settings.dead_time_ps[ch] = dead_time_ps
    proxy_settings.dead_time_ps[ch_falling] = dead_time_ps
  if prolonged_dead_time is not None:
    proxy_settings.prolonged_dead_time[ch] = prolonged_dead_time
    proxy_settings.prolonged_dead_time[ch_falling] = prolonged_dead_time
  if static_calibration is not None:
    proxy_settings.static_calibration[ch] = static_calibration
    proxy_settings.static_calibration[ch_falling] = static_calibration

  self.__stub.SetSettings(proxy_settings)

set_lintag_ip_address(ip_address)

Sets the IP-Address of the LINTag to connect to in the used LINTag Capture

Parameters:

Name Type Description Default
ip_address str

A valid LINTag IP-Address in the shape http://192.168.8.31:10032

required
Source code in LINTag/LINTag.py
109
110
111
112
113
114
115
116
117
118
119
def set_lintag_ip_address(self, ip_address):
  """
      Sets the IP-Address of the LINTag to connect to in the used LINTag Capture

      Parameters:
          ip_address (str): A valid LINTag IP-Address in the shape `http://192.168.8.31:10032`

      """
  siprq = SetIpRequest()
  siprq.ip_address = ip_address
  self.__stub.SetLintagIpAddress(siprq)

Controlling the FileWriter

LINTag.LINTag.FileWriterClass

A class that interfaces with the LINTag Capture FileWriter module in order to control it from python

Source code in LINTag/LINTag.py
215
216
217
218
219
220
221
222
223
224
class FileWriterClass:
  """
    A class that interfaces with the LINTag Capture FileWriter module in order to control it from python
    """
  __channel = ""
  __stub = ""

  def __init__(self, channel, stub):
    self.__channel = channel
    self.__stub = stub