Skip to content

Commit

Permalink
Add support to download all EEGEyeNet DOTS data.
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-oreilly committed May 12, 2024
1 parent 11de755 commit 74039c0
Show file tree
Hide file tree
Showing 2 changed files with 228 additions and 28 deletions.
78 changes: 50 additions & 28 deletions eoglearn/datasets/eegeyenet.py
Original file line number Diff line number Diff line change
@@ -1,35 +1,49 @@
import pandas as pd
from pathlib import Path

from .utils import _fetch_dataset

PARAMS = {
"EP10_DOTS": list(
[
dict(
url="https://osf.io/download/u2hct/",
archive_name="EP10_DOTS1_EEG.mat",
folder_name="EEGEYENET-Data/dots/EP10",
hash="md5:3e05afdf9c873ac34cb2ffc1141256a3",
dataset_name="EEGEYENET",
)
]
),
}

DOTS = {"EP10": PARAMS["EP10_DOTS"]}
def _get_urls_df():
return pd.read_csv(Path(__file__).parent / "eegeyenet_urls.csv")


def _get_params(subject, run):
df = _get_urls_df()
row = df.loc[(df.subject == subject.upper()) & (df.run == int(run))]
assert len(row) == 1
row = row.T.squeeze()
return dict(
url=row["url"],
archive_name=f"{subject}_DOTS{run}_EEG.mat",
folder_name=f"EEGEYENET-Data/dots/{subject}",
hash=row["hash"],
dataset_name="EEGEYENET")


def get_subjects_runs():
"""Get dictionary of {subject: [lists of runs]}.
Returns
-------
dict
Dictionary of subjects with the runs as values.
"""
df = _get_urls_df()
return {subject: df.run.values[df.subject == subject]
for subject in df.subject.unique()}


def fetch_eegeyenet(subject="EP10", run=0, fetch_dataset_kwargs=None):
def fetch_eegeyenet(subject="EP10", run=1, fetch_dataset_kwargs=None):
"""Fetch a sample file from the EEG Eyenet dataset.
Parameters
----------
subject : str
Subject identifier. Defaults to ``'EP10'``.
run : int | str
Which run to download. Most Participants completed 6 runs of the task, saved
to 6 different files. integers are treated as indices, i.e. ``0`` for subject
``"EP10"``corresponds to ``"EP10_DOTS1_EEG.mat"``. If ``str``, it must be the
exact filename to download for the ``subject``, ie. ``"EP10_DOTS1_EEG.mat"``.
Defaults to ``0``.
Which run to download. Most Participants completed 6 runs of the task,
saved to 6 different files. Defaults to ``1``.
fetch_dataset_kwargs : dict | None
Keyword arguments to pass to :func:`~mne.datasets.fetch_dataset`.
if ``None``, no keyword arguments are passed. Defaults to ``None``.
Expand All @@ -41,13 +55,21 @@ def fetch_eegeyenet(subject="EP10", run=0, fetch_dataset_kwargs=None):
"""
if not fetch_dataset_kwargs:
fetch_dataset_kwargs = dict()
if isinstance(run, int):
dataset_params = DOTS[subject][run]
elif isinstance(run, str):
run = [run for run in DOTS[subject] if run["archive_name"] == run][0]
dataset_params = DOTS[subject][run]
else:
raise ValueError("run must be an integer or string, not {}".format(type(run)))
fetch_dataset_kwargs["dataset_params"] = dataset_params
run = int(run)
runs = get_subjects_runs()
if subject not in runs or run not in runs[subject]:
raise ValueError("subject and run not available. See "
"get_subjects_runs() for information on "
"available subjects and runs.")

fetch_dataset_kwargs["dataset_params"] = _get_params(subject, run)
fpath = _fetch_dataset(fetch_dataset_kwargs=fetch_dataset_kwargs)
fpath = fpath / fetch_dataset_kwargs["dataset_params"]["archive_name"]

# mne.datasets.fetch_dataset will not download a new run if the subject
# folder already exist
if not fpath.exists():
fetch_dataset_kwargs["force_update"] = True
_fetch_dataset(fetch_dataset_kwargs=fetch_dataset_kwargs)

return fpath
178 changes: 178 additions & 0 deletions eoglearn/datasets/eegeyenet_urls.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
subject,run,url,hash
EP10,1,https://osf.io/download/u2hct,md5:3e05afdf9c873ac34cb2ffc1141256a3
EP10,2,https://osf.io/download/28cvb,md5:1bebd24bc8a8eeb4165c44122d1aff8d
EP10,3,https://osf.io/download/g3cn4,md5:c261df6e43da9122577f580f7df85022
EP10,4,https://osf.io/download/dy96c,md5:fdddde6fd1b52bc8f6d23c5c1c74687e
EP10,5,https://osf.io/download/y5sme,md5:1157814a462e4fee47d59782d65261ed
EP10,6,https://osf.io/download/ktvmp,md5:7bad553a41dcf69b7adca63809a6263d
EP12,1,https://osf.io/download/9ftm4,md5:39c9ef4d6fc95f6e3b6fd85243b01d18
EP12,2,https://osf.io/download/28euv,md5:012bc78b849b01c464389292bd242535
EP12,3,https://osf.io/download/a96qp,md5:0565c68248b8aa8cf5f365bb18bd0732
EP12,4,https://osf.io/download/7pk6e,md5:114097073449bb4163feff424f62aaf1
EP12,5,https://osf.io/download/ef52s,md5:92a6781bf181e2c70345bc7a6aae5a1a
EP12,6,https://osf.io/download/rhzwk,md5:d314b61d48bfcb392d8e1c7d47639e52
EP14,2,https://osf.io/download/wb4yq,md5:e71bdda1ceae67235e84f146b7c145a3
EP14,3,https://osf.io/download/fqwzk,md5:0db420dc3528a8864a63a022a8515017
EP14,4,https://osf.io/download/xedk6,md5:e1680283ee3d2ebd39587088bc4d52e9
EP14,5,https://osf.io/download/jx9bf,md5:e9bd5ec4bd9a48c0e882169cd00552f8
EP14,6,https://osf.io/download/84znd,md5:3a6b67f20a6b1d8b6a8ea54b5de78657
EP18,1,https://osf.io/download/b3skm,md5:4898b1ccc7bbded8c2d958a019d008b3
EP18,2,https://osf.io/download/fpyd6,md5:910fef853e4c06e19b4ea3e4d08afb56
EP18,3,https://osf.io/download/8rmqz,md5:f514a43481afd5ddf73edc1fcc2578cc
EP18,4,https://osf.io/download/tpr6u,md5:9f1e44cffee45a1b444ab79d046d2208
EP18,5,https://osf.io/download/8s5ng,md5:53c99d608ff38dc2db1505ef9c4ce9fd
EP18,6,https://osf.io/download/bscqz,md5:422cb0d51e3dc970abe62ce79c55f193
EP23,1,https://osf.io/download/8qhja,md5:69b8c1ad800a64b96a234a1570be3920
EP23,2,https://osf.io/download/pqbf5,md5:3ec8b4af142e384a354fba0a19c99155
EP23,3,https://osf.io/download/wb6r8,md5:164ab01c9e049e26dc3ee18a53ccc37d
EP23,4,https://osf.io/download/mhcx5,md5:955c00e622bceee53785736b811154c7
EP23,5,https://osf.io/download/k8vxu,md5:b782743c75b1c787f5c23cee8051b611
EP23,6,https://osf.io/download/a8bv3,md5:32bc655e75a0cb830b69e2cdb9082ce6
EP24,1,https://osf.io/download/bk4xy,md5:c725d2bd7ddc5ecc6f50b9b3c72e255e
EP24,2,https://osf.io/download/qm9db,md5:10c2f75826e70fee72ca8ab039a8ade3
EP24,3,https://osf.io/download/cbmdz,md5:21b46ae5960c2ed6b94d503483773523
EP24,4,https://osf.io/download/d9wuc,md5:3c2f327f4225dc8bed79c21a58bab7d5
EP24,5,https://osf.io/download/qjaf6,md5:13a6873c8242573c885670f865a215f7
EP24,6,https://osf.io/download/hwp47,md5:7f37ce8f740cc58011e3790efbeb5d52
EP26,1,https://osf.io/download/6mhyx,md5:a5c35305ca0d80b568ff0811ee4fd0da
EP26,2,https://osf.io/download/my2e5,md5:c298599cb9b21af7e0110a603aa40cc6
EP26,3,https://osf.io/download/mt6db,md5:4ce12918693498322106fe68d81413d0
EP26,4,https://osf.io/download/9mjcr,md5:8f88adac2f4bd42729cd9152350be798
EP26,5,https://osf.io/download/2kh8e,md5:172a8da7dc76112a14e835ddb26d68a8
EP26,6,https://osf.io/download/8ajyk,md5:81138616059826b05085e9e1ed6c8996
EP28,1,https://osf.io/download/72nsb,md5:ce4b98093cf56db3096a080aa117d0cb
EP28,2,https://osf.io/download/urwt7,md5:ad20689b555bab330842bbdda73bbaa5
EP28,3,https://osf.io/download/ztqgr,md5:8176300c98a8798f787ce69bad76e0a7
EP28,4,https://osf.io/download/djw3p,md5:a4a15754678d08768ed1c52d17e08a80
EP28,5,https://osf.io/download/dxq8j,md5:b89da3e5a5370db0b78aafdb996b43b9
EP28,6,https://osf.io/download/57qkn,md5:260dd0c87ce3a0f5eb7fb53beabdbc60
EP29,1,https://osf.io/download/c8kxa,md5:d5f38e30b663eff9ec13c527cb35e27e
EP29,2,https://osf.io/download/cqebr,md5:f1fb8e8b53e69cfdaaf2d66ae5424338
EP29,3,https://osf.io/download/3e5k4,md5:8e144c46a461b654e3851b2295df3194
EP29,4,https://osf.io/download/ps4j7,md5:032925a15aa5d55b5f8e240c4a54f842
EP29,5,https://osf.io/download/aeb35/,md5:18bb7513a4888c33c14b12b5d33d19b1
EP29,6,https://osf.io/download/e8xz5/,md5:a648d7131d7a127a06c5944fc7343161
EP35,1,https://osf.io/download/bek4z,md5:9cd6a0e636c67189bdeb90e5aa72001a
EP35,2,https://osf.io/download/yr6c3,md5:b88bf71939113d8eedf1317e8804559a
EP35,3,https://osf.io/download/xqmus,md5:317f5217637ce450fd1324742f369328
EP35,4,https://osf.io/download/r7cf9/,md5:267419c7929052d9c6ce2aa4a8439258
EP35,5,https://osf.io/download/z6jp3,md5:832d1c2f3f3e895084052e2f9f6c2810
EP35,6,https://osf.io/download/72vgs,md5:763773fe1106d85ca9edc90e81ecc8cc
EP37,1,https://osf.io/download/xm8ne,md5:9253c4d210f522bb6399c885427922aa
EP37,2,https://osf.io/download/v4acf,md5:2cbc631b48d124f2102e6b69492b7076
EP37,3,https://osf.io/download/ybuq5,md5:2bc4b19619abf3223617aa2e630f3d55
EP37,4,https://osf.io/download/p93vy,md5:51ac42e001196f4385d4199770071579
EP37,5,https://osf.io/download/6r3fw,md5:0afa88c59a2ea03c2ddd82c08f0a6fd9
EP37,6,https://osf.io/download/jfvcy,md5:c5dbfd2a4e8cf0b6ee01a50bb69fa6ce
EP39,1,https://osf.io/download/v97f5,md5:3e1450b5bdc1acffbc4c7ebc0271d4b2
EP39,2,https://osf.io/download/bvmq3,md5:f027b131628e0e475c7131d86d9d75d8
EP39,3,https://osf.io/download/ahucz,md5:3170ab4b53bc983041b49d9e6267b106
EP39,4,https://osf.io/download/9dzth,md5:c1e7d99a29e13e5508fad799fa7cfe1e
EP39,5,https://osf.io/download/qwhcu,md5:5e60bc4a3fe76b9a2abae7225822c2ea
EP39,6,https://osf.io/download/n5g34,md5:dd99d2d86fd636a0cf20605258d6c2b0
EP41,1,https://osf.io/download/gxjkd,md5:2666332645f0596003f2fe6f42165f27
EP41,2,https://osf.io/download/qdb56,md5:8d8999efa0075b63fd9856a3d1dbc3c0
EP41,4,https://osf.io/download/t2mx5,md5:dd8f256b8baa810adffa2603c8f39fed
EP41,5,https://osf.io/download/wpcz9,md5:61b9867bc03325af6b5566edba223657
EP41,6,https://osf.io/download/b3726,md5:e786d137e9e72ea3079223708a1a86cc
EP46,1,https://osf.io/download/q69b8,md5:c672d91beebbc12a322fb1073fb15d96
EP46,2,https://osf.io/download/z7enq,md5:d0d73c294002b8e9186f4a92cb3a8393
EP46,3,https://osf.io/download/qav2k,md5:a3f294849dfa7b0f2f409e10e4475706
EP46,4,https://osf.io/download/upbn4,md5:aa62d7bd0ddb6f38b69878dd4b23a07f
EP46,5,https://osf.io/download/j27du,md5:6412d29846ff5b5a50af132ef98bbedd
EP46,6,https://osf.io/download/a6hwd,md5:9ca89ef40384f3bbcb483113131aed0c
EP49,1,https://osf.io/download/gnyeq,md5:fc3fff47ecf894509437bb3b439abb1f
EP49,2,https://osf.io/download/23vyh,md5:fbd7179d8746262e3b9c6ba6af740ee2
EP49,3,https://osf.io/download/rftq8,md5:a1e8f572f6f86fd2c441e7a83901a331
EP49,4,https://osf.io/download/hg25k,md5:48dde5cbe59ebda4d545b5ac1d051cfd
EP49,5,https://osf.io/download/sy3at,md5:f67f33f07b0de6c840e1792c1daec366
EP49,6,https://osf.io/download/kdus8,md5:2d99b33f489ad3449ea6449336cac445
EP54,1,https://osf.io/download/kg6my,md5:c2d109bef7e6fa28a9985fb2b57f01c7
EP54,2,https://osf.io/download/vkyc5,md5:c7a190b7402b97f3ed51f357616e2f58
EP54,3,https://osf.io/download/fng3q,md5:1095f65df2a84e6163c9cff1ec85068a
EP54,4,https://osf.io/download/mkuqj,md5:ea8ee52d4daeaf41122c13b6731f286a
EP54,5,https://osf.io/download/vdjb6/,md5:3b5d7a3f8766a16f4f074a683e87b206
EP54,6,https://osf.io/download/q4gc9/,md5:cce38944e39148c09002c13da92927db
EP56,1,https://osf.io/download/pm23e,md5:3265fed0f5c87588f804fa05b2589fc1
EP56,2,https://osf.io/download/gt3uv,md5:6ffc887aa187c46b53535d2e7a159305
EP56,3,https://osf.io/download/g9h4n,md5:8f7333faa592ca7ec2d811e98c5b0d6f
EP56,4,https://osf.io/download/mgxcf,md5:b154da203cd7a3cecc9ae8923a37440d
EP56,5,https://osf.io/download/k5vtw,md5:98f1ec4b8fdb97f482faac9e6c4a2591
EP56,6,https://osf.io/download/wbhn9,md5:5347b49ac0c9be51e5997c524a4b756d
EP57,1,https://osf.io/download/shxpr,md5:6690a87f35dfd41d43a2c412b6f28911
EP57,2,https://osf.io/download/f3ukz,md5:7bdff6d202b9b5848d448d691aa57170
EP57,3,https://osf.io/download/epvg4,md5:26df35821267f32974867b19c593611a
EP57,4,https://osf.io/download/kjyf9,md5:44cce5265080111f890dc4c2578418c8
EP57,5,https://osf.io/download/pn83e,md5:b93e8e4cd216826a9cd413f270851f12
EP57,6,https://osf.io/download/zwgm6,md5:a074d8cd6cdad6d9948948d2eda896fb
EP58,1,https://osf.io/download/u47yf,md5:37be627580cee8dde8ed4493ea77826e
EP58,2,https://osf.io/download/bj276,md5:f9d222b7734e0998eec30ea7a208c163
EP58,3,https://osf.io/download/qb9wn,md5:42ab4781c715ba5b4fe70fe8c85e2b63
EP58,4,https://osf.io/download/eyqpf,md5:687240becc17ce7a4cf82e9112b2fa3d
EP58,5,https://osf.io/download/dz7t2,md5:2d7269e4927f6086ee94e701b9cfc0ea
EP58,6,https://osf.io/download/wzs3j,md5:3672e565b0774f43f3c3df63849e9ca6
EP59,1,https://osf.io/download/68vaf,md5:f49309319d0afdb5549be3e4052f025a
EP59,2,https://osf.io/download/vdcuy,md5:70aecddbc38dd567ab898f093bbe4f0a
EP59,3,https://osf.io/download/s8wug,md5:0c78298acd00be059b66daa029b58d3c
EP59,4,https://osf.io/download/dpn9h,md5:7eac810198a21db04a8bb780a745e057
EP59,5,https://osf.io/download/q6dkn,md5:e34035e522d293293fd6f1757e16eaa9
EP59,6,https://osf.io/download/pvj8w,md5:2b4adeeca0d954ef424dc5275b2e3692
EP61,1,https://osf.io/download/j9ew5,md5:09ed18319ddb6a0647b3bffd5f903ea7
EP61,2,https://osf.io/download/j67vy,md5:9a8a5f69c369c7311394637a476edf2a
EP61,3,https://osf.io/download/bs7wx,md5:979a0c2c22f997933e549748b49b98f6
EP61,4,https://osf.io/download/yhu5r,md5:764080aeca11413deb46d85e09d9705a
EP61,5,https://osf.io/download/bztx2,md5:3930442d82767ba006a8bf49c2dd5cba
EP61,6,https://osf.io/download/g7pme,md5:6394f2e9e599a39910ef5f27b9f398ce
EP65,1,https://osf.io/download/yf7jk,md5:2a867068da7bcf1dec403ed90abe59bf
EP65,2,https://osf.io/download/w9htx,md5:f055574c4b8701b81320ac35886dc3f6
EP65,3,https://osf.io/download/wevjm,md5:1a2520c1814a3b4d566316dc5e60ef12
EP65,4,https://osf.io/download/gwrc2,md5:b2038200e8f31f4972fdc168735f42e7
EP65,5,https://osf.io/download/xhqut,md5:29c9ff1936ae21bde4d7836a88d54558
EP65,6,https://osf.io/download/kamfz,md5:921ed74678d975c1138a09eb5df5a235
EP72,1,https://osf.io/download/68ex2,md5:5d96a03ddf66ee0e66882ca46a70afcc
EP72,2,https://osf.io/download/rhbdj,md5:02963ee0569eb08bfd3ed6f6350c57a3
EP72,3,https://osf.io/download/x74ne,md5:78820d627f61778a0a2a9a74b448016b
EP72,4,https://osf.io/download/kcdqe,md5:6844232aae7ddcbcbfd400b2d4497916
EP72,5,https://osf.io/download/84y9x,md5:5d6690995f6961bf9d026c2a88229a83
EP72,6,https://osf.io/download/peu4w,md5:4e1766dd29e41f34b5be0d1a41a93406
EP74,1,https://osf.io/download/jx7ya,md5:9b94ee55a396ea02ea3ab84a12b82a07
EP74,2,https://osf.io/download/4e5k3/,md5:60499600365c72bd8ad0b80317d2ee33
EP74,3,https://osf.io/download/zv3xa,md5:26443c8508d97bca7565836d556fc539
EP74,4,https://osf.io/download/7d35h,md5:c370ae8de2daf5526dd023c79fbf3de6
EP74,5,https://osf.io/download/uysaf,md5:4bdc11d04e540fa5f13451bb54091aa7
EP74,6,https://osf.io/download/9vdcm,md5:ec45b48c9c8c0ba73bd384481b883897
EP82,1,https://osf.io/download/3xjey,md5:94072fba2f262a26be9370ac061ca4a7
EP82,2,https://osf.io/download/pekds,md5:a5444b9c445cd7e8674375944ef1d807
EP82,3,https://osf.io/download/aeh2j,md5:ff30d3bcbfdaa6735270f07e0883d340
EP82,4,https://osf.io/download/jp4b9,md5:5c4950860a24a1728dc0e8a785316fc6
EP82,5,https://osf.io/download/9gxnd,md5:c351a7d0268a60b7d3f36d0ef5510c58
EP82,6,https://osf.io/download/vk48b,md5:9c58cc445b78736b823dbe923ee587ed
EP86,1,https://osf.io/download/n87dc,md5:61c5a8c791e0bb9fbbada1c4bc7857e0
EP86,2,https://osf.io/download/awqrt,md5:847aa52d1a877ac5bd8367b1358dae3e
EP86,3,https://osf.io/download/hpk3v,md5:b327e37ef934f100609fae4f73f323e5
EP86,4,https://osf.io/download/87s3z,md5:521faf3c51ab6d6a042a69bdc5a186dd
EP86,5,https://osf.io/download/cmjny,md5:379dc6df4c4999e4a8be23ef16ea27fc
EP86,6,https://osf.io/download/d2chq,md5:99fe9b77bca7d6e64ed016e6c7446cf3
EP88,1,https://osf.io/download/dfcez,md5:ee461712805c9dcf01a3d4a7c8c007fa
EP88,2,https://osf.io/download/svw6h,md5:3799a06a029d73a1abde1980595ef0d1
EP88,3,https://osf.io/download/zkym7,md5:861ea4df8bb381bfd21b3c0d9e55cc8e
EP88,4,https://osf.io/download/hs5zb,md5:af7f34c6a1e73ec07d57f543c21350a0
EP88,5,https://osf.io/download/z5wk7,md5:91b06dfbd4bce1c68444cfe492c46401
EP93,1,https://osf.io/download/w2jrk,md5:0c71a0e5bd6400d9c9a3411467bdf086
EP93,2,https://osf.io/download/y35th,md5:11b4872762973465ec45cbfa38c73f00
EP93,3,https://osf.io/download/78xnt,md5:7f981c2ba02cab1ea927194e5658614f
EP93,4,https://osf.io/download/b7gvp,md5:0e0bb830fb57875fa4ab0cc072f22d1c
EP93,5,https://osf.io/download/ujg9s,md5:17ef887d3cc8fda536ec134b5fa58df7
EP93,6,https://osf.io/download/6kjsw,md5:20aece5cc6c768a324121bd5e109b3aa
EP94,1,https://osf.io/download/6a23r,md5:80ec80c9f0eae3ccd5903f8c124d0d60
EP94,2,https://osf.io/download/475yt,md5:877f836e32e2e340108f853098d4a0ef
EP94,3,https://osf.io/download/ws2cn,md5:e87acc1bf972d5ad381bc08dd8399994
EP94,4,https://osf.io/download/8vqet,md5:8ee7e3354620a2135894cd514f54f776
EP94,5,https://osf.io/download/xz8yb,md5:b5b7dedf18851b188256116699bae2d4
EP94,6,https://osf.io/download/ne7xg,md5:1a7260712d53fc19ce799381c24b1e2f
EP97,1,https://osf.io/download/m25es,md5:b02872913900107244d4d4bc15c2ac12
EP97,2,https://osf.io/download/29zhd,md5:795fa1ba3329bdc60c763ac364d1cc02
EP97,3,https://osf.io/download/29a57,md5:d2b280562e8bfec129c24fc87ee8893a
EP97,4,https://osf.io/download/q2sxe,md5:62a9375b8263fb9813ab642c174a5730
EP97,5,https://osf.io/download/w8vsh,md5:3206124a7f7c2d2b70f5e820e11afc78
EP97,6,https://osf.io/download/ga4f7,md5:1cd0a0f0792eefd2459392f410e56042

0 comments on commit 74039c0

Please sign in to comment.