I had a lot of issues trying to solve the problem with my plot of omega vs time, since the angle returned from the arctan function jumps up to a positive value. I tried adding 2*pi so that it returns to the first quadrant, but to no avail (from the answer to using arctan / arctan2 to plot a from 0 to 2π). I then tried making all the items in the array negative so that it continues on but I'm not sure what the issue is: arctan plot returns values that jump discontinuously I also tried using arctan2, math.atan, math.atan2
h = h5py.File("Waveforms/BBH0001/rhOverM_Asymptotic_GeometricUnits.h5", "r")
data = h['Extrapolated_N2.dir/Y_l2_m1.dat']
I had to define a function because of the error I got when trying to find the arctan of an array, and then vectorize iy
def f(z):
return np.int(math.degrees(np.arctan(z)))
f2 = np.vectorize(f)
z = data[:,2]/data[:,1]
a = f2(z)
This part of code might look painful for some of you. I tried using a lot of different methods to solve the issue
i = 1
for i in xrange(len(z)):
if a[i] > (a[i-1] + 10):
b = [-x for x in a]
plt.plot(data[:,0], b, label='w')