Skip to content

XIA

Overview

Xia controllers can run in single point or continuous (aka mapping) acquisitions.

Supported controllers:

  • Mercury
  • FalconX

Todo

  • LIVE, EVENTS, TRIGGERS preset modes
  • USER and SYNC advance modes

Mosca to XIA

The conversion from mosca parameters to xia parameter is done in the function mosca.devices.xia.xia.Xia.apply_mosca.

Source code in mosca/devices/xia/xia.py
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
def apply_mosca(self,
            acq_nb_points=None,
            acq_realtime=None,
            acq_nb_triggers=None,
            spectrum_size=None,
            trigger_mode=None,
            gate_mode=None,
            block_size=None,
            resume=False,
            **kwargs):
    # TODO, check that params are correctly set?
    if self.is_running():
        raise RuntimeError('Cannot apply_mosca, an acquisition is already running. Stop it first.')

    self._poller = None

    mapping_mode = None
    gate_ignore = None
    preset_value = None
    num_map_pixels = None
    preset_type = None
    input_logic_polarity = None

    if gate_mode is not None:
        # gate_ignore for all but trigger_mode = ExtTrig
        gate_ignore = 1. if gate_mode == GateMode.IGNORE else 0.

    if trigger_mode == TriggerMode.FREERUN:
        # manual start/stop
        # acquisition is active depending on the gate level (or ignore all together)
        if acq_nb_points != 1:
            raise ValueError("Can't have trigger mode FREERUN and acq_nb_points != 1.")
        mapping_mode = 0.
        preset_type = XiaPresets.XIA_PRESET_NONE.value

    elif trigger_mode == TriggerMode.INT_TRIG_READOUT:
        # acquisition starts right away, but can still be controller by the input gate
        # i.e: if gate_mode != ignore, the time runs only when the gate is active
        # active gate level is set or turned off by gate_mode
        if acq_nb_points != 1:
            raise ValueError("Can't have trigger mode INT_TRIG_READOUT and acq_nb_points != 1.")
        mapping_mode = 0.
        preset_type = XiaPresets.XIA_PRESET_FIXED_REAL.value
        preset_value = acq_realtime
    else:
        preset_type = XiaPresets.XIA_PRESET_NONE.value
        num_map_pixels = acq_nb_points
        mapping_mode = 1.

        if gate_mode == GateMode.IGNORE or gate_mode == None:
            raise ValueError(f"Can't have trigger mode {trigger_mode.name} and gate mode IGNORE or None.")
        elif gate_mode == GateMode.HIGH:
            input_logic_polarity = XiaGatePolarity.XIA_GATE_COLLECT_HI.value
        elif gate_mode == GateMode.LOW:
            input_logic_polarity = XiaGatePolarity.XIA_GATE_COLLECT_LO.value

        if trigger_mode == TriggerMode.GATE:
            # mapping mode, acquiring when the gate is active
            # pixel advance when the gate becomes inactive
            # active gate level is controlled by gate_mode
            # - acquisition runs on HI level: gate mode -> HIGH (pixel advance on falling edge)
            # - acquisition runs on LO level: gate mode -> LOW (pixel advance on rising edge)
            gate_ignore = 0.

        elif trigger_mode == TriggerMode.EXT_TRIG:
            # mapping mode, without gate
            # continuous acquisition, pixels are advanced when an edge is detected
            # edge direction is controlled by gate_mode:
            # - advance on rising edge: gate mode -> LOW
            # - advance on falling edge: gate mode -> HIGH
            # (choice made to stay coherent with the GATE trigger mode)
            gate_ignore = 1.

        else:
            raise ValueError(f"Unsupported trigger mode: {trigger_mode.name}")

    if mapping_mode is not None:
        self.mapping_mode = mapping_mode

    if gate_ignore is not None:
        self.gate_ignore = gate_ignore

    if preset_type is not None:
        self.preset_type = preset_type

    if preset_value is not None:
        self.preset_value = preset_value

    if spectrum_size is not None:
        self.number_mca_channels = spectrum_size

    if block_size is not None:
        self.pixels_per_buffer = block_size

    if input_logic_polarity is not None:
        self.input_logic_polarity = input_logic_polarity

    if num_map_pixels is not None:
        self.num_map_pixels = num_map_pixels

enum values

The given values for preset_value and gate_polarity settings are based on the enumeration defined in the XIA headers at the time of writing the documentation (and code...).

Single point acquisition

To configure the hardware to run a single point acquisition, acq_nb_points must be set to 1.

  • realtime: the acquisition starts when the hardware is started, and runs for the given number of seconds (acq_realtime, measured by the hardware).
  • freerun: the acquisition start as when the hardware is started, and runs until a stop is requested.

In both cases the acquisition can be inhibited with the gate (gate_mode).

Realtime run

Starts acquiring as soon as the hardware is started.

Mosca Value
acq_nb_points 1
trigger_mode INT_TRIG_READOUT
acq_realtime time in s
gate_mode
  • HIGH
  • LOW
  • IGNORE

This translates into the following XIA settings:

XIA Value
mapping_mode 0.0
preset_type 1.0 (XIA_PRESET_FIXED_REAL)
preset_value acq_realtime
gate_ignore
  • 0.0 if gate_mode is HIGH or LOW
  • 1.0 if gate_mode is IGNORE
input_logic_polarity
  • 0.0 if gate_mode is HIGH (XIA_GATE_COLLECT_HI)
  • 1.0 if gate_mode is LOW (XIA_GATE_COLLECT_LO)

Free run

The acquisition time is controller by the user (start/stop).

Mosca Value
acq_nb_points 1
trigger_mode FREERUN
gate_mode
  • HIGH
  • LOW
  • IGNOGRE

This translates into the following XIA settings:

XIA Value
mapping_mode 0.0
preset_type 0.0 (XIA_PRESET_NONE)
gate_ignore
  • 0.0 if gate_mode is HIGH or LOW
  • 1.0 if gate_mode is IGNORE
input_logic_polarity
  • 0.0 if gate_mode is HIGH (XIA_GATE_COLLECT_HI)
  • 1.0 if gate_mode is LOW (XIA_GATE_COLLECT_LO)

Continuous (mapping) acquisition

To configure the hardware to run in mapping mode, acq_nb_points must be higher than 1.

Individual points (aka pixel) are completed ("advanced") either when a rising or falling edge is detector.

WIP: advance modes

XIA also support USER and SYNC advance modes, they are not implemented yet in Mosca.

Gate mode

In this mode, acquisition runs while the gate is active. The acquired data point is made available when the gate become inactive. Desired gate level is configured with gate mode.

Mosca Value
acq_nb_points >=1
gate_mode
  • HIGH
  • LOW
trigger_mode GATE
block_size >=1

This translates into the following XIA settings:

XIA Value
mapping_mode 1.0
num_map_pixels acq_nb_points
gate_ignore 0.0
input_logic_polarity
  • 0.0 if gate_mode is HIGH (XIA_GATE_COLLECT_HI)
  • 1.0 if gate_mode is LOW (XIA_GATE_COLLECT_LO)
pixels_per_buffer block_size

Edge mode

In this mode, acquisition runs as soon as the detector is started. The acquired data point is made available when an edge is detected. Edge direction (falling OR rising) is configured with gate mode, just like in Gate mode:

  • gate mode = HIGH: point ends with a falling edge
  • gate mode = LOW: point ends with a rising edge
Mosca Value
acq_nb_points >=1
gate_mode
  • HIGH
  • LOW
trigger_mode GATE
block_size >=1

This translates into the following XIA settings:

XIA Value
mapping_mode 1.0
num_map_pixels acq_nb_points
gate_ignore 1.0
input_logic_polarity
  • 0.0 if gate_mode is HIGH (XIA_GATE_COLLECT_HI)
  • 1.0 if gate_mode is LOW (XIA_GATE_COLLECT_LO)
pixels_per_buffer block_size

Controller specific settings

FalconX

At the time of writing the documentation, the maximum value for nump_map_pixels is 1020. The FalconX has mca_refresh setting that can be set directly through the controller instance.

Mercury

n/a

Tango

The DS has three optional properties:

  • default_ini_dir: default folder (ini_dir) into which look for ini files. If not provided, the default_ini_file directory will be used (if provided). If default_ini_file is not provided either, the current working directory is used.
  • default_ini_file: default ini file (ini_file) to load at DS startup, if provided.
  • lib_path: folder containing the handel.dll library. If not provided, the one found (if any) in the system path will be used. If none is found, the DS will fail to start.

The DS has an attribute named ini_dir. It is used when available_configs is called.

When setting ini_file with a relative path, the DS will try to find it relative to ini_dir.

When setting ini_file with an absolute path, ini_dir will not be used.