コード例 #1
0
ファイル: channel_data.py プロジェクト: neurodebian/pymeg
    def __init__(self, fid):
        align.check(fid);

        #self.name = ''.join(list(fread(fid, 16, 'c', 'c', 1)));
        self.name = fid.read(16)
        self.chan_no = fread(fid, 1, 'H', 'H', 1);
        self.type = fread(fid, 1, 'H', 'H', 1);
        self.sensor_no = fread(fid, 1, 'h', 'h', 1);
        fid.seek(2, os.SEEK_CUR);
        self.gain = fread(fid, 1, 'f', 'f', 1);
        self.units_per_bit = fread(fid, 1, 'f', 'f', 1);
        #self.yaxis_label = ''.join(list(fread(fid, 16, 'c', 'c', 1)));
        self.yaxis_label = fid.read(16)
        self.aar_val = fread(fid, 1, 'd', 'd', 1);
        self.checksum = fread(fid, 1, 'i', 'i', 1);
        #self.reserved = ''.join(list(fread(fid, 32, 'c', 'c', 1)));
        self.reserved = fid.read(32)
        fid.seek( 4, os.SEEK_CUR);

        if self.type in [1,3]: self.device_data = device_data.readmeg(fid); #meg/ref
        elif self.type in [2]: self.device_data = device_data.readeeg(fid); #eeg
        elif self.type in [4]: self.device_data = device_data.readexternal(fid); #external
        elif self.type in [5]: self.device_data = device_data.readtrigger(fid); #TRIGGER
        elif self.type in [6]: self.device_data = device_data.readutility(fid); #utility
        elif self.type in [7]: self.device_data = device_data.readderived(fid); #derived
        elif self.type in [8]: self.device_data = device_data.readshorted(fid); #shorted
        else: print 'device type unknown'
コード例 #2
0
ファイル: channel_data.py プロジェクト: badbytes/pymeg
    def __init__(self, fid,log=None):
        align.check(fid);

        #logging.basicConfig(filename='/tmp/MSWconfigread.log',filemode='w',level=logging.DEBUG)
        self.name_array = array(fread(fid, 16, 'c', 'c', 1))
        self.name = ''.join(list(self.name_array));
        #print self.name,fid.tell()
        #self.name = fid.read(16)
        self.chan_no = fread(fid, 1, 'H', 'H', 1);
        self.type = fread(fid, 1, 'H', 'H', 1);
        self.sensor_no = fread(fid, 1, 'h', 'h', 1);
        fid.seek(2, os.SEEK_CUR);
        self.gain = fread(fid, 1, 'f', 'f', 1);
        self.units_per_bit = fread(fid, 1, 'f', 'f', 1);
        #self.yaxis_label = ''.join(list(fread(fid, 16, 'c', 'c', 1)));
        #self.yaxis_label = fid.read(16)
        self.yaxis_label = array(fread(fid, 16, 'c', 'c', 1))
        self.aar_val = fread(fid, 1, 'd', 'd', 1);
        self.checksum = fread(fid, 1, 'i', 'i', 1);
        #self.reserved = ''.join(list(fread(fid, 32, 'c', 'c', 1)));

        #self.reserved = fid.read(32)
        self.reserved = array(fread(fid, 32, 'c', 'c', 1))
        fid.seek( 4, os.SEEK_CUR);

        if self.type in [1,3]: self.device_data = device_data.readmeg(fid); #meg/ref
        elif self.type in [2]: self.device_data = device_data.readeeg(fid); #eeg
        elif self.type in [4]: self.device_data = device_data.readexternal(fid); #external
        elif self.type in [5]: self.device_data = device_data.readtrigger(fid); #TRIGGER
        elif self.type in [6]: self.device_data = device_data.readutility(fid); #utility
        elif self.type in [7]: self.device_data = device_data.readderived(fid); #derived
        elif self.type in [8]: self.device_data = device_data.readshorted(fid); #shorted
        else:
            print 'device type unknown',self.type,self.name