<jupyter_start><jupyter_text>plot the interspike interval<jupyter_code>import matplotlib as mpl
mpl.rcParams['axes.linewidth'] = 0.5 #set the value globally
mpl.rcParams['xtick.major.width'] = 0.5
mpl.rcParams['ytick.major.width'] = 0.5
mpl.rcParams['axes.titlesize'] = 10
mpl.rcParams['axes.labelsize'] = 8
mpl.rcParams["lines.linewidth"] = 0.5

mpl.rc('font',**{'family':'sans-serif','serif':['Arial']})
mpl.rcParams['pdf.fonttype'] = 42
pal = {'FirstVisit/': '#ff9966' , 'Later7thVisit/': '#acc568' , 'Later20thVisit/': '#7bc368'}
kwargs = {'palette': pal 
          ,'hue_order': ['FirstVisit/', 'Later7thVisit/', 'Later20thVisit/']}
color = ['#ff9966' , '#acc568' , '#7bc368']
outpath = r"../dataFolders/PaperPipelineOutput/Figures/v3/Paper/"
shapes = ['c-1_', 'c-2_', 'c-3_', 'c-10_']
visitnum = ['FirstVisit/','Later7thVisit/' , 'Later20thVisit/']
ISI = np.concatenate(result.InterSweepInterval)
std = np.std(ISI*1/100)
stdFreq = 1/std


q25 = 1/np.quantile(ISI*1/100, .25)
q50 = 1/np.quantile(ISI*1/100, .50)
q75 = 1/np.quantile(ISI*1/100, .75)

stdFreq, q25, q75, q50
med_ISI = np.quantile(ISI*1/100, .50)
med_ISI
f, ax = plt.subplots(3, 4,
                     sharex = True, sharey = True,
                    figsize = (7,7/4*3))
# ax = ax.ravel()

r = 0
for visit, df in result.groupby('visitNum', sort = False):
    print(visit)
    c = 0
    for flowers, subdf in df.groupby('flower', sort = False):
        print(flowers)
        sl = subdf.loc[:, ['mothname', 'InterSweepInterval']]
#         axNum = r + c
        ax[r,c].eventplot(positions = sl.InterSweepInterval.values*1/100,
                      orientation = 'horizontal'
                     , linelengths = 1
                     , lineoffsets = 0.5
                         , linewidth = 0.5)
        ax[r,c].set_title(visit + '_' + flowers)
        c+=1
    r+=1
#         ticklocs = np.arange(len(sl))
#         plt.yticks(locs =  ticklocs
#                    ,labels = sl.mothname)

f.text(0.525, 0.07, 'Time (second)', ha='center')
f.text(0.09, 0.5, 'Moth Number', va='center', rotation='vertical')
plt.savefig(r"../dataFolders/PaperPipelineOutput/Figures/v3/Paper/" + 'InterSweepInterval.pdf')<jupyter_output>FirstVisit/
c-10
c-1
c-2
c-3
Later7thVisit/
c-10
c-1
c-2
c-3
Later20thVisit/
c-10
c-1
c-2
c-3<jupyter_text>test values of one eventplot<jupyter_code>test = result[(result.flower == 'c-1') & (result.visitNum == 'FirstVisit/')].InterSweepInterval.values
print(test)
f =plt.figure(figsize = (20,6))
plt.eventplot(test,
             linelengths = 1,
             lineoffsets = 1)
allValues = np.concatenate(result.InterSweepInterval.values)

f = plt.figure(figsize = (7/4, 7/4))
v, binEdges, _ = plt.hist(allValues*1/100, bins = 70)

plt.axvline(x = med_ISI)
plt.xlim(0, 8)
plt.ylabel('Count')
plt.xlabel('Time (sec)')

ax = f.add_axes([0.6,0.5,0.2,0.3])
_,_,_ = ax.hist(allValues*1/100, bins = 70)

plt.savefig(r"../dataFolders/PaperPipelineOutput/Figures/v3/Paper/InterSweepIntervalAllTogetherHist_v1.pdf")
f, ax = plt.subplots(4, 1, figsize = (3.5, 3.5*3), sharex = True
#                      , sharey = True
                    )
ff = 0
for flower, df in result.groupby('flower', sort = False):
    print(flower, f)
    c = 0
    for visit, subdf in df.groupby('visitNum', sort = False):
        isi = np.concatenate(subdf.InterSweepInterval.values*1/100)
        ax[ff].hist(isi
                   , bins = binEdges
                   ,label = visit
                   , alpha = 0.6
#                 , density = True
                  , histtype = 'stepfilled'
                  , color = color[c])
        
        print(visit)
        c+=1
    ax[ff].legend()
    ax[ff].set_title(flower)
    ax[ff].set_xlim(0,8)
    ff+=1

f.text(0.525, 0.07, 'Time (second)', ha='center')
f.text(0.01, 0.5, 'Count', va='center', rotation='vertical')
plt.savefig("../dataFolders/PaperPipelineOutput/Figures/v3/" + 'InterSweepIntervalHistogram.png')<jupyter_output>c-10 Figure(252x756)
FirstVisit/
Later7thVisit/
Later20thVisit/
c-1 Figure(252x756)
FirstVisit/
Later7thVisit/
Later20thVisit/
c-2 Figure(252x756)
FirstVisit/
Later7thVisit/
Later20thVisit/
c-3 Figure(252x756)
FirstVisit/
Later7thVisit/
Later20thVisit/
{'fraction_non_alphanumeric': 0.1712312455346511, 'fraction_numerical': 0.05977613717551798, 'mean_word_length': 2.903345724907063, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '523229', 'license': 'MIT', 'n_tokens_mistral': 1849, 'n_tokens_neox': 1630, 'n_words': 287, 'path': 'PaperPinelineCodes/4b-InterSweepInterval.ipynb', 'repo_name': 'TanviDeora/ProboscisTracking', 'size': '4199'}