<commit_before>__all__=[
    'initialize_data',
    'report_data',
    'plot_data',
    'open_file_in_write_mode',
]

from matplotlib import pyplot
from numpy import array,append

def initialize_data():
    return {
        'time'   :array([],dtype=float),
        'current':array([],dtype=float),
        'voltage':array([],dtype=float),
    }

def report_data(data,time,dev):
    data['time'   ]=append(data['time'   ],time                )
    data['current']=append(data['current'],device.get_current())
    data['voltage']=append(data['voltage'],device.get_voltage())

def plot_data(data):
    time   =data['time'   ]
    current=data['current']
    voltage=data['voltage']
    plot_linewidth=3
    label_fontsize=20
    f,axarr=pyplot.subplots(2,sharex=True,figsize=(16,12))
    axarr[0].plot(time,current,lw=plot_linewidth)
    axarr[0].set_ylabel(r'$\mathrm{Current\  [A]}$',fontsize=label_fontsize)
#    axarr[0].plot(time,1e3*current,lw=plot_linewidth)
#    axarr[0].set_ylabel(r'$\mathrm{Current\ [mA]}$',fontsize=label_fontsize)<commit_msg>fixed typo in python data helpers<commit_after>__all__=[
    'initialize_data',
    'report_data',
    'plot_data',
    'open_file_in_write_mode',
]

from matplotlib import pyplot
from numpy import array,append

def initialize_data():
    return {
        'time'   :array([],dtype=float),
        'current':array([],dtype=float),
        'voltage':array([],dtype=float),
    }

def report_data(data,time,device):
    data['time'   ]=append(data['time'   ],time                )
    data['current']=append(data['current'],device.get_current())
    data['voltage']=append(data['voltage'],device.get_voltage())

def plot_data(data):
    time   =data['time'   ]
    current=data['current']
    voltage=data['voltage']
    plot_linewidth=3
    label_fontsize=20
    f,axarr=pyplot.subplots(2,sharex=True,figsize=(16,12))
    axarr[0].plot(time,current,lw=plot_linewidth)
    axarr[0].set_ylabel(r'$\mathrm{Current\  [A]}$',fontsize=label_fontsize)
#    axarr[0].plot(time,1e3*current,lw=plot_linewidth)
#    axarr[0].set_ylabel(r'$\mathrm{Current\ [mA]}$',fontsize=label_fontsize)
{'fraction_non_alphanumeric': 0.17489421720733428, 'fraction_numerical': 0.013164080865068171, 'mean_word_length': 4.6, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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}}
{'dir': 'git-commits-cleaned', 'id': '3195594', 'n_tokens_mistral': 782, 'n_tokens_neox': 760, 'n_words': 88}