ENH: Trial identification scheme

@drammock this should be ready for review. I'll have to test it extensively with the TDT+Eyelink in the lab, but I'd prefer to do those fixes in a separate PR since it will be much more readable that way.