.. _generate-example-dataset:

Generating an example dataset
-----------------------------

In case you don't have an entire experiment's worth of NWB files, you can generate an example dataset by running:

.. tabs::
    .. tab:: CLI

        .. code-block:: bash

            nwb2bids tutorial ephys dataset

        .. tip::

            Lost in the CLI? Can't remember the exact phrase to type when navigating through the command groups? No worries!

            Simply add the ``--help`` to any command to see detailed descriptions, expected inputs, and optional flags.

            You can also see a layout of the command structure by calling each level at a time, for example ``nwb2bids``,
            ``nwb2bids tutorial``, and so on.

            Try it out on ``nwb2bids tutorial`` to see all the types of tutorial data we can generate for you.

    .. tab:: Python Library

        .. code-block:: python

            import nwb2bids

            tutorial_directory = nwb2bids.testing.generate_ephys_tutorial(
                mode="dataset"
            )

        .. tip::

            Lost in the Python library? Can't remember the exact inputs to pass to an imported function? No worries!

            Simply add the ``?`` at the end of any module or function to see a detailed description of imports or
            expected inputs. Try it out on ``nwb2bids?`` to see the library's welcome message.

            The **nwb2bids** library is also designed for easy auto-completion in interactive environments like
            IPython or Jupyter notebooks; try it out on by hitting your tab button after typing ``nwb2bids.testing.`` to
            see all the functions exposed to that submodule.

Now we should have a directory that looks something like:

.. code-block:: text

    ecephys_tutorial_dataset/
    ├── ecephys_session_3.nwb
    ├── DO_NOT_CONVERT.nwb
    └── some_sessions/
        ├── ecephys_session_1.nwb
        └── ecephys_session_1.nwb

.. note::

    Don't like overwhelming your home directory with lots of small files?

    .. tabs::
        .. tab:: CLI

            You can control where tutorial data is generated by using the ``--output-directory`` flag (or ``-o`` for
            short):

            .. skip: next

            .. code-block:: bash

                nwb2bids tutorial ephys file --output-directory path/to/some/directory

        .. tab:: Python Library

            You can control where tutorial data is generated by using the ``output_directory`` keyword argument:

            .. skip: next

            .. code-block:: python

                import nwb2bids

                tutorial_directory = nwb2bids.testing.generate_ephys_tutorial(
                    mode="file",
                    output_directory=path_to_some_directory,
                )



Other modalities
----------------

You can also generate example NWB files for other modalities, such as ``icephys``!

.. tabs::
    .. tab:: CLI

        .. code-block:: bash

            nwb2bids tutorial ephys dataset --modality icephys

    .. tab:: Python Library

        .. code-block:: python

            import nwb2bids

            tutorial_file = nwb2bids.testing.generate_ephys_tutorial(mode="dataset", modality="icephys")
