.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/2D_1_examples/plot_2_TEM.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_2D_1_examples_plot_2_TEM.py: Transmission Electron Microscopy (TEM) dataset ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. GENERATED FROM PYTHON SOURCE LINES 6-13 The following `TEM dataset `_ is a section of an early larval brain of *Drosophila melanogaster* used in the analysis of neuronal microcircuitry. The dataset was obtained from the `TrakEM2 tutorial `_ and subsequently converted to the CSD model file-format. Let's import the CSD model data-file and look at its data structure. .. GENERATED FROM PYTHON SOURCE LINES 13-21 .. code-block:: Python import matplotlib.pyplot as plt import csdmpy as cp filename = "https://www.ssnmr.org/sites/default/files/CSDM/TEM/TEM.csdf" TEM = cp.load(filename) print(TEM.data_structure) .. rst-class:: sphx-glr-script-out .. code-block:: none { "csdm": { "version": "1.0", "read_only": true, "timestamp": "2016-03-12T16:41:00Z", "description": "TEM image of the early larval brain of Drosophila melanogaster used in the analysis of neuronal microcircuitry.", "dimensions": [ { "type": "linear", "count": 512, "increment": "4.0 nm", "quantity_name": "length", "reciprocal": { "quantity_name": "wavenumber" } }, { "type": "linear", "count": 512, "increment": "4.0 nm", "quantity_name": "length", "reciprocal": { "quantity_name": "wavenumber" } } ], "dependent_variables": [ { "type": "internal", "numeric_type": "uint8", "quantity_type": "scalar", "components": [ [ "126, 107, ..., 164, 171" ] ] } ] } } .. GENERATED FROM PYTHON SOURCE LINES 22-25 This dataset consists of two linear dimensions and one single-component dependent variable. The tuple of the dimension and the dependent variable instances from this example are .. GENERATED FROM PYTHON SOURCE LINES 25-28 .. code-block:: Python x = TEM.dimensions y = TEM.dependent_variables .. GENERATED FROM PYTHON SOURCE LINES 29-30 and the respective coordinates (viewed only for the first ten coordinates), .. GENERATED FROM PYTHON SOURCE LINES 30-32 .. code-block:: Python print(x[0].coordinates[:10]) .. rst-class:: sphx-glr-script-out .. code-block:: none [ 0. 4. 8. 12. 16. 20. 24. 28. 32. 36.] nm .. GENERATED FROM PYTHON SOURCE LINES 33-35 .. code-block:: Python print(x[1].coordinates[:10]) .. rst-class:: sphx-glr-script-out .. code-block:: none [ 0. 4. 8. 12. 16. 20. 24. 28. 32. 36.] nm .. GENERATED FROM PYTHON SOURCE LINES 36-38 For convenience, let's convert the coordinates from `nm` to `µm` using the :meth:`~csdmpy.Dimension.to` method of the respective :ref:`dim_api` instance, .. GENERATED FROM PYTHON SOURCE LINES 38-41 .. code-block:: Python x[0].to("µm") x[1].to("µm") .. GENERATED FROM PYTHON SOURCE LINES 42-43 and plot the data. .. GENERATED FROM PYTHON SOURCE LINES 43-49 .. code-block:: Python plt.figure(figsize=(5, 3.5)) ax = plt.subplot(projection="csdm") cb = ax.imshow(TEM, aspect="auto") plt.colorbar(cb, ax=ax) plt.tight_layout() plt.show() .. image-sg:: /auto_examples/2D_1_examples/images/sphx_glr_plot_2_TEM_001.png :alt: plot 2 TEM :srcset: /auto_examples/2D_1_examples/images/sphx_glr_plot_2_TEM_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.424 seconds) .. _sphx_glr_download_auto_examples_2D_1_examples_plot_2_TEM.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_2_TEM.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_2_TEM.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_