#python 3.6.3
import numpy as np
time_C0002A/1000
array([[-0.99925 ],
[-0.99925 ],
[-0.99925 ],
...,
[ 0.0181095],
[ 0.0195675],
[ 0.0205931]])
Fs_log = 1 / np.diff(time_C0002A/1000)
When I enter it in to see what it returns, it is given as an empty array
Fs_log
array([], shape=(9063,0), dtype = float64)
I am expecting an array to be returned and have confirmed with a different example, any idea what could be occurring and how I should remedy this? i believe it is an issue with the axis along which diff is taken but I am not sure what it should be defined as, example:
np.diff(time_C0002A/1000, axis = 0)
But I am not sure? Input appreciated!
Your time_C0002A array has a shape of (n,1). np.diff take the difference over the last axis by default, in your case of length 1. You can specify the axis as an argument.
np.diff(time_C0002A/1000, axis=0)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With