Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: simplify command line, robustify inputs #41

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.tpl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export PUPIL_PATH=../pupil
#export PUPIL_PATH=/home/basile/data/src/pupil
export GI_TYPELIB_PATH=/usr/local/lib/x86_64-linux-gnu/girepository-1.0/
OUTPUT_PATH=/scratch/neuromod/data/
16 changes: 8 additions & 8 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from subprocess import Popen

import os, sys, importlib
import itertools
from collections.abc import Iterable, Iterator

from src.shared import config
Expand All @@ -21,13 +20,9 @@ def run(parsed):
suggestion = suggest_session_tasks(parsed.tasks)
raise(ValueError('session tasks file cannot be found for %s. Did you mean %s ?'%(parsed.tasks, suggestion)))
from src.shared import cli
if parsed.skip_n_tasks:
if isinstance(tasks, Iterator):
tasks = itertools.islice(tasks, parsed.skip_n_tasks, None)
else:
tasks = tasks[parsed.skip_n_tasks:]

try:
cli.main_loop(
"""cli.main_loop(
tasks,
parsed.subject,
parsed.session,
Expand All @@ -42,7 +37,12 @@ def run(parsed):
parsed.skip_soundcheck,
parsed.target_ETcalibration,
parsed.validate_ET,
)
)"""

cli.main_loop(
ses_mod,
parsed
)
finally:
if not parsed.no_force_resolution:
screen.reset_exp_screen()
Expand Down
33 changes: 0 additions & 33 deletions src/sessions/ses-liris.py

This file was deleted.

8 changes: 8 additions & 0 deletions src/sessions/ses-mario.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,11 @@ def get_tasks(parsed):
import importlib
phase2 = importlib.import_module('src.sessions.ses-mario-phase2')
yield from phase2.get_tasks(parsed)


def get_config(parsed):
return {
'eyetracking_calibration_version': 1,
'eyetracking_validation': True,
'output_dataset': 'mario',
}
15 changes: 8 additions & 7 deletions src/sessions/ses-mario3.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,6 @@ def smb3_completion_fn(env):
for run in range(10):

next_levels = [f"1Player.World{world}.{level}" for idx,(world,level) in design[savestate['index']:savestate['index']+20].iterrows()]
if len(next_levels) < 5:
print('Stable phase completed, no more levels to play')
return []

task = videogame.VideoGameMultiLevel(
game_name='SuperMarioBros3-Nes',
Expand All @@ -125,11 +122,15 @@ def smb3_completion_fn(env):

#only increment if the task was not interrupted, if interrupted, it needs to be rescan
if task._task_completed:
print('saving savestate')
savestate['index'] += task._nlevels
with open(savestate_path, 'w') as f:
json.dump(savestate, f)

yield task_base.Pause(
text="You can take a short break.\n Press A when ready to continue",
wait_key='a',
)
def get_config(parsed):
return {
'eyetracking_calibration_version': 2,
'eyetracking_validation': True,
'add_pauses': True,
'output_dataset': 'mario3',
}
8 changes: 8 additions & 0 deletions src/sessions/ses-mariomeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,11 @@ def get_tasks(parsed):
text="You can take a short break.\n Press A when ready to continue",
wait_key='a',
)

def get_config(parsed):
return {
'eyetracking_calibration_version': 1,
'eyetracking_validation': True,
'output_dataset': 'mariomeg',
'meg': True,
}
8 changes: 8 additions & 0 deletions src/sessions/ses-mariostars.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,11 @@ def get_tasks(parsed):
text="You can take a short break.\n Press A when ready to continue",
wait_key='a',
)


def get_config(parsed):
return {
'eyetracking_calibration_version': 1,
'eyetracking_validation': True,
'output_dataset': 'mariostars',
}
19 changes: 0 additions & 19 deletions src/sessions/ses-motion.py

This file was deleted.

12 changes: 0 additions & 12 deletions src/sessions/ses-shinobi.py

This file was deleted.

26 changes: 0 additions & 26 deletions src/sessions/ses-shinobi_3levels.py

This file was deleted.

11 changes: 0 additions & 11 deletions src/sessions/ses-test64.py

This file was deleted.

8 changes: 8 additions & 0 deletions src/sessions/ses-triplet.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,11 @@ def generate_design_file(subject, all_triplets, pilot=False):
else:
all_triplets = pandas.read_csv(os.path.join(TRIPLET_DATA_PATH, 'fMRI_triplets.csv'))
generate_design_file(parsed.subject, all_triplets, parsed.pilot)


def get_config(parsed):
return {
'eyetracking_calibration_version': 1,
'eyetracking_validation': True,
'output_dataset': 'triplets',
}
12 changes: 0 additions & 12 deletions src/sessions/ses-triplet_test.py

This file was deleted.

23 changes: 0 additions & 23 deletions src/sessions/ses-video1.py

This file was deleted.

27 changes: 0 additions & 27 deletions src/sessions/ses-video2.py

This file was deleted.

27 changes: 0 additions & 27 deletions src/sessions/ses-video3.py

This file was deleted.

27 changes: 0 additions & 27 deletions src/sessions/ses-video3b.py

This file was deleted.

25 changes: 0 additions & 25 deletions src/sessions/ses-video_images_pilot.py

This file was deleted.

9 changes: 0 additions & 9 deletions src/sessions/ses-video_pilot.py

This file was deleted.

12 changes: 0 additions & 12 deletions src/sessions/ses-videogame_test.py

This file was deleted.

Loading