cellpy.readers.dbreader
#
Module Contents#
Classes#
Simple excel reader. |
- 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
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.
- 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).
- abstract from_batch(batch_name: str, include_key: bool = False, include_individual_arguments: bool = False) dict [source]#
- 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