cellpy.readers.dbreader#

Module Contents#

Classes#

DbSheetCols

Reader

Simple excel reader.

class DbSheetCols[source]#
class Reader(db_file=None, db_datadir=None, db_datadir_processed=None, db_frame=None, batch=None, batch_col_name=None)[source]#

Bases: cellpy.readers.core.BaseDbReader

Inheritance diagram of cellpy.readers.dbreader.Reader

Simple excel reader.

Parameters:
  • db_file (str, pathlib.Path) – xlsx-file to read.

  • db_datadir (str, pathlib.Path) – path where raw date is located.

  • db_datadir_processed (str, pathlib.Path) – path where cellpy files are located.

  • db_frame (pandas.DataFrame) – use this instead of reading from xlsx-file.

  • batch (str) – batch name to use.

  • batch_col_name (str) – name of the column in the db-file that contains the batch name.

extract_date_from_cell_name(force=False)[source]#
filter_by_col(column_names)[source]#

filters sheet/table by columns (input is column header)

The routine returns the serial numbers with values>1 in the selected columns.

Parameters:

column_names (list) – the column headers.

Returns:

pandas.DataFrame

filter_by_col_value(column_name, min_val=None, max_val=None)[source]#

filters sheet/table by column.

The routine returns the serial-numbers with min_val <= values >= max_val in the selected column.

Parameters:
  • column_name (str) – column name.

  • min_val (int) – minimum value of serial number.

  • max_val (int) – maximum value of serial number.

Returns:

pandas.DataFrame

filter_by_slurry(slurry, appender='_')[source]#

Filters sheet/table by slurry name.

Input is slurry name or list of slurry names, for example ‘es030’ or [“es012”,”es033”,”es031”].

Parameters:
  • slurry (str or list of strings) – slurry names.

  • appender (chr) – char that surrounds slurry names.

Returns:

List of serial_number (ints).

filter_selected(serial_numbers)[source]#
abstract from_batch(batch_name: str, include_key: bool = False, include_individual_arguments: bool = False) dict[source]#
get_all()[source]#
get_area(serial_number)[source]#
abstract get_areal_loading(serial_number)[source]#
get_args(serial_number: int) dict[source]#
get_by_column_label(column_name, serial_number)[source]#
get_cell_name(serial_number)[source]#
get_cell_type(serial_number)[source]#
get_comment(serial_number)[source]#
get_experiment_type(serial_number)[source]#
get_fileid(serial_number, full_path=True)[source]#
get_group(serial_number)[source]#
get_instrument(serial_number)[source]#
get_label(serial_number)[source]#
get_loading(serial_number)[source]#
get_mass(serial_number)[source]#
get_nom_cap(serial_number)[source]#
get_total_mass(serial_number)[source]#
inspect_exists(serial_number)[source]#
inspect_hd5f_fixed(serial_number)[source]#
static intersect(lists)[source]#
pick_table()[source]#

Pick the table and return a pandas.DataFrame.

print_serial_number_info(serial_number, print_to_screen=True)[source]#

Print information about the run.

Parameters:
  • serial_number – serial number.

  • print_to_screen – runs the print statement if True, returns txt if not.

Returns:

txt if print_to_screen is False, else None.

select_all(serial_numbers)[source]#

Select rows for identification for a list of serial_number.

Parameters:

serial_numbers – list (or ndarray) of serial numbers

Returns:

pandas.DataFrame

select_batch(batch, batch_col_name=None, case_sensitive=True, drop=True, clean=False, **kwargs) List[int][source]#

Selects the rows in column batch_col_number.

Parameters:
  • batch – batch to select

  • batch_col_name – column name to use for batch selection (default: DbSheetCols.batch).

  • case_sensitive – if True, the batch name must match exactly (default: True).

  • drop – if True, all un-selected rows are dropped from the table (default: True).

  • clean – if True and drop is True, the table is cleaned from duplicates and NaNs (default: False).

Returns:

List of row indices

select_serial_number_row(serial_number)[source]#

Select row for identification number serial_number

Parameters:

serial_number – serial number

Returns:

pandas.DataFrame

static subtract(list1, list2)[source]#
static subtract_many(list1, lists)[source]#
static union(lists)[source]#