Note

This is the documentation for the current state of the development branch of Qiskit Experiments. The documentation or APIs here can change prior to being released.

DataProcessor

class DataProcessor(input_key, data_actions=None)[source]

A DataProcessor defines a sequence of operations to perform on experimental data. Calling an instance of DataProcessor applies this sequence on the input argument. A DataProcessor is created with a list of DataAction instances. Each DataAction applies its _process method on the data and returns the processed data. The nodes in the DataProcessor may also perform data validation and some minor formatting. The output of one data action serves as input for the next data action. DataProcessor.__call__(datum) usually takes in an entry from the data property of an ExperimentData object (i.e. a dict containing metadata and memory keys and possibly counts, like the Result.data property) and produces the formatted data. DataProcessor.__call__(datum) extracts the data from the given datum under DataProcessor._input_key (which is specified at initialization) of the given datum.

Create a chain of data processing actions.

Parameters:
  • input_key (str) – The initial key in the datum Dict[str, Any] under which the data processor will find the data to process.

  • data_actions (Optional[List[DataAction]]) – A list of data processing actions to construct this data processor with. If nothing is given the processor returns unprocessed data.

Attributes

DataProcessor.is_trained

Return True if all nodes of the data processor have been trained.

Methods

DataProcessor.__call__(data, **options)

Call self on the given datum.

DataProcessor.append(node)

Append new data action node to this data processor.

DataProcessor.call_with_history(data[, ...])

Call self on the given datum.

DataProcessor.train(data)

Train the nodes of the data processor.