diff --git a/docs/source/topics/data_types.rst b/docs/source/topics/data_types.rst index a2309d4e66..dd762b88c4 100644 --- a/docs/source/topics/data_types.rst +++ b/docs/source/topics/data_types.rst @@ -284,6 +284,27 @@ The user also has to specify the units for both ``x`` and ``y``: In [4]: xy.set_y(np.array([1, 2, 3, 4]), 'Volume Expansion', '%') + To retrieve the ``x`` values and their metadata, you can use the :py:meth:`~aiida.orm.XyData.get_x` method: + +.. code-block:: ipython + + In [5]: x_name, x_array, x_units = xy.get_x() + +Similarly, to retrieve the ``y`` values and their metadata, use the :py:meth:`~aiida.orm.XyData.get_y` method: + +.. code-block:: ipython + + In [6]: y_values = xy.get_y() + In [7]: for y_name, y_array, y_units in y_values: + ...: print(y_name, y_array, y_units) + +You can also retrieve the names of all ``y`` arrays using :py:meth:`~aiida.orm.XyData.get_y_arraynames`: + +.. code-block:: ipython + + In [8]: y_names = xy.get_y_arraynames() + In [9]: print(y_names) + Note that you can set multiple ``y`` values that correspond to the ``x`` grid. Same as for the :py:class:`~aiida.orm.ArrayData`, the names and shapes of the arrays are stored to the database, the content of the arrays is stored to the repository in the `numpy format `_ (``.npy``).