### Setup Discourse Development Environment and Prepare Mail Archives Source: https://github.com/mne-tools/mne-python/wiki/Mailing-list-migration Clones the Discourse repository, sets up a development environment, and downloads/prepares mailing list archives for import. This involves installing dependencies, converting mail files to mbox format, and configuring the import script settings. ```Bash git clone https://github.com/discourse/discourse.git cd discourse d/boot_dev --init printf "\ngem 'sqlite3'" >> Gemfile d/rails db:migrate RAILS_ENV=development d/bundle install # These I actually usually do in another dir like ~/Desktop so I only ever have to do it once mkdir shared wget -r -l1 --no-parent --no-directories "https://mail.nmr.mgh.harvard.edu/pipermail//mne_analysis/" -P shared/import/data/mne_analysis -A "*-*.txt.gz" rm shared/import/data/mne_analysis/robots.txt.tmp gzip -d shared/import/data/mne_analysis/*.txt.gz wget https://gist.githubusercontent.com/larsoner/940cd6c7100b87c4c5668cb0bc540afb/raw/9e78513620d11355ad0e10f4a2470996c26ebc8c/mailmanToMBox.py -O shared/mailmanToMBox.py python3 shared/mailmanToMBox.py shared/import/data/mne_analysis/ rm shared/import/data/mne_analysis/*.txt wget https://raw.githubusercontent.com/discourse/discourse/master/script/import_scripts/mbox/settings.yml -O shared/import/settings.yml vim shared/import/settings.yml # add "Mne_analysis": "mne_analysis" under "tag:" section # Then I `cp -a` these to the `discourse/` root dir in case I need to hard reset, then go to a shell: d/shell ``` -------------------------------- ### Install and Run Pre-commit Hooks Source: https://github.com/mne-tools/mne-python/blob/main/doc/development/contributing.rst Install the pre-commit package and install its hooks to check code style automatically. ```bash pip install pre-commit pre-commit install --install-hooks ``` -------------------------------- ### Install Documentation Build Dependencies Source: https://github.com/mne-tools/mne-python/blob/main/doc/development/contributing.rst Installs Python packages needed for building the MNE-Python documentation and installs the Graphviz system dependency. ```bash $ pip install --group=doc $ conda install graphviz ``` -------------------------------- ### Navigate to Examples Directory Source: https://github.com/mne-tools/mne-python/blob/main/doc/help/faq.rst When MNE-Python prompts to re-download datasets, ensure your data is in the examples directory and run scripts from that location. ```console $ cd examples/preprocessing ``` -------------------------------- ### Install libxp6 on Ubuntu Source: https://github.com/mne-tools/mne-python/blob/main/doc/install/mne_c.rst Use this command to add the necessary PPA and install the libxp6 package if MNE-C cannot find libxp.so.6. ```console $ sudo add-apt-repository ppa:zeehio/libxp $ sudo apt install libxp6 ``` -------------------------------- ### Check Make Installation Source: https://github.com/mne-tools/mne-python/blob/main/doc/development/contributing.rst Verify if GNU Make is installed by running the 'make' command. A specific output indicates it is not installed or not in the PATH. ```bash $ make ``` -------------------------------- ### Update Documentation Links to Installers Source: https://github.com/mne-tools/mne-python/wiki/How-to-make-a-patch-release Update links in documentation to point to new installer files for all platforms. ```shell [circle deploy] ``` -------------------------------- ### Build and Execute Specific Documentation Example Source: https://github.com/mne-tools/mne-python/blob/main/doc/development/contributing.rst Use this command to build documentation and execute only a specific tutorial or example identified by a regex pattern. ```bash make html-pattern PATTERN={} ``` -------------------------------- ### Run Linux Installer Source: https://github.com/mne-tools/mne-python/blob/main/doc/install/installers.rst Execute the downloaded shell script to install MNE-Python on Linux. ```console $ sh ./MNE-Python-1.12.1_0-Linux.sh ``` -------------------------------- ### Install optipng on Linux Source: https://github.com/mne-tools/mne-python/blob/main/doc/development/contributing.rst Installs the optipng utility on Linux systems using apt package manager, which is required for building documentation. ```bash sudo apt install optipng ``` -------------------------------- ### Install optipng on macOS Source: https://github.com/mne-tools/mne-python/blob/main/doc/development/contributing.rst Installs the optipng utility on macOS using Homebrew, which is required for building documentation. ```bash brew install optipng ``` -------------------------------- ### Make Installation Error Message Source: https://github.com/mne-tools/mne-python/blob/main/doc/development/contributing.rst This message indicates that 'make' is not found, suggesting it may not be installed. ```text make: *** No targets specified and no makefile found. Stop. ``` -------------------------------- ### Install MNE-Python with Full Qt Bindings via Pip Source: https://github.com/mne-tools/mne-python/blob/main/doc/install/advanced.rst Install MNE-Python with all optional dependencies, including PyQt6, using pip. This is an alternative to the conda-forge installation. ```console $ pip install "mne[full]" ``` -------------------------------- ### Install CuPy and Initialize CUDA Source: https://github.com/mne-tools/mne-python/blob/main/doc/install/advanced.rst Install the CuPy library and initialize CUDA support in MNE-Python. This enables GPU acceleration for supported operations. ```console $ conda install cupy $ MNE_USE_CUDA=true python -c "import mne; mne.cuda.init_cuda(verbose=True)" ``` -------------------------------- ### Install netpbm on macOS using Homebrew Source: https://github.com/mne-tools/mne-python/blob/main/doc/install/mne_c.rst Use this command to install the netpbm library on macOS via Homebrew, a prerequisite for MNE-C on this platform. ```console $ brew install netpbm ``` -------------------------------- ### Installing spyder-kernels for Spyder Source: https://github.com/mne-tools/mne-python/blob/main/doc/install/ides.rst If Spyder fails to start due to a missing 'spyder-kernels' package, install the required version within your conda environment using this command. ```bash conda install spyder-kernels ``` -------------------------------- ### Build Documentation Locally (HTML) Source: https://github.com/mne-tools/mne-python/blob/main/doc/development/contributing.rst Use this command in the 'doc' directory to build the HTML documentation. It formats but does not execute tutorial examples. ```bash make html-noplot ``` -------------------------------- ### Install netpbm on macOS using MacPorts Source: https://github.com/mne-tools/mne-python/blob/main/doc/install/mne_c.rst Alternatively, install the netpbm library on macOS using MacPorts if you prefer this package manager. ```console $ sudo port install netpbm ``` -------------------------------- ### Install Latest Stable MNE-Python Source: https://github.com/mne-tools/mne-python/blob/main/README.rst Install the latest stable version of MNE-Python with minimal dependencies using pip. ```console $ pip install --upgrade mne ``` -------------------------------- ### Set Notebook 3D Backend Source: https://github.com/mne-tools/mne-python/blob/main/doc/install/advanced.rst Set the 3D backend to 'notebook' for interactive 3D plots within notebooks without installing Qt. Requires PyVista installation. ```ipython In [1]: import mne In [2]: mne.viz.set_3d_backend("notebook") ``` -------------------------------- ### Verify MNE-C setup script availability Source: https://github.com/mne-tools/mne-python/blob/main/doc/install/mne_c.rst Run this command in a new terminal to confirm that the MNE-C setup script for bash/sh shells has been correctly sourced. ```console ls $MNE_ROOT/bin/mne_setup_sh ``` -------------------------------- ### Install MNE-Python Core Dependencies (Pip) Source: https://github.com/mne-tools/mne-python/blob/main/doc/install/manual_install.rst Installs only the core functionality of MNE-Python, suitable for users who do not require 3D visualization. This is a minimal installation. ```console $ pip install mne ``` -------------------------------- ### Install Development Version of MNE-Python (pip) Source: https://github.com/mne-tools/mne-python/blob/main/README.rst Install the latest development version of MNE-Python using pip. ```console $ pip install --upgrade https://github.com/mne-tools/mne-python/archive/refs/heads/main.zip ``` -------------------------------- ### Install OSMesa VTK Variant on Headless Server Source: https://github.com/mne-tools/mne-python/blob/main/doc/install/advanced.rst Install the osmesa VTK variant on a headless Linux server to enable off-screen rendering without needing a virtual display like Xvfb. ```console $ conda install -c conda-forge "vtk>=9.2=*osmesa*" "mesalib=21.2.5" ``` -------------------------------- ### Install Test Dependencies Source: https://github.com/mne-tools/mne-python/blob/main/doc/development/contributing.rst Installs additional Python packages required for running the MNE-Python test suite. ```bash $ pip install --group=test ``` -------------------------------- ### Check MNE-Python Installation Source: https://github.com/mne-tools/mne-python/blob/main/doc/install/check_installation.rst Run this command in your terminal to verify the MNE-Python installation and display system information. Ensure your MNE-Python environment is active. ```bash python -c "import mne; mne.sys_info()" ``` -------------------------------- ### Install MNE-Python with PySide6 Binding via Pip Source: https://github.com/mne-tools/mne-python/blob/main/doc/install/advanced.rst Install MNE-Python with the PySide6 Qt binding using pip. This allows using PySide6 instead of the default PyQt5 or PyQt6. ```console $ pip install "mne[full-pyside6]" ``` -------------------------------- ### Install MNE-Python with HDF5 Support (Pip) Source: https://github.com/mne-tools/mne-python/blob/main/doc/install/manual_install.rst Installs MNE-Python with HDF5 I/O support using pip. This is required for specific functions like reading EEGlab files or saving source morphs. ```console $ pip install "mne[hdf5]" ``` -------------------------------- ### Set GitHub Username and Installation Location Source: https://github.com/mne-tools/mne-python/blob/main/doc/development/contributing.rst Defines environment variables for your GitHub username and the desired installation path for the MNE-Python development version. Remember to replace placeholders with your actual information. ```bash $ GITHUB_USERNAME="insert_your_actual_GitHub_username_here" $ # pick where to put your local copy of MNE-Python development version: $ INSTALL_LOCATION="/opt" ``` -------------------------------- ### Install MNE-Python without Qt Bindings via Pip Source: https://github.com/mne-tools/mne-python/blob/main/doc/install/advanced.rst Install MNE-Python without any Qt bindings using pip. This is useful if you do not need Qt-based visualization features. ```console $ pip install "mne[full-no-qt]" ``` -------------------------------- ### Install MNE-Python in Editable Mode Source: https://github.com/mne-tools/mne-python/blob/main/doc/development/contributing.rst Removes the stable MNE-Python base and installs the development version from the local clone in editable mode. This allows changes in the source code to be reflected immediately. ```bash $ cd $INSTALL_LOCATION/mne-python # make sure we're in the right folder $ conda remove --force mne-base # the --force avoids dependency checking $ pip install -e . ``` -------------------------------- ### sample.data_path Source: https://github.com/mne-tools/mne-python/blob/main/doc/api/datasets.rst Returns the path to the MNE sample dataset. This is a widely used dataset for MNE-Python examples. ```APIDOC ## sample.data_path ### Description Returns the path to the MNE sample dataset. This is a widely used dataset for MNE-Python examples. ### Method Not applicable (Python function) ### Endpoint Not applicable (Python function) ### Parameters - **download** (bool) - Optional - If True, download the dataset if it is not found. Defaults to False. - **verbose** (bool) - Optional - If True, print messages to the console. Defaults to None. ### Request Example ```python import mne path = mne.datasets.sample.data_path() ``` ### Response Returns the local path to the MNE sample dataset. ``` -------------------------------- ### Extract MNE-C from a tar.gz archive Source: https://github.com/mne-tools/mne-python/blob/main/doc/install/mne_c.rst Unpack the MNE-C software from a compressed tar archive to your desired installation location. ```console $ cd $ tar zxvf ``` -------------------------------- ### Clean Previous Builds Source: https://github.com/mne-tools/mne-python/wiki/How-to-make-a-major-or-minor-release Remove existing build artifacts and files before starting a new package build. ```bash rm -r build rm mne/html/bootstrap.min.js rm debian/python-mne* rm -r debian/python-mne ``` -------------------------------- ### setup_volume_source_space Source: https://github.com/mne-tools/mne-python/blob/main/doc/api/forward.rst Sets up a volume source space. ```APIDOC ## setup_volume_source_space ### Description Sets up a volume source space, which discretizes the entire brain volume into voxels. This is an alternative to surface-based source spaces. ### Function Signature `mne.setup_volume_source_space(subject, mri=None, bem=None, pos=None, add_dist=False, n_jobs=None, parallel_backend='loky', verbose=None)` ``` -------------------------------- ### setup_source_space Source: https://github.com/mne-tools/mne-python/blob/main/doc/api/forward.rst Sets up a source space from a FreeSurfer reconstruction. ```APIDOC ## setup_source_space ### Description Sets up a source space from a FreeSurfer reconstruction. This function generates the source points and their properties based on anatomical MRI data. ### Function Signature `mne.setup_source_space(subject, fname=None, spacing='oct6', add_dist=False, n_jobs=None, surface='white', parallel_backend='loky', verbose=None)` ``` -------------------------------- ### Install MNE-Python Core Dependencies (Conda) Source: https://github.com/mne-tools/mne-python/blob/main/doc/install/manual_install.rst Installs the core functionality of MNE-Python into a new conda environment named 'mne'. This is a minimal installation that can be extended later. ```console $ conda create --channel=conda-forge --strict-channel-priority --name=mne mne-base ``` -------------------------------- ### Add HDF5 Support to Existing Pip Installation Source: https://github.com/mne-tools/mne-python/blob/main/doc/install/manual_install.rst Installs the 'h5io' and 'pymatreader' packages to enable HDF5 support for an MNE-Python installation that was previously done via pip. ```console $ pip install h5io pymatreader ``` -------------------------------- ### Update Documentation Links to Installers Source: https://github.com/mne-tools/mne-python/wiki/How-to-make-a-major-or-minor-release Modify the installer links in the MNE-Python documentation to point to the newly updated installer files. This change should be pushed to both the maintenance and main branches. ```bash Change button links doc/install/installers.rst to point to the new installer files. Make sure to update links for all 3 platforms. Push this change to both maint/X.Y and main, with commit message [circle deploy]. ``` -------------------------------- ### MNE-Python Desktop Entry Configuration Source: https://github.com/mne-tools/mne-python/blob/main/doc/install/advanced.rst Example .desktop file content for MNE-Python on Linux systems that require application-specific desktop entries for proper dock icon display. ```ini [Desktop Entry] Type=Application Version=1.5 Name=MNE-Python StartupWMClass=MNE-Python ``` -------------------------------- ### Running Documentation Tests Source: https://github.com/mne-tools/mne-python/blob/main/doc/development/contributing.rst Commands to run basic tests on the documentation and apply code formatting checks. ```bash $ pytest mne/tests/test_docstring_parameters.py $ make ruff ``` -------------------------------- ### Setup and Write Source Space Source: https://github.com/mne-tools/mne-python/blob/main/doc/documentation/cookbook.rst Creates and saves a source space for MNE-Python analysis. This involves defining the grid points on the cortical surface and writing them to a FIF file. ```python src = setup_source_space('sample', spacing='oct6') # doctest: +SKIP write_source_spaces('sample-oct6-src.fif', src) # doctest: +SKIP ``` -------------------------------- ### Finding Python Interpreter Path (MNE-Python Installer) Source: https://github.com/mne-tools/mne-python/blob/main/doc/install/ides.rst This output shows the path to the Python interpreter when using the MNE-Python installer on Linux and macOS. ```output Using Python: /some/directory/mne-python_1.10.0_0/bin/python ``` -------------------------------- ### Start Discourse Development Instance with Host Access Source: https://github.com/mne-tools/mne-python/wiki/Mailing-list-migration Shuts down the development instance and restarts it, enabling host system port access and allowing temporary hosting via a specified subdomain. This is useful for external access or testing with custom domains. ```Bash d/shutdown_dev # NB: The -p opens up listening ports *at the host system level*! d/boot_dev -p -e DISCOURSE_DEV_HOSTS=my.subdomain.com # to temporarily host, allowing this domain d/bundle install d/unicorn google-chrome http://localhost:9292 # and others hopefully http://my.subdomain.com:9292 ``` -------------------------------- ### Stage Codemeta and Citation Files Source: https://github.com/mne-tools/mne-python/wiki/How-to-make-a-patch-release Add the updated codemeta and citation files to staging. ```shell git add codemeta.json CITATION.cff ``` -------------------------------- ### Install nb_conda_kernels for Jupyter Source: https://github.com/mne-tools/mne-python/blob/main/doc/install/advanced.rst Install the nb_conda_kernels package into the base conda environment to facilitate using MNE-Python in Jupyter notebooks launched from the Anaconda GUI. ```console $ conda install --name=base nb_conda_kernels ``` -------------------------------- ### SourceSimulator Source: https://github.com/mne-tools/mne-python/blob/main/doc/api/simulation.rst A class for simulating source activity. ```APIDOC ## SourceSimulator ### Description A class for simulating source activity. ### Method (Not specified in source) ### Endpoint (Not specified in source) ### Parameters (Not specified in source) ### Request Example (Not specified in source) ### Response (Not specified in source) ``` -------------------------------- ### Import data from EEGLAB .set files Source: https://github.com/mne-tools/mne-python/blob/main/doc/help/migrating.rst Read raw data from EEGLAB .set files into MNE-Python. ```python raw = io.read_raw_eeglab(fname) (set file) ``` -------------------------------- ### Install MNE-Python with All Dependencies (Conda) Source: https://github.com/mne-tools/mne-python/blob/main/doc/install/manual_install.rst Installs MNE-Python and all its dependencies into a new conda environment named 'mne'. Adjust the environment name using the --name flag. ```console $ conda create --channel=conda-forge --strict-channel-priority --name=mne mne ``` -------------------------------- ### Basic Git Commands for Development Source: https://github.com/mne-tools/mne-python/blob/main/doc/development/contributing.rst Lists essential Git commands for MNE-Python development, including cloning repositories, adding remote connections, fetching updates, and managing branches. ```bash git clone {} git remote add {} {} git fetch --all ``` -------------------------------- ### Execute Command-Line Tool with Debugger Source: https://github.com/mne-tools/mne-python/blob/main/doc/development/contributing.rst Run an MNE command-line tool using 'python -m' and enter an interactive Python session upon completion for post-mortem debugging. ```bash python -i -m mne browse_raw ~/mne_data/MNE-sample-data/MEG/sample/sample_audvis_raw.fif ``` -------------------------------- ### Install MNE-Python with HDF5 Support (Conda) Source: https://github.com/mne-tools/mne-python/blob/main/doc/install/manual_install.rst Installs MNE-Python with HDF5 I/O support and necessary packages (h5io, h5py, pymatreader) into a new conda environment named 'mne'. ```console $ conda create --override-channels --channel=conda-forge --name=mne mne-base h5io h5py pymatreader ``` -------------------------------- ### Deploy Stable Website Source: https://github.com/mne-tools/mne-python/wiki/How-to-make-a-patch-release Push an empty commit to deploy the stable branch if it hasn't been deployed. ```shell git commit --allow-empty -m '[circle deploy]' ``` -------------------------------- ### Enable Qt GUI Backend in IPython/Jupyter on Windows Source: https://github.com/mne-tools/mne-python/blob/main/doc/install/advanced.rst On Windows, use the %gui qt IPython magic command to ensure proper GUI event loop handling within IPython or Jupyter. ```ipython In [2]: %gui qt ``` -------------------------------- ### make_forward_solution Source: https://github.com/mne-tools/mne-python/blob/main/doc/api/forward.rst Computes a forward solution from source space, BEM, and sensor information. ```APIDOC ## make_forward_solution ### Description Computes a forward solution, which describes how neural activity in the source space projects to the sensors. It requires source space, BEM model, and sensor information. ### Function Signature `mne.make_forward_solution(src, fwd_params, trans, info, bem=None, eeg=True, meg=True, n_jobs=None, verbose=None)` ``` -------------------------------- ### Update MNE Installers Repository Source: https://github.com/mne-tools/mne-python/wiki/How-to-make-a-major-or-minor-release Search for and replace old version numbers with the new release version in the mne-installers repository documentation. This ensures links point to the correct installer files. ```bash git grep "1.7.[0-9]" -- ':!*.svg' doc/ change to X.Y.Z ``` -------------------------------- ### Squash Website Commits for Release Source: https://github.com/mne-tools/mne-python/wiki/How-to-make-a-major-or-minor-release Use git commands to fetch, reset, clean, and squash commits on the main branch of the website repository. This prepares the website for archiving the previous stable version and committing the new release. ```console git fetch origin git checkout main git reset --hard origin/main git clean -xdf git log | grep -B4 "Archive" | head -5 commit e9ec0b8f29b791a2a60764976d595923b24eb302 Author: Eric Larson Date: Fri Apr 19 09:26:05 2024 -0400 Archive 1.6 git reset --soft e9ec0b8f29b791a2a60764976d595923b24eb302 git commit -am "X.Y Squash" cp -a stable X.W # the previous stable version git add X.W/* git commit -m "Archive X.W" git push origin -f main ``` -------------------------------- ### Install Development Version of MNE-Python Source: https://github.com/mne-tools/mne-python/blob/main/doc/install/updating.rst Install the latest development version of MNE-Python from GitHub using pip. This command bypasses dependency checks. Ensure the 'mne' conda environment is activated first. ```console $ pip install -U --no-deps https://github.com/mne-tools/mne-python/archive/refs/heads/main.zip ``` -------------------------------- ### Add Upstream Remote and Fetch All Source: https://github.com/mne-tools/mne-python/blob/main/doc/development/contributing.rst Configures the local repository to track the official MNE-Python repository as 'upstream' and fetches all branches and tags from all configured remotes. Also sets up a local git blame ignore file. ```bash $ cd mne-python $ git remote add upstream https://github.com/mne-tools/mne-python.git $ git fetch --all $ git config --local blame.ignoreRevsFile .git-blame-ignore-revs ```