@@ -578,6 +578,8 @@ def do_qualify_reinjections(self, line):
578
578
)
579
579
580
580
# keep only those that matched both for now
581
+
582
+ df_all ["redundant" ] = False
581
583
df = df_all [ df_all ._merge == "both" ]
582
584
583
585
df .to_excel ("temp.xls" )
@@ -630,7 +632,6 @@ def _print_reinjection_comparison(original_packet, reinj):
630
632
# df["best_reinjection"] = np.nan # or -1
631
633
632
634
# mark the
633
- df ["redundant" ] = False
634
635
635
636
# print(df.columns)
636
637
@@ -643,7 +644,7 @@ def _print_reinjection_comparison(original_packet, reinj):
643
644
# print("successful reinjections" % len(reinjected_in))
644
645
645
646
# select only packets that have been reinjected
646
- reinjected_packets = sender_df .dropna (axis = 'index' , subset = [ _sender ("reinjected_in " ) ])
647
+ reinjected_packets = sender_df .dropna (axis = 'index' , subset = [ _sender ("reinjection_of " ) ])
647
648
648
649
print ("%d reinjected packets" % len (reinjected_packets ))
649
650
@@ -655,25 +656,45 @@ def _print_reinjection_comparison(original_packet, reinj):
655
656
for row in reinjected_packets .itertuples ():
656
657
# here we look at all the reinjected packets
657
658
658
- print ("full row %r" % (row ,))
659
+ # print("full row %r" % (row,))
659
660
660
661
# if there are packets in _receiver(reinjected_in), it means the reinjections
661
662
# arrived before other similar segments and thus these segments are useless
662
663
# it should work because
663
- useless_reinjections = getattr (row , _receiver ("reinjected_in" ), [])
664
+ # useless_reinjections = getattr(row, _receiver("reinjected_in"), [])
664
665
665
- print ("useless_reinjections listing %r" % (useless_reinjections ,))
666
- try :
667
- useless_reinjections = [] if math .isnan (useless_reinjections ) else useless_reinjections
668
- except TypeError as e :
669
- # This value cannot be a list.
670
- pass
666
+ # if it was correctly mapped
667
+ # row._merge doesn't exist ?
668
+ if row ._1 != "both" :
669
+ # TODO count missed classifications ?
670
+ log .debug ("reinjection %d could not be mapped, giving up..." % (row .packetid ))
671
+ continue
672
+
673
+ initial_packetid = row .reinjection_of [0 ]
674
+ # print("initial_packetid = %r %s" % (initial_packetid, type(initial_packetid)))
675
+
676
+ #
677
+ original_packet = df_all .loc [ df_all .packetid == initial_packetid ].iloc [0 ]
678
+
679
+ if original_packet ._merge != "both" :
680
+ # TODO count missed classifications ?
681
+ log .debug ("Original packet %d could not be mapped, giving up..." % (original_packet .packetid ))
682
+ continue
683
+
684
+
685
+ orig_arrival = getattr (original_packet , _receiver ("reltime" ))
686
+ reinj_arrival = getattr (row , _receiver ("reltime" ))
687
+
688
+
689
+ # print("useless_reinjections listing %r" % (useless_reinjections,))
690
+
691
+ # for reinjection_pktid in useless_reinjections:
692
+ # print("looking at receiver_pktid= %r %s" % (reinjection_pktid, type(reinjection_pktid)))
671
693
672
- print ("useless_reinjections listing %r" % (useless_reinjections ,))
673
694
674
- for reinjection_pktid in useless_reinjections :
675
- print ("looking at receiver_pktid= %r %s" % ( reinjection_pktid , type ( reinjection_pktid )) )
676
- sender_df .loc [ sender_df [ _receiver ("packetid" )] == reinjection_pktid , "redundant" ] = True
695
+ if orig_arrival < reinj_arrival :
696
+ print ("GOT A MATCH" )
697
+ sender_df .loc [ sender_df [ _sender ("packetid" )] == row . packetid , "redundant" ] = True
677
698
678
699
679
700
print ("results: " , df [ df .redundant == True ] )
@@ -702,11 +723,7 @@ def _print_reinjection_comparison(original_packet, reinj):
702
723
# loc ? this is an array, sort it and take the first one ?
703
724
# initial_packetid = getattr(row, _sender("reinjection_of")),
704
725
initial_packetid = row .reinjection_of [0 ]
705
- # getattr(row, _sender("reinjection_of")),
706
- # print("initial_packetid = %r %s" % (row.reinjection_of, type(row.reinjection_of)))
707
726
print ("initial_packetid = %r %s" % (initial_packetid , type (initial_packetid )))
708
- # print("initial_packetid = %r" % (initial_packetid[0]))
709
- # packet 892 is a successful_reinjection of 627. It arrived at 1529916731.5988212 to compare with Series([], Name: abstime_receiver, dtype: float64) while being transmitted at 1529916731.5480695 to compare with Series([], Name: abstime, dtype: float64)
710
727
711
728
original_packet = df_all .loc [ df_all .packetid == initial_packetid ].iloc [0 ]
712
729
print ("original packet = %r %s" % (original_packet , type (original_packet )))
0 commit comments