cellpy.utils.batch_tools.batch_journals#

Module Contents#

Classes#

LabJournal

A journal keeps track of the details of the experiment.

Attributes#

hdr_journal

missing_keys

trans_dict

class LabJournal(db_reader='default', engine=None, batch_col=None, **kwargs)[source]#

Bases: cellpy.utils.batch_tools.batch_core.BaseJournal, abc.ABC

Inheritance diagram of cellpy.utils.batch_tools.batch_journals.LabJournal

A journal keeps track of the details of the experiment.

The journal should at a mimnimum contain information about the name and project the experiment has.

pages#

table with information about each cell/file.

Type:

pandas.DataFrame

name#

the name of the experiment (used in db-lookup).

Type:

str

project#

the name of the project the experiment belongs to (used for making folder names).

Type:

str

file_name#

the file name used in the to_file method.

Type:

str or path

project_dir#

folder where to put the batch (or experiment) files and information.

batch_dir#

folder in project_dir where summary-files and information and results related to the current experiment are stored.

raw_dir#

folder in batch_dir where cell-specific information and results are stored (e.g. raw-data, dq/dv data, voltage-capacity cycles).

Journal for selected batch.

The journal contains pages (pandas.DataFrame) with prms for each cell (one cell pr row).

Parameters:
  • db_reader – either default (a simple excel reader already implemented in cellpy) or other db readers that implement the needed API.

  • engine

    defaults to simple_db_engine for parsing db using the db_reader

    self.pages = simple_db_engine(

    self.db_reader, id_keys, **kwargs

    )

  • batch_col – the column name for the batch column in the db (used by simple_db_engine).

  • **kwargs – passed to the db_reader

add_cell(cell_id, **kwargs)[source]#

Add a cell to the pages

add_comment(comment)[source]#

add a comment (will be saved in the journal file)

create_empty_pages(description=None)[source]#
duplicate_journal(folder=None) None[source]#

Copy the journal to folder.

Parameters:
  • folder (str or pathlib.Path) – folder to copy to (defaults to the

  • folder). (current)

from_db(project=None, name=None, batch_col=None, dbreader_kwargs=None, **kwargs)[source]#

populate journal from db.

Parameters:
  • project (str) – project name.

  • name (str) – experiment name.

  • batch_col (int) – batch column.

  • dbreader_kwargs – sent to simple db_reader.

**kwargs: sent to engine.

simple_db-engine -> filefinder.search_for_files:

run_name(str): run-file identification. raw_extension(str): optional, extension of run-files (without the ‘.’). cellpy_file_extension(str): optional, extension for cellpy files

(without the ‘.’).

raw_file_dir(path): optional, directory where to look for run-files

(default: read prm-file)

cellpy_file_dir(path): optional, directory where to look for

cellpy-files (default: read prm-file)

prm_filename(path): optional parameter file can be given. file_name_format(str): format of raw-file names or a glob pattern

(default: YYYYMMDD_[name]EEE_CC_TT_RR) [not finished yet].

reg_exp(str): use regular expression instead (defaults to None) [not finished yet]. sub_folders (bool): perform search also in sub-folders. file_list (list of str): perform the search within a given list

of filenames instead of searching the folder(s). The list should not contain the full filepath (only the actual file names). If you want to provide the full path, you will have to modify the file_name_format or reg_exp accordingly.

pre_path (path or str): path to prepend the list of files selected

from the file_list.

Returns:

None

from_file(file_name=None, paginate=True, **kwargs)[source]#

Loads a DataFrame with all the needed info about the experiment

from_file_old(file_name=None)[source]#

Loads a DataFrame with all the needed info about the experiment

from_frame(frame, name=None, project=None, paginate=None, **kwargs)[source]#
generate_empty_session()[source]#
generate_file_name()[source]#

generate a suitable file name for the experiment

generate_folder_names()[source]#

Set appropriate folder names.

get_cell(id_key)[source]#

get additional cell info from db

get_column(header)[source]#

populate new column from db

look_for_file()[source]#
paginate()[source]#

Make folders where we would like to put results etc.

classmethod read_journal_excel_file(file_name, **kwargs)[source]#
classmethod read_journal_jason_file(file_name, **kwargs)[source]#
remove_cell(cell_id)[source]#
remove_comment(comment_id)[source]#
to_file(file_name=None, paginate=True, to_project_folder=True, duplicate_to_local_folder=True)[source]#

Saves a DataFrame with all the needed info about the experiment.

Parameters:
  • file_name (str or pathlib.Path) – journal file name (.json or .xlsx)

  • paginate (bool) – make project folders

  • to_project_folder (bool) – save journal file to the folder containing your cellpy projects

  • duplicate_to_local_folder (bool) – save journal file to the folder you are in now also

Returns:

None

view_comments()[source]#
hdr_journal[source]#
missing_keys = [][source]#
trans_dict[source]#