def test_Sample01_Eb015pi(self):
        reader = btk.btkAcquisitionFileReader()
        reader.SetFilename(_TDDConfigure.C3DFilePathIN + 'sample01/Eb015pi.c3d')
        reader.Update()
        acq = reader.GetOutput()

        self.assertEqual(acq.GetMaxInterpolationGap(), 10)
        self.assertEqual(acq.GetPointFrequency(), 50)
        self.assertEqual(acq.GetPointNumber(), 26)
        self.assertEqual(acq.GetAnalogFrequency(), 200)
        self.assertEqual(acq.GetAnalogNumber(), 16)
        self.assertEqual(acq.GetPoint(0).GetLabel(), 'RFT1')
        self.assertEqual(acq.GetPoint(9).GetDescription(), 'DISTAL FOOT')
        self.assertEqual(acq.GetAnalog(15).GetLabel(), 'CH16')
        self.assertEqual(acq.GetAnalog(2).GetDescription(), 'FORCE Z-COMP 1')
        self.assertAlmostEqual(acq.GetPoint(0).GetValues()[8,0], 250.4166, 3)
        self.assertAlmostEqual(acq.GetPoint(17).GetValues()[16,0], 285, 3)
        self.assertAlmostEqual(acq.GetPoint(17).GetValues()[16,1], 222.4166, 3)
        self.assertAlmostEqual(acq.GetPoint(17).GetValues()[16,2], 564.4166, 3)
        self.assertAlmostEqual(acq.GetPoint(0).GetResiduals()[0], 1.3333, 3)
        self.assertAlmostEqual(acq.GetPoint(14).GetResiduals()[20], 1.91667, 3)
        self.assertAlmostEqual(acq.GetAnalog(0).GetValues()[0], -26.6599, 3)
        self.assertAlmostEqual(acq.GetAnalog(0).GetValues()[1], -25.8, 3)
        
        self.assertEqual(acq.GetEventNumber(), 3)
        self.assertEqual(acq.GetEvent(0).GetLabel(), 'RIC')
        self.assertAlmostEqual(acq.GetEvent(0).GetTime(), 2.72, 3)
        self.assertEqual(acq.GetEvent(1).GetLabel(), 'RHS')
        self.assertAlmostEqual(acq.GetEvent(1).GetTime(), 5.40, 3)
        self.assertEqual(acq.GetEvent(2).GetLabel(), 'RTO')
        self.assertAlmostEqual(acq.GetEvent(2).GetTime(), 7.32, 3)

        io = btk.btkC3DFileIO(reader.GetAcquisitionIO())        
        self.assertAlmostEqual(io.GetPointScale(), 0.08333, 3)
Example #2
0
    def test_Sample01_Eb015pi(self):
        reader = btk.btkAcquisitionFileReader()
        reader.SetFilename(_TDDConfigure.C3DFilePathIN +
                           'sample01/Eb015pi.c3d')
        reader.Update()
        acq = reader.GetOutput()

        self.assertEqual(acq.GetMaxInterpolationGap(), 10)
        self.assertEqual(acq.GetPointFrequency(), 50)
        self.assertEqual(acq.GetPointNumber(), 26)
        self.assertEqual(acq.GetAnalogFrequency(), 200)
        self.assertEqual(acq.GetAnalogNumber(), 16)
        self.assertEqual(acq.GetPoint(0).GetLabel(), 'RFT1')
        self.assertEqual(acq.GetPoint(9).GetDescription(), 'DISTAL FOOT')
        self.assertEqual(acq.GetAnalog(15).GetLabel(), 'CH16')
        self.assertEqual(acq.GetAnalog(2).GetDescription(), 'FORCE Z-COMP 1')
        self.assertAlmostEqual(acq.GetPoint(0).GetValues()[8, 0], 250.4166, 3)
        self.assertAlmostEqual(acq.GetPoint(17).GetValues()[16, 0], 285, 3)
        self.assertAlmostEqual(
            acq.GetPoint(17).GetValues()[16, 1], 222.4166, 3)
        self.assertAlmostEqual(
            acq.GetPoint(17).GetValues()[16, 2], 564.4166, 3)
        self.assertAlmostEqual(acq.GetPoint(0).GetResiduals()[0], 1.3333, 3)
        self.assertAlmostEqual(acq.GetPoint(14).GetResiduals()[20], 1.91667, 3)
        self.assertAlmostEqual(acq.GetAnalog(0).GetValues()[0], -26.6599, 3)
        self.assertAlmostEqual(acq.GetAnalog(0).GetValues()[1], -25.8, 3)

        self.assertEqual(acq.GetEventNumber(), 3)
        self.assertEqual(acq.GetEvent(0).GetLabel(), 'RIC')
        self.assertAlmostEqual(acq.GetEvent(0).GetTime(), 2.72, 3)
        self.assertEqual(acq.GetEvent(1).GetLabel(), 'RHS')
        self.assertAlmostEqual(acq.GetEvent(1).GetTime(), 5.40, 3)
        self.assertEqual(acq.GetEvent(2).GetLabel(), 'RTO')
        self.assertAlmostEqual(acq.GetEvent(2).GetTime(), 7.32, 3)

        io = btk.btkC3DFileIO(reader.GetAcquisitionIO())
        self.assertAlmostEqual(io.GetPointScale(), 0.08333, 3)
Example #3
0
 def test_CanReadFileEmpty(self):
     pt = btk.btkC3DFileIO()
     self.assertEqual(pt.CanReadFile(''), False)
Example #4
0
 def test_CanWriteFileOk(self):
     pt = btk.btkC3DFileIO()
     self.assertEqual(pt.CanWriteFile('test.c3d'), True)
Example #5
0
 def test_CanWriteFileFail(self):
     pt = btk.btkC3DFileIO()
     self.assertEqual(pt.CanWriteFile('test.jpeg'), False)
Example #6
0
 def test_CanReadFileOk(self):
     pt = btk.btkC3DFileIO()
     self.assertEqual(
         pt.CanReadFile(_TDDConfigure.C3DFilePathIN +
                        'sample01/Eb015pi.c3d'), True)
Example #7
0
 def test_CanReadFileFail(self):
     pt = btk.btkC3DFileIO()
     self.assertEqual(
         pt.CanReadFile(_TDDConfigure.C3DFilePathIN + 'others/Fail.c3d'),
         False)
 def test_CanReadFileEmptyFile(self):
     pt = btk.btkC3DFileIO()
     self.assertEqual(pt.CanReadFile(_TDDConfigure.C3DFilePathIN + 'others/Empty.c3d'), False);
 def test_CanReadFileEmpty(self):
     pt = btk.btkC3DFileIO()
     self.assertEqual(pt.CanReadFile(''), False);
 def test_CanWriteFileOk(self):
     pt = btk.btkC3DFileIO()
     self.assertEqual(pt.CanWriteFile('test.c3d'), True);
 def test_CanWriteFileFail(self):
     pt = btk.btkC3DFileIO()
     self.assertEqual(pt.CanWriteFile('test.jpeg'), False);
 def test_CanReadFileOk(self):
     pt = btk.btkC3DFileIO()
     self.assertEqual(pt.CanReadFile(_TDDConfigure.C3DFilePathIN + 'sample01/Eb015pi.c3d'), True);