Science Score: 67.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 21 DOI reference(s) in README -
✓Academic publication links
Links to: zenodo.org -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.8%) to scientific vocabulary
Keywords
Repository
Analyses for the eComp experiment 2021
Basic Info
- Host: GitHub
- Owner: sappelhoff
- License: mit
- Language: Python
- Default Branch: main
- Homepage: https://github.com/sappelhoff/ecomp_analysis/
- Size: 1.03 MB
Statistics
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
- Releases: 2
Topics
Metadata Files
README.md
ecomp_analysis
This repository contains the analysis code for the eComp project.
The archived version can be found on Zenodo:
All important details are reported in the original paper for the project:
- preprint: 10.1101/2022.03.31.486560
- journal article: 10.1371/journal.pcbi.1010747
Installation
To install a Python environment suitable to running this analysis code, please:
- Download Miniconda for your system: https://docs.conda.io/en/latest/miniconda.html
(this will provide you with the
condacommand) - Use
condato installmamba:conda install mamba -n base -c conda-forge(for more information, see: https://github.com/mamba-org/mamba) - Use the
environment.ymlfile in this repository to create theecomp_analysisenvironment:mamba env create -f environment.yml
You can now run conda activate ecomp_analysis and should have all required packages installed
for running the analyses.
Obtaining the data
The code can run with the mpib_ecomp_sourcedata dataset:
- repository: https://gin.g-node.org/sappelhoff/mpibecompsourcedata
- doi: 10.12751/g-node.lir3qw
However, running the code the first time might take a long time
in order to produce all derivatives that are not shipped as part of this
(analysis code) repository.
Downloading the mpib_ecomp_derivatives dataset may speed this step up
(not required):
- repository: https://gin.g-node.org/sappelhoff/mpibecompderivatives
- doi: 10.12751/g-node.9rtg6f
There is a Brain Imaging Data Structure (BIDS) version of the data available:
- repository: https://gin.g-node.org/sappelhoff/mpibecompdataset
- doi: 10.12751/g-node.jtfg5d
Finally, there is the experiment code that was used when the data was collected:
- repository: https://github.com/sappelhoff/ecomp_experiment/
- doi: 10.5281/zenodo.6411313
Configuration before running the code
Before running the code on your machine, make sure you have activated the ecomp_analysis
environment, and have downloaded all data (see steps above).
Next, you need to open the config.py file in this repository.
In there, you will find several important settings that can be kept stable.
However, you will need to adjust the path variables pointing to the data,
for example:
DATA_DIR_LOCAL, pointing to the data stored locallyDATA_DIR_EXTERNAL, pointing to the data stored on an external harddriveANALYSIS_DIR_LOCAL, pointing to the analysis code repository (THIS repository) stored locally- ...
Generally, the analyses scripts will import the paths defined in config.py and
use them to obtain the data.
For example:
```Python from config import DATADIREXTERNAL, ANALYSISDIRLOCAL
datadir = DATADIREXTERNAL analysisdir = ANALYSISDIRLOCAL
... use datadir and analysisdir
```
you can edit the analysis scripts themselves to get the data from local, external,
or remote sources that you have specified in config.py.
Running the code
Some of the analysis scripts
(specifically those starting with two digits, e.g., 01_find_bads.py)
accept command line options.
It is convenient to run them from the command line (e.g., with bash) like so:
bash
for i in {1..32}
do
python -u 01_find_bads.py \
--sub=$i \
--data_dir="/mnt/home/appelhoff/Projects/ARC-Studies/eeg_compression/ecomp_data/" \
--analysis_dir="/mnt/home/appelhoff/Projects/ARC-Studies/eeg_compression/ecomp_data/code/ecomp_analysis/" \
--overwrite=True
done
The above will run the 01_find_bads.py script for each participant,
using the overwrite option,
and the data and analysis directory paths specified.
Note that some of the other scripts do not accept command line options.
We recommend running them interactively with an editor such as VSCode
(https://code.visualstudio.com/).
VSCode will pick up on the # %% comments, and render parts of the script
as code cells that can be individually executed.
General order to run code files
If you don't want to use the mpib_ecomp_derivatives dataset described above
to skip some of the computations, you will need to execute all code files.
The following list is a suggested order, because some code files will depend on others.
Note that the data in the derived_data/annotations/ directory is crucial for
reproducing results because parts of the information therein cannot be automatically provided
(for example, which ICA components are rejected).
beh_misc.py- two analyses will be skipped because they depend on outputs from later steps. Simply re-run this script after completing all other steps to get the respective results.
00_sanity_check.py01_find_bads.py02_inspect_raw.py03_run_ica.py04_inspect_ica.py05_make_epochs.pyeeg_misc.pyerp_numbers.pyrdms_mahalanobis.pyrsa_timecourse.pyrsa_neurometrics.pybeh_accuracy.pybeh_modeling.py- Run with different command line options:
--fit_scenario=X, whereXis (i)"free", (ii)"k_is_1", (iii)"k_smaller_1", and (iv)"k_bigger_1". Or set thefit_scenariovariable in the script if you do not want to run this from the command line. (Keepfit_positionset to"all") - Run with different command line options
fit_position=X, whereXis a string "1", "2", ..., "10" (So you need to run this ten times). Additionally, run it withfirsthalfandsecondhalf. As above, you may also simply set thefit_positionvariable in the script. (Keepfit_scenarioset to"free")
- Run with different command line options:
beh_weightings.py- Run with different command line options:
--fit_scenario=X, whereXis (i)free, (ii)k_is_1. Or set thefit_scenariovariable in the script if you do not want to run this from the command line.
- Run with different command line options:
plots_fig1.pyplots_fig2.pyplots_fig3.pyplots_fig4.py- Use LibreOffice Draw (https://www.libreoffice.org/discover/draw/) to open
figures/paradigm_figure.odgand exportparadigm_figure.pdf - Use
xelatex(for example on a service like https://www.overleaf.com/) andfigures/fig*.texto finalize the figures. Note that the*stands for 1, 2, 3, or 4.
Explanation of files
General "infrastructure" files
.flake8--> code style configuration (see alsopyproject.toml).gitignore--> which files to ignore during version control.pre-commit-config.yaml--> for enforcing proper coding style.environment.yml--> software dependencies, see "Installation"pyproject.toml--> code style configuration (see also.flake8)README.md--> general information about this repositoryLICENSE--> how to use and credit the resources
Utility libraries
config.py--> general configuration and variables that get re-used across scriptsutils.py--> general functions that get re-used across scriptsclusterperm.py--> functions for cluster-based permutation testingmodel_rdms.py--> script to generate model representational dissimilarity matrices
EEG preprocessing scripts
Generel preprocessing flow of the EEG data:
00_sanity_check.py01_find_bads.py02_inspect_raw.py03_run_ica.py04_inspect_ica.py05_make_epochs.py
Miscellaneous analysis scripts
For example for checking for missing data or rejected EEG epochs:
beh_misc.pyeeg_misc.py
EEG analysis scripts
For both RSA and ERP analyses:
rdms_mahalanobis.pyrsa_neurometrics.pyrsa_timecourse.pyerp_numbers.py
Behavior analysis scripts
For general accuracy and descriptive behavior analyses, as well as modeling:
beh_accuracy.pybeh_modeling.pybeh_weightings.py
Figure creation scripts
Each producing the figure as found in the manuscript (but see .tex files mentioned below):
plots_fig1.pyplots_fig2.pyplots_fig3.pyplots_fig4.py
Analysis outputs (derived_data/ directory)
This directory generally contains outputs from the scripts above.
Importantly, the annotations subfolder contains important data from the
visual screening of the EEG data (cannot be automatically reproduced):
*_annotations.txt--> saved MNE-Python annotations*_bad-channels.txt--> each non-empty row in the file describes a bad channel*_bads_pyprep.json--> outputs from the01_find_bads.pyscript*_exclude_ica.json--> which ICA components to exclude*_faster_bad_epos.json--> epoch indices rejected through the "FASTER" pipeline
Analysis outputs (figures/ directory)
This directory generally contains outputs from the scripts above. Exceptions are:
paradigm_figure.odg--> to create fig1a, using LibreOffice Draw (https://www.libreoffice.org/discover/draw/)*.tex--> files that are used to put panel letters onto finished figures:fig1.texfig2.texfig3.texfig4.tex
Owner
- Name: Stefan Appelhoff
- Login: sappelhoff
- Kind: user
- Location: Germany
- Company: @MPIB
- Website: https://www.stefanappelhoff.com
- Twitter: stefanappelhoff
- Repositories: 18
- Profile: https://github.com/sappelhoff
Citation (CITATION.cff)
# YAML 1.2
---
# Metadata for citation of this software according to the CFF format (https://citation-file-format.github.io/)
cff-version: 1.2.0
title: eComp Analysis Code
authors:
- given-names: Stefan
family-names: Appelhoff
affiliation: Max Planck Institute for Human Development
orcid: 'https://orcid.org/0000-0001-8002-0877'
type: software
repository-code: 'https://github.com/sappelhoff/ecomp_analysis/'
license: MIT
keywords:
- analysis
- neuroscience
- psychology
- eeg
message: >-
Please cite this software using the metadata from
'preferred-citation' in the CITATION.cff file.
preferred-citation:
authors:
- given-names: Stefan
family-names: Appelhoff
orcid: 'https://orcid.org/0000-0001-8002-0877'
- given-names: Ralph
family-names: Hertwig
orcid: 'https://orcid.org/0000-0002-9908-9556'
- given-names: Bernhard
family-names: Spitzer
orcid: 'https://orcid.org/0000-0001-9752-932X'
title: >-
EEG-representational geometries and psychometric distortions in approximate numerical judgment
journal: PLOS Computational Biology
volume: 18
number: 12
month: 12
year: 2022
type: article
doi: 10.1371/journal.pcbi.1010747
identifiers:
- description: "Code archive on Zenodo"
type: doi
value: 10.5281/zenodo.6411287
...
GitHub Events
Total
Last Year
Dependencies
- datalad *
- mne <1.1
- pooch *
- pyopengl *
- pyyaml *