clwainwright / CosmoTransitions

A package for analyzing finite or zero-temperature cosmological phase transitions driven by single or multiple scalar fields.
MIT License
25 stars 19 forks source link

Compilation error #24

Closed SubhenduRakshit closed 3 years ago

SubhenduRakshit commented 4 years ago

Dear All, I am getting the following error in MacOS Mojave. I am new to Python. numpy version:1.18.1, scipy version: 1.4.1, matplotlib version: 3.2.0. Thanks, S Rakshit

-----------------output------------------ Rakshits-MacBook:sr-test rakshit$ ipython3 Python 3.7.7 (default, Mar 10 2020, 15:43:03) Type 'copyright', 'credits' or 'license' for more information IPython 7.13.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from testModel1 import model1

In [2]: m=model1()

In [3]: alltrans=m.findAllTransitions()
Tracing phase starting at x = [295.56323266 406.39105772] ; t = 0.0 Tracing minimum up traceMinimum t0 = 0 ................................................................................................................. Tracing phase starting at x = [ 215.33159683 -149.94745675] ; t = 118.20010359187555 Tracing minimum down traceMinimum t0 = 118.2 ........................................................................................ Tracing minimum up traceMinimum t0 = 118.2 ............................................................................................................................................................................................... Tracing phase starting at x = [ 0.00116792 -0.00088472] ; t = 223.70229847224445 Tracing minimum down traceMinimum t0 = 223.702 ................... Tracing minimum up traceMinimum t0 = 223.702 ............................................ Tunneling from phase 1 to phase 0 at T=77.61682 high_vev = [ 234.29595961 -111.48237945] low_vev = [289.27693899 389.92592893]

TypeError Traceback (most recent call last) /usr/local/lib/python3.7/site-packages/numpy/core/function_base.py in linspace(start, stop, num, endpoint, retstep, dtype, axis) 116 try: --> 117 num = operator.index(num) 118 except TypeError:

TypeError: 'numpy.float64' object cannot be interpreted as an integer

During handling of the above exception, another exception occurred:

TypeError Traceback (most recent call last)

in ----> 1 alltrans=m.findAllTransitions() /usr/local/lib/python3.7/site-packages/cosmoTransitions/generic_potential.py in findAllTransitions(self, tunnelFromPhase_args) 621 self.getPhases() 622 self.TnTrans = transitionFinder.findAllTransitions( --> 623 self.phases, self.Vtot, self.gradV, tunnelFromPhase_args) 624 # Add in the critical temperature 625 if self.TcTrans is None: /usr/local/lib/python3.7/site-packages/cosmoTransitions/transitionFinder.py in findAllTransitions(phases, V, dV, tunnelFromPhase_args) 925 del phases[start_phase.key] 926 trans = tunnelFromPhase(phases, start_phase, V, dV, Tmax, --> 927 **tunnelFromPhase_args) 928 if trans is None and not start_phase.low_trans: 929 start_phase = None /usr/local/lib/python3.7/site-packages/cosmoTransitions/transitionFinder.py in tunnelFromPhase(phases, start_phase, V, dV, Tmax, Ttol, maxiter, phitol, overlapAngle, nuclCriterion, verbose, fullTunneling_params) 835 try: 836 Tnuc = optimize.brentq(_tunnelFromPhaseAtT, Tmin, Tmax, args=args, --> 837 xtol=Ttol, maxiter=maxiter, disp=False) 838 except ValueError as err: 839 if err.args[0] != "f(a) and f(b) must have different signs": /usr/local/lib/python3.7/site-packages/scipy/optimize/zeros.py in brentq(f, a, b, args, xtol, rtol, maxiter, full_output, disp) 778 if rtol < _rtol: 779 raise ValueError("rtol too small (%g < %g)" % (rtol, _rtol)) --> 780 r = _zeros._brentq(f, a, b, xtol, rtol, maxiter, args, full_output, disp) 781 return results_c(full_output, r) 782 /usr/local/lib/python3.7/site-packages/cosmoTransitions/transitionFinder.py in _tunnelFromPhaseAtT(T, phases, start_phase, V, dV, phitol, overlapAngle, nuclCriterion, fullTunneling_params, verbose, outdict) 707 tobj = pathDeformation.fullTunneling( 708 [x1,x0], V_, dV_, callback_data=T, --> 709 **fullTunneling_params) 710 tdict['instanton'] = tobj 711 tdict['action'] = tobj.action /usr/local/lib/python3.7/site-packages/cosmoTransitions/pathDeformation.py in fullTunneling(path_pts, V, dV, maxiter, fixEndCutoff, save_all_steps, verbose, callback, callback_data, V_spline_samples, tunneling_class, tunneling_init_params, tunneling_findProfile_params, deformation_class, deformation_init_params, deformation_deform_params) 948 # 1. Fit the spline to the path. 949 path = SplinePath(pts, V, dV, V_spline_samples=V_spline_samples, --> 950 extend_to_minima=True) 951 # 2. Do 1d tunneling along the path. 952 if V_spline_samples is not None: /usr/local/lib/python3.7/site-packages/cosmoTransitions/pathDeformation.py in __init__(self, pts, V, dV, V_spline_samples, extend_to_minima, reeval_distances) 760 if xmin > 0.0: xmin = 0.0 761 nx = np.ceil(abs(xmin)-.5) + 1 --> 762 x = np.linspace(xmin, 0, nx)[:, np.newaxis] 763 pt_ext = pts[0] + x*dpts[0] 764 pts = np.append(pt_ext, pts[1:], axis=0) <__array_function__ internals> in linspace(*args, **kwargs) /usr/local/lib/python3.7/site-packages/numpy/core/function_base.py in linspace(start, stop, num, endpoint, retstep, dtype, axis) 119 raise TypeError( 120 "object of type {} cannot be safely interpreted as an integer." --> 121 .format(type(num))) 122 123 if num < 0: TypeError: object of type cannot be safely interpreted as an integer. In [4]:
SubhenduRakshit commented 4 years ago

The entire problem comes from lines 116-121 of the function_base.py code of numpy. If I comment them out Cosmotransitions runs smoothly! But should I comment out these lines?