Sharing Data#

PyProBE makes sharing data simple and straightforward. This is a simple example to demonstrate the process.

First we will import some sample data:

[1]:
import pyprobe
import os
import shutil

# 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)

data_directory = '../../../tests/sample_data/neware'

cell.add_procedure(procedure_name='Sample',
                   folder_path = data_directory,
                   filename = 'sample_data_neware.parquet')

We can then use the archive() method of the cell object. This stores all attributes of the cell object into a single folder. The data is stored as .parquet files and the metadata is stored in .json files.

[2]:
cell.archive(path = 'sample_archive')
os.listdir('.')
[2]:
['analysing-GITT-data.ipynb',
 'comparing-pyprobe-performance.ipynb',
 'sharing-data.ipynb',
 'providing-valid-inputs.ipynb',
 'LEAN-differentiation.ipynb',
 'examples.rst',
 'sample_archive',
 'ocv-fitting.ipynb',
 'differentiating-voltage-data.ipynb',
 'getting-started.ipynb',
 'filtering-data.ipynb']

You can choose to compress the folder by adding .zip to the path:

[3]:
cell.archive(path = 'sample_archive.zip')
os.listdir('.')
[3]:
['sample_archive.zip',
 'analysing-GITT-data.ipynb',
 'comparing-pyprobe-performance.ipynb',
 'sharing-data.ipynb',
 'providing-valid-inputs.ipynb',
 'LEAN-differentiation.ipynb',
 'examples.rst',
 'ocv-fitting.ipynb',
 'differentiating-voltage-data.ipynb',
 'getting-started.ipynb',
 'filtering-data.ipynb']

You can then retrieve the archived object with the pyprobe.load_archive() method:

[4]:
saved_cell = pyprobe.load_archive('sample_archive.zip')
print(saved_cell.info)

{'Name': 'Sample cell', 'Chemistry': 'NMC622', 'Nominal Capacity [Ah]': 0.04, 'Cycler number': 1, 'Channel number': 1, 'color': '#ff00ff'}
[5]:
fig = pyprobe.Plot()
fig.add_line(saved_cell.procedure['Sample'], 'Time [hr]', 'Voltage [V]')
fig.show()
2024-12-23 16:57:41,632 - pyprobe.units - ERROR - Name Date does not match pattern.
2024-12-23 16:57:41,633 - pyprobe.units - ERROR - Name Step does not match pattern.
2024-12-23 16:57:41,634 - pyprobe.units - ERROR - Name Event does not match pattern.

Clean up after example

[6]:
shutil.rmtree('sample_archive')