European-XFEL / karabo_data

Python tools to read and analyse data from European XFEL
https://karabo-data.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
13 stars 7 forks source link

To generalize serve files interface #98

Open ebadkamil opened 5 years ago

ebadkamil commented 5 years ago

Hi all,

In karabo-FAI we came across the issue that when dealing with JungFrau detector, we stream from dataagregator files which also stream control data. Could we generalize serve_files in karabo_data so that one can specify device name and particular key that we want to stream. At the moment in KaraboFAI we do something like this.


def _stream(self):
        streamer = ZMQStreamer(self._port)
        streamer.start()

        run = RunDirectory(self._folder)
        # TOPIC to be later replaced by Detector type LPD, AGIPD, JFRAU
        if config["TOPIC"] == "FXE" or config["TOPIC"] == "SPB":
            devices = [("*DET/*CH0:xtdf", "image.data")]
        elif config["TOPIC"] == "JungFrau":
            devices = [("*/DET/*:daqOutput", "data.adc")]
        else:
            devices = None

        for tid, data in run.trains(devices=devices, require_all=True):
            if data:
                streamer.feed(data)
        streamer.stop()

But it will be nice if one can just use serve_files with devices option.

takluyver commented 5 years ago

I think it would be reasonable to add a selection parameter.