diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 9e9249c..af9a4df 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,17 @@ Changes ======= +Version 0.9.1 +------------- + +**2018-08-07** + +* Fixed issues loading pyFR data (#180) +* Fixed loading of YC events (#182) +* Fixed loading of jacksheets with tabs instead of spaces (#185) +* Breaking change: removed ``to_xyz`` methods (#187) + + Version 0.9.0 ------------- diff --git a/cmlreaders/__init__.py b/cmlreaders/__init__.py index dc40234..c8d492e 100644 --- a/cmlreaders/__init__.py +++ b/cmlreaders/__init__.py @@ -8,5 +8,5 @@ from .readers import * # noqa from .cmlreader import CMLReader # noqa -__version__ = "0.9.0" +__version__ = "0.9.1" version_info = namedtuple("VersionInfo", "major,minor,patch")(*__version__.split('.')) diff --git a/docs/getting_started.ipynb b/docs/getting_started.ipynb index 96a005b..ed66d47 100644 --- a/docs/getting_started.ipynb +++ b/docs/getting_started.ipynb @@ -125,7 +125,7 @@ { "data": { "text/plain": [ - "['localization']" + "('localization',)" ] }, "execution_count": 4, @@ -145,7 +145,7 @@ { "data": { "text/plain": [ - "['pairs',\n", + "('pairs',\n", " 'contacts',\n", " 'voxel_coordinates',\n", " 'prior_stim_results',\n", @@ -157,7 +157,7 @@ " 'classifier_excluded_leads',\n", " 'electrode_categories',\n", " 'target_selection_file',\n", - " 'baseline_classifier']" + " 'baseline_classifier')" ] }, "execution_count": 5, @@ -177,7 +177,7 @@ { "data": { "text/plain": [ - "['session_summary',\n", + "('session_summary',\n", " 'classifier_summary',\n", " 'math_summary',\n", " 'used_classifier',\n", @@ -192,7 +192,7 @@ " 'all_events',\n", " 'task_events',\n", " 'math_events',\n", - " 'ps4_events']" + " 'ps4_events')" ] }, "execution_count": 6, @@ -518,7 +518,7 @@ " 'R1394E', 'R1395M', 'R1396T', 'R1397D', 'R1398J', 'R1401J',\n", " 'R1402E', 'R1404E', 'R1405E', 'R1406M', 'R1409D', 'R1412M',\n", " 'R1414E', 'R1415T', 'R1416T', 'R1420T', 'R1421M', 'R1422T',\n", - " 'R1423E', 'R1425D', 'R1427T', 'R1431J'], dtype=object)" + " 'R1423E', 'R1425D', 'R1427T', 'R1431J', 'R1438M'], dtype=object)" ] }, "execution_count": 10, @@ -971,517 +971,6 @@ "event_recarray[0]" ] }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Loading from a Custom Location\n", - "\n", - "Since locations are automatically determined based on the data type, if loading from a custom location, be sure to specify the file_type parameter when loading the data. One common use case for this functionality is that you need to load some data from your scratch or home directory that is in a format supported by CMLReaders. Another use case is that you may discover that data is residing in a location that is not known by CMLReaders. Instead of waiting until the next release of the package, you can use a custom file path to load the data, submit an issue on Github, and continue with you analysis. \n" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
eegoffsetcategorycategory_numeegfileexp_versionexperimentintrusionis_stimitem_nameitem_num...recog_rtrecognizedrectimerejectedserialpossessionstim_liststim_paramssubjecttype
0-1X-999catFR5-999FalseX-999...-999-999-999-999-9991False[]R1389JSTIM_ARTIFACT_DETECTION_START
15831X-999R1389J_catFR5_1_28Feb18_1552.h5catFR5-999False-1...-999-999-999-999-9991False[{'amplitude': 500.0, 'anode_label': 'STG6', '...R1389JSTIM_ON
1023781X-999R1389J_catFR5_1_28Feb18_1552.h5catFR5-999False-1...-999-999-999-999-9991False[{'amplitude': 500.0, 'anode_label': 'STG6', '...R1389JSTIM_ON
100315125X-999R1389J_catFR5_1_28Feb18_1552.h5catFR5-999FalseX-999...-999-999-999-999-9991False[]R1389JREC_END
10002515863Flowers9R1389J_catFR5_1_28Feb18_1552.h5catFR5-999FalseLILY112...-999-999-999-99941True[]R1389JWORD
\n", - "

5 rows × 28 columns

\n", - "
" - ], - "text/plain": [ - " eegoffset category category_num eegfile \\\n", - "0 -1 X -999 \n", - "1 5831 X -999 R1389J_catFR5_1_28Feb18_1552.h5 \n", - "10 23781 X -999 R1389J_catFR5_1_28Feb18_1552.h5 \n", - "100 315125 X -999 R1389J_catFR5_1_28Feb18_1552.h5 \n", - "1000 2515863 Flowers 9 R1389J_catFR5_1_28Feb18_1552.h5 \n", - "\n", - " exp_version experiment intrusion is_stim item_name item_num \\\n", - "0 catFR5 -999 False X -999 \n", - "1 catFR5 -999 False -1 \n", - "10 catFR5 -999 False -1 \n", - "100 catFR5 -999 False X -999 \n", - "1000 catFR5 -999 False LILY 112 \n", - "\n", - " ... recog_rt recognized rectime rejected \\\n", - "0 ... -999 -999 -999 -999 \n", - "1 ... -999 -999 -999 -999 \n", - "10 ... -999 -999 -999 -999 \n", - "100 ... -999 -999 -999 -999 \n", - "1000 ... -999 -999 -999 -999 \n", - "\n", - " serialpos session stim_list \\\n", - "0 -999 1 False \n", - "1 -999 1 False \n", - "10 -999 1 False \n", - "100 -999 1 False \n", - "1000 4 1 True \n", - "\n", - " stim_params subject \\\n", - "0 [] R1389J \n", - "1 [{'amplitude': 500.0, 'anode_label': 'STG6', '... R1389J \n", - "10 [{'amplitude': 500.0, 'anode_label': 'STG6', '... R1389J \n", - "100 [] R1389J \n", - "1000 [] R1389J \n", - "\n", - " type \n", - "0 STIM_ARTIFACT_DETECTION_START \n", - "1 STIM_ON \n", - "10 STIM_ON \n", - "100 REC_END \n", - "1000 WORD \n", - "\n", - "[5 rows x 28 columns]" - ] - }, - "execution_count": 19, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "# Loading from a custom location\n", - "event_reader.to_json(\"task_events.json\")\n", - "event_df = reader.load('task_events', file_path='task_events.json')\n", - "event_df.head()" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Saving Data\n", - "\n", - "CMLReaders can also be used to save data in a different format from the original files. The three supported output formats are: CSV, JSON, and HDF5. However, not all file formats are supported by all of the readers. In particular, HDF5 output is only supported for a minimal number of data types." - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
eegoffsetcategorycategory_numeegfileexp_versionexperimentintrusionis_stimitem_nameitem_num...recog_rtrecognizedrectimerejectedserialpossessionstim_liststim_paramssubjecttype
0-1X-999NaNNaNcatFR5-999FalseX-999...-999-999-999-999-9991False[]R1389JSTIM_ARTIFACT_DETECTION_START
15831X-999R1389J_catFR5_1_28Feb18_1552.h5NaNcatFR5-999FalseNaN-1...-999-999-999-999-9991False[{'amplitude': 500.0, 'anode_label': 'STG6', '...R1389JSTIM_ON
27790X-999R1389J_catFR5_1_28Feb18_1552.h5NaNcatFR5-999FalseNaN-1...-999-999-999-999-9991False[{'amplitude': 500.0, 'anode_label': 'STG6', '...R1389JSTIM_ON
39786X-999R1389J_catFR5_1_28Feb18_1552.h5NaNcatFR5-999FalseNaN-1...-999-999-999-999-9991False[{'amplitude': 500.0, 'anode_label': 'STG6', '...R1389JSTIM_ON
411782X-999R1389J_catFR5_1_28Feb18_1552.h5NaNcatFR5-999FalseNaN-1...-999-999-999-999-9991False[{'amplitude': 500.0, 'anode_label': 'STG6', '...R1389JSTIM_ON
\n", - "

5 rows × 28 columns

\n", - "
" - ], - "text/plain": [ - " eegoffset category category_num eegfile \\\n", - "0 -1 X -999 NaN \n", - "1 5831 X -999 R1389J_catFR5_1_28Feb18_1552.h5 \n", - "2 7790 X -999 R1389J_catFR5_1_28Feb18_1552.h5 \n", - "3 9786 X -999 R1389J_catFR5_1_28Feb18_1552.h5 \n", - "4 11782 X -999 R1389J_catFR5_1_28Feb18_1552.h5 \n", - "\n", - " exp_version experiment intrusion is_stim item_name item_num \\\n", - "0 NaN catFR5 -999 False X -999 \n", - "1 NaN catFR5 -999 False NaN -1 \n", - "2 NaN catFR5 -999 False NaN -1 \n", - "3 NaN catFR5 -999 False NaN -1 \n", - "4 NaN catFR5 -999 False NaN -1 \n", - "\n", - " ... recog_rt recognized rectime rejected \\\n", - "0 ... -999 -999 -999 -999 \n", - "1 ... -999 -999 -999 -999 \n", - "2 ... -999 -999 -999 -999 \n", - "3 ... -999 -999 -999 -999 \n", - "4 ... -999 -999 -999 -999 \n", - "\n", - " serialpos session stim_list \\\n", - "0 -999 1 False \n", - "1 -999 1 False \n", - "2 -999 1 False \n", - "3 -999 1 False \n", - "4 -999 1 False \n", - "\n", - " stim_params subject \\\n", - "0 [] R1389J \n", - "1 [{'amplitude': 500.0, 'anode_label': 'STG6', '... R1389J \n", - "2 [{'amplitude': 500.0, 'anode_label': 'STG6', '... R1389J \n", - "3 [{'amplitude': 500.0, 'anode_label': 'STG6', '... R1389J \n", - "4 [{'amplitude': 500.0, 'anode_label': 'STG6', '... R1389J \n", - "\n", - " type \n", - "0 STIM_ARTIFACT_DETECTION_START \n", - "1 STIM_ON \n", - "2 STIM_ON \n", - "3 STIM_ON \n", - "4 STIM_ON \n", - "\n", - "[5 rows x 28 columns]" - ] - }, - "execution_count": 20, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "# JSON to CSV\n", - "event_reader.to_csv(\"task_events.csv\")\n", - "event_df = pd.read_csv(\"task_events.csv\")\n", - "event_df.head()" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "dict_keys(['contact_name', 'contact_type', 'x', 'y', 'z', 'atlas', 'orient_to'])" - ] - }, - "execution_count": 21, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "# CSV to JSON\n", - "electrode_coord_reader = reader.get_reader('electrode_coordinates')\n", - "electrode_coord_reader.to_json('electrode_coordinates.json')\n", - "\n", - "with open(\"electrode_coordinates.json\") as f:\n", - " electrode_coord_dict = json.load(f)\n", - "\n", - "electrode_coord_dict.keys()" - ] - }, { "cell_type": "markdown", "metadata": {}, @@ -1500,7 +989,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 19, "metadata": {}, "outputs": [ { @@ -1509,7 +998,7 @@ "array([0, 2, 3, 9])" ] }, - "execution_count": 22, + "execution_count": 19, "metadata": {}, "output_type": "execute_result" } @@ -1523,7 +1012,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 20, "metadata": {}, "outputs": [ { @@ -1532,7 +1021,7 @@ "4527" ] }, - "execution_count": 23, + "execution_count": 20, "metadata": {}, "output_type": "execute_result" } @@ -1552,7 +1041,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 21, "metadata": {}, "outputs": [ { @@ -1561,7 +1050,7 @@ "4527" ] }, - "execution_count": 24, + "execution_count": 21, "metadata": {}, "output_type": "execute_result" } @@ -1582,7 +1071,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 22, "metadata": {}, "outputs": [ { @@ -1591,7 +1080,7 @@ "array(['R1111M', 'R1409D'], dtype=object)" ] }, - "execution_count": 25, + "execution_count": 22, "metadata": {}, "output_type": "execute_result" } @@ -1619,7 +1108,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 23, "metadata": {}, "outputs": [], "source": [ @@ -1642,16 +1131,24 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 24, "metadata": {}, "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/Users/depalati/src/cmlreaders/cmlreaders/path_finder.py:225: MultiplePathsFoundWarning: Multiple files found. Returning the first file found\n", + " 'file found', MultiplePathsFoundWarning)\n" + ] + }, { "data": { "text/plain": [ "(1, 100, 1623160)" ] }, - "execution_count": 27, + "execution_count": 24, "metadata": {}, "output_type": "execute_result" } @@ -1677,7 +1174,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 25, "metadata": {}, "outputs": [], "source": [ @@ -1694,16 +1191,24 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 26, "metadata": {}, "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/Users/depalati/src/cmlreaders/cmlreaders/path_finder.py:225: MultiplePathsFoundWarning: Multiple files found. Returning the first file found\n", + " 'file found', MultiplePathsFoundWarning)\n" + ] + }, { "data": { "text/plain": [ "(288, 100, 50)" ] }, - "execution_count": 29, + "execution_count": 26, "metadata": {}, "output_type": "execute_result" } @@ -1729,16 +1234,24 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 27, "metadata": {}, "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/Users/depalati/src/cmlreaders/cmlreaders/path_finder.py:225: MultiplePathsFoundWarning: Multiple files found. Returning the first file found\n", + " 'file found', MultiplePathsFoundWarning)\n" + ] + }, { "data": { "text/plain": [ "(1020, 100, 100)" ] }, - "execution_count": 30, + "execution_count": 27, "metadata": {}, "output_type": "execute_result" } @@ -1761,7 +1274,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 28, "metadata": {}, "outputs": [ { @@ -1770,7 +1283,7 @@ "ptsa.data.timeseries.TimeSeries" ] }, - "execution_count": 31, + "execution_count": 28, "metadata": {}, "output_type": "execute_result" } @@ -1782,7 +1295,7 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 29, "metadata": {}, "outputs": [ { @@ -1791,7 +1304,7 @@ "mne.epochs.EpochsArray" ] }, - "execution_count": 32, + "execution_count": 29, "metadata": {}, "output_type": "execute_result" } diff --git a/docs/html/_modules/cmlreaders/_accessors/events.html b/docs/html/_modules/cmlreaders/_accessors/events.html index 8c69b2b..8490a0c 100644 --- a/docs/html/_modules/cmlreaders/_accessors/events.html +++ b/docs/html/_modules/cmlreaders/_accessors/events.html @@ -8,7 +8,7 @@ - cmlreaders._accessors.events — CML Data Readers 0.9.0 documentation + cmlreaders._accessors.events — CML Data Readers 0.9.1 documentation @@ -237,7 +237,7 @@

Source code for cmlreaders._accessors.events

         var DOCUMENTATION_OPTIONS = {
             URL_ROOT:'../../../',
-            VERSION:'0.9.0',
+            VERSION:'0.9.1',
             LANGUAGE:'None',
             COLLAPSE_INDEX:false,
             FILE_SUFFIX:'.html',
diff --git a/docs/html/_modules/cmlreaders/cmlreader.html b/docs/html/_modules/cmlreaders/cmlreader.html
index fe982c4..bc1d89c 100644
--- a/docs/html/_modules/cmlreaders/cmlreader.html
+++ b/docs/html/_modules/cmlreaders/cmlreader.html
@@ -8,7 +8,7 @@
   
   
   
-  cmlreaders.cmlreader — CML Data Readers 0.9.0 documentation
+  cmlreaders.cmlreader — CML Data Readers 0.9.1 documentation
   
 
   
@@ -347,7 +347,11 @@ 

Source code for cmlreaders.cmlreader

         # coerce to "all_events" unless we're looking at experiments that don't
         # include these.
         if data_type == "events":
-            if self.experiment.startswith("PS") or self.experiment.startswith("TH"):
+            if (
+                self.experiment.startswith("PS") or
+                self.experiment.startswith("TH") or
+                self.experiment.startswith("YC")
+            ):
                 data_type = "task_events"
             else:
                 data_type = "all_events"
@@ -503,7 +507,7 @@ 

Source code for cmlreaders.cmlreader