.. only:: html
.. note::
:class: sphx-glr-download-link-note
Click :ref:`here ` to download the full example code
.. rst-class:: sphx-glr-example-title
.. _sphx_glr_auto_examples_correlated_examples_plot_0_0D11_dataset.py:
Scatter, 0D{1,1} dataset
^^^^^^^^^^^^^^^^^^^^^^^^
We start with a 0D{1,1} correlated dataset, that is, a dataset
without a coordinate grid. A 0D{1,1} dataset has no dimensions, d = 0, and
two single-component dependent variables.
In the following example [#f3]_, the two `correlated` dependent variables are
the :math:`^{29}\text{Si}` - :math:`^{29}\text{Si}` nuclear spin couplings,
:math:`^2J`, across a Si-O-Si linkage, and the `s`-character product on the
O and two Si along the Si-O bond across the Si-O-Si linkage.
Let's import the dataset.
.. code-block:: default
import csdmpy as cp
filename = "https://osu.box.com/shared/static/h1nxth6gs94fthfmvip5vchp3zh4zd6o.csdf"
zero_d_dataset = cp.load(filename)
Since the dataset has no dimensions, the value of the
:attr:`~csdmpy.CSDM.dimensions` attribute of the :attr:`~csdmpy.CSDM`
class is an empty tuple,
.. code-block:: default
print(zero_d_dataset.dimensions)
.. rst-class:: sphx-glr-script-out
Out:
.. code-block:: none
[]
The :attr:`~csdmpy.CSDM.dependent_variables` attribute, however, holds
two dependent-variable objects. The data structure from the two dependent
variables is
.. code-block:: default
print(zero_d_dataset.dependent_variables[0].data_structure)
.. rst-class:: sphx-glr-script-out
Out:
.. code-block:: none
{
"type": "internal",
"name": "Gaussian computed J-couplings",
"unit": "Hz",
"quantity_name": "frequency",
"numeric_type": "float32",
"quantity_type": "scalar",
"component_labels": [
"J-coupling"
],
"components": [
[
"-1.87378, -1.42918, ..., 25.1742, 26.0608"
]
]
}
and
.. code-block:: default
print(zero_d_dataset.dependent_variables[1].data_structure)
.. rst-class:: sphx-glr-script-out
Out:
.. code-block:: none
{
"type": "internal",
"name": "product of s-characters",
"unit": "%",
"numeric_type": "float32",
"quantity_type": "scalar",
"component_labels": [
"s-character product"
],
"components": [
[
"0.8457453, 0.8534185, ..., 1.5277092, 1.5289451"
]
]
}
respectively.
**Visualizing the dataset**
The correlation plot of the dependent-variables from the dataset is
shown below.
.. code-block:: default
import matplotlib.pyplot as plt
y0 = zero_d_dataset.dependent_variables[0]
y1 = zero_d_dataset.dependent_variables[1]
plt.scatter(y1.components[0], y0.components[0], s=2, c="k")
plt.xlabel(y1.axis_label[0])
plt.ylabel(y0.axis_label[0])
plt.tight_layout()
plt.show()
.. image:: /auto_examples/correlated_examples/images/sphx_glr_plot_0_0D11_dataset_001.png
:class: sphx-glr-single-img
.. rubric:: Citation
.. [#f3]
Srivastava DJ, Florian P, Baltisberger JH, Grandinetti PJ. Correlating geminal
couplings to structure in framework silicates. Phys Chem Chem Phys. 2018;20:562–571.
DOI:10.1039/C7CP06486A
.. rst-class:: sphx-glr-timing
**Total running time of the script:** ( 0 minutes 1.180 seconds)
.. _sphx_glr_download_auto_examples_correlated_examples_plot_0_0D11_dataset.py:
.. only :: html
.. container:: sphx-glr-footer
:class: sphx-glr-footer-example
.. container:: sphx-glr-download sphx-glr-download-python
:download:`Download Python source code: plot_0_0D11_dataset.py `
.. container:: sphx-glr-download sphx-glr-download-jupyter
:download:`Download Jupyter notebook: plot_0_0D11_dataset.ipynb `
.. only:: html
.. rst-class:: sphx-glr-signature
`Gallery generated by Sphinx-Gallery `_