hpparvi / pytransit Goto Github PK
View Code? Open in Web Editor NEWFast and easy exoplanet transit light curve modelling.
License: GNU General Public License v2.0
Fast and easy exoplanet transit light curve modelling.
License: GNU General Public License v2.0
The Gimenez transit model needs to be brought back for v 2.
PyTransit/notebooks/01_broadband_parameter_estimation.ipynb
Python 3.8.5
TypingError: Failed in nopython mode pipeline (step: nopython frontend)
non-precise type array(pyobject, 0d, C)
During: typing of argument at /var/folders/39/hmv9hpy10cg6cx015773lbtw0000gn/T/ipykernel_1807/3291592562.py (3)
File "../../../../var/folders/39/hmv9hpy10cg6cx015773lbtw0000gn/T/ipykernel_1807/3291592562.py", line 3:
The computation of the stellar oblateness f in pytransit/models/numba/gdmodel.py assumes a density computed from a spherical star:
rho = M_star * (4/3 * pi * R_star**3)
to simplify the original expression of f:
f = w**2 * R_star**3 / (2 * G * M_star)
One can however include the stellar oblateness in the expression of the density:
rho = M_star * (4/3 * pi * R_star**3 * (1-f))
and then solve the resulting quadratic equation in f that gives a single possible value:
f = 0.5 * (1 - sqrt(1 - 3.*w*w / (2.*G*pi*rho)))
that should be returned by the stellar_oblateness(w, rho)
function.
Of course, for slow rotators, w << 1
=> f ~ 3.*w*w/(8.*G*pi*rho)
, which is the current implementation.
Describe the bug
After gitclone
and executed python setup.py
, I got below message.
In [1]: import pytransit
/home/nishiumi/.conda/envs/py35/lib/python3.6/site-packages/llvmlite/binding/ffi.py:138: UserWarning: Module pytransit was already imported from /home/nishiumi/.conda/envs/py35/lib/python3.6/site-packages/PyTransit-2.0-py3.6.egg/pytransit/__init__.py, but /home/nishiumi/PyTransit is being added to sys.path
from pkg_resources import resource_filename
/home/nishiumi/.conda/envs/py35/lib/python3.6/site-packages/numba/compiler.py:602: NumbaPerformanceWarning:
The keyword argument 'parallel=True' was specified but no transformation for parallel execution was possible.
To find out why, try turning on parallel diagnostics, see http://numba.pydata.org/numba-doc/latest/user/parallel.html#diagnostics for help.
File "../.conda/envs/py35/lib/python3.6/site-packages/PyTransit-2.0-py3.6.egg/pytransit/orbits/orbits_py.py", line 168:
@njit("f8[:](f8[:], f8, f8, f8, f8)", parallel=True)
def ta_newton_v(t, t0, p, e, w):
^
self.func_ir.loc))
/home/nishiumi/.conda/envs/py35/lib/python3.6/site-packages/numba/compiler.py:602: NumbaPerformanceWarning:
The keyword argument 'parallel=True' was specified but no transformation for parallel execution was possible.
To find out why, try turning on parallel diagnostics, see http://numba.pydata.org/numba-doc/latest/user/parallel.html#diagnostics for help.
File "../.conda/envs/py35/lib/python3.6/site-packages/PyTransit-2.0-py3.6.egg/pytransit/orbits/orbits_py.py", line 176:
@njit("f8[:](f8[:],f8,f8,f8,f8)", parallel=True)
def ta_iter_v(t, t0, p, e, w):
^
self.func_ir.loc))
Desktop (please complete the following information):
The Gimenez transit model needs to be brought back for v 2.
Hi Hannu,
Since I upgraded pytransit I have problems with k2ps:
---> 22 from k2ps.psearch import TransitSearch
23 from scipy.ndimage import binary_dilation
24 from pytransit import MandelAgol as MA
~/.local/lib/python3.7/site-packages/k2ps/psearch.py in ()
21 from scipy.optimize import minimize
22
---> 23 from pytransit.orbits_f import orbits as of
24 from exotk.utils.orbits import as_from_rhop, i_from_baew
25 from exotk.utils.misc_f import utilities as uf
ModuleNotFoundError: No module named 'pytransit.orbits_f'
Some of the values in the light curve are nans when evaluating the following:
from pytransit import GravityDarkenedModel
rstar = 1.661671
k = [0.08381965]
rho = 0.375759167
rperiod = 0.236134363449647
tpole = 7650
phi = 1.3339553017948966
beta = 0.25
ldc = [0.5739341461489451, 0.1268867674944764]
t0 = 0
p = 1.76358769
a = 3.9532587719177115
i = 1.5111688037790845
l = 0.682913618
e = 0
w = np.pi/4
tmo = GravityDarkenedModel(rstar=rstar,sres=100, pres=8,filters=600,model='blackbody',tmax=10500)
t = np.linspace(-2./24,+2./24,1000)
tmo.set_data(t)
lc = tmo.evaluate_ps(k, rho, rperiod, tpole, phi, beta, ldc, t0, p, a, i, l, e, w)
The first instance of a nan appearing seems to be when calculate_luminosity_interpolation_table is executed inside oblate_model_s
Hi...I'am using Fedora 28 and facing with this problem ..note that I'am using Python 3.6....Don't know what to do....
Error: Symbol ‘chunk_size’ at (1) has no IMPLICIT type
error: Command "/usr/bin/gfortran -Wall -g -fno-second-underscore -fPIC -O3 -funroll-loops -DDCHUNK_SIZE=128 -Ibuild/src.linux-x86_64-3.6/build/src.linux-x86_64-3.6/pytransit -I/home/sreenivas/.local/lib/python3.6/site-packages/numpy/core/include -I/usr/include/python3.6m -c -c src/gimenez.f90 -o build/temp.linux-x86_64-3.6/src/gimenez.o -Jbuild/temp.linux-x86_64-3.6/pytransit -Ibuild/temp.linux-x86_64-3.6/pytransit" failed with exit status 1
Describe the bug
Not a bug but I enountered an error while testing a heterogeneous time series set-up during quadratic model evaluation as follows.
To Reproduce
import numpy as np
from pytransit.models.ma_quadratic import QuadraticModel
tm = QuadraticModel()
bands = 'g r i z'.split()
times = [np.linspace(0,1,1000)]*len(bands)
tm.set_data(time = np.concatenate(times),
lcids = [np.zeros_like(t)+n for n,t in enumerate(times)],
pbids = np.arange(len(bands)))
ldcs = np.repeat([0.5,0.5], len(bands)) #wrong assumption but just to test
fluxes_mod = tm.evaluate_ps(0.01, ldcs, 0.5, 2.0, 5.0, np.pi/2, 0, 0)
####################################
TypingError Traceback (most recent call last)
<ipython-input-88-28d7f2fc206b> in <module>
6 pbids = np.arange(len(bands)))
7 ldcs = np.repeat([0.5,0.5], len(bands))
----> 8 fluxes_mod = tm.evaluate_ps(0.01, ldcs, 0.5, 2.0, 5.0, np.pi/2, 0, 0)
~/miniconda3/lib/python3.6/site-packages/pytransit/models/ma_quadratic.py in evaluate_ps(self, k, ldc, t0, p, a, i, e, w, copy)
69 flux = quadratic_model_interpolated(self.time, pvp, ldc, self.lcids, self.pbids, self.nsamples, self.exptimes,
70 self._es, self._ms, self._tae, self.ed, self.ld, self.le,
---> 71 self.kt, self.zt)
72 else:
73 raise NotImplementedError
~/.local/lib/python3.6/site-packages/numba-0.43.1-py3.6-linux-x86_64.egg/numba/dispatcher.py in _compile_for_args(self, *args, **kws)
348 e.patch_message(msg)
349
--> 350 error_rewrite(e, 'typing')
351 except errors.UnsupportedError as e:
352 # Something unsupported is present in the user code, add help info
~/.local/lib/python3.6/site-packages/numba-0.43.1-py3.6-linux-x86_64.egg/numba/dispatcher.py in error_rewrite(e, issue_type)
315 raise e
316 else:
--> 317 reraise(type(e), e, None)
318
319 argtypes = []
~/.local/lib/python3.6/site-packages/numba-0.43.1-py3.6-linux-x86_64.egg/numba/six.py in reraise(tp, value, tb)
656 value = tp()
657 if value.__traceback__ is not tb:
--> 658 raise value.with_traceback(tb)
659 raise value
660
TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Invalid use of Function(<built-in function getitem>) with argument(s) of type(s): (array(int64, 1d, C), array(float64, 1d, C))
* parameterized
In definition 0:
All templates rejected with literals.
In definition 1:
All templates rejected without literals.
In definition 2:
All templates rejected with literals.
In definition 3:
All templates rejected without literals.
In definition 4:
All templates rejected with literals.
In definition 5:
All templates rejected without literals.
In definition 6:
TypeError: unsupported array index type array(float64, 1d, C) in [array(float64, 1d, C)]
raised from /home/muscat/.local/lib/python3.6/site-packages/numba-0.43.1-py3.6-linux-x86_64.egg/numba/typing/arraydecl.py:71
In definition 7:
TypeError: unsupported array index type array(float64, 1d, C) in [array(float64, 1d, C)]
raised from /home/muscat/.local/lib/python3.6/site-packages/numba-0.43.1-py3.6-linux-x86_64.egg/numba/typing/arraydecl.py:71
In definition 8:
All templates rejected with literals.
In definition 9:
All templates rejected without literals.
This error is usually caused by passing an argument of a type that is unsupported by the named function.
[1] During: typing of intrinsic-call at /home/muscat/miniconda3/lib/python3.6/site-packages/pytransit/models/numba/ma_quadratic_nb.py (565)
File "../../../miniconda3/lib/python3.6/site-packages/pytransit/models/numba/ma_quadratic_nb.py", line 565:
def quadratic_model_interpolated(t, pvp, ldc, lcids, pbids, nsamples, exptimes,
<source elided>
ilc = lcids[j]
ipb = pbids[ilc]
^
This is not usually a problem with Numba itself but instead often caused by
the use of unsupported features or an issue in resolving types.
Expected behavior
returns an np.ndarray
Desktop (please complete the following information):
Macintosh:PyTransit geoff$ setup.py config_fc --fcompiler=gnu95 --opt="-Ofast" --f90flags="-cpp -fopenmp -march=native" build
[snip]
building extension "pytransit.utils_f" sources
f2py options: []
f2py:> build/src.macosx-10.10-x86_64-2.7/pytransit/utils_fmodule.c
IOError: [Errno 2] No such file or directory: 'src/utils.f90'. Skipping file "src/utils.f90".
Reading fortran codes...
Post-processing...
Post-processing (stage 2)...
Building modules...
error: f2py target file 'build/src.macosx-10.10-x86_64-2.7/pytransit/utils_fmodule.c' not generated
In the PyTransit/notebooks/tess_examples/WASP-4b.ipynb:
lpf = TESSLPF('WASP-4b', dfile, zero_epoch=zero_epoch.n, period=period.n, nsamples=2, bldur=0.25)
Gives error: ImportError Traceback (most recent call last)
in
----> 1 lpf = TESSLPF('WASP-4b', dfile, zero_epoch=zero_epoch.n, period=period.n, nsamples=2, bldur=0.25)
2
3 tn = int(round((lpf.times[0].mean() - lpf.zero_epoch) / period.n))
4 tc = zero_epoch + tn*period
5
~/.local/lib/python3.6/site-packages/pytransit/lpf/tesslpf.py in init(self, name, dfile, tic, zero_epoch, period, nsamples, trdur, bldur, use_pdc, split_transits, separate_noise, tm, minpt)
139 wnids = arange(len(times)) if separate_noise else None
140 BaseLPF.init(self, name, ['TESS'], times=times, fluxes=fluxes, pbids=pbids,
--> 141 nsamples=nsamples, exptimes=[0.00139], wnids=wnids, tref=tref, tm=tm)
142
143 def _init_lnlikelihood(self):
~/.local/lib/python3.6/site-packages/pytransit/lpf/lpf.py in init(self, name, passbands, times, fluxes, errors, pbids, covariates, wnids, tm, nsamples, exptimes, init_data, result_dir, tref, lnlikelihood)
210 self._init_instrument()
211
--> 212 self._init_lnlikelihood()
213 self._init_baseline()
214 self._post_initialisation()
~/.local/lib/python3.6/site-packages/pytransit/lpf/tesslpf.py in _init_lnlikelihood(self)
142
143 def _init_lnlikelihood(self):
--> 144 self._add_lnlikelihood_model(CeleriteLogLikelihood(self))
145
146 def add_ldtk_prior(teff, logg, z):
~/.local/lib/python3.6/site-packages/pytransit/lpf/loglikelihood/celeriteloglikelihood.py in init(self, lpf, name, noise_ids, fixed_hps)
30 def init(self, lpf, name: str = 'gp', noise_ids=None, fixed_hps=None):
31 if not with_celerite:
---> 32 raise ImportError("CeleriteLogLikelihood requires celerite.")
33
34 self.name = name
ImportError: CeleriteLogLikelihood requires celerite.
I cloned the repository per your README.md and then installed gfortran from https://gcc.gnu.org/wiki/GFortranBinaries, installing gfortran6.3 for my macOS Sierra (10.12) machine.
I then attempted to build PyTransit with the provided command:
$ python setup.py config_fc --fcompiler=gnu95 --opt="-Ofast" --f90flags="-cpp -fopenmp -march=native -mno-avx" build
All was OK until I got many errors due to symbols not being found:
...
/usr/local/bin/gfortran -Wall -g -L/usr/local/lib build/temp.macosx-10.7-x86_64-3.5/build/src.macosx-10.7-x86_64-3.5/pytransit/gimenez_fmodule.o build/temp.macosx-10.7-x86_64-3.5/build/src.macosx-10.7-x86_64-3.5/fortranobject.o build/temp.macosx-10.7-x86_64-3.5/src/gimenez.o build/temp.macosx-10.7-x86_64-3.5/build/src.macosx-10.7-x86_64-3.5/pytransit/gimenez_f-f2pywrappers2.o -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin16/6.3.0 -L/Users/tgreene/anaconda/envs/astro3/lib -lgomp -lm -lgfortran -o build/lib.macosx-10.7-x86_64-3.5/pytransit/gimenez_f.cpython-35m-darwin.so
Undefined symbols for architecture x86_64:
"_GOMP_parallel", referenced from:
___gimenez_MOD_alpha.constprop.6 in gimenez.o
___gimenez_MOD_alpha in gimenez.o
___gimenez_MOD_gimenez_m in gimenez.o
___gimenez_MOD_eval_lerp in gimenez.o
"_PyArg_ParseTupleAndKeywords", referenced from:
_f2py_rout_gimenez_f_gimenez_init_arrays in gimenez_fmodule.o
_f2py_rout_gimenez_f_gimenez_eval_lerp in gimenez_fmodule.o
_f2py_rout_gimenez_f_gimenez_eval in gimenez_fmodule.o
_f2py_rout_gimenez_f_gimenez_gimenez_m in gimenez_fmodule.o
_f2py_rout_gimenez_f_gimenez_alpha in gimenez_fmodule.o
_f2py_rout_gimenez_f_gimenez_jacobi in gimenez_fmodule.o
(etc...)
ld: symbol(s) not found for architecture x86_64
...
The same errors occurred when I tried installing on another Mac running OS X 10.11 and gfortran6.1.
I'd appreciate any help in resolving this.
while installing in my pc i got something like this ..i tried to solve this by installing xgboost..but didn't worked..please help me.....
python setup.py install --user
Traceback (most recent call last):
File "setup.py", line 1, in
from numpy.distutils.core import setup, Extension
ImportError: No module named numpy.distutils.core
Also applies to test_ma.py with call to MandelAgol
Macintosh:tests geoff$ python test_gimenez.py
Traceback (most recent call last):
File "test_gimenez.py", line 33, in test_lerp_basic
f = Gimenez(npol=500, nthr=1, lerp=True)(self.z, self.k, self.u[0])
TypeError: init() got an unexpected keyword argument 'lerp'
Traceback (most recent call last):
File "test_gimenez.py", line 49, in test_lerp_npol
f = Gimenez(npol=100, nthr=1, lerp=True)(self.z, self.k, self.u[0])
TypeError: init() got an unexpected keyword argument 'lerp'
Traceback (most recent call last):
File "test_gimenez.py", line 67, in test_lerp_threading
f = Gimenez(npol=500, nthr=nthr, lerp=True)(self.z, self.k, self.u[0])
TypeError: init() got an unexpected keyword argument 'lerp'
Traceback (most recent call last):
File "test_gimenez.py", line 25, in test_nolerp_basic
f = Gimenez(npol=500, nthr=1, lerp=False)(self.z, self.k, self.u[0])
TypeError: init() got an unexpected keyword argument 'lerp'
Traceback (most recent call last):
File "test_gimenez.py", line 41, in test_nolerp_npol
f = Gimenez(npol=100, nthr=1, lerp=False)(self.z, self.k, self.u[0])
TypeError: init() got an unexpected keyword argument 'lerp'
Traceback (most recent call last):
File "test_gimenez.py", line 58, in test_nolerp_threading
f = Gimenez(npol=500, nthr=nthr, lerp=False)(self.z, self.k, self.u[0])
TypeError: init() got an unexpected keyword argument 'lerp'
Ran 6 tests in 0.018s
FAILED (errors=6)
Macintosh:tests geoff$
Describe the bug
python3 setup.py install --home=/opt/local/pytransit/2.4/
fails with the following error error: Setup script exited with error: package directory 'find_namespace:' does not exist
.
To Reproduce
Steps to reproduce the behavior:
git clone https://github.com/hpparvi/PyTransit
cd PyTransit
python3 setup.py install --home=/opt/local/pytransit/2.4/'
Expected behavior
That PyTransit would install.
Desktop (please complete the following information):
Additional context
Running setuptools-51.3.3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-9k276gyw/setuptools-51.3.3/egg-dist-tmp-g8698kzj
file e.py (for module e) not found
file a.py (for module a) not found
file s.py (for module s) not found
file y.py (for module y) not found
file _.py (for module _) not found
file i.py (for module i) not found
file n.py (for module n) not found
file s.py (for module s) not found
file t.py (for module t) not found
file a.py (for module a) not found
file l.py (for module l) not found
file l.py (for module l) not found
error: Setup script exited with error: package directory 'find_namespace:' does not exist
Describe the bug
Running a simple evaluation of the QuadraticModel raises a numba TypingError. What's odd to me is that calling evaluate_ps doesn't raise any issue.
The issue itself is:
---------------------------------------------------------------------------
TypingError Traceback (most recent call last)
<ipython-input-16-d3c5206936e9> in <module>
1 ldc = np.array([0.2, 0.4])
----> 2 flux = tm.evaluate(k=0.1, ldc=ldc, t0=0, p=1, a=3, i=np.pi/2, e=0, w=np.pi/2)
~/opt/anaconda3/envs/emperor/lib/python3.9/site-packages/pytransit/models/ma_quadratic.py in evaluate(self, k, ldc, t0, p, a, i, e, w, copy)
131 w = zeros(npv) if w is None else w
132
--> 133 flux = quadratic_model_v(self.time, k, t0, p, a, i, e, w, ldc,
134 self.lcids, self.pbids, self.epids, self.nsamples, self.exptimes, self.npb,
135 self.ed, self.ld, self.le, self.kt, self.zt, self.interpolate)
~/opt/anaconda3/envs/emperor/lib/python3.9/site-packages/numba/core/dispatcher.py in _compile_for_args(self, *args, **kws)
418 e.patch_message(msg)
419
--> 420 error_rewrite(e, 'typing')
421 except errors.UnsupportedError as e:
422 # Something unsupported is present in the user code, add help info
~/opt/anaconda3/envs/emperor/lib/python3.9/site-packages/numba/core/dispatcher.py in error_rewrite(e, issue_type)
359 raise e
360 else:
--> 361 raise e.with_traceback(None)
362
363 argtypes = []
TypingError: Failed in nopython mode pipeline (step: nopython frontend)
No implementation of function Function(<function atleast_1d at 0x7ff5c5f89a60>) found for signature:
>>> atleast_1d(int64)
There are 2 candidate implementations:
- Of which 2 did not match due to:
Overload of function 'atleast_1d': File: numba/core/typing/npydecl.py: Line 724.
With argument(s): '(int64)':
No match.
During: resolving callee type: Function(<function atleast_1d at 0x7ff5c5f89a60>)
During: typing of call at /Users/jayvains/opt/anaconda3/envs/emperor/lib/python3.9/site-packages/pytransit/models/numba/ma_quadratic_nb.py (584)
File "../../../../opt/anaconda3/envs/emperor/lib/python3.9/site-packages/pytransit/models/numba/ma_quadratic_nb.py", line 584:
def quadratic_model_v(t, k, t0, p, a, i, e, w, ldc, lcids, pbids, epids, nsamples, exptimes, npb, edt, ldt, let, kt, zt, interpolate):
p, a, i, e, w = atleast_1d(p), atleast_1d(a), atleast_1d(i), atleast_1d(e), atleast_1d(w)
^
To Reproduce
Steps to reproduce the behavior:
tm = QuadraticModel()
tim = np.linspace(-0.2, 0.2, 10000)
tm.set_data(tim)
ldc = np.array([0.2, 0.4])
flux = tm.evaluate(k=0.1, ldc=ldc, t0=0, p=1, a=3, i=np.pi/2, e=0, w=np.pi/2)
Expected behavior
I expect the code to evaluate and produce a light curve
Desktop (please complete the following information):
Line 34 in 826ce3a
pyrr
and seaborn
are not in the dependency list, but basic importing doesn't work without having them installed
$ pip install pytransit
>>> import pytransit
[...]
~/dev/yeehaw/.venv/lib/python3.7/site-packages/pytransit/utils/octasphere.py in <module>
22 from math import sin, cos, acos, pi
23 from numpy import empty, array, vstack, cross, dot
---> 24 from pyrr import quaternion
25
26
ModuleNotFoundError: No module named 'pyrr'
and similar for seaborn
After manually installing pyrr
and seaborn
import works fine.
Hi,
I was looking at the source code and I found that some double precision parameters are declare without specify the precision at the end of the number, i.e. function ellc(k):
real(8), parameter :: &
& a1=0.443251414630, &
& a2=0.062606012200, &
& a3=0.047573835460, &
& a4=0.017365064510, &
& b1=0.249983683100, &
& b2=0.092001800370, &
& b3=0.040696975260, &
& b4=0.005264496390
You should add _dp
at the end of all these values:
real(8), parameter :: &
& a1=0.443251414630_dp, &
& a2=0.062606012200_dp, &
& a3=0.047573835460_dp, &
& a4=0.017365064510_dp, &
& b1=0.249983683100_dp, &
& b2=0.092001800370_dp, &
& b3=0.040696975260_dp, &
& b4=0.005264496390_dp
otherwise the code will use a single precision value even if they have been declare real(8)
.
I found the same issue in the orbits.f90
file, mainly in the do while
conditions; in this case it would be better to add the _fd
at the end of the value.
Best,
Luca
For easy pip installs
Pytransit in my code was previously working fine. I'm now getting this error when using QuadraticModel evaluate_ps:
TypeError Traceback (most recent call last)
in
----> 1 flux_qm = tmc.evaluate_ps(k, ldc, t0, p, a, i, e, w)
~/anaconda3/lib/python3.7/site-packages/PyTransit-2.5.4-py3.7.egg/pytransit/models/ma_quadratic.py in evaluate_ps(self, k, ldc, t0, p, a, i, e, w, copy)
183 flux = quadratic_model_s(self.time, k, t0, p, a, i, e, w, ldc,
184 self.lcids, self.pbids, self.epids, self.nsamples, self.exptimes, self.npb,
--> 185 self.ed, self.ld, self.le, self.kt, self.zt, self.interpolate)
186 return squeeze(flux)
187
TypeError: expected dtype object, got 'numpy.dtype[float64]'
and this error when using OblateStarModel evaluate_ps:
TypeError Traceback (most recent call last)
in
1 rperiod = 10
----> 2 flux_om = tmo.evaluate_ps(k, rho, rperiod, tpole, phi, beta, ldc, t0, p, a, i, az, e, w)
~/anaconda3/lib/python3.7/site-packages/PyTransit-2.5.4-py3.7.egg/pytransit/models/osmodel.py in evaluate_ps(self, k, rho, rperiod, tpole, phi, beta, ldc, t0, p, a, i, l, e, w, copy)
191 flux = oblate_model_s(self.time, k, t0, p, a, l, i, e, w, ldc, mstar, self.rstar, ostar, tpole, gpole,
192 f, feff, sphi, cphi, beta, self.wavelength, self.tres, self._ts, self._xs, self._ys, self._xp, self._yp,
--> 193 self.lcids, self.pbids, self.nsamples, self.exptimes, self.npb)
194
195 return squeeze(flux)
TypeError: expected dtype object, got 'numpy.dtype[float64]'
I pulled the most recent version and this didn't resolve it
An example very similar to the one from the readme, but with i=90 deg
and over one full orbit
import numpy as np
from pytransit import MandelAgol
p = 1.01
t = np.linspace(4-p/2, 4.+p/2, 5000)
k, t0, a, i, e, w = 0.1, 4, 8, 0.5*np.pi, 0.2, 0.5*np.pi
u = [0.25,0.10]
m = MandelAgol()
m.evaluate(t, k, u, t0, p, a, i, e, w)
returns
array([0.98889585, 1. , 1. , ..., 1. , 1. ,
0.98889585])
So outliers occur at exactly t0 +/- P/2
.
Hello,
I recently tried installing PyTransit (for use with K2PS) and have run into some errors. I have asked a friend to try installing PyTransit as well, and he runs into similar issues. I am on Linux Mint and he's on a Mac, and we are both using Anaconda. Here's what I find:
When I try this command from the install instructions:
"python setup.py config_fc --fcompiler=gnu95 --opt="-Ofast" --f90flags="-cpp -fopenmp -static -march=native" build"
I get this error:
/usr/bin/ld: /home/asa/anaconda3/lib/libgomp.a(barrier.o): relocation R_X86_64_32 against `.text' can not be used when making a shared object; recompile with -fPIC
/home/asa/anaconda3/lib/libgomp.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
It is my understanding that this has to do with interactions between static and dynamic directories. I found a possible solution in modifying ./configure with --enable-shared, but there's no ./configure to do this with. Putting 'sudo' in front of the command gives me "ImportError: No module named numpy.distutils.core", an error which seems to have been solved in the past for scipy and xgboost by using pip install.
If I ignore the fact that the last command didn't work and try "python setup.py install --user", I get this error:
Warning: src/gimenez.f90:35: Illegal preprocessor directive
Warning: src/gimenez.f90:36: Illegal preprocessor directive
Warning: src/gimenez.f90:37: Illegal preprocessor directive
src/gimenez.f90:271.33:
real(8), dimension(CHUNK_SIZE, npol) :: d
1
Error: Symbol 'chunk_size' at (1) has no IMPLICIT type
And if I ignore the installation directions and just try using "pip install pytransit", I get this:
#warning "Using deprecated NumPy API, disable it by "
^
...
Warning: src/gimenez.f90:35: Illegal preprocessor directive
Warning: src/gimenez.f90:36: Illegal preprocessor directive
Warning: src/gimenez.f90:37: Illegal preprocessor directive
src/gimenez.f90:271.33:
real(8), dimension(CHUNK_SIZE, npol) :: d
1
Error: Symbol 'chunk_size' at (1) has no IMPLICIT type
Both of these install methods give this as well:
/home/asa/anaconda3/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'extra_options'
and the config_fc command gives
/home/asa/anaconda3/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'install_requires'
warnings.warn(msg)
as well.
As for my friend, he gets the "deprecated NumPy API" warning from the pip install and from the config_fc command. The pip install fails to complete, and the setup.py install --user gives him the same 'extra options' and 'install requires' warnings. It finishes installing, but he still can't import the module in python.
That about sums it up. I want to thank you for making these very helpful codes, and for taking the time to look into this. I am relatively new to linux and bug reporting in general, so if there is any more information you need for me or anything I can do to help, please don't hesitate to ask.
When calling evaluate_ps
in an EclipseModel
instance, it returns a constant flux equal to 1 for all times.
I might have identified the issue as coming from the function pytransit.orbits.taylor_z.t14
used in uniform_model_s
(and uniform_model_v
) to compute the variable half_window_width
.
For eclipse configurations, t14
returns negative values, which in turn generates a negative half_window_width
and prevents points to fall in the eclipse window.
A quick fix I implemented locally is modifying lines 174-178 of pytransit/models/numba/ma_uniform_nb.py as follows:
if zsign >= 0:
y0, vx, vy, ax, ay, jx, jy, sx, sy = vajs_from_paiew(p, a, i, e, w)
et = 0.0
half_window_width = 0.025 + 0.5 * t14(k[0], y0, vx, vy, ax, ay, jx, jy, sx, sy)
else:
et, y0, vx, vy, ax, ay, jx, jy, sx, sy = vajs_from_paiew_eclipse(p, a, i, e, w)
half_window_width = 0.025 - 0.5 * t14(k[0], y0, vx, vy, ax, ay, jx, jy, sx, sy)
The same correction might be needed for the function uniform_model_v
.
I'd like to know if PyTransit takes into account Light Travel Time Delay and if not, if it would be feasible to include? I know there's a derivation in the starry package
Thanks!
MandelAgol breaks when z == k. Doesn't happen that often, but must be fixed.
I noticed a non reproducibility of the code for eccentric orbit. I made a small script to show what is the problem:
import pytransit as pt
import numpy as np
import matplotlib.pyplot as pl
from math import acos, pi
m = pt.MandelAgol()
t = np.linspace(-0.3, 0.3, num=500)
k = 0.093390
u = [0.489582, 0.127812]
t0 = 0
p = 3.337757
a = 10.779853
i = 1.52
e = 0.13
# e = 0.0
w = pi * 0.5
l_res = []
for ii in range(10):
pl.figure()
l_res.append(m.evaluate(t, k, u, t0, p, a, i, e, w))
pl.plot(t, l_res[ii])
l_res = np.asarray(l_res)
print(np.abs((l_res[:-1, :] - l_res[1:, :])).max())
The for loop execute the same computation 10 times and then I compute and print the maximum absolute difference between two consecutive executions. If the code is stable/reproducible it should always give me 0.0
When I run this script with 'e = 0.0', I get 0.0, but when I run it with e = 0.13, I get 0.00480200621537.
I made several test varying the other parameters and it looks that eccentricity is the parameter responsible for this instability. I also tried different values of e and it looks like the higher e is the higher is the maximum difference.
In the script there is a plot of the light-curve a every execution and it looks likes the resulting light-curve is made of two different transit shapes (which seems stable), but each time sample can be taken randomly from one of those two transit shapes.
Do you know where this comes from ?
PS: I tried reinstalling pytransit, but it didn't solve the problem.
Dear Hannu,
I've been trying out PyTransit and I got an unexpected behaviour when pushing the eccentricity higher than 0.45: a second transit is appearing in the light curve! See the attached plot:
To Reproduce
These are the rather simple steps to reproduce the behavior:
%matplotlib notebook
import numpy as np
import matplotlib.pyplot as plt
from pytransit import QuadraticModel
t_plot = np.arange(0.85, 1.05, 0.00001)
tm = QuadraticModel()
tm.set_data(t_plot)
k, t0, p, a, i, e, w = 0.1, 0., 1., 15., 87./180.*np.pi, 0.4, 47./180.*np.pi
ldc = [0.1, 0.3]
flux_pytransit = tm.evaluate_ps(k, ldc, t0, p, a, i, e, w)
e = 0.50
flux_pytransit_02 = tm.evaluate_ps(k, ldc, t0, p, a, i, e, w)
plt.figure(figsize=(5,5))
plt.plot(t_plot, flux_pytransit_02, c='C1', label="e=0.5")
plt.plot(t_plot, flux_pytransit, c='C0', label="e=0.4")
plt.legend()
plt.xlabel('time')
plt.ylabel('flux')
plt.show()
Expected behavior
Only one transit!
Desktop
Thank you for your attention,
Luca
Running the compile command in the readme
python setup.py config_fc --fcompiler=gnu95 --opt="-Ofast" --f90flags="-cpp -fopenmp -march=native" build
I get
...
/var/folders/vj/jd6pxcxn4zz1ljj4sznqr9d80000gn/T//ccAiYMOG.s:10401:no such instruction: `vmovsd %xmm0, -8(%rax)'
/var/folders/vj/jd6pxcxn4zz1ljj4sznqr9d80000gn/T//ccAiYMOG.s:10402:no such instruction: `vmovsd %xmm1, -16(%rax)'
error: Command "/usr/local/bin/gfortran -cpp -fopenmp -march=native -m64 -fPIC
-Ofast -DDCHUNK_SIZE=128 -Ibuild/src.macosx-10.5-x86_64-2.7 -
I/Users/ryan/anaconda/lib/python2.7/site-packages/numpy/core/include -
I/Users/ryan/anaconda/include/python2.7 -c -c src/gimenez.f90 -o
build/temp.macosx-10.5-x86_64-2.7/src/gimenez.o
-Jbuild/temp.macosx-10.5-x86_64-2.7/pytransit
-Ibuild/temp.macosx-10.5-x86_64-2.7/pytransit" failed with exit status 1
Any ideas?
When trying to run pytransit along with numpy 1.24, I get the error:
"ImportError: cannot import name 'int' from 'numpy'"
It works fine with numpy 1.23.
I am trying to run roadrunnermodel on Windows 11 WSL, but on startup, I get the error message:
"SystemError: initialization of _internal failed without raising an exception"
It appears to be connected with numba, but re-installing numba makes no difference.
Here is a screen shot of the whole error output:
Thanks for any help!
John
Dependabot couldn't authenticate with https://pypi.python.org/simple/.
You can provide authentication details in your Dependabot dashboard by clicking into the account menu (in the top right) and selecting 'Config variables'.
Describe the bug
This is not a bug, just a question.
I ran the pytransit inside emcee with pool.
It didn't speed up the calculation. What is the fastest way in multiple core CPU server?
To Reproduce
We have 64 cores and 128 threads CPU server. The OS is ubuntu 18.04.
I ran emcee like this using pytransit inside the log_probability function on the machine.
processers=1
with Pool(processes=processers) as pool:
sampler = emcee.EnsembleSampler(nwalkers, ndim, log_probability, args = args, pool=pool)
It took 22 minutes. This uses 64 threads. Almost threads shows 99% in htop command.
One thread showed CPU% > 6000.
I changed processers=2 and ran the same script.
It took 17 minutes.
Finally, I ran this script. This script don't uses pool.
sampler = emcee.EnsembleSampler(nwalkers, ndim, log_probability, args = args)
It took 17 minutes.
Do you know why?
Power-2 model needs to be implemented also in OpenCL for version 2.
Cannot install PyTransit with Python3 pip using conda (fresh env). Tried Ubuntu 18.04 and Windows 10. The error is
gfortran:f90: src/gimenez.f90
src/gimenez.f90:35:2:
#ifndef CHUNK_SIZE
1
Warning: Illegal preprocessor directive
src/gimenez.f90:36:2:
#define CHUNK_SIZE 128
1
Warning: Illegal preprocessor directive
src/gimenez.f90:37:2:
#endif
1
Warning: Illegal preprocessor directive
src/gimenez.f90:271:33:
real(8), dimension(CHUNK_SIZE, npol) :: d
1
Error: Symbol ‘chunk_size’ at (1) has no IMPLICIT type
src/gimenez.f90:35:2:
#ifndef CHUNK_SIZE
1
Warning: Illegal preprocessor directive
src/gimenez.f90:36:2:
#define CHUNK_SIZE 128
1
Warning: Illegal preprocessor directive
src/gimenez.f90:37:2:
#endif
1
Warning: Illegal preprocessor directive
src/gimenez.f90:271:33:
real(8), dimension(CHUNK_SIZE, npol) :: d
1
Error: Symbol ‘chunk_size’ at (1) has no IMPLICIT type
error: Command "/usr/local/gcc-7.1/bin/gfortran -Wall -g -fno-second-underscore -fPIC -O3 -funroll-loops -DDCHUNK_SIZE=128 -Ibuild/src.linux-x86_64-3.7/build/src.linux-x86_64-3.7/pytransit -I/home/michael/miniconda3/envs/hpk_env/lib/python3.7/site-packages/numpy/core/include -I/home/michael/miniconda3/envs/hpk_env/include/python3.7m -c -c src/gimenez.f90 -o build/temp.linux-x86_64-3.7/src/gimenez.o -Jbuild/temp.linux-x86_64-3.7/pytransit -Ibuild/temp.linux-x86_64-3.7/pytransit" failed with exit status 1
----------------------------------------
Hi, Hannu.
Describe the bug
When I import pytransit and george at the same time, I got this problem.
I confirmed it in 2 environments(I mean two PCs).
If you know how to solve this, Could you teach us?
(py3) muscat@muscat-ut ~ $ ipython
Python 3.6.3 |Anaconda, Inc.| (default, Oct 13 2017, 12:02:49)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.4.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import pytransit
In [2]: import george
Segmentation fault (core dumped)
also,
(py3) muscat@muscat-ut ~ $ ipython
Python 3.6.3 |Anaconda, Inc.| (default, Oct 13 2017, 12:02:49)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.4.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import george
In [2]: import pytransit
Segmentation fault (core dumped)
To Reproduce
Steps to reproduce the behavior:
import george
or import pytransit
import pytransit
or import george
Segmentation fault (core dumped)
Desktop:
PC1 (work station, almost all muscat Japanese member uses for analysis)
PC2 (general PC)
Sincerely,
Taku
Describe the bug
When trying to pip install there seems to be an import error. It says ImportError: No module named semantic_version. I tried gitclone and running python setup.py and the same issue occurred.
Error received
ERROR: Command errored out with exit status 1:
command: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/20/17pdj9qj2v71hjsr1g7pstgw0000gn/T/pip-install-0pz7tO/pytransit/setup.py'"'"'; __file__='"'"'/private/var/folders/20/17pdj9qj2v71hjsr1g7pstgw0000gn/T/pip-install-0pz7tO/pytransit/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/20/17pdj9qj2v71hjsr1g7pstgw0000gn/T/pip-pip-egg-info-vtk4uz
cwd: /private/var/folders/20/17pdj9qj2v71hjsr1g7pstgw0000gn/T/pip-install-0pz7tO/pytransit/
Complete output (6 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/20/17pdj9qj2v71hjsr1g7pstgw0000gn/T/pip-install-0pz7tO/pytransit/setup.py", line 21, in <module>
exec(fp.read(), version)
File "<string>", line 17, in <module>
ImportError: No module named semantic_version
----------------------------------------
I am working on Mac OS X 10.11.2 (El Capitan).
I just tried to install pytransit using the command provided in GitHub:
python setup.py config_fc --fcompiler=gnu95 --opt="-Ofast" --f90flags="-cpp -fopenmp -march=native -mno-avx" build
python setup.py install --user
Everything goes well (warnings but no error). But when in python, I try import pytransit I get the following error message: ImportError: No module named 'gimenez'. (see details in the .txt file attached).
Lino Bellone
Sorry to disturb you, but I'm not an experienced user: trying to install pytransit, I received this error:
...........
...........
Found executable C:\Users\edoar\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe
C:\Users\edoar\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -DDCHUNK_SIZE=128 -Ibuild\src.win-amd64-2.7 -IC:\Users\edoar\Anaconda2\lib\site-packages\numpy\core\include -IC:\Users\edoar\Anaconda2\include -IC:\Users\edoar\Anaconda2\PC /Tcbuild\src.win-amd64-2.7\fortranobject.c /Fobuild\temp.win-amd64-2.7\Release\build\src.win-amd64-2.7\fortranobject.obj
compiling Fortran 90 module sources
Fortran f77 compiler: C:\Program Files (x86)\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin\gfortran.exe -Wall -g -ffixed-form -fno-second-underscore -Ofast
Fortran f90 compiler: C:\Program Files (x86)\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin\gfortran.exe -cpp -fopenmp -march=native -Ofast
Fortran fix compiler: C:\Program Files (x86)\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin\gfortran.exe -Wall -g -ffixed-form -fno-second-underscore -cpp -fopenmp -march=native -Ofast
compile options: '-DDCHUNK_SIZE=128 -Ibuild\src.win-amd64-2.7 -IC:\Users\edoar\Anaconda2\lib\site-packages\numpy\core\include -IC:\Users\edoar\Anaconda2\include -IC:\Users\edoar\Anaconda2\PC -c'
extra options: '-Jbuild\temp.win-amd64-2.7\Release\pytransit -Ibuild\temp.win-amd64-2.7\Release\pytransit'
gfortran.exe:f90: src/gimenez.f90
compiling Fortran sources
Fortran f77 compiler: C:\Program Files (x86)\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin\gfortran.exe -Wall -g -ffixed-form -fno-second-underscore -Ofast
Fortran f90 compiler: C:\Program Files (x86)\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin\gfortran.exe -cpp -fopenmp -march=native -Ofast
Fortran fix compiler: C:\Program Files (x86)\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin\gfortran.exe -Wall -g -ffixed-form -fno-second-underscore -cpp -fopenmp -march=native -Ofast
compile options: '-DDCHUNK_SIZE=128 -Ibuild\src.win-amd64-2.7 -IC:\Users\edoar\Anaconda2\lib\site-packages\numpy\core\include -IC:\Users\edoar\Anaconda2\include -IC:\Users\edoar\Anaconda2\PC -c'
extra options: '-Jbuild\temp.win-amd64-2.7\Release\pytransit -Ibuild\temp.win-amd64-2.7\Release\pytransit'
gfortran.exe:f90: build\src.win-amd64-2.7\pytransit\gimenez_f-f2pywrappers2.f90
could not find library 'gomp' in directories []
could not find library 'm' in directories []
C:\Users\edoar\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:"C:\Program Files (x86)\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\lib\gcc\i686-w64-mingw32\6.3.0" /LIBPATH:C:\Users\edoar\Anaconda2\libs /LIBPATH:C:\Users\edoar\Anaconda2\PCbuild\amd64 /LIBPATH:C:\Users\edoar\Anaconda2\PC\VS9.0\amd64 /LIBPATH:C:\Users\edoar\Anaconda2\libs /LIBPATH:C:\Users\edoar\Anaconda2\PCbuild\amd64 /LIBPATH:C:\Users\edoar\Anaconda2\PC\VS9.0\amd64 gomp.lib m.lib /EXPORT:initgimenez_f build\temp.win-amd64-2.7\Release\build\src.win-amd64-2.7\pytransit\gimenez_fmodule.obj build\temp.win-amd64-2.7\Release\build\src.win-amd64-2.7\fortranobject.obj build\temp.win-amd64-2.7\Release\src\gimenez.o build\temp.win-amd64-2.7\Release\build\src.win-amd64-2.7\pytransit\gimenez_f-f2pywrappers2.o /OUT:build\lib.win-amd64-2.7\pytransit\gimenez_f.pyd /IMPLIB:build\temp.win-amd64-2.7\Release\build\src.win-amd64-2.7\pytransit\gimenez_f.lib /MANIFESTFILE:build\temp.win-amd64-2.7\Release\build\src.win-amd64-2.7\pytransit\gimenez_f.pyd.manifest
Found executable C:\Users\edoar\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\link.exe
LINK : fatal error LNK1181: cannot open input file 'gomp.lib'
error: Command "C:\Users\edoar\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:"C:\Program Files (x86)\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\lib\gcc\i686-w64-mingw32\6.3.0" /LIBPATH:C:\Users\edoar\Anaconda2\libs /LIBPATH:C:\Users\edoar\Anaconda2\PCbuild\amd64 /LIBPATH:C:\Users\edoar\Anaconda2\PC\VS9.0\amd64 /LIBPATH:C:\Users\edoar\Anaconda2\libs /LIBPATH:C:\Users\edoar\Anaconda2\PCbuild\amd64 /LIBPATH:C:\Users\edoar\Anaconda2\PC\VS9.0\amd64 gomp.lib m.lib /EXPORT:initgimenez_f build\temp.win-amd64-2.7\Release\build\src.win-amd64-2.7\pytransit\gimenez_fmodule.obj build\temp.win-amd64-2.7\Release\build\src.win-amd64-2.7\fortranobject.obj build\temp.win-amd64-2.7\Release\src\gimenez.o build\temp.win-amd64-2.7\Release\build\src.win-amd64-2.7\pytransit\gimenez_f-f2pywrappers2.o /OUT:build\lib.win-amd64-2.7\pytransit\gimenez_f.pyd /IMPLIB:build\temp.win-amd64-2.7\Release\build\src.win-amd64-2.7\pytransit\gimenez_f.lib /MANIFESTFILE:build\temp.win-amd64-2.7\Release\build\src.win-amd64-2.7\pytransit\gimenez_f.pyd.manifest" failed with exit status 1181
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.