ellc icon indicating copy to clipboard operation
ellc copied to clipboard

flux-weighted RVs fail if period is exactly 1.0

Open kecnry opened this issue 5 years ago • 2 comments

Using ellc 1.8.5 on Python 2 or 3.

The example in the API docs with a period of 1.5, works:

import ellc
import numpy as np
import matplotlib.pyplot as plt
period = 1.5 
phase = np.arange(-0.25,0.75, 0.001)
time = phase*period
frv1,frv2 = ellc.rv(time,radius_1=0.1,radius_2=0.05,sbratio=0.2,
                    incl=89.95,q=0.5,a=10,ld_1='quad',ldc_1=[0.65,0.2],ld_2='lin',
                    ldc_2=0.45,t_zero=0, period=period,flux_weighted=True)
rv1,rv2 = ellc.rv(time,radius_1=0.1,radius_2=0.05,sbratio=0.2,
                  incl=89.95,q=0.5,a=10,ld_1='quad',ldc_1=[0.65,0.2],ld_2='lin',
                  ldc_2=0.45,t_zero=0, period=period,flux_weighted=False)
plt.plot(phase,frv1)
plt.plot(phase,frv2)
plt.plot(phase,rv1,'--')
plt.plot(phase,rv2,':')
plt.show()

ellc_1 5

but switching the period to 1.0 gives arrays filled with 8.98846567e+307 for frv1 and frv2 (rv1 and rv2 from flux_weighted=False seem fine):

ellc_1 0

periods of 0.99999 or 1.00001 are fine, as are other integers.

kecnry avatar Apr 20 '20 16:04 kecnry

Thanks for the bug report but this will not be fixed. There are no in the binaries universe with an orbital period of exactly 1 day, so specifying P=1 means the user is trying to use phase units to calculate the radial velocity. This will not work because the stellar masses are calculated from P and a via's Kepler's law. The documentation is not very clear on this point so I will leave this issue open for now to remind me to update it "soon".

pmaxted avatar Apr 20 '20 16:04 pmaxted

Ok, thanks for the explanation! I can easily work around it, but it had me stumped for a while thinking I was doing something else wrong. So a note in the docs or raising an error when using 1 day would help!

kecnry avatar Apr 20 '20 16:04 kecnry