Data nodes

Data nodes are intermediate stops along the data pipeline. Their main purposes are to visualize data, display transformation status, select parameters of data transformations, possibly stop or split data propagation or combine with other data. Each data node defines and operates arrays that get their values in the upstream part of the pipeline.

class parseq.core.nodes.Node(widgetClass=None)

Parental Node class. Must be subclassed to define the following class variables:

name: str

The name of the node, also shown as a GUI tab and also is a section name in ini file. Must be unique in the pipeline.

arrays: OrderedDict of dicts

Describes the arrays operated in this node. Note, this object only contains data description; the actual data arrays will be attributed to data objects (items). The keys of arrays are names of these arrays, the values are dictionaries that optionally contain the following kwargs:

role: str, default = ‘1D’ (not plotted)

The array’s role. Can be ‘x’, ‘y’, ‘yleft’, ‘yright’, ‘z’ or ‘1D’ for 1D arrays (one and only one x-axis array is required), ‘2D’ for 2D plots and ‘3D’ for stacked 2D images. ‘0D’ values are listed in the data tree. ‘optional’ array is not required in data files and can be used as an auxiliary. Unless with a ‘0D’ role, each array will appear in data location dialog to define its location.

raw: str, default = array name

Can define an intermediate array at the pipeline head when the main array (the key in arrays) is supposed to be obtained by an after load transformation. The plotted array is still the main one. The idea of having a raw version of an array is in the possibility of creating a transformation that not only begins at the first node but can also end at the first node.

qLabel: str, default = array name

Used in the GUI labels.

plotLabel: str, or list of str, default = qLabel

Axis label for the GUI plot. For 2D or 3D plots the 2- or 3-list that corresponds to the plot axes. The list may contain keys from arrays and then the label and unit are taken from that dictionary (the entry of arrays) or, alternatively, the list elements themselves are axis labels. For 0D values, this parameter may hold a format string to be used with the format() method.

qUnit: str, default None

Optional data unit to be displayed in the GUI.

plotUnit: str, default = qUnit

Attached to the plot label in parentheses. For example, for Å^-1: qUnit = u’Å⁻¹’ and plotUnit = r’Å$^{-1}$’.

plotParams: dict, default is {} that assumes thin solid lines

Default parameters for plotting. Can have the following keys: linewidth (or lw), style, symbol and symbolsize. Note that color is set for a data item and is equal across the nodes, so it is set not here.

checkShapes: list of str

Can be useful at data file reading. If given, the list contains keys of arrays. The corresponding arrays will be checked for equal shape. The names of multidimensional arrays can be ended by a slice. Example: checkShapes = [‘theta’, ‘i0’, ‘xes3D[0]’].

auxArrays: list of lists

Can be useful only for data export. Array names are grouped together so that the 1st element in a group is an x array and the others are y arrays. This grouping is respected only for the export of 1D data.

__init__(widgetClass=None)

Instantiates the node and optionally passes a Qt widget class of a user dialog that defines transformation parameters.

get_prop(arrayName, prop)

Returns the property prop for a given array name defined in this node. This method can be useful in creating the GUI part of a transformation node.

is_between_nodes(nodeName1, nodeName2, node1in=True, node2in=True)

Returns True if this transformation node is between the given two nodes in the sense of data propagation in the pipeline. This method can be useful in creating the GUI part of a transformation node.

nodeName1 and nodeName2: Node

nodeName2 can be None, the right end is infinite then.

node1in and node2in: bool

define whether the interval is closed (when True) or open.