I have an excel sheet of data points in excel that represent how far something moves relative to an origin point. Negative numbers are before the origin and positive are after the organism meets that point and continues moving. I would imagine that I would need to create a loop that goes from one number to the next subtracting it from the previous number.
After I have the differences in the distances want to
EX Data:
0.0003
0.0032
0.0021
0.0012
So far I have imported the data and defined moving and stopped.
#import dataset
geckomove=numpy.loadtxt(open("SMgecko.csv","rb"),delimiter=",")
#find array size: 427 data points in column
g=geckomove.shape
print(g) # moving=0 stopped=0
Not really clear how the values relate to frames, but taking a simple example, this would give you the difference between each value
import numpy
arr = numpy.array([
0.0003,
0.0032,
0.0021,
0.0012])
# Offset the values
arr2 = arr[1:]
arr2 = numpy.concatenate((arr2, numpy.array([0]))) # probably better way to do this
arr3 = arr2 - arr
print(arr3[:-1]) # [ 0.0029 -0.0011 -0.0009]
Meaning, between first and second value, there was a 0.0029
difference, then down 0.0011
between the next two, and so-forth.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.