(self, factor=10, first=3, switch=True)
return self
rude downsampling of a `CMADataLogger` data file by `factor`, keeping
        also the first `first` entries. This function is a stump and subject
        to future changes.

        Arguments
        ---------
           - `factor` -- downsampling factor
           - `first` -- keep first `first` entries
           - `switch` -- switch the new logger name to oldname+'down'

        Details
        -------
        ``self.name_prefix+'down'`` files are written

        Example
        -------
        ::

            import cma
            cma.downsampling()  # takes outcmaes* files
            cma.plot('outcmaesdown')
rude downsampling of a `CMADataLogger` data file by `factor`, keeping
        also the first `first` entries. This function is a stump and subject
        to future changes.
rude downsampling of a CMADataLogger data file by factor keeping also the first first entries . This function is a stump and subject to future changes .
def downsampling(self, factor=10, first=3, switch=True):
        """
        rude downsampling of a `CMADataLogger` data file by `factor`, keeping
        also the first `first` entries. This function is a stump and subject
        to future changes.

        Arguments
        ---------
           - `factor` -- downsampling factor
           - `first` -- keep first `first` entries
           - `switch` -- switch the new logger name to oldname+'down'

        Details
        -------
        ``self.name_prefix+'down'`` files are written

        Example
        -------
        ::

            import cma
            cma.downsampling()  # takes outcmaes* files
            cma.plot('outcmaesdown')

        """
        newprefix = self.name_prefix + 'down'
        for name in CMADataLogger.names:
            f = open(newprefix+name+'.dat','w')
            iline = 0
            cwritten = 0
            for line in open(self.name_prefix+name+'.dat'):
                if iline < first or iline % factor == 0:
                    f.write(line)
                    cwritten += 1
                iline += 1
            f.close()
            print('%d' % (cwritten) + ' lines written in ' + newprefix+name+'.dat')
        if switch:
            self.name_prefix += 'down'
        return self
def downsampling ( self , factor = 10 , first = 3 , switch = True ) : newprefix = self . name_prefix + 'down' for name in CMADataLogger . names : f = open ( newprefix + name + '.dat' , 'w' ) iline = 0 cwritten = 0 for line in open ( self . name_prefix + name + '.dat' ) : if iline < first or iline % factor == 0 : f . write ( line ) cwritten += 1 iline += 1 f . close ( ) print ( '%d' % ( cwritten ) + ' lines written in ' + newprefix + name + '.dat' ) if switch : self . name_prefix += 'down' return self