Check the contents of the arr. I am thinking there are two P and S arrivals and it is plotting them both.
Here is my arrivals list for a local quake. I ended up taking the first P and S. I also have some code to take the average value if I find it is a better match to the waveform. In most cases, the first arrival works.
5 arrivals
P phase arrival at 34.768 seconds
P phase arrival at 37.076 seconds
P phase arrival at 37.503 seconds
P phase arrival at 38.355 seconds
P phase arrival at 38.846 seconds
5 arrivals
S phase arrival at 61.310 seconds
S phase arrival at 64.162 seconds
S phase arrival at 64.909 seconds
S phase arrival at 66.208 seconds
S phase arrival at 67.056 seconds
Thanks for the quick reply, that appears to be the issue as the console prints the below text
P phase arrival at 334.316 seconds
P phase arrival at 337.612 seconds
P phase arrival at 337.873 seconds
S phase arrival at 607.074 seconds
S phase arrival at 616.727 seconds
S phase arrival at 616.823 seconds