mne-tools/mne-python — pull request #303 by mluessi (2012-12-20 21:54:10+00:00)
Title: FIX: PySurfer SUBJECTS_DIR

Currently PySurfer needs the SUBJECTS_DIR environment variable. I will submit a PR to PySurfer such that subjects_dir can be set using a keyword argument to Brain, like we do in mne-python. This is designed to work with future versions of PySurfer where the subjects_dir argument can be used.

For old (=current) versions. I currently set `os.environ['SUBJECTS_DIR']` in `plot_source_estimates`. This is not ideal as it can break things, e.g., a user can plot one stc with a value for subjects_dir and then plot another stc with a different value for subjects_dir. After this, the Brain from the first plot will no longer work correctly (as some Brain methods query `os.environ['SUBJECTS_DIR']`). An alternative solution for old (current) PySurfer would be:

if 'SUBJECTS_DIR' in os.environ:
if os.environ['SUBJECTS_DIR'] != subjects_dir:
raise ValueError('for old PySurfer versions, the subjects directory has to be set using the
'SUBJECTS_DIR environment variable')
else:
raise ValueError('for old PySurfer versions, the subjects directory has to be set using the
'SUBJECTS_DIR environment variable')