You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A single run can retrieve data simultaneously from multiple sources:
datahub -p --epics s 0.0 e 2.0 c S10BC01-DBPM010:X1 --daqbuf s 0.0 e 2.0 c S10BC01-DBPM010:Q1 delay 30.0
The example above saves the next 2 seconds of data from an EPICS channel, and also from databuffer data read through daqbuf.
Being daqbuf a retrieving source, and given the fact we want future data, a "delay" parameter is specified to provide the time needed
for actual data to be available in daqbuf backend.
The argument documentation is available in the help message for the 'datahub' command:
usage: datahub [--GLOBAL_ARG_1 VALUE]...[--GLOBAL_ARG_N VALUE] [--<SOURCE 1>] [SOURCE_1_ARG_1 VALUE]...[SOURCE_1_ARG_N VALUE]...[--<SOURCE M>] [SOURCE_M_ARG_1 VALUE]...[SOURCE_M_ARG_N VALUE]
Command line interface for DataHub
optional arguments:
-h, --help show this help message and exit
-j, --json JSON Complete query defined as JSON
-f, --hdf5 [filename default_compression='gzip' auto_decompress=False path=None metadata_compression='gzip' ]
hdf5 options
-x, --txt [folder ] txt options
-p, --print print options
-m, --plot [channels=None colormap='viridis' color=None marker_size=None line_width=None max_count=None max_rate=None ]
plot options
-ps, --pshell [channels=None address='localhost' port=7777 timeout=3.0 layout='vertical' context=None style=None colormap='viridis' color=None marker_size=3 line_width=None max_count=None max_rate=None ]
pshell options
-s, --start START Relative or absolute start time or ID
-e, --end END Relative or absolute end time or ID
-r, --range RANGE Range definitions: ['Last 1min', 'Last 10min', 'Last 1h', 'Last 12h', 'Last 24h', 'Last 7d', 'Yesterday', 'Today', 'Last Week', 'This Week', 'Last Month', 'This Month']
-i, --id Force query by id
-t, --time Force query by time
-c, --channels CHANNELS
Channel list (comma-separated)
-n, --bins BINS Number of data bins
-l, --last Include last value before range
-fi, --filter FILTER Sets a filter for data
-di, --interval INTERVAL
Downsampling interval between samples in seconds
-dm, --modulo MODULO Downsampling modulo of the samples
-u, --url URL URL of default source
-b, --backend BACKEND
Backend of default source (use "null" for all backends)
-tt, --timestamp TIMESTAMP
Timestamp type: nano/int (default), sec/float or str
-cp, --compression COMPRESSION
Compression: gzip (default), szip, lzf, lz4 or none
-dc, --decompress Auto-decompress compressed images
-px, --prefix Add source ID to channel names
-pl, --parallel Parallelize query if possible
-pt, --path PATH Path to data in the file
-a, --align Merge sources aligning the message ids
-sr, --search Search channel names given a pattern (instead of fetching data)
-v, --verbose Displays complete search results, not just channels names
--epics [channels url=None path=None start=None end=None]
epics query arguments
--bsread [channels url='https://dispatcher-api.psi.ch/sf-databuffer' mode='SUB' path=None start=None end=None]
bsread query arguments
--pipeline [channels url='http://sf-daqsync-01:8889' name=None config=None mode='SUB' path=None start=None end=None]
pipeline query arguments
--camera [channels url='http://sf-daqsync-01:8888' name=None mode='SUB' path=None start=None end=None]
camera query arguments
--databuffer [channels url='https://data-api.psi.ch/sf-databuffer' backend='sf-databuffer' path=None delay=1.0 start=None end=None]
databuffer query arguments
--retrieval [channels url='https://data-api.psi.ch/api/1' backend='sf-databuffer' path=None delay=1.0 start=None end=None]
retrieval query arguments
--dispatcher [channels path=None start=None end=None]
dispatcher query arguments
--daqbuf [channels url='https://data-api.psi.ch/api/4' backend='sf-databuffer' path=None delay=1.0 cbor=True parallel=False start=None end=None]
daqbuf query arguments
--array10 [channels url=None mode='SUB' path=None reshape=False start=None end=None]
array10 query arguments
--redis [channels url='sf-daqsync-18:6379' backend='0' path=None start=None end=None]
redis query arguments
--stddaq [channels url='sf-daq-6.psi.ch:6379' name=None mode='SUB' path=None start=None end=None]
stddaq query arguments
If urls and backends are not specified in the command line arguments, sources utilize default ones.
Default URLs and backends can be redefined by environment variables:
The following arguments (or their abbreviations) can be used as source arguments,
overwriting the global arguments if present:
channels
start
end
id
time
url
backend
path
interval
modulo
prefix
In this example a hdf5 file will be generated querying the next 10 pulses of S10BC01-DBPM010:Q1 from daqbuf,
but also next 2 seconds of the EPICS channel S10BC01-DBPM010:X1:
datahub -f tst.h5 -s 0 -e 10 -i -c S10BC01-DBPM010:Q1 --daqbuf delay 10.0 --epics s 0 e 2 time True c S10BC01-DBPM010:X1
Source specific arguments, unlike the global ones, don't start by '-' or '--'. Boolean argument values (such as for id or time) must be explicitly typed.
Data can be potted with the options --plot or --pshell.
This example will print and plot the values of an EPICS channel for 10 seconds:
The query ranges, specified by arguments start and end, can be specified by time or ID, in absolute or relative values.
By default time range is used, unless the id argument is set.
For time ranges values can be :
Numeric, interpreted as a relative time to now (0). Ex: -10 means 10 seconds ago.
Big numeric (> 10 days as ms), interpreted as a timestamp (millis sin EPOCH).
String, an absolute timestamp ISO 8601, UTC or local time ('T' can be ommited).
For ID ranges, the values can be:
Absolute.
Relative to now (if value < 100000000).
Channel search
The --search argument is used for searching channel names and info instead of querying data.
Queries can be performed asynchronously, and therefore can be paralellized.
This example retrieves and saves data from a BSREAD source and from EPICS, for 3 seconds: