Return the length of the trace.

        :Parameters:
        chain : int or None
          The chain index. If None, returns the combined length of all chains.

def length(self, chain=-1):
        """Return the length of the trace.

        :Parameters:
        chain : int or None
          The chain index. If None, returns the combined length of all chains.
        """
        if chain is not None:
            tables = [self.db._gettables()[chain], ]
        else:
            tables = self.db._gettables()

        n = asarray([table.nrows for table in tables])
        return n.sum()