.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/datasets/plot_dataset_arithmetic.py" .. LINE NUMBERS ARE GIVEN BELOW. .. 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_datasets_plot_dataset_arithmetic.py: ================== Dataset Arithmetic ================== This plots example volume data onto an example subject, S1, onto a flatmap using quickflat. In order for this to run, you have to have a flatmap for this subject in the pycortex filestore. Once you have created a cortex.Volume object, you can manipulate it with normal arithmetic operators like +, -, *, /, and ** .. GENERATED FROM PYTHON SOURCE LINES 13-41 .. rst-class:: sphx-glr-horizontal * .. image-sg:: /auto_examples/datasets/images/sphx_glr_plot_dataset_arithmetic_001.png :alt: plot dataset arithmetic :srcset: /auto_examples/datasets/images/sphx_glr_plot_dataset_arithmetic_001.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/datasets/images/sphx_glr_plot_dataset_arithmetic_002.png :alt: plot dataset arithmetic :srcset: /auto_examples/datasets/images/sphx_glr_plot_dataset_arithmetic_002.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/datasets/images/sphx_glr_plot_dataset_arithmetic_003.png :alt: plot dataset arithmetic :srcset: /auto_examples/datasets/images/sphx_glr_plot_dataset_arithmetic_003.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-script-out Out: .. code-block:: none Generating a flatmap cache Failed to get connection ** (inkscape:5116): CRITICAL **: 01:26:49.265: dbus_g_proxy_new_for_name: assertion 'connection != NULL' failed ** (inkscape:5116): CRITICAL **: 01:26:49.265: dbus_g_proxy_call: assertion 'DBUS_IS_G_PROXY (proxy)' failed ** (inkscape:5116): CRITICAL **: 01:26:49.265: dbus_g_connection_register_g_object: assertion 'connection != NULL' failed Failed to get connection ** (inkscape:5119): CRITICAL **: 01:26:50.304: dbus_g_proxy_new_for_name: assertion 'connection != NULL' failed ** (inkscape:5119): CRITICAL **: 01:26:50.304: dbus_g_proxy_call: assertion 'DBUS_IS_G_PROXY (proxy)' failed ** (inkscape:5119): CRITICAL **: 01:26:50.304: dbus_g_connection_register_g_object: assertion 'connection != NULL' failed Failed to get connection ** (inkscape:5122): CRITICAL **: 01:26:51.342: dbus_g_proxy_new_for_name: assertion 'connection != NULL' failed ** (inkscape:5122): CRITICAL **: 01:26:51.342: dbus_g_proxy_call: assertion 'DBUS_IS_G_PROXY (proxy)' failed ** (inkscape:5122): CRITICAL **: 01:26:51.342: dbus_g_connection_register_g_object: assertion 'connection != NULL' failed | .. code-block:: default import cortex import numpy as np np.random.seed(1234) import matplotlib.pyplot as plt subject = 'S1' xfm = 'fullhead' # Creating a random dataset that is the shape for this transform with one # entry for each voxel test_data = np.random.randn(31, 100, 100) # This creates a Volume object for our test dataset for the given subject # and transform vol_data = cortex.Volume(test_data, subject, xfm, vmin=-2, vmax=2) cortex.quickshow(vol_data) plt.show() # Now you can do arithmetic with the Volume vol_plus = vol_data + 1 cortex.quickshow(vol_plus) plt.show() # You can also do multiplication vol_mult = vol_data * 4 cortex.quickshow(vol_mult) plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 18.572 seconds) .. _sphx_glr_download_auto_examples_datasets_plot_dataset_arithmetic.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_dataset_arithmetic.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_dataset_arithmetic.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_