def cell(filename=None, mass=None, instrument=None, logging_mode="INFO",
         cycle_mode=None, auto_summary=True):
    """Create a CellpyData object"""

    from cellpy import log

    log.setup_logging(default_level=logging_mode)
    cellpy_instance = setup_cellpy_instance()

    if instrument is not None:
        cellpy_instance.set_instrument(instrument=instrument)

    if cycle_mode is not None:
        cellpy_instance.cycle_mode = cycle_mode

    if filename is not None:
        filename = Path(filename)

        if filename.suffix in [".h5", ".hdf5", ".cellpy", ".cpy"]:
            logging.info(f"Loading cellpy-file: {filename}")
            cellpy_instance.load(filename)
        else:
            logging.info(f"Loading raw-file: {filename}")
            cellpy_instance.from_raw(filename)
            if mass is not None:
                logging.info("Setting mass")
                cellpy_instance.set_mass(mass)
            if auto_summary:
                logging.info("Creating step table")
                cellpy_instance.make_step_table()
                logging.info("Creating summary data")
                cellpy_instance.make_summary()

    logging.info("Created CellpyData object")
    return cellpy_instance
def cell ( filename = None , mass = None , instrument = None , logging_mode = "INFO" , cycle_mode = None , auto_summary = True ) : from cellpy import log log . setup_logging ( default_level = logging_mode ) cellpy_instance = setup_cellpy_instance ( ) if instrument is not None : cellpy_instance . set_instrument ( instrument = instrument ) if cycle_mode is not None : cellpy_instance . cycle_mode = cycle_mode if filename is not None : filename = Path ( filename ) if filename . suffix in [ ".h5" , ".hdf5" , ".cellpy" , ".cpy" ] : logging . info ( f"Loading cellpy-file: {filename}" ) cellpy_instance . load ( filename ) else : logging . info ( f"Loading raw-file: {filename}" ) cellpy_instance . from_raw ( filename ) if mass is not None : logging . info ( "Setting mass" ) cellpy_instance . set_mass ( mass ) if auto_summary : logging . info ( "Creating step table" ) cellpy_instance . make_step_table ( ) logging . info ( "Creating summary data" ) cellpy_instance . make_summary ( ) logging . info ( "Created CellpyData object" ) return cellpy_instance
Create a CellpyData object