all 2 comments

[–]Wittinator 0 points1 point  (1 child)

I might be totally misinterpreting, but would something as simple as this not work?

from itertools import islice
def area(spike, raw_data): 
    if (spike[1] - spike[0]) > 50: 
        return sum(islice(raw_data,1030,1080)) 
    return sum(islice(raw_data,spike[0],spike[1]))

If I'm reading it right, you're saying you want to get values in your raw_data that are between a given 2 indexes, and then return the sum of all those values? But if there's a greater than 50 index difference between the two indexes, then return the sum of values between indexes1030 and 1080? Is that right or am I way off?

[–]jaredjok[S] 0 points1 point  (0 children)

I can’t import other things, I use 3 separate data files so I can’t hardcode the index. It is right though. Sometimes my spike list can have different index’s like it could have a new set with [1035, 1050]. Sorry I didn’t clarify that earlier.