Private
Public Access
11
1
17
ZMQ Message Reference
watts edited this page 2025-08-05 13:34:03 +02:00

This page lists the JSON strings that can be sent to the ZMQ REQ/REP port in order to request actions by Pixelator. The ZMQ messages must be sent in the format:

[HEADER, DATA1 (, DATA2)]

where the data can either be an empty string, or a JSON list or structure, e.g.:

["string1","string2","string3"] or {"key1":"value1","key2":"value2","key3":"value3"}

Request messages are typically responded to by a simple ["status", "ok"] response on the REQ/REP port and the publication of further data on the PUB/SUB port.

'initialize'

No data required or used. Lots of data is returned and published with the intended use being to populate a GUI.

Reply Messages:

  • ["status","ok"]
  • Positioner definitions
  • Detector definitions
  • Oscilloscope options
  • Zone Plate definitions
  • File IO config options

Published Messages:

  • Positioner status
  • Focus status
  • Scan status
  • Beam shutter status
  • Topup status
  • User status
  • Recorded channels
  • Focus type
  • Scan type archive attribute
  • Beam shutter mode
  • Topup mode

'recordedChannels'

Data is a list of strings that correspond to the names of the detectors to be enabled. For example:

    msg = ['recordedChannels',   '["Counter0", "Counter1"]' ]

Reply Messages:

  • ["status","ok"]

'detectorSettings'

Data is a string that corresponds to the name of a detector. For example:

    msg = ['detectorSettings',   'Counter0' ]

Reply Messages:

  • ["status","ok"]
  • message from specific detector module with a JSON array, but there doesn't seem to be an implementation yet.

'updateDetectorSettings'

Data is a string that corresponds to the name of a detector. Data2 is a JSON array with property, value pairs. For example:

    msg = ['updateDetectorSettings',   'Counter0', JSON_string ]

Reply Messages:

  • ["status","ok"]

'estimatedTime'

Data is a JSON scan request (see 'scanRequest' below). For example:

    msg = ['estimatedTime',   Scan_Request ]

Reply Messages:

  • ["status","ok"]
  • ['estimatedTime', Time_String ]

A Time_String will have a format like "00h 00m 01s", or "555h 59m 59s".

'scanRequest'

Data is a JSON scan request. For example:

    msg = ['estimatedTime',   "{
      'scanType': 'Sample',
      'spatialType': 'Image',
      'meander': 1, 
      'tiling': 1, 
      'yAxisFast': 0, 
      'lineMode': 'Constant Velocity', 
      'accelerationDistance': 0.5, 
      'tileDelay': 0.05, 'lineDelay': 0.05, 
      'outerRegions': [{'dwellTime': 0.005, 
                                     'axes': [{'nPoints': 2, 
                                     'trajectories': [{'start': 900.0, 
                                                                'end': 320.0, 
                                                                'range': -580.0, 
                                                                'step': -580.0, 
                                                                'positionerName': 'Energy'
                                                              }]
                                                 }]
                                  }], 
      'innerRegions': [{'axes': [{'nPoints': 1200, 
                                                   'trajectories': [{'center': 4282.670215322501, 
                                                                              'range': 12.0, 
                                                                              'step': 0.01, 
                                                                              'positionerName': 'FineY'
                                                                            }]
                                                  },
                                                  {'nPoints': 140, 
                                                  'trajectories': [{'center': 37.8280758446287, 
                                                                             'range': 28.0, 
                                                                             'step': 0.2, 
                                                                             'positionerName': 'FineX'
                                                                           }]
                                                  }]
                                   },
                                   {'axes': [{'nPoints': 10, 
                                                   'trajectories': [{'center': 5571.33258869908, 
                                                                              'range': 1.0, 
                                                                              'step': 0.1, 
                                                                              'positionerName': 'FineY'
                                                                           }]
                                                  },
                                                  {'nPoints': 10, 
                                                  'trajectories': [{'center': -5400.94023907363, 
                                                                             'range': 1.0, 
                                                                             'step': 0.1, 
                                                                             'positionerName': 'FineX'
                                                                           }]
                                                  }]
                                  }],
                                  'nOuterRegions': 1, 
                                  'nInnerRegions': 1, 
                                  'singleOuterRegionValue': 1, 
                                  'displayedAxes': {'x': {'region': 'inner', 
                                                                        'index': 1
                                                                       }, 
                                                                 'y': {'region': 'inner', 
                                                                        'index': 0
                                                                        }
                                                                 },
                                  'positionPrecision': {'precision': 200.0}, 
                                  'defocus': {'diameter': 0.0}
      }"
]

Reply Messages:

  • ["status","ok"]

'abortScan'

Message only needs the header, no data required. For example:

    msg = ['abortScan' ]

Reply Messages:

  • ["status","ok"]

'pauseScan'

Message only needs the header, no data required. For example:

    msg = ['pauseScan' ]

Reply Messages:

  • ["status","ok"]

'resumeScan'

Message only needs the header, no data required. For example:

    msg = ['resumeScan' ]

Reply Messages:

  • ["status","ok"]

'scanStatus'

Message only needs the header, no data required. For example:

    msg = ['scanStatus' ]

I don't think this is actually used anymore, or is useful, since Pixelator regularly publishes scanStatus messages.

Reply Messages:

  • ["status","ok"]
  • ["scanStatus", '{"current":{"innerRegion":1, "line":3, "lineRepetition":1, "outerRegion":1, "point":582, "polarization":1, "remainingTime":"25h 11m 10s", "time":"00h 01m 01s" }, "scanType":"Sample Scan", "status":"running", "total":{"innerRegion":1, "line":5001,"lineRepetition":1, "outerRegion":1, "point":1000, "polarization":1, "time":"25h 08m 40s" } }' ]

'moveRequest'

'moveStatus'

'homeRequest'

'positionerStatus'

'modified positioner definition'

  • "name": (required) Positioner name. Must exist as a defined positioner.

    Further optional keys correspond to the positioner base settings.

  • "positionOffset"

  • "upperSoftLimit"

  • "lowerSoftLimit"

  • "autoOff"

Example message contents for modifying the CoarseX positioner:

    msg = ['modified positioner definition',
    '{
	"autoOffMode":"Always",
	"lowerSoftLimit":120.0,
	"positionOffset":3.456,
	"upperSoftLimit":1221.0,
	}']

Successful modification of the positioner definition will result in the publication of the new positioner definition in full.

'modified zonePlate definition'

'zonePlateFocus'

'oscilloscopeDefinition'

'focusType'

'scanTypeArchive'

'localFileScanTypeArchive'

'allMotorsOff'

'resetInterferometer'

'OSA_IN'

'OSA_OUT'

'ZonePlate IN'

'ZonePlate OUT'

'Sample OUT'

'topupMode'

'beamShutterMode'

'loadFile directory'

'loadFile file'

'loadDefinition'

'change user'

'script info'