示例#1
0
	def create_gen(self):
		pressao = gerador_duplo(gerador_simples(120,5),gerador_simples(80,3))
		pressao.gs1.info(1, 'pa', (0,300), 'Systolic', 1, 60)
		pressao.gs2.info(2, 'pa', (0,300), 'Dyastolic', 1, 60)
		temperatura = gerador_duplo(gerador_simples(36,3), gerador_simples(35,4))
		temperatura.gs1.info(1, 'C', (0,100), 'Temperature CH1', 1, 60)
		temperatura.gs2.info(2, 'C', (0,100), 'Temperature CH2', 1, 60)
		spo2 = gerador_simples(92,3)
		spo2.info(1, '%O2', (0, 100), 'Oximetry', 1, 60)
		cor = choice(self.ecgs)
		ecg = gerador_arquivo('../resources/'+cor[1],256,300,int)
		ecg.info(1, 'mv', (-1024,1024), 'D2', 1, 1000)
		fc = gerador_simples(cor[0],5)
		fc.info(1, 'BPM', (0,300), 'Cardiac Rate', 1, 60)
		return {3:pressao, 1:temperatura, 4:spo2, 6:ecg, 5:fc}
                self.t_qrs = 0;
                self.M = np.mean(self.mm.queue)
                refM = np.mean(self.mm.queue)
                self.R = 0
                self.F = 0
                
            else:
                if self.count > self.ms2n(350):
                    pa = self.y[self.count - self.ms2n(349):self.count - self.ms2n(299)]
                    pb = self.y[self.count - self.ms2n(49):self.count]
                    self.F = self.F + (np.max(pa) - np.max(pb))/150.0
                if self.t_qrs > self.ms2n(200) and self.t_qrs < self.ms2n(1200):
                    self.M = self.dec(refM ,0.75*refM, self.ms2n(1000), self.M)
                if self.t_qrs == round((2/3.0)*self.rm):
                    self.R = 0.01*refM
                if self.t_qrs > round((2/3.0)*self.rm) and self.t_qrs < self.rm:
                    self.R = self.dec(0.01*refM, 0.10*refM, self.ms2n(1400), self.R)
            self.t_qrs += 1
            print MFR, self.M, self.F, self.R, y
            
        

    

if __name__ == '__main__':
    g = gerador_arquivo('../resources/.ecg_180',256, 10000, int)
    data = g.getNext()
    qrsdec = QRSDetector(256)
    qrsdec.addData(data)
    qrsdec.detect()
    print qrsdec.inter_qrs.queue
示例#3
0
                refM = np.mean(self.mm.queue)
                self.R = 0
                self.F = 0

            else:
                if self.count > self.ms2n(350):
                    pa = self.y[self.count - self.ms2n(349):self.count -
                                self.ms2n(299)]
                    pb = self.y[self.count - self.ms2n(49):self.count]
                    self.F = self.F + (np.max(pa) - np.max(pb)) / 150.0
                if self.t_qrs > self.ms2n(200) and self.t_qrs < self.ms2n(
                        1200):
                    self.M = self.dec(refM, 0.75 * refM, self.ms2n(1000),
                                      self.M)
                if self.t_qrs == round((2 / 3.0) * self.rm):
                    self.R = 0.01 * refM
                if self.t_qrs > round(
                    (2 / 3.0) * self.rm) and self.t_qrs < self.rm:
                    self.R = self.dec(0.01 * refM, 0.10 * refM,
                                      self.ms2n(1400), self.R)
            self.t_qrs += 1
            print MFR, self.M, self.F, self.R, y


if __name__ == '__main__':
    g = gerador_arquivo('../resources/.ecg_180', 256, 10000, int)
    data = g.getNext()
    qrsdec = QRSDetector(256)
    qrsdec.addData(data)
    qrsdec.detect()
    print qrsdec.inter_qrs.queue