Importing Data ============== Making a cell object -------------------- PyProBE stores all experimental data and information in a :class:`pyprobe.cell.Cell` object. It has two main attributes: - a dictionary of cell details and experimental info (:attr:`pyprobe.cell.Cell.info`) - a dictionary of experimental procedures performed on the cell (:attr:`pyprobe.cell.Cell.procedure`). A cell object can be created by providing an info dictionary as a keyword argument to ``info``: .. code-block:: python import pyprobe # Describe the cell. Required fields are 'Name'. info_dictionary = {'Name': 'Sample cell', 'Chemistry': 'NMC622', 'Nominal Capacity [Ah]': 0.04, 'Cycler number': 1, 'Channel number': 1,} # Create a cell object cell = pyprobe.Cell(info = info_dictionary) The ``info`` dictionary can contain any number of key-value pairs. The only required key is ``'Name'``, which is used to identify the cell in plots. PyProBE will verify that the ``info`` dictionary contains the ``'Name'`` field. If it does not, it will fill this field with ``'Default Name'``. Converting data to PyProBE Format --------------------------------- PyProBE defines a Procedure as a dataset collected from a single run of an experimental protocol created on a battery cycler. Throughout its life, a cell will likely undergo multiple procedures, such as beginning-of-life testing, degradation cycles, reference performance tests (RPTs) etc. Before adding data to a cell object, it must be converted into the PyProBE standard format. This is done with the :func:`~pyprobe.cell.Cell.process_cycler_file` method: .. code-block:: python # From the previously created cell instance cell.process_cycler_file(cycler = 'neware', folder_path = 'path/to/root_folder/experiment_folder', input_filename = 'cycler_file.csv', output_filename = 'processed_cycler_file.parquet') Your parquet file will be saved in the same directory (:code:`folder_path`) as the input file. Once converted into this format, PyProBE is agnostic to cycler manufacturer and model. For more details on the PyProBE standard format, and an up-to-date list of supported cyclers, see the :ref:`input_data_guidance` section. Working with multiple input files --------------------------------- Some cyclers may output data in multiple files. For example, BioLogic Modulo Bat procedures. Assuming the data is all in the same folder, PyProBE is able to collect all of the files and process them into a single parquet file. This is done by providing a :code:`*` wildcard in the :code:`input_filename` argument: .. code-block:: python # From the previously created cell instance cell.process_cycler_file(cycler = 'neware', folder_path = 'path/to/root_folder/experiment_folder', input_filename = 'cycler_file*.csv', output_filename = 'processed_cycler_file.parquet') This will process all files in the folder that match the pattern :code:`cycler_file*.csv`, e.g. :code:`cycler_file_1.csv`, :code:`cycler_file_2.csv`, etc. The Biologic Modulo Bat format has its own reader ``'biologic_MB'``: .. code-block:: python cell.process_cycler_file(cycler = 'biologic_MB', folder_path = 'path/to/root_folder/experiment_folder', input_filename = 'cycler_file_*_MB.mpt', output_filename = 'processed_cycler_file.parquet') .. _adding_data_to_cell: Adding data to a cell object ---------------------------- For data to be imported into PyProBE, there must be a corresponding :code:`README.yaml` file in the same directory as the data file. This file contains details of the experimental procedure that generated the data. See the :ref:`writing_a_readme_file` section for guidance. A data file in the standard PyProBE format can be added to a cell object using the :func:`~pyprobe.cell.Cell.add_procedure` method. A procedure must be given a name when it is imported. Choose something descriptive, so it is easy to distinguish between different procedures that have been run on the same cell. .. code-block:: python # Add the processed data to the cell object cell.add_procedure(procedure_name = 'Example procedure', folder_path = 'path/to/root_folder/experiment_folder', filename = 'processed_cycler_file.parquet') Any number of procedures can be added to a cell, for example: .. code-block:: python # Add the first procedure cell.add_procedure(procedure_name = 'Cycling', folder_path = 'path/to/root_folder/experiment_folder', filename = 'processed_cycler_file_cycling.parquet') # Add the second procedure cell.add_procedure(procedure_name = 'RPT', folder_path = 'path/to/root_folder/experiment_folder', filename = 'processed_cycler_file_RPT.parquet') print(cell.procedure) # Returns: dict({'Cycling':