diff --git a/doc/changes/dev/13775.maintenance.rst b/doc/changes/dev/13775.maintenance.rst new file mode 100644 index 00000000000..0d396ffe630 --- /dev/null +++ b/doc/changes/dev/13775.maintenance.rst @@ -0,0 +1 @@ +Modernize path handling in ``mne/misc.py`` using ``pathlib``, by :newcontrib:`Akhila Thammenenwar`. diff --git a/doc/changes/devel/13775.maintenance.rst b/doc/changes/devel/13775.maintenance.rst new file mode 100644 index 00000000000..168e520ca34 --- /dev/null +++ b/doc/changes/devel/13775.maintenance.rst @@ -0,0 +1 @@ +Modernize path handling in ``mne/misc.py`` using ``pathlib``, by `Akhila Thammenenwar`_. diff --git a/doc/changes/names.inc b/doc/changes/names.inc index 48c3b86d2be..b6796e88f2c 100644 --- a/doc/changes/names.inc +++ b/doc/changes/names.inc @@ -1,370 +1,3 @@ -.. _Aaron Earle-Richardson: https://github.com/Aaronearlerichardson -.. _Abram Hindle: https://softwareprocess.es -.. _Adam Li: https://github.com/adam2392 -.. _Adeline Fecker: https://github.com/adelinefecker -.. _Adina Wagner: https://github.com/adswa -.. _Adonay Nunes: https://github.com/AdoNunes -.. _Alan Leggitt: https://github.com/leggitta -.. _Alejandro Weinstein: http://ocam.cl -.. _Alessandro Tonin: https://www.linkedin.com/in/alessandro-tonin-7892b046 -.. _Alex Ciok: https://github.com/alexCiok -.. _Alex Gramfort: https://alexandre.gramfort.net -.. _Alex Kiefer: https://home.alexk101.dev -.. _Alex Lepauvre: https://github.com/AlexLepauvre -.. _Alex Rockhill: https://github.com/alexrockhill/ -.. _Alexander Rudiuk: https://github.com/ARudiuk -.. _Alexandre Barachant: https://alexandre.barachant.org -.. _Aman Srivastava: https://github.com/aman-coder03 -.. _Andrea Brovelli: https://brovelli.github.io/ -.. _Andreas Hojlund: https://github.com/ahoejlund -.. _Andres Rodriguez: https://github.com/infinitejest/ -.. _Andrew Dykstra: https://github.com/adykstra -.. _Andrew Gilbert: https://github.com/adgilbert -.. _Andrew Quinn: https://github.com/ajquinn -.. _Aniket Pradhan: https://github.com/Aniket-Pradhan -.. _Aniket Singh Yadav: https://github.com/Aniketsy -.. _Anna Padee: https://github.com/apadee/ -.. _Annalisa Pascarella: https://github.com/annapasca -.. _Anne-Sophie Dubarry: https://github.com/annesodub -.. _Antoine Collas: https://www.antoinecollas.fr -.. _Antoine Gauthier: https://github.com/Okamille -.. _Antti Rantala: https://github.com/Odingod -.. _Apoorva Karekal: https://github.com/apoorva6262 -.. _Archit Singhal: https://github.com/architsinghal-mriirs -.. _Arne Pelzer: https://github.com/aplzr -.. _Ashley Drew: https://github.com/ashdrew -.. _Asish Panda: https://github.com/kaichogami -.. _Austin Hurst: https://github.com/a-hurst -.. _Beige Jin: https://github.com/BeiGeJin -.. _Ben Beasley: https://github.com/musicinmybrain -.. _Benedikt Ehinger: https://www.benediktehinger.de -.. _Bradley Voytek: https://github.com/voytek -.. _Britta Westner: https://britta-wstnr.github.io -.. _Bruno Aristimunha: https://bruaristimunha.github.io -.. _Bruno Nicenboim: https://bnicenboim.github.io -.. _btkcodedev: https://github.com/btkcodedev -.. _buildqa: https://github.com/buildqa -.. _Carina Forster: https://github.com/CarinaFo -.. _Carlos de la Torre-Ortiz: https://ctorre.me -.. _Cathy Nangini: https://github.com/KatiRG -.. _Chetan Gohil: https://github.com/cgohil8 -.. _Chris Bailey: https://github.com/cjayb -.. _Chris Holdgraf: https://chrisholdgraf.com -.. _Chris Mullins: https://crmullins.com -.. _Christian Brodbeck: https://github.com/christianbrodbeck -.. _Christian O'Reilly: https://github.com/christian-oreilly -.. _Christopher Dinh: https://github.com/chdinh -.. _Chun-Hui Li: https://github.com/iamsc -.. _Clemens Brunner: https://github.com/cbrnr -.. _Cora Kim: https://github.com/kimcoco -.. _Cristóbal Moënne-Loccoz: https://github.com/cmmoenne -.. _Dan Wakeman: https://github.com/dgwakeman -.. _Daniel Carlström Schad: https://github.com/DanielCSchad -.. _Daniel Hasegan: https://daniel.hasegan.com -.. _Daniel McCloy: https://dan.mccloy.info -.. _Daniel Strohmeier: https://github.com/joewalter -.. _Daniel Tse: https://github.com/Xiezhibin -.. _Darin Erat Sleiter: https://github.com/dsleiter -.. _David Haslacher: https://github.com/davidhaslacher -.. _David Julien: https://github.com/Swy7ch -.. _David Sabbagh: https://github.com/DavidSabbagh -.. _Demetres Kostas: https://github.com/kostasde -.. _Denis Engemann: https://denis-engemann.de -.. _Dev Parikh: https://github.com/devparikh0506 -.. _Dinara Issagaliyeva: https://github.com/dissagaliyeva -.. _Diptyajit Das: https://github.com/dasdiptyajit -.. _Dirk Gütlin: https://github.com/DiGyt -.. _Dmitrii Altukhov: https://github.com/dmalt -.. _Dominik Welke: https://github.com/dominikwelke/ -.. _Dominik Wetzel: https://github.com/schmetzler -.. _Dominique Makowski: https://dominiquemakowski.github.io/ -.. _Eberhard Eich: https://github.com/ebeich -.. _Eduard Ort: https://github.com/eort -.. _Emily Stephen: https://github.com/emilyps14 -.. _Emma Bailey: https://www.cbs.mpg.de/employees/bailey -.. _Emma Zhang: https://portfolio-production-ed03.up.railway.app/ -.. _Emmanuel Ferdman: https://github.com/emmanuel-ferdman -.. _Emrecan Çelik: https://github.com/emrecncelik -.. _Enrico Varano: https://github.com/enricovara/ -.. _Enzo Altamiranda: https://www.linkedin.com/in/enzoalt -.. _Eric Larson: https://larsoner.com -.. _Erica Peterson: https://github.com/nordme -.. _Erkka Heinila: https://github.com/Teekuningas -.. _Etienne de Montalivet: https://github.com/etiennedemontalivet -.. _Evan Hathaway: https://github.com/ephathaway -.. _Evgenii Kalenkovich: https://github.com/kalenkovich -.. _Evgeny Goldstein: https://github.com/evgenygoldstein -.. _Ezequiel Mikulan: https://github.com/ezemikulan -.. _Fahimeh Mamashli: https://github.com/fmamashli -.. _Famous077: https://github.com/Famous077 -.. _Farzin Negahbani: https://github.com/Farzin-Negahbani -.. _Federico Raimondo: https://github.com/fraimondo -.. _Federico Zamberlan: https://github.com/fzamberlan -.. _Felix Klotzsche: https://github.com/eioe -.. _Felix Raimundo: https://github.com/gamazeps -.. _Florian Hofer: https://github.com/hofaflo -.. _Florin Pop: https://github.com/florin-pop -.. _Frederik Weber: https://github.com/Frederik-D-Weber -.. _Fu-Te Wong: https://github.com/zuxfoucault -.. _Gennadiy Belonosov: https://github.com/Genuster -.. _Geoff Brookshire: https://github.com/gbrookshire -.. _George O'Neill: https://georgeoneill.github.io -.. _Gnaneswar Lopinti: https://github.com/flying-spagetti -.. _Gonzalo Reina: https://orcid.org/0000-0003-4219-2306 -.. _Guillaume Dumas: https://mila.quebec/en/person/guillaume-dumas -.. _Guillaume Favelier: https://github.com/GuillaumeFavelier -.. _Hakimeh Aslsardroud: https://www.researchgate.net/profile/Hakimeh-Pourakbari -.. _Hakimeh Pourakbari: https://github.com/Hpakbari -.. _Hamid Maymandi: https://github.com/HamidMandi -.. _Hamza Abdelhedi: https://github.com/BabaSanfour -.. _Hansuja Budhiraja: https://github.com/HansujaB -.. _Hari Bharadwaj: https://github.com/haribharadwaj -.. _Harrison Ritz: https://github.com/harrisonritz -.. _Hasrat Ali Arzoo: https://github.com/hasrat17 -.. _Henrich Kolkhorst: https://github.com/hekolk -.. _Himanshu Mahor: https://github.com/1himan -.. _Hongjiang Ye: https://github.com/ye-hongjiang -.. _Hubert Banville: https://github.com/hubertjb -.. _Hyonyoung Shin: https://github.com/mcvain -.. _Hüseyin Orkun Elmas: https://github.com/HuseyinOrkun -.. _Ilian Azz: https://github.com/ilianAZZ -.. _Ilias Machairas: https://github.com/JungleHippo -.. _Ivan Skelin: https://github.com/ivan-skelin -.. _Ivan Zubarev: https://github.com/zubara -.. _Ivana Kojcic: https://github.com/ikojcic -.. _Ivo de Jong: https://github.com/ivopascal -.. _Jaakko Leppakangas: https://github.com/jaeilepp -.. _Jack Zhang: https://github.com/jackz314 -.. _Jacob Phelan: https://github.com/JacPhe -.. _Jacob Woessner: https://github.com/withmywoessner -.. _Jair Montoya Martinez: https://github.com/jmontoyam -.. _Jan Ebert: https://www.jan-ebert.com/ -.. _Jan Sedivy: https://github.com/honzaseda -.. _Jan Sosulski: https://jan-sosulski.de -.. _Jan Zerfowski: https://github.com/jzerfowski -.. _Jan-Mathijs Schoeffelen: https://github.com/schoffelen -.. _Jasper van den Bosch: https://github.com/ilogue -.. _Jean-Baptiste Schiratti: https://github.com/jbschiratti -.. _Jean-Rémi King: https://github.com/kingjr -.. _Jeff Stout: https://megcore.nih.gov/index.php/Staff -.. _Jennifer Behnke: https://github.com/JKBehnke -.. _Jeroen Van Der Donckt: https://github.com/jvdd -.. _Jesper Duemose Nielsen: https://github.com/jdue -.. _Jevri Hanna: https://github.com/jshanna100 -.. _jeythekey: https://github.com/jeythekey -.. _Joan Massich: https://github.com/massich -.. _Johann Benerradi: https://github.com/HanBnrd -.. _Johannes Herforth: https://herforth.net -.. _Johannes Niediek: https://github.com/jniediek -.. _John Samuelsson: https://github.com/johnsam7 -.. _John Veillette: https://psychology.uchicago.edu/directory/john-veillette -.. _Jon Houck: https://www.mrn.org/people/jon-m.-houck/principal-investigators -.. _Jona Sassenhagen: https://github.com/jona-sassenhagen -.. _Jonathan Kuziek: https://github.com/kuziekj -.. _Jordan Drew: https://github.com/jadrew43 -.. _Jose Alanis: https://github.com/JoseAlanis -.. _Joshua Bear: https://github.com/joshbear -.. _Joshua Calder-Travis: https://github.com/jCalderTravis -.. _Joshua Teves: https://github.com/jbteves -.. _Judy D Zhu: https://github.com/JD-Zhu -.. _Juergen Dammers: https://github.com/jdammers -.. _Jukka Nenonen: https://www.linkedin.com/pub/jukka-nenonen/28/b5a/684 -.. _Jussi Nurminen: https://github.com/jjnurminen -.. _Kaisu Lankinen: http://bishoplab.berkeley.edu/Kaisu.html -.. _Katarina Slama: https://github.com/katarinaslama -.. _Katia Al-Amir: https://github.com/katia-sentry -.. _Kay Robbins: https://github.com/VisLab -.. _Keith Doelling: https://github.com/kdoelling1919 -.. _Konstantinos Tsilimparis: https://contsili.github.io/ -.. _Kostiantyn Maksymenko: https://github.com/makkostya -.. _Kristijan Armeni: https://github.com/kristijanarmeni -.. _Kyle Mathewson: https://github.com/kylemath -.. _Larry Eisenman: https://github.com/lneisenman -.. _Lau Møller Andersen: https://github.com/ualsbombe -.. _Laura Gwilliams: https://lauragwilliams.github.io -.. _Laurent Le Mentec: https://github.com/LaurentLM -.. _Leonardo Barbosa: https://github.com/noreun -.. _Leonardo Rochael Almeida: https://github.com/leorochael -.. _Liberty Hamilton: https://github.com/libertyh -.. _Lorenzo Desantis: https://github.com/lorenzo-desantis/ -.. _Lukas Breuer: https://www.researchgate.net/profile/Lukas-Breuer-2 -.. _Lukas Gemein: https://github.com/gemeinl -.. _Luke Bloy: https://www.research.chop.edu/imaging/team -.. _Lukáš Hejtmánek: https://github.com/hejtmy -.. _Lx37: https://github.com/Lx37 -.. _Mads Jensen: https://github.com/MadsJensen -.. _Maggie Clarke: https://github.com/mdclarke -.. _Mainak Jas: https://jasmainak.github.io -.. _Maksym Balatsko: https://github.com/mbalatsko -.. _Marcin Koculak: https://github.com/mkoculak -.. _Marian Dovgialo: https://github.com/mdovgialo -.. _Marijn van Vliet: https://github.com/wmvanvliet -.. _Mark Alexander Henney: https://github.com/henneysq -.. _Mark Wronkiewicz: https://github.com/wronk -.. _Marmaduke Woodman: https://github.com/maedoc -.. _Martin Billinger: https://github.com/mbillingr -.. _Martin Luessi: https://github.com/mluessi -.. _Martin Oberg: https://github.com/obergmartin -.. _Martin Schulz: https://github.com/marsipu -.. _Mathieu Scheltienne: https://github.com/mscheltienne -.. _Mathurin Massias: https://mathurinm.github.io/ -.. _Mats van Es: https://github.com/matsvanes -.. _Matt Boggess: https://github.com/mattboggess -.. _Matt Courtemanche: https://github.com/mjcourte -.. _Matt Sanderson: https://github.com/monkeyman192 -.. _Matteo Anelli: https://github.com/matteoanelli -.. _Matthias Dold: https://matthiasdold.de -.. _Matthias Eberlein: https://github.com/MatthiasEb -.. _Matti Hämäläinen: https://research.aalto.fi/en/persons/matti-h%C3%A4m%C3%A4l%C3%A4inen/ -.. _Matti Toivonen: https://github.com/mattitoi -.. _Mauricio Cespedes Tenorio: https://github.com/mcespedes99 -.. _Melih Yayli: https://github.com/yaylim -.. _Michael Straube: https://github.com/mistraube -.. _Michal Žák: https://github.com/michalrzak -.. _Michiru Kaneda: https://github.com/rcmdnk -.. _Mikołaj Magnuski: https://github.com/mmagnuski -.. _Milan Rybář: https://milanrybar.cz -.. _Mingjian He: https://github.com/mh105 -.. _Mohammad Daneshzand: https://github.com/mdaneshzand -.. _Mojackhak: https://github.com/Mojackhak -.. _Moritz Gerster: https://github.com/moritz-gerster -.. _Motofumi Fushimi: https://github.com/motofumi-fushimi/motofumi-fushimi.github.io -.. _Nabil Alibou: https://github.com/nabilalibou -.. _Natalie Klein: https://github.com/natalieklein -.. _Nathalie Gayraud: https://github.com/ngayraud -.. _Natneal B: https://github.com/natinew77-creator -.. _Naveen Srinivasan: https://github.com/naveensrinivasan -.. _Nick Foti: https://nfoti.github.io -.. _Nick Ward: https://profiles.ucl.ac.uk/10827-nick-ward -.. _Nicolas Barascud: https://github.com/nbara -.. _Nicolas Fourcaud-Trocmé: https://www.crnl.fr/fr/user/316 -.. _Niels Focke: https://neurologie.umg.eu/forschung/arbeitsgruppen/epilepsie-und-bildgebungsforschung -.. _Niklas Wilming: https://github.com/nwilming -.. _Nikolai Chapochnikov: https://github.com/chapochn -.. _Nikolai Kapralov: https://github.com/ctrltz -.. _Nikolas Chalas: https://github.com/Nichalas -.. _Noah Markowitz: https://github.com/nmarkowitz -.. _Okba Bekhelifi: https://github.com/okbalefthanded -.. _Olaf Hauk: https://neuroscience.cam.ac.uk/member/olafhauk -.. _Ole Jensen: https://www.psy.ox.ac.uk/people/ole-jensen -.. _Oleh Kozynets: https://github.com/OlehKSS -.. _Pablo Mainar: https://github.com/pablomainar -.. _Pablo-Arias: https://github.com/Pablo-Arias -.. _Padma Sundaram: https://www.nmr.mgh.harvard.edu/user/8071 -.. _Paul Anders: https://github.com/Mettphysik -.. _Paul Pasler: https://github.com/ppasler -.. _Paul Roujansky: https://github.com/paulroujansky -.. _Pavel Navratil: https://github.com/navrpa13 -.. _Peter Molfese: https://github.com/pmolfese -.. _Phillip Alday: https://palday.bitbucket.io -.. _Pierre Ablin: https://pierreablin.com -.. _Pierre Guetschel: https://github.com/PierreGtch -.. _Pierre-Antoine Bannier: https://github.com/PABannier -.. _Ping-Keng Jao: https://github.com/nafraw -.. _Pragnya Khandelwal: https://github.com/PragnyaKhandelwal -.. _Proloy Das: https://github.com/proloyd -.. _Qian Chu: https://github.com/qian-chu -.. _Qianliang Li: https://www.dtu.dk/english/service/phonebook/person?id=126774 -.. _Quentin Barthélemy: https://github.com/qbarthelemy -.. _Quentin Bertrand: https://github.com/QB3 -.. _Qunxi Dong: https://github.com/dongqunxi -.. _Rahul Nadkarni: https://github.com/rahuln -.. _Ram Pari: https://github.com/ramkpari -.. _Ramiro Gatti: https://github.com/ragatti -.. _ramonapariciog: https://github.com/ramonapariciog -.. _Rasmus Aagaard: https://github.com/rasgaard -.. _Rasmus Zetter: https://github.com/rzetter -.. _Reza Nasri: https://github.com/rznas -.. _Reza Shoorangiz: https://github.com/rezashr -.. _Richard Höchenberger: https://github.com/hoechenberger -.. _Richard Koehler: https://github.com/richardkoehler -.. _Richard Scholz: https://github.com/scholzri -.. _Riessarius Stargardsky: https://github.com/Riessarius -.. _Roan LaPlante: https://github.com/aestrivex -.. _Robert Luke: https://github.com/rob-luke -.. _Robert Seymour: https://neurofractal.github.io -.. _Romain Derollepot: https://github.com/rderollepot -.. _Romain Trachel: https://fr.linkedin.com/in/trachelr -.. _Roman Goj: https://romanmne.blogspot.co.uk -.. _Rongfei Jin: https://github.com/greasycat -.. _Ross Maddox: https://medicine.umich.edu/dept/khri/ross-maddox-phd -.. _Rotem Falach: https://github.com/Falach -.. _Roy Eric Wieske: https://github.com/Randomidous -.. _Sammi Chekroud: https://github.com/schekroud -.. _Samu Taulu: https://phys.washington.edu/people/samu-taulu -.. _Samuel Deslauriers-Gauthier: https://github.com/sdeslauriers -.. _Samuel Louviot: https://github.com/Sam54000 -.. _Samuel Powell: https://github.com/samuelpowell -.. _Santeri Ruuskanen: https://github.com/ruuskas -.. _Santi Martínez: https://github.com/szz-dvl -.. _Sara Sommariva: https://github.com/sarasommariva -.. _Sawradip Saha: https://sawradip.github.io/ -.. _Scott Huberty: https://orcid.org/0000-0003-2637-031X -.. _Sebastiaan Mathot: https://www.cogsci.nl/smathot -.. _Sebastian Castano: https://github.com/jscastanoc -.. _Sebastian Jentschke: https://github.com/sjentsch -.. _Sebastian Major: https://github.com/major-s -.. _Sena Er: https://github.com/sena-neuro -.. _Senwen Deng: https://snwn.de -.. _Seyed Yahya Shirazi: https://neuromechanist.github.io -.. _Sheraz Khan: https://github.com/SherazKhan -.. _Shresth Keshari: https://github.com/shresth-keshari -.. _Shristi Baral: https://github.com/shristibaral -.. _Shruti Bhale: https://github.com/shruti423 -.. _Silvia Cotroneo: https://github.com/sfc-neuro -.. _Simeon Wong: https://github.com/dtxe -.. _Simon Kern: https://skjerns.de -.. _Simon Kornblith: https://simonster.com -.. _Simon M. Hofmann: https://github.com/SHEscher -.. _Sondre Foslien: https://github.com/sondrfos -.. _Sophie Herbst: https://github.com/SophieHerbst -.. _Stanislas Chambon: https://github.com/Slasnista -.. _Stefan Appelhoff: https://stefanappelhoff.com -.. _Stefan Repplinger: https://github.com/stfnrpplngr -.. _Steinn Hauser Magnusson: https://github.com/steinnhauser -.. _Steven Bethard: https://github.com/bethard -.. _Steven Bierer: https://github.com/neurolaunch -.. _Steven Gutstein: https://github.com/smgutstein -.. _Sumalyo Datta: https://github.com/Sumalyo -.. _Susanna Aro: https://www.linkedin.com/in/susanna-aro -.. _Svea Marie Meyer: https://github.com/SveaMeyer13 -.. _Sébastien Marti: https://www.researchgate.net/profile/Sebastien-Marti -.. _T. Wang: https://github.com/twang5 -.. _Tal Linzen: https://tallinzen.net/ -.. _Tamas Fehervari: https://github.com/zEdS15B3GCwq -.. _Teon Brooks: https://github.com/teonbrooks -.. _Tharupahan Jayawardana: https://github.com/tharu-jwd -.. _Thomas Binns: https://github.com/tsbinns -.. _Thomas Caswell: https://tacaswell.github.io -.. _Thomas Hartmann: https://github.com/thht -.. _Thomas Radman: https://github.com/tradman -.. _Théodore Papadopoulo: https://github.com/papadop -.. _Timothy Gates: https://au.linkedin.com/in/tim-gates-0528a4199 -.. _Timur Sokhin: https://github.com/Qwinpin -.. _Tod Flak: https://github.com/todflak -.. _Tom Ma: https://github.com/myd7349 -.. _Tom Stone: https://github.com/tomdstone -.. _Tommy Clausner: https://github.com/TommyClausner -.. _Toomas Erik Anijärv: https://github.com/teanijarv -.. _Tristan Stenner: https://github.com/tstenner/ -.. _Tziona NessAiver: https://github.com/TzionaN -.. _user27182: https://github.com/user27182 -.. _Valerii Chirkov: https://github.com/vagechirkov -.. _varshaa-1616: https://github.com/varshaa-1616 -.. _Varun Kasyap Pentamaraju: https://github.com/varunkasyap -.. _Velu Prabhakar Kumaravel: https://github.com/vpKumaravel -.. _Victor Ferat: https://github.com/vferat -.. _Victoria Peterson: https://github.com/vpeterson -.. _Wei Xu: https://github.com/psyxw -.. _Will Turner: https://bootstrapbill.github.io -.. _Wouter Kroot: https://github.com/WouterKroot -.. _Xabier de Zuazo: https://github.com/zuazo -.. _Xiaokai Xia: https://github.com/dddd1007 -.. _Yaroslav Halchenko: http://haxbylab.dartmouth.edu/ppl/yarik.html -.. _Yiping Zuo: https://github.com/frostime -.. _Yixiao Shen: https://github.com/SYXiao2002 -.. _Yousra Bekhti: https://www.linkedin.com/pub/yousra-bekhti/56/886/421 -.. _Yu-Han Luo: https://github.com/yh-luo -.. _Zhi Zhang: https://github.com/tczhangzhi/ -.. _Ziyi ZENG: https://github.com/ZiyiTsang -.. _Zvi Baratz: https://github.com/ZviBaratz +.. _Akhila Thammenenwar: https://github.com/Akhila21-6 +.. _Akhila Thammenenwar: https://github.com/Akhila21-6 +.. _Akhila Thammenenwar: https://github.com/Akhila21-6 diff --git a/mne/misc.py b/mne/misc.py index bea711f927d..7b373e1dc92 100644 --- a/mne/misc.py +++ b/mne/misc.py @@ -2,6 +2,8 @@ # License: BSD-3-Clause # Copyright the MNE-Python contributors. +from pathlib import Path + def parse_config(fname): """Parse a config file (like .ave and .cov files). @@ -20,10 +22,11 @@ def parse_config(fname): tmin, tmax, name, grad_reject, mag_reject, eeg_reject, eog_reject """ + fname = Path(fname) + reject_params = read_reject_parameters(fname) - with open(fname) as f: - lines = f.readlines() + lines = fname.read_text().splitlines() cat_ind = [i for i, x in enumerate(lines) if "category {" in x] event_dict = dict() @@ -67,14 +70,17 @@ def read_reject_parameters(fname): params : dict The rejection parameters. """ - with open(fname) as f: - lines = f.readlines() + fname = Path(fname) + lines = fname.read_text().splitlines() reject_names = ["gradReject", "magReject", "eegReject", "eogReject", "ecgReject"] reject_pynames = ["grad", "mag", "eeg", "eog", "ecg"] reject = dict() for line in lines: words = line.split() + # Defensive check for empty lines + if not words: + continue if words[0] in reject_names: reject[reject_pynames[reject_names.index(words[0])]] = float(words[1])