{"action":"created","issue":{"url":"https://api.github.com/repos/beOn/cili/issues/1","labels_url":"https://api.github.com/repos/beOn/cili/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/beOn/cili/issues/1/comments","events_url":"https://api.github.com/repos/beOn/cili/issues/1/events","html_url":"https://github.com/beOn/cili/issues/1","id":47702207,"number":1,"title":"KeyError: 'onset'","user":{"login":"dschreij","id":689044,"avatar_url":"https://avatars.githubusercontent.com/u/689044?v=3","gravatar_id":"","url":"https://api.github.com/users/dschreij","html_url":"https://github.com/dschreij","followers_url":"https://api.github.com/users/dschreij/followers","following_url":"https://api.github.com/users/dschreij/following{/other_user}","gists_url":"https://api.github.com/users/dschreij/gists{/gist_id}","starred_url":"https://api.github.com/users/dschreij/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dschreij/subscriptions","organizations_url":"https://api.github.com/users/dschreij/orgs","repos_url":"https://api.github.com/users/dschreij/repos","events_url":"https://api.github.com/users/dschreij/events{/privacy}","received_events_url":"https://api.github.com/users/dschreij/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2014-11-04T11:16:54Z","updated_at":"2015-07-01T13:23:19Z","closed_at":"2015-03-04T22:08:31Z","body":"Hi! To begin with: great project!\r\nI only have trouble reading in in ascii files because it crashes with KeyError: \"onset\" in the process.\r\nHere's a traceback\r\n\r\n```\r\nTraceback (most recent call last):\r\n\r\n  File \"C:/Users/Daniel/Dropbox/VU/EPOS/EyeTrackerCourse/eposetcourse.py\", line 8, in <module>\r\n    samples, events = cili.load_eyelink_dataset(\"01RB.asc\")\r\n\r\n  File \"build\\bdist.win32\\egg\\cili\\util.py\", line 156, in load_eyelink_dataset\r\n    s, e = pandas_dfs_from_asc(file_name)\r\n\r\n  File \"build\\bdist.win32\\egg\\cili\\util.py\", line 210, in pandas_dfs_from_asc\r\n    samp_df = pandas_df_from_lines(s_lines, samp_dtypes, ASC_SFIELDS_IGNORE)\r\n\r\n  File \"build\\bdist.win32\\egg\\cili\\util.py\", line 241, in pandas_df_from_lines\r\n    warn_bad_lines=False,)\r\n\r\n  File \"C:\\Python27\\lib\\site-packages\\pandas\\io\\parsers.py\", line 463, in parser_f\r\n    return _read(filepath_or_buffer, kwds)\r\n\r\n  File \"C:\\Python27\\lib\\site-packages\\pandas\\io\\parsers.py\", line 249, in _read\r\n    return parser.read()\r\n\r\n  File \"C:\\Python27\\lib\\site-packages\\pandas\\io\\parsers.py\", line 706, in read\r\n    ret = self._engine.read(nrows)\r\n\r\n  File \"C:\\Python27\\lib\\site-packages\\pandas\\io\\parsers.py\", line 1170, in read\r\n    values = data.pop(self.index_col[i])\r\n\r\nKeyError: 'onset'\r\n```\r\nIf you want, I can send you one of the .asc files to reproduce the error. There are no variables in my ascii files named \"onset\" (nor does it occur in any other form in there). I dove into the util.py folder and saw that you pass \"onset\" as the argument of index_col for pandas' read_csv function, but is this variable also created in the pandas_dfs_from_asc() function? I see you explicitly assigning \"onset\" as the index name in pandas_df_from_txt() (line 183), but not in the former function."},"comment":{"url":"https://api.github.com/repos/beOn/cili/issues/comments/117672416","html_url":"https://github.com/beOn/cili/issues/1#issuecomment-117672416","issue_url":"https://api.github.com/repos/beOn/cili/issues/1","id":117672416,"user":{"login":"fusaroli","id":6108197,"avatar_url":"https://avatars.githubusercontent.com/u/6108197?v=3","gravatar_id":"","url":"https://api.github.com/users/fusaroli","html_url":"https://github.com/fusaroli","followers_url":"https://api.github.com/users/fusaroli/followers","following_url":"https://api.github.com/users/fusaroli/following{/other_user}","gists_url":"https://api.github.com/users/fusaroli/gists{/gist_id}","starred_url":"https://api.github.com/users/fusaroli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fusaroli/subscriptions","organizations_url":"https://api.github.com/users/fusaroli/orgs","repos_url":"https://api.github.com/users/fusaroli/repos","events_url":"https://api.github.com/users/fusaroli/events{/privacy}","received_events_url":"https://api.github.com/users/fusaroli/received_events","type":"User","site_admin":false},"created_at":"2015-07-01T13:23:19Z","updated_at":"2015-07-01T13:23:19Z","body":"Opening this up again. I have been playing with this great project and I am having the same problem as dschreij and my file never had output input values checked. I also tried checking it but no luck.\r\nThe files are here: \r\n- OIV unchecked: https://www.dropbox.com/s/yjfte9i8399ta6c/101.asc?dl=0\r\n- OIV checked: https://www.dropbox.com/s/076tze5gyvcodqt/101.asc?dl=0\r\n\r\nAnd here the error messages:\r\n\r\n---------------------------------------------------------------------------\r\nKeyError                                  Traceback (most recent call last)\r\n<ipython-input-4-7b0393d4db11> in <module>()\r\n      8 # Load the files and clean up the clutter\r\n      9 \r\n---> 10 samps, events = load_eyelink_dataset(\"/Users/semrf/Dropbox/Stuff we share/101.asc\")\r\n\r\n/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cili/util.pyc in load_eyelink_dataset(file_name)\r\n    154     root, ext = os.path.splitext(file_name)\r\n    155     if ext == '.asc':\r\n--> 156         s, e = pandas_dfs_from_asc(file_name)\r\n    157     elif ext in ['.txt']:\r\n    158         s = load_tdf(file_name)\r\n\r\n/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cili/util.pyc in pandas_dfs_from_asc(file_path)\r\n    208     ev_dtypes = dict([(ev_name, build_asc_ev_dtypes(ev_name, side, has_vel, has_res)) for ev_name in ev_names])\r\n    209     # get a df for the samples\r\n--> 210     samp_df = pandas_df_from_lines(s_lines, samp_dtypes, ASC_SFIELDS_IGNORE)\r\n    211     # handle event types that need to have their lines preprocessed...\r\n    212     for ev_name in ASC_IRREG_EVENTS:\r\n\r\n/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cili/util.pyc in pandas_df_from_lines(csv_lines, dtypes, ignore)\r\n    239                      error_bad_lines=False,\r\n    240                      # usecols=use_names,\r\n--> 241                      warn_bad_lines=False,)\r\n    242     nums = [d[0] for d in dtypes if d[1] not in [object] and d[0] not in ['onset']]\r\n    243     ints = [d[0] for d in dtypes if d[1] in ASC_INT_TYPES and d[0] not in ['onset']]\r\n\r\n/Users/semrf/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pandas/io/parsers.py in parser_f(filepath_or_buffer, sep, dialect, compression, doublequote, escapechar, quotechar, quoting, skipinitialspace, lineterminator, header, index_col, names, prefix, skiprows, skipfooter, skip_footer, na_values, na_fvalues, true_values, false_values, delimiter, converters, dtype, usecols, engine, delim_whitespace, as_recarray, na_filter, compact_ints, use_unsigned, low_memory, buffer_lines, warn_bad_lines, error_bad_lines, keep_default_na, thousands, comment, decimal, parse_dates, keep_date_col, dayfirst, date_parser, memory_map, float_precision, nrows, iterator, chunksize, verbose, encoding, squeeze, mangle_dupe_cols, tupleize_cols, infer_datetime_format, skip_blank_lines)\r\n    468                     skip_blank_lines=skip_blank_lines)\r\n    469 \r\n--> 470         return _read(filepath_or_buffer, kwds)\r\n    471 \r\n    472     parser_f.__name__ = name\r\n\r\n/Users/semrf/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pandas/io/parsers.py in _read(filepath_or_buffer, kwds)\r\n    254         return parser\r\n    255 \r\n--> 256     return parser.read()\r\n    257 \r\n    258 _parser_defaults = {\r\n\r\n/Users/semrf/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pandas/io/parsers.py in read(self, nrows)\r\n    713                 raise ValueError('skip_footer not supported for iteration')\r\n    714 \r\n--> 715         ret = self._engine.read(nrows)\r\n    716 \r\n    717         if self.options.get('as_recarray'):\r\n\r\n/Users/semrf/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pandas/io/parsers.py in read(self, nrows)\r\n   1182                     values = data.pop(i)\r\n   1183                 else:\r\n-> 1184                     values = data.pop(self.index_col[i])\r\n   1185 \r\n   1186                 values = self._maybe_parse_dates(values, i,\r\n\r\nKeyError: 'onset'\r\n"}}