def __init__(self, *args, **kwargs): """Initialize the Batch class. The initialization accepts arbitrary arguments and keyword arguments. It first looks for the file_name and db_reader keyword arguments. Usage: b = Batch((name, (project)), **kwargs) Examples: >>> b = Batch("experiment001", "main_project") >>> b = Batch("experiment001", "main_project", batch_col="b02") >>> b = Batch(name="experiment001", project="main_project", batch_col="b02") >>> b = Batch(file_name="cellpydata/batchfiles/cellpy_batch_experiment001.json") Keyword Args (priority): file_name (str or pathlib.Path): journal file name to load. db_reader (str): data-base reader to use (defaults to "default" as given in the config-file or prm-class). Args: *args: name (str) (project (str)) Keyword Args (other): default_log_level (str): custom log-level (defaults to None (i.e. default log-level in cellpy)). custom_log_dir (str or pathlib.Path): custom folder for putting the log-files. force_raw_file (bool): load from raw regardless (defaults to False). force_cellpy (bool): load cellpy-files regardless (defaults to False). force_recalc (bool): Always recalculate (defaults to False). export_cycles (bool): Extract and export individual cycles to csv (defaults to True). export_raw (bool): Extract and export raw-data to csv (defaults to True). export_ica (bool): Extract and export individual dQ/dV data to csv (defaults to True). accept_errors (bool): Continue automatically to next file if error is raised (defaults to False). nom_cap (float): give a nominal capacity if you want to use another value than the one given in the config-file or prm-class. """ default_log_level = kwargs.pop("log_level", None) custom_log_dir = kwargs.pop("custom_log_dir", None) if default_log_level is not None or custom_log_dir is not None: log.setup_logging( custom_log_dir=custom_log_dir, default_level=default_log_level, reset_big_log=True, ) db_reader = kwargs.pop("db_reader", "default") file_name = kwargs.pop("file_name", None) logging.debug("creating CyclingExperiment") self.experiment = CyclingExperiment(db_reader=db_reader) logging.info("created CyclingExperiment") self.experiment.force_cellpy = kwargs.pop("force_cellpy", False) self.experiment.force_raw = kwargs.pop("force_raw_file", False) self.experiment.force_recalc = kwargs.pop("force_recalc", False) self.experiment.export_cycles = kwargs.pop("export_cycles", True) self.experiment.export_raw = kwargs.pop("export_raw", True) self.experiment.export_ica = kwargs.pop("export_ica", False) self.experiment.accept_errors = kwargs.pop("accept_errors", False) self.experiment.nom_cap = kwargs.pop("nom_cap", None) if not file_name: if len(args) > 0: self.experiment.journal.name = args[0] if len(args) > 1: self.experiment.journal.project = args[1] for key in kwargs: if key == "name": self.experiment.journal.name = kwargs[key] elif key == "project": self.experiment.journal.project = kwargs[key] elif key == "batch_col": self.experiment.journal.batch_col = kwargs[key] else: self.experiment.journal.from_file(file_name=file_name) self.exporter = CSVExporter() self.exporter._assign_dumper(ram_dumper) self.exporter.assign(self.experiment) self.plotter = CyclingSummaryPlotter() self.plotter.assign(self.experiment) self._journal_name = self.journal_name self.headers_step_table = get_headers_step_table()
cellpy_limits, cellpy_units, get_headers_summary, get_headers_normal, get_headers_step_table, ) CELLPY_FILE_VERSION = 5 MINIMUM_CELLPY_FILE_VERSION = 1 STEP_TABLE_VERSION = 5 RAW_TABLE_VERSION = 5 SUMMARY_TABLE_VERSION = 5 HEADERS_NORMAL = get_headers_normal() HEADERS_SUMMARY = get_headers_summary() HEADERS_STEP_TABLE = get_headers_step_table() class FileID(object): """class for storing information about the raw-data files. This class is used for storing and handling raw-data file information. It is important to keep track of when the data was extracted from the raw-data files so that it is easy to know if the hdf5-files used for @storing "treated" data is up-to-date. Attributes: name (str): Filename of the raw-data file. full_name (str): Filename including path of the raw-data file. size (float): Size of the raw-data file. last_modified (datetime): Last time of modification of the raw-data
"#FFFEA3", "#B0E0E6", ], "seaborn-dark-palette": [ "#001C7F", "#017517", "#8C0900", "#7600A1", "#B8860B", "#006374", ], } hdr_summary = get_headers_summary() hdr_raw = get_headers_normal() hdr_steps = get_headers_step_table() hdr_journal = get_headers_journal() def _hv_bokeh_available(): if not hv_available: print("You need holoviews. But I cannot load it. Aborting...") return False if not bokeh_available: print("You need Bokeh. But I cannot find it. Aborting...") return False return True def find_column(columns, label=None, end="cycle_index"): """find columns based on how the column-name ends.