Multiple outputs and restructured ParallelSourcePlugin #190
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This allows strax plugins to have multiple outputs. If you want to return incompatible kinds of rows, e.g. both records and hits, or peaks and some metadata for each chunk, multi-output support is essential.
To return multiple outputs from a plugin:
provides
tuple should have multiple elements, listing the provided data type namesdtype
anddata_kind
attributes should be dictionaries mapping data type names to dtypes and data kind names, respectively. The values of these dicts can be specified in the same way as the entire attribute would be for a single-output plugincompute
method must return a dictionary mapping data types to results (structured numpy arrays or field/array dictionaries).For more info, see the updated docs, and tests/test_multi_output.py provides an example.
This also rewrites ParallelSourcePlugin. We should no longer subclass these plugins directy (as e.g. straxen's DAQReader does); instead, they are automatically created by strax when a
parallel='process'
plugin is followed by other plugins that can become inlined. Again, further description is in the docs. This should speed up processing fromrecords
onwards on machines with many cores, sincerecords
is then picked up byParallelSourcePlugin
just likeraw_records
usually is. See also the new docs and #150.