cellpy.utils.batch_tools.batch_helpers#

Module Contents#

Functions#

create_factory()

create_folder_structure(project_name, batch_name)

This function creates a folder structure for the batch project.

create_labels(label, *args)

Returns a re-formatted label (currently it only removes the dates

create_selected_summaries_dict(summaries_list)

Creates a dictionary with summary column headers.

export_dqdv(cell_data, savedir, sep[, last_cycle])

Exports dQ/dV data from a CellpyCell instance.

find_files(info_dict[, file_list, pre_path, sub_folders])

Find files using cellpy.filefinder.

fix_groups(groups)

Takes care of strange group numbers.

generate_folder_names(name, project)

Creates sensible folder names.

join_summaries(summary_frames, selected_summaries[, ...])

parse the summaries and combine based on column (selected_summaries)

look_up_and_get(cellpy_file_name, table_name[, root, ...])

Extracts table from cellpy hdf5-file.

make_unique_groups(info_df)

This function cleans up the group numbers a bit.

pick_summary_data(key, summary_df, selected_summaries)

picks the selected pandas.DataFrame

save_multi(data, file_name[, sep])

Convenience function for storing data column-wise in a csv-file.

Attributes#

CELL_TYPE_IDS

hdr_journal

hdr_summary

create_factory()[source]#
create_folder_structure(project_name, batch_name)[source]#

This function creates a folder structure for the batch project.

The folder structure consists of main working folder project_name` located in the ``outdatadir (as defined in the cellpy configuration file) with a sub-folder named batch_name. It also creates a folder inside the batch_name folder for storing the raw data. If the folders does not exist, they will be made. The function also returns the name of the info-df.

Parameters:
  • project_name – name of the project

  • batch_name – name of the batch

Returns: (info_file, (project_dir, batch_dir, raw_dir))

create_labels(label, *args)[source]#

Returns a re-formatted label (currently it only removes the dates from the run-name)

create_selected_summaries_dict(summaries_list)[source]#

Creates a dictionary with summary column headers.

Examples

>>> summaries_to_output = ["discharge_capacity_gravimetric", "charge_capacity_gravimetric"]
>>> summaries_to_output_dict = create_selected_summaries_dict(
>>>    summaries_to_output
>>> )
>>> print(summaries_to_output_dict)
{'discharge_capacity_gravimetric': "discharge_capacity_gravimetric",
       'charge_capacity_gravimetric': "discharge_capacity_gravimetric"}
Parameters:

summaries_list – list containing cellpy summary column id names

Returns: dictionary of the form {cellpy id name: cellpy summary

header name,}

export_dqdv(cell_data, savedir, sep, last_cycle=None)[source]#

Exports dQ/dV data from a CellpyCell instance.

Parameters:
  • cell_data – CellpyCell instance

  • savedir – path to the folder where the files should be saved

  • sep – separator for the .csv-files.

  • last_cycle – only export up to this cycle (if not None)

find_files(info_dict, file_list=None, pre_path=None, sub_folders=None, **kwargs)[source]#

Find files using cellpy.filefinder.

Parameters:
  • info_dict – journal pages.

  • file_list – list of files names to search through.

  • pre_path – path to prepend found files from file_list (if file_list is given).

  • sub_folders (bool) – perform search also in sub-folders.

**kwargs (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).

reg_exp(str): use regular expression instead (defaults to None). 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:

info_dict

fix_groups(groups)[source]#

Takes care of strange group numbers.

generate_folder_names(name, project)[source]#

Creates sensible folder names.

join_summaries(summary_frames, selected_summaries, keep_old_header=False)[source]#

parse the summaries and combine based on column (selected_summaries)

look_up_and_get(cellpy_file_name, table_name, root=None, max_cycle=None)[source]#

Extracts table from cellpy hdf5-file.

make_unique_groups(info_df)[source]#

This function cleans up the group numbers a bit.

pick_summary_data(key, summary_df, selected_summaries)[source]#

picks the selected pandas.DataFrame

save_multi(data, file_name, sep=';')[source]#

Convenience function for storing data column-wise in a csv-file.

CELL_TYPE_IDS = ['cc', 'ec', 'eth'][source]#
hdr_journal[source]#
hdr_summary[source]#