<jupyter_start><jupyter_text>Processing cellpy batch - cycles  `{{cookiecutter.project_name}}::{{cookiecutter.session_id}}` **Experimental-id:** `{{cookiecutter.notebook_name}}`  **Short-name:** `{{cookiecutter.session_id}}`  **Project:** `{{cookiecutter.project_name}}`  **By:** `{{cookiecutter.author_name}}`   **Date:** `{{cookiecutter.date}}`    Imports and setup<jupyter_code>import os
import pathlib

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import holoviews as hv
from holoviews.core.io import Pickler, Unpickler
import hvplot.pandas
from holoviews import opts

import cellpy
from cellpy import prms
from cellpy import prmreader
from cellpy.utils import batch, helpers, plotutils
%matplotlib inline
hv.extension('bokeh')
pd.set_option('display.max_columns', 70)
print(f"cellpy version: {cellpy.__version__}")
cellpy_batch_file = "cellpy_batch_" + "{{cookiecutter.session_id}}" + ".json"
b = batch.from_journal(cellpy_batch_file)
b.link()
cell_labels = b.experiment.cell_names
print(" cell labels: ")
cell_labels
# # Remove bad cycles (if you have saved it to the journal session)
# helpers.yank_outliers(b, remove_indexes=b.journal.session["bad_cycles"])
# # It is usually nice to see the capacity plot in the same notebook.
# # You can use the b.plot_summary() method or plotutils.bplot e.g.
# plotutils.bplot(b, columns=["charge_capacity"], max_cycle=100)<jupyter_output><empty_output><jupyter_text>Plot all cycles This will output an interactive plot for all the cycles for each cell. If you want to only plot selected cycles you can use the `cycle` argument in the `get_cap` method, *e.g.*```pythoncurves = d.get_cap(cycle=[1, 2, 3, 10, 100])```<jupyter_code># plot all cycles up to cycle 50
voltage_curves = dict()
cycle = list(range(1, 51))
for label in cell_labels:
    d = b.experiment.data[label]
    curves = d.get_cap(cycle=cycle, label_cycle_number=True, interpolated=True, number_of_points=100)
    if not curves.empty:
        curve = hv.Curve(curves, kdims=["capacity", "cycle"], vdims="voltage").groupby("cycle").overlay()#.opts(show_legend=False)
        voltage_curves[label] = curve
    else:
        print(f"[{label} empty]")
NdLayout_voltage_curves = hv.NdLayout(voltage_curves, kdims='label').cols(3)
palette = 'Spectral'
NdLayout_voltage_curves.opts(
    hv.opts.Curve(color=hv.Palette(palette), tools=['hover']),
    hv.opts.NdOverlay(shared_axes=False),
    hv.opts.NdLayout(title="Voltage Curves"),
)<jupyter_output><empty_output><jupyter_text>Making and saving cycles to html and pickle for later use<jupyter_code>cell_id = b.experiment.cell_names[0]
c = b.experiment.data[cell_id]
cycle = [1,2, 10, 20]

curves = c.get_cap(cycle=cycle, label_cycle_number=True, interpolated=True, number_of_points=100)
curves_fig = hv.Curve(curves, kdims="capacity", "cycle", vdims=["voltage", "cycle"]).groupby("cycle").overlay()#.opts(show_legend=False)
curves_fig
fig_label = f"{{cookiecutter.session_id}}_{cell_id}_curves_evolution"

# export to html:
hv.save(
    curves_fig,
    f"out/{fig_label}.html",
    toolbar=True
)

# save as pickle (can be loaded in other notebooks)
Pickler.save(curves_fig, f"out/{fig_label}.hvz",)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13804923652228107, 'fraction_numerical': 0.009971953879713306, 'mean_word_length': 6.246049661399549, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '161640', 'license': 'MIT', 'n_tokens_mistral': 1171, 'n_tokens_neox': 1125, 'n_words': 260, 'path': '{{cookiecutter.experiment_folder_name}}/03_{{cookiecutter.notebook_name}}_cycles.ipynb', 'repo_name': 'jepegit/cookie_cellpy', 'size': '3209'}