def to_csv(self, datadir=None, sep=None, cycles=False, raw=True,
               summary=True, shifted=False,
               method=None, shift=0.0,
               last_cycle=None):
        """Saves the data as .csv file(s).

        Args:
            datadir: folder where to save the data (uses current folder if not
                given).
            sep: the separator to use in the csv file
                (defaults to CellpyData.sep).
            cycles: (bool) export voltage-capacity curves if True.
            raw: (bool) export raw-data if True.
            summary: (bool) export summary if True.
            shifted (bool): export with cumulated shift.
            method (string): how the curves are given
                "back-and-forth" - standard back and forth; discharge
                    (or charge) reversed from where charge (or
                    discharge) ends.
                "forth" - discharge (or charge) continues along x-axis.
                "forth-and-forth" - discharge (or charge) also starts at 0 (or
                    shift if not shift=0.0)
            shift: start-value for charge (or discharge)
            last_cycle: process only up to this cycle (if not None).

        Returns: Nothing

        """

        if sep is None:
            sep = self.sep

        self.logger.debug("saving to csv")

        dataset_number = -1
        for data in self.datasets:
            dataset_number += 1
            if not self._is_not_empty_dataset(data):
                self.logger.info("to_csv -")
                self.logger.info("empty test [%i]" % dataset_number)
                self.logger.info("not saved!")
            else:
                if isinstance(data.loaded_from, (list, tuple)):
                    txt = "merged file"
                    txt += "using first file as basename"
                    self.logger.debug(txt)
                    no_merged_sets = len(data.loaded_from)
                    no_merged_sets = "_merged_" + str(no_merged_sets).zfill(3)
                    filename = data.loaded_from[0]
                else:
                    filename = data.loaded_from
                    no_merged_sets = ""
                firstname, extension = os.path.splitext(filename)
                firstname += no_merged_sets
                if datadir:
                    firstname = os.path.join(datadir,
                                             os.path.basename(firstname))

                if raw:
                    outname_normal = firstname + "_normal.csv"
                    self._export_normal(data, outname=outname_normal, sep=sep)
                    if data.step_table_made is True:
                        outname_steps = firstname + "_steps.csv"
                        self._export_steptable(data, outname=outname_steps,
                                               sep=sep)
                    else:
                        self.logger.debug("step_table_made is not True")

                if summary:
                    outname_stats = firstname + "_stats.csv"
                    self._export_stats(data, outname=outname_stats, sep=sep)

                if cycles:
                    outname_cycles = firstname + "_cycles.csv"
                    self._export_cycles(outname=outname_cycles,
                                        dataset_number=dataset_number,
                                        sep=sep, shifted=shifted,
                                        method=method, shift=shift,
                                        last_cycle=last_cycle)
def to_csv ( self , datadir = None , sep = None , cycles = False , raw = True , summary = True , shifted = False , method = None , shift = 0.0 , last_cycle = None ) : if sep is None : sep = self . sep self . logger . debug ( "saving to csv" ) dataset_number = - 1 for data in self . datasets : dataset_number += 1 if not self . _is_not_empty_dataset ( data ) : self . logger . info ( "to_csv -" ) self . logger . info ( "empty test [%i]" % dataset_number ) self . logger . info ( "not saved!" ) else : if isinstance ( data . loaded_from , ( list , tuple ) ) : txt = "merged file" txt += "using first file as basename" self . logger . debug ( txt ) no_merged_sets = len ( data . loaded_from ) no_merged_sets = "_merged_" + str ( no_merged_sets ) . zfill ( 3 ) filename = data . loaded_from [ 0 ] else : filename = data . loaded_from no_merged_sets = "" firstname , extension = os . path . splitext ( filename ) firstname += no_merged_sets if datadir : firstname = os . path . join ( datadir , os . path . basename ( firstname ) ) if raw : outname_normal = firstname + "_normal.csv" self . _export_normal ( data , outname = outname_normal , sep = sep ) if data . step_table_made is True : outname_steps = firstname + "_steps.csv" self . _export_steptable ( data , outname = outname_steps , sep = sep ) else : self . logger . debug ( "step_table_made is not True" ) if summary : outname_stats = firstname + "_stats.csv" self . _export_stats ( data , outname = outname_stats , sep = sep ) if cycles : outname_cycles = firstname + "_cycles.csv" self . _export_cycles ( outname = outname_cycles , dataset_number = dataset_number , sep = sep , shifted = shifted , method = method , shift = shift , last_cycle = last_cycle )
Saves the data as .csv file(s).

        Args:
            datadir: folder where to save the data (uses current folder if not
                given).
            sep: the separator to use in the csv file
                (defaults to CellpyData.sep).
            cycles: (bool) export voltage-capacity curves if True.
            raw: (bool) export raw-data if True.
            summary: (bool) export summary if True.
            shifted (bool): export with cumulated shift.
            method (string): how the curves are given
                "back-and-forth" - standard back and forth; discharge
                    (or charge) reversed from where charge (or
                    discharge) ends.
                "forth" - discharge (or charge) continues along x-axis.
                "forth-and-forth" - discharge (or charge) also starts at 0 (or
                    shift if not shift=0.0)
            shift: start-value for charge (or discharge)
            last_cycle: process only up to this cycle (if not None).

        Returns: Nothing