
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "auto_examples/02-multisite-data/02-run_load_mareos.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        :ref:`Go to the end <sphx_glr_download_auto_examples_02-multisite-data_02-run_load_mareos.py>`
        to download the full example code.

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_auto_examples_02-multisite-data_02-run_load_mareos.py:


Load MAREoS dataset
===================

.. GENERATED FROM PYTHON SOURCE LINES 7-9

Imports
-------

.. GENERATED FROM PYTHON SOURCE LINES 9-17

.. code-block:: Python


    from pathlib import Path

    import pandas as pd

    from uniharmony.datasets import load_MAREoS









.. GENERATED FROM PYTHON SOURCE LINES 18-20

We can call the helper funtion to load all the dataset (aprox 3MB).
The files will be stored in the cache, so we don't have to worry about them

.. GENERATED FROM PYTHON SOURCE LINES 20-23

.. code-block:: Python

    datasets = load_MAREoS()






.. rst-class:: sphx-glr-script-out

 .. code-block:: none

    2026-05-18 13:04:33 [info     ] MAREoS datasets already exist at: /home/runner/.cache/uniharmony/MAREoS
    2026-05-18 13:04:33 [info     ] Getting data file: /home/runner/.cache/uniharmony/MAREoS/public_datasets/eos_simple1_data.csv
    2026-05-18 13:04:33 [info     ] Getting data file: /home/runner/.cache/uniharmony/MAREoS/public_datasets/eos_simple2_data.csv
    2026-05-18 13:04:33 [info     ] Getting data file: /home/runner/.cache/uniharmony/MAREoS/public_datasets/eos_interaction1_data.csv
    2026-05-18 13:04:33 [info     ] Getting data file: /home/runner/.cache/uniharmony/MAREoS/public_datasets/eos_interaction2_data.csv
    2026-05-18 13:04:33 [info     ] Getting data file: /home/runner/.cache/uniharmony/MAREoS/public_datasets/true_simple1_data.csv
    2026-05-18 13:04:33 [info     ] Getting data file: /home/runner/.cache/uniharmony/MAREoS/public_datasets/true_simple2_data.csv
    2026-05-18 13:04:33 [info     ] Getting data file: /home/runner/.cache/uniharmony/MAREoS/public_datasets/true_interaction1_data.csv
    2026-05-18 13:04:33 [info     ] Getting data file: /home/runner/.cache/uniharmony/MAREoS/public_datasets/true_interaction2_data.csv




.. GENERATED FROM PYTHON SOURCE LINES 24-27

Exploration
-----------
Let's explore now how the datasets looks like

.. GENERATED FROM PYTHON SOURCE LINES 27-30

.. code-block:: Python

    print(datasets.keys())






.. rst-class:: sphx-glr-script-out

 .. code-block:: none

    dict_keys(['eos_simple1', 'eos_simple2', 'eos_interaction1', 'eos_interaction2', 'true_simple1', 'true_simple2', 'true_interaction1', 'true_interaction2'])




.. GENERATED FROM PYTHON SOURCE LINES 31-32

We have now all the datasets in a dictionary. There is a total of 8 datasets.

.. GENERATED FROM PYTHON SOURCE LINES 32-38

.. code-block:: Python


    # Select one dataset and explore what is inside the dictionary
    dataset = datasets["eos_simple1"]
    print(dataset.keys())






.. rst-class:: sphx-glr-script-out

 .. code-block:: none

    dict_keys(['X', 'y', 'sites', 'covs', 'folds'])




.. GENERATED FROM PYTHON SOURCE LINES 39-41

Let's unpack what is inside the keys. This is the typical way you can use
the dataset for further downstream analysis.

.. GENERATED FROM PYTHON SOURCE LINES 41-47

.. code-block:: Python

    X = dataset["X"]
    y = dataset["y"]

    print(f"Load X with shape:{X.shape} and y:{y.shape}")






.. rst-class:: sphx-glr-script-out

 .. code-block:: none

    Load X with shape:(1001, 14) and y:(1001,)




.. GENERATED FROM PYTHON SOURCE LINES 48-50

Variations
----------

.. GENERATED FROM PYTHON SOURCE LINES 50-56

.. code-block:: Python


    # You can use the helper function to only return a part of the datasets
    datasets = load_MAREoS(effects="eos")
    print(datasets.keys())






.. rst-class:: sphx-glr-script-out

 .. code-block:: none

    2026-05-18 13:04:33 [info     ] MAREoS datasets already exist at: /home/runner/.cache/uniharmony/MAREoS
    2026-05-18 13:04:33 [info     ] Getting data file: /home/runner/.cache/uniharmony/MAREoS/public_datasets/eos_simple1_data.csv
    2026-05-18 13:04:33 [info     ] Getting data file: /home/runner/.cache/uniharmony/MAREoS/public_datasets/eos_simple2_data.csv
    2026-05-18 13:04:33 [info     ] Getting data file: /home/runner/.cache/uniharmony/MAREoS/public_datasets/eos_interaction1_data.csv
    2026-05-18 13:04:33 [info     ] Getting data file: /home/runner/.cache/uniharmony/MAREoS/public_datasets/eos_interaction2_data.csv
    dict_keys(['eos_simple1', 'eos_simple2', 'eos_interaction1', 'eos_interaction2'])




.. GENERATED FROM PYTHON SOURCE LINES 57-61

.. code-block:: Python

    datasets = load_MAREoS(effects="eos", effect_types="simple")
    print(datasets.keys())






.. rst-class:: sphx-glr-script-out

 .. code-block:: none

    2026-05-18 13:04:33 [info     ] MAREoS datasets already exist at: /home/runner/.cache/uniharmony/MAREoS
    2026-05-18 13:04:33 [info     ] Getting data file: /home/runner/.cache/uniharmony/MAREoS/public_datasets/eos_simple1_data.csv
    2026-05-18 13:04:33 [info     ] Getting data file: /home/runner/.cache/uniharmony/MAREoS/public_datasets/eos_simple2_data.csv
    dict_keys(['eos_simple1', 'eos_simple2'])




.. GENERATED FROM PYTHON SOURCE LINES 62-66

.. code-block:: Python

    datasets = load_MAREoS(effects="eos", effect_types="simple", effect_examples="1")
    print(datasets.keys())






.. rst-class:: sphx-glr-script-out

 .. code-block:: none

    2026-05-18 13:04:33 [info     ] MAREoS datasets already exist at: /home/runner/.cache/uniharmony/MAREoS
    2026-05-18 13:04:33 [info     ] Getting data file: /home/runner/.cache/uniharmony/MAREoS/public_datasets/eos_simple1_data.csv
    dict_keys(['eos_simple1'])




.. GENERATED FROM PYTHON SOURCE LINES 67-69

Returning the dataset as DataFrame allows to see the simulated areas
You can chose to load the dataset as pandas.DataFrame, with has the simulated areas of the brain.

.. GENERATED FROM PYTHON SOURCE LINES 69-77

.. code-block:: Python


    datasets = load_MAREoS(effects="eos", effect_types="simple", effect_examples="1", as_numpy=False)
    dataset = datasets["eos_simple1"]["X"]
    # Show only 5 columns
    pd.set_option("display.max_columns", 8)
    dataset.head()






.. rst-class:: sphx-glr-script-out

 .. code-block:: none

    2026-05-18 13:04:33 [info     ] MAREoS datasets already exist at: /home/runner/.cache/uniharmony/MAREoS
    2026-05-18 13:04:33 [info     ] Getting data file: /home/runner/.cache/uniharmony/MAREoS/public_datasets/eos_simple1_data.csv


.. raw:: html

    <div class="output_subarea output_html rendered_html output_result">
    <div>
    <style scoped>
        .dataframe tbody tr th:only-of-type {
            vertical-align: middle;
        }

        .dataframe tbody tr th {
            vertical-align: top;
        }

        .dataframe thead th {
            text-align: right;
        }
    </style>
    <table border="1" class="dataframe">
      <thead>
        <tr style="text-align: right;">
          <th></th>
          <th>Lthal</th>
          <th>Rthal</th>
          <th>Lcaud</th>
          <th>Rcaud</th>
          <th>...</th>
          <th>Lamyg</th>
          <th>Ramyg</th>
          <th>Laccumb</th>
          <th>Raccumb</th>
        </tr>
        <tr>
          <th>id</th>
          <th></th>
          <th></th>
          <th></th>
          <th></th>
          <th></th>
          <th></th>
          <th></th>
          <th></th>
          <th></th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <th>1</th>
          <td>8895.369099</td>
          <td>8383.870372</td>
          <td>3803.558492</td>
          <td>4357.165963</td>
          <td>...</td>
          <td>1563.622497</td>
          <td>1854.229137</td>
          <td>698.637972</td>
          <td>701.906213</td>
        </tr>
        <tr>
          <th>2</th>
          <td>8679.346875</td>
          <td>6654.136742</td>
          <td>3924.041654</td>
          <td>3745.063498</td>
          <td>...</td>
          <td>1511.933005</td>
          <td>1020.152948</td>
          <td>709.090077</td>
          <td>534.448106</td>
        </tr>
        <tr>
          <th>3</th>
          <td>9191.801201</td>
          <td>7159.776871</td>
          <td>3444.265568</td>
          <td>3158.455008</td>
          <td>...</td>
          <td>1761.132128</td>
          <td>1114.841164</td>
          <td>785.199200</td>
          <td>717.806882</td>
        </tr>
        <tr>
          <th>4</th>
          <td>7531.473405</td>
          <td>6694.021219</td>
          <td>4984.063517</td>
          <td>4689.035649</td>
          <td>...</td>
          <td>1774.472741</td>
          <td>742.652391</td>
          <td>1104.007368</td>
          <td>769.837240</td>
        </tr>
        <tr>
          <th>5</th>
          <td>7070.478721</td>
          <td>5575.244389</td>
          <td>3285.175734</td>
          <td>2234.129050</td>
          <td>...</td>
          <td>1722.570593</td>
          <td>1414.669078</td>
          <td>1000.597680</td>
          <td>440.375965</td>
        </tr>
      </tbody>
    </table>
    <p>5 rows × 14 columns</p>
    </div>
    </div>
    <br />
    <br />

.. GENERATED FROM PYTHON SOURCE LINES 78-82

Load the dataset in a user determine folder
We could also want to see the csv files in a folder, we could pass a directory for the function to save the data
Let's pass a directory inside the repository.
We will use a relative path from this example to look for appropiated path

.. GENERATED FROM PYTHON SOURCE LINES 82-84

.. code-block:: Python

    data_dir = Path().resolve().parents[1] / "src" / "uniharmony" / "datasets" / "data"
    datasets = load_MAREoS(data_dir=data_dir)




.. rst-class:: sphx-glr-script-out

 .. code-block:: none

    Unzipping contents of '/home/runner/.cache/uniharmony/public_datasets.zip' to '/home/runner/work/UniHarmony/UniHarmony/src/uniharmony/datasets/data/MAREoS'
    2026-05-18 13:04:33 [info     ] MAREoS datasets downloaded: 16 CSV files in /home/runner/work/UniHarmony/UniHarmony/src/uniharmony/datasets/data/MAREoS
    2026-05-18 13:04:33 [info     ] Getting data file: /home/runner/work/UniHarmony/UniHarmony/src/uniharmony/datasets/data/MAREoS/public_datasets/eos_simple1_data.csv
    2026-05-18 13:04:33 [info     ] Getting data file: /home/runner/work/UniHarmony/UniHarmony/src/uniharmony/datasets/data/MAREoS/public_datasets/eos_simple2_data.csv
    2026-05-18 13:04:33 [info     ] Getting data file: /home/runner/work/UniHarmony/UniHarmony/src/uniharmony/datasets/data/MAREoS/public_datasets/eos_interaction1_data.csv
    2026-05-18 13:04:33 [info     ] Getting data file: /home/runner/work/UniHarmony/UniHarmony/src/uniharmony/datasets/data/MAREoS/public_datasets/eos_interaction2_data.csv
    2026-05-18 13:04:33 [info     ] Getting data file: /home/runner/work/UniHarmony/UniHarmony/src/uniharmony/datasets/data/MAREoS/public_datasets/true_simple1_data.csv
    2026-05-18 13:04:33 [info     ] Getting data file: /home/runner/work/UniHarmony/UniHarmony/src/uniharmony/datasets/data/MAREoS/public_datasets/true_simple2_data.csv
    2026-05-18 13:04:33 [info     ] Getting data file: /home/runner/work/UniHarmony/UniHarmony/src/uniharmony/datasets/data/MAREoS/public_datasets/true_interaction1_data.csv
    2026-05-18 13:04:33 [info     ] Getting data file: /home/runner/work/UniHarmony/UniHarmony/src/uniharmony/datasets/data/MAREoS/public_datasets/true_interaction2_data.csv





.. rst-class:: sphx-glr-timing

   **Total running time of the script:** (0 minutes 0.903 seconds)


.. _sphx_glr_download_auto_examples_02-multisite-data_02-run_load_mareos.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example

    .. container:: sphx-glr-download sphx-glr-download-jupyter

      :download:`Download Jupyter notebook: 02-run_load_mareos.ipynb <02-run_load_mareos.ipynb>`

    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download Python source code: 02-run_load_mareos.py <02-run_load_mareos.py>`

    .. container:: sphx-glr-download sphx-glr-download-zip

      :download:`Download zipped: 02-run_load_mareos.zip <02-run_load_mareos.zip>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
