.. 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_2D_1_examples_plot_2_TEM.py: Transmission Electron Microscopy (TEM) dataset ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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. .. code-block:: default import matplotlib.pyplot as plt import csdmpy as cp filename = "https://osu.box.com/shared/static/3w5iqkx15fayan1u6g6sn5woc2ublkyh.csdf" TEM = cp.load(filename) print(TEM.data_structure) .. rst-class:: sphx-glr-script-out 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" ] ] } ] } } 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 .. code-block:: default x = TEM.dimensions y = TEM.dependent_variables and the respective coordinates (viewed only for the first ten coordinates), .. code-block:: default print(x[0].coordinates[:10]) .. rst-class:: sphx-glr-script-out Out: .. code-block:: none [ 0. 4. 8. 12. 16. 20. 24. 28. 32. 36.] nm .. code-block:: default print(x[1].coordinates[:10]) .. rst-class:: sphx-glr-script-out Out: .. code-block:: none [ 0. 4. 8. 12. 16. 20. 24. 28. 32. 36.] nm 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, .. code-block:: default x[0].to("µm") x[1].to("µm") and plot the data. .. code-block:: default plt.figure(figsize=(6, 4)) cp.plot(TEM) plt.tight_layout() plt.show() .. image:: /auto_examples/2D_1_examples/images/sphx_glr_plot_2_TEM_001.png :alt: plot 2 TEM :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 1.235 seconds) .. _sphx_glr_download_auto_examples_2D_1_examples_plot_2_TEM.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_2_TEM.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_2_TEM.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_