Skip to content

Conversation

@smerdis
Copy link

@smerdis smerdis commented Feb 13, 2016

…n unit_old was not a key in the _unit2human dict.

…n unit_old was not a key in the _unit2human dict
@smerdis
Copy link
Author

smerdis commented Feb 13, 2016

this is a fix for #2878

unit_new = _human2unit[ch_type]
if unit_old != _human2unit[ch_type]:
if unit_old in _human2unit.keys(): uo_str = _unit2human[unit_old]
else: uo_str = unit_old
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please follow pep8 conventions. If the key is missing, please add it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smerdis
Copy link
Author

smerdis commented Feb 13, 2016

Style should be fixed, and I added the unknown unit to the dict as you suggested. However I'm not sure about this behavior: in the example I presented in #2878, the unit type is 0, and this code would result in a unit type of '0' (with value '0') being added to the dictionary. As another commenter on the issue mentioned, the underlying file reader might be the cause of the weird unit. I had simply intended to make the warning message not cause an error...

@jasmainak
Copy link
Member

what file reader did you use?

@jasmainak
Copy link
Member

look up FIFF constants

@larsoner
Copy link
Member

We actually don't have a _UNIT_ with value 0, so whatever converter wrote the FIF file wrote some unit type we don't understand. You should be able to add 0: 'unknown' to the dict around line 182 to fix the problem. Can you try it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants