Skip to content

Commit

Permalink
more float conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle Pearson committed Sep 17, 2024
1 parent 904904d commit 3d8152f
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions exotic/api/ephemeris.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ def plot_periodogram(self, minper=0, maxper=0, minper2=0, maxper2=0):
si = np.argsort(self.epochs)

if minper == 0:
minper = max(3, 2 * np.diff(self.epochs[si]).min())
minper = max(3, 2. * np.diff(self.epochs[si]).min())
if maxper == 0:
maxper = (np.max(self.epochs) - np.min(self.epochs)) * 3.

Expand All @@ -368,8 +368,8 @@ def plot_periodogram(self, minper=0, maxper=0, minper2=0, maxper2=0):
# create basis vectors for Tn = T0 + n*P + Asin(wn) + Bcos(wn)
basis = np.ones((4, len(self.epochs)))
basis[1] = self.epochs
basis[2] = np.sin(2 * np.pi * self.epochs / per)
basis[3] = np.cos(2 * np.pi * self.epochs / per)
basis[2] = np.sin(2. * np.pi * self.epochs / per)
basis[3] = np.cos(2. * np.pi * self.epochs / per)

# perform the weighted least squares regression
res_first_order = sm.WLS(self.data, basis.T, weights=1.0 / self.dataerr ** 2).fit()
Expand Down Expand Up @@ -413,10 +413,10 @@ def plot_periodogram(self, minper=0, maxper=0, minper2=0, maxper2=0):
# create basis vectors for second order solution
basis = np.ones((6, len(self.epochs)))
basis[1] = self.epochs
basis[2] = np.sin(2 * np.pi * self.epochs / per)
basis[3] = np.cos(2 * np.pi * self.epochs / per)
basis[4] = np.sin(2 * np.pi * self.epochs / per2)
basis[5] = np.cos(2 * np.pi * self.epochs / per2)
basis[2] = np.sin(2. * np.pi * self.epochs / per)
basis[3] = np.cos(2. * np.pi * self.epochs / per)
basis[4] = np.sin(2. * np.pi * self.epochs / per2)
basis[5] = np.cos(2. * np.pi * self.epochs / per2)

# perform the weighted least squares regression
res_second_order = sm.WLS(self.data, basis.T, weights=1.0 / self.dataerr ** 2).fit()
Expand Down Expand Up @@ -478,8 +478,8 @@ def plot_periodogram(self, minper=0, maxper=0, minper2=0, maxper2=0):
# super sample fourier solution for first order
xnew = np.linspace(self.epochs.min(), self.epochs.max(), 1000)
basis_new = np.ones((2, len(xnew)))
basis_new[0] = np.sin(2 * np.pi * xnew / per)
basis_new[1] = np.cos(2 * np.pi * xnew / per)
basis_new[0] = np.sin(2. * np.pi * xnew / per)
basis_new[1] = np.cos(2. * np.pi * xnew / per)
y_bestfit_new = np.dot(basis_new.T, coeffs_first_order[2:]) # reconstruct signal

# plot first order fourier solution
Expand All @@ -503,10 +503,10 @@ def plot_periodogram(self, minper=0, maxper=0, minper2=0, maxper2=0):
# super sample fourier solution for second order
xnew = np.linspace(self.epochs.min(), self.epochs.max(), 1000)
basis_new = np.ones((4, len(xnew)))
basis_new[0] = np.sin(2 * np.pi * xnew / per)
basis_new[1] = np.cos(2 * np.pi * xnew / per)
basis_new[2] = np.sin(2 * np.pi * xnew / per2)
basis_new[3] = np.cos(2 * np.pi * xnew / per2)
basis_new[0] = np.sin(2. * np.pi * xnew / per)
basis_new[1] = np.cos(2. * np.pi * xnew / per)
basis_new[2] = np.sin(2. * np.pi * xnew / per2)
basis_new[3] = np.cos(2. * np.pi * xnew / per2)
y_bestfit_new2 = np.dot(basis_new.T, coeffs_second_order[2:]) # reconstruct signal

# plot first order fourier solution
Expand All @@ -525,8 +525,8 @@ def plot_periodogram(self, minper=0, maxper=0, minper2=0, maxper2=0):
# plot phase folded signal for first order solution
xnew = np.linspace(0, per, 1000)
basis_new = np.ones((2, len(xnew)))
basis_new[0] = np.sin(2 * np.pi * xnew / per)
basis_new[1] = np.cos(2 * np.pi * xnew / per)
basis_new[0] = np.sin(2. * np.pi * xnew / per)
basis_new[1] = np.cos(2. * np.pi * xnew / per)
y_bestfit_new = np.dot(basis_new.T, coeffs_first_order[2:]) # reconstruct signal
xnewphase = xnew / per % 1
si = np.argsort(xnewphase)
Expand Down

0 comments on commit 3d8152f

Please sign in to comment.