assert (set(df['tape'].values) == set([113, 114, 115, 111])) assert (set(tapedf.keys()) == set([113, 114, 115, 111])) # # Bigrams and randomisations test # # Define the **sequences** # In[4]: ## parameters and settings Dt = 0.3 Dtint = (float('-inf'), Dt) ## define the sequences sequencesList0 = aa.dfDict2listOfSeqs(tapedf, Dt=Dtint, l='call', time_param='ici') ## filter out isolated calls (sequences of size one) sequencesList = [l for l in sequencesList0 if len(l) > 1] seqO = mysts.sequenceBigrams(sequencesList) def test_seqO(): assert (len(seqO.seqOfSeqs) == 71) assert (seqO.callCounts['129'] == 89) # **Bigrams**, counts and probabilities # In[5]:
Nsh = 1000 pc = 0.05 ## labels for the calls calls = [1.0, 2.0, 3.0, 4.0] # if item[1] > minCalls] sampsLi = calls[:] + ["_end"] # None #[ 'A', 'B', 'C', 'E', '_ini','_end'] condsLi = calls[:] + ["_ini"] # remove sequences with cs = -1 rmNodes = list(set(df[call_label]) - set(calls)) + [-1.0] # nodes to remove from network # minBigrams = 3 ### define sequence object # sequences sequencesList0 = aa.dfDict2listOfSeqs(tape_df, Dt=Dtint, l=call_label, time_param=time_param) # filter out isolated calls (sequences of size one) sequencesList = [l for l in sequencesList0 if len(l) > 1] # object seqO = myst.sequenceBigrams(sequencesList) # In[52]: def test_seqO(): assert len(seqO.seqOfSeqs) == 2027 np.testing.assert_array_almost_equal(seqO.callCounts[2.0], 345)
assert set(df["tape"].values) == set([113, 114, 115, 111]) assert set(tapedf.keys()) == set([113, 114, 115, 111]) # # Bigrams and randomisations test # # Define the **sequences** # In[4]: ## parameters and settings Dt = 0.3 Dtint = (None, Dt) ## define the sequences sequencesList0 = aa.dfDict2listOfSeqs(tapedf, Dt=Dtint, l="call", time_param="ici") ## filter out isolated calls (sequences of size one) sequencesList = [l for l in sequencesList0 if len(l) > 1] seqO = mysts.sequenceBigrams(sequencesList) def test_seqO(): assert len(seqO.seqOfSeqs) == 71 assert seqO.callCounts["129"] == 89 # **Bigrams**, counts and probabilities # In[5]: