Beispiel #1
0
 def __init__(self, datapdf):
     fid=open(datapdf, "r")
     fid.seek(0, os.SEEK_END); ep = fid.tell()
     fid.seek(-8, os.SEEK_END);
     header_offset=fread(fid, 1, 'q', 'q', 1); #first byte of the header
     try:
         fid.seek(header_offset, os.SEEK_SET);
     except IOError:
         print 'I dont think you selected a pdf file'
         return
     try:
         self.header_data = header_data.read(fid); #read first section of header
         self.epoch_data = [epoch_data.read(fid) for i in range(0, self.header_data.total_epochs[0])] #read epoch header info
         self.channel_ref_data = [channel_ref_data.read(fid) for j in range(0, self.header_data.total_chans[0])]
         self.event_data = [event_data.read(fid) for j in range(0, self.header_data.total_fixed_events[0])]
         self.proc_data = [proc_data.read(fid) for j in range(0, self.header_data.total_processes[0])]
         self.header_offset=header_offset
         fid.seek(0, os.SEEK_END)
         fid.close
     except IndexError:
         print 'probably not a 4D MEG file'
         pass
Beispiel #2
0
    def __init__(self, Exp):
        fid = open(datapdf, "r")
        id = fread(fid, 10, "c", "c", 1)
        fid.seek(1, os.SEEK_CUR)
        lname = fread(fid, 15, "c", "c", 1)
        fid.seek(2, os.SEEK_CUR)
        fname = fread(fid, 15, "c", "c", 1)
        fid.seek(1, os.SEEK_CUR)
        mname = fread(fid, 17, "c", "c", 1)
        fid.seek(1, os.SEEK_CUR)
        # fid.tell = 59
        # cb1silfdFD
        fid.seek(60, os.SEEK_SET)
        x = fread(fid, 1, "i", "i", 1)

        self.header_data = header_data.read(fid)
        # read first section of header
        self.epoch_data = [
            epoch_data.read(fid) for i in range(0, self.header_data.total_epochs[0])
        ]  # read epoch header info
        self.channel_ref_data = [channel_ref_data.read(fid) for j in range(0, self.header_data.total_chans[0])]
        self.event_data = [event_data.read(fid) for j in range(0, self.header_data.total_fixed_events[0])]
        self.header_offset = header_offset
        fid.close