예제 #1
0
    def test_SofiePyTableAccess(self):
        logging.info('AntPyTableAccess Test')
        writer = SofiePyTableAccess('simple-test-data.h5', '/test')
        self.assertIsInstance(writer, SofiePyTableAccess, 'Root Does not exist')
        writer.close()
        writer = SofiePyTableAccess('simple-test-data.h5', '/test')
        self.assertIsInstance(writer, SofiePyTableAccess, 'Root Exists')

        writer = SofiePyTableAccess('simple-test-data.h5', '/testagain')
        self.assertIsInstance(writer, SofiePyTableAccess, 'New Root')

        writer = SofiePyTableAccess('simple-test-data.h5', '/testagain/new')
        self.assertIsInstance(writer, SofiePyTableAccess, 'New Leaf')

        writer = SofiePyTableAccess('simple-test-data.h5', '/testagain/new')
        self.assertIsInstance(writer, SofiePyTableAccess, 'Repeat Leaf')
        writer.setRunName('test/new2')
        writer.setRunName('testagain/new3/sub1')
        writer.setRunName('testagain/new3/sub1')
        writer.setRunName('testagain/new3/sub2')

        writer = AntRawDataAccess('simple-test-data.h5', '/test')
        writerData = ('1', '2', '3', '4', '5', '6', '7', '8', '9', 111111.101221)
        logging.info('Writing the following data: ' + str(writerData))
        writer.write(writerData)
        logging.info('Came Back from writing.')
        writer.close()

        writer = AntRawDataAccess('simple-test-data.h5', '/test/AntRawData')
        self.assertIsInstance(writer, AntRawDataAccess)
예제 #2
0
 def write(self,thePayloadList):
     """ Writes the data into a table with each byte in a separate column. 
     
     Throws an IncorrectAntDataError if thePayloadList is not equal 
     to sofiehdfformat.AntParser.ANTDATALENGTH
     """
     if len(thePayloadList)!=ANTPARSERRAWLISTLENTH:
         raise AntRawParserLengthNotCorrect()
     SofiePyTableAccess.write(self,thePayloadList)
예제 #3
0
    def write(self,thePayloadList):
        """ Writes the data into a table with each byte in a separate column.

        Throws an IncorrectAntDataError if thePayloadList is not equal
        to sofiehdfformat.AntParser.ANTDATALENGTH
        """
        if len(thePayloadList)!=ANTPARSERPARSEDLISTLENTH:
            raise AntParserLengthNotCorrect('The length should be: '+\
                str(ANTPARSERPARSEDLISTLENTH)+
                ': BUT is: '+ str(len(thePayloadList))
                )
        SofiePyTableAccess.write(self,thePayloadList)
예제 #4
0
 def __init__(self, filename, runName='/test',
              allowDuplicates=True,
              description='',
              videoSamplingRate=-1,
              videoFrames=-1,
              scale=-0.1):
     SofiePyTableAccess.__init__(self, filename, runName=runName,
                                 allowDuplicates=allowDuplicates,
                                 description=description);
     self.setTable(C3DMetaName, C3DMeta)
     SofiePyTableAccess.write(self, [videoSamplingRate, videoFrames, scale,
                              time.time()])
     self.allowDuplicates()
예제 #5
0
    def write(self, theMarkers):
        """ Writes the data into a table with each Marker Label in a separate Table
        """
        #logging.debug(theMarkers)
        if theMarkers == False:
            return
        for key in theMarkers.keys():
            theMarker = theMarkers[key]
            key = key.replace('*', '_STAR')

            #logging.debug('The Marker'+str(theMarker))
            #logging.debug('Writing Marker: '+key)

            self.setTable(C3DMarkerName + key, C3DMarker)
            SofiePyTableAccess.write(self, theMarker)
    def write(self,thePayloadList):
        """ Writes the data into a table with each byte in a separate column. 
        """
        logging.debug(thePayloadList)
        newPayLoadList = {}
        for key in thePayloadList.keys():
            newPayLoadList[self._makesafekey(key)] = thePayloadList[key]
            if thePayloadList[key] == None:
                continue
            if isinstance(thePayloadList[key], basestring):
                converted = thePayloadList[key].strip('\'')
                if len(converted) == 0 or converted == None:
                    newPayLoadList[self._makesafekey(key)] = None
                else:
                    logging.debug(thePayloadList[key].strip('\''))
                    newPayLoadList[self._makesafekey(key)] = float(converted)
        logging.debug(newPayLoadList)

        SofiePyTableAccess.write(self,newPayLoadList)