In [14]:
from scipy.io import loadmat, whosmat
import numpy as np
import matplotlib.pyplot as plt
import json

with open('./nasa-battery-data-python/B0005_charge.json') as f_charge:    
    charge_data = json.load(f_charge)
    
for cycle in charge_data.keys():
    plt.plot(charge_data[cycle]["time"], charge_data[cycle]["voltage_battery"], '-')
    #plt.plot(discharge_data[cycle]["time"], discharge_data[cycle]["voltage_battery"], '-')
    plt.ylabel('Voltage')
    plt.xlabel('Time (s)')
    plt.ylim(3,4.5)
    plt.xlim(0,4000)
plt.show()



In [15]:
with open('./nasa-battery-data-python/B0005_discharge.json') as f_discharge:    
    discharge_data = json.load(f_discharge)
    
for cycle in discharge_data.keys():
    plt.plot(discharge_data[cycle]["time"], discharge_data[cycle]["voltage_battery"], '-')
    plt.ylabel('Voltage')
    plt.xlabel('Time (s)')
    plt.ylim(3,4.5)
    plt.xlim(0,4000)
plt.show()



In [40]:
plt.plot(discharge_data['1']["time"], discharge_data['1']['voltage_battery'], '-')
plt.ylabel('Voltage')
plt.xlabel('Time (s)')
plt.ylim(3,4.5)
plt.xlim(0,4000)
plt.show()



In [47]:
plt.plot(discharge_data['1']["time"], discharge_data['1']["current_battery"], '-')
plt.ylabel('Voltage')
plt.xlabel('Time (s)')
#plt.ylim(3,4.5)
#plt.xlim(0,4000)
plt.show()



In [61]:
plt.plot(charge_data['2']["time"], charge_data['2']['voltage_battery'], '-')
plt.plot([x+charge_data['2']["time"][-1] for x in discharge_data['3']["time"]], discharge_data['3']['voltage_battery'], '-')
plt.ylabel('Voltage')
plt.xlabel('Time (s)')
plt.ylim(3,4.5)
plt.show()



In [54]:
charge_data['2']["time"][-1]


Out[54]:
10516.0

In [59]:
discharge_data['3']["time"]


Out[59]:
[0.0,
 16.672,
 35.703,
 53.828,
 71.891,
 90.047,
 108.313,
 126.391,
 144.625,
 162.719,
 180.953,
 199.016,
 217.297,
 235.469,
 253.735,
 271.813,
 290.063,
 308.266,
 326.422,
 344.594,
 362.782,
 381.016,
 399.25,
 417.422,
 435.563,
 453.75,
 472.032,
 490.328,
 508.516,
 526.641,
 544.891,
 563.078,
 581.235,
 599.5,
 617.703,
 636.032,
 654.172,
 672.344,
 690.547,
 708.844,
 727.047,
 745.266,
 763.703,
 782.0,
 800.25,
 818.563,
 836.953,
 855.344,
 873.578,
 891.828,
 910.25,
 928.625,
 947.0,
 965.344,
 983.688,
 1002.0,
 1020.344,
 1038.703,
 1057.078,
 1075.422,
 1093.75,
 1112.063,
 1130.485,
 1148.75,
 1167.094,
 1185.438,
 1203.875,
 1222.172,
 1240.563,
 1259.094,
 1277.453,
 1295.844,
 1314.391,
 1332.766,
 1351.235,
 1369.688,
 1388.141,
 1406.61,
 1425.188,
 1443.703,
 1462.282,
 1480.672,
 1499.203,
 1517.766,
 1536.313,
 1554.828,
 1573.422,
 1591.969,
 1610.532,
 1629.235,
 1647.844,
 1666.5,
 1685.094,
 1703.719,
 1722.344,
 1741.016,
 1759.703,
 1778.36,
 1796.969,
 1815.625,
 1834.297,
 1852.953,
 1871.657,
 1890.313,
 1909.172,
 1927.875,
 1946.672,
 1965.407,
 1984.188,
 2002.907,
 2021.625,
 2040.36,
 2059.078,
 2077.86,
 2096.641,
 2115.688,
 2134.594,
 2153.563,
 2172.407,
 2191.25,
 2210.11,
 2228.938,
 2247.953,
 2266.875,
 2286.0,
 2305.032,
 2323.985,
 2342.907,
 2362.016,
 2381.125,
 2400.078,
 2419.063,
 2438.078,
 2457.172,
 2476.266,
 2495.36,
 2514.438,
 2533.438,
 2552.516,
 2571.578,
 2590.735,
 2609.813,
 2628.969,
 2648.266,
 2667.516,
 2686.735,
 2706.047,
 2725.328,
 2744.703,
 2763.907,
 2783.047,
 2802.344,
 2821.641,
 2840.922,
 2860.407,
 2879.766,
 2899.141,
 2918.438,
 2937.922,
 2957.407,
 2976.813,
 2996.188,
 3015.641,
 3035.094,
 3054.578,
 3074.016,
 3093.532,
 3113.094,
 3132.641,
 3152.235,
 3171.766,
 3191.25,
 3210.703,
 3230.375,
 3250.032,
 3269.688,
 3289.532,
 3309.188,
 3328.828,
 3348.735,
 3368.688,
 3388.735,
 3408.75,
 3428.719,
 3448.797,
 3468.953,
 3489.219,
 3509.61,
 3529.828,
 3550.157,
 3570.453,
 3590.797,
 3611.172,
 3631.438,
 3651.875,
 3672.344]

In [ ]: