[Solved] What kind of number 9.00000000e-01 is?

[ad_1] >>> import numpy as np >>> x = np.arange(-1,1,0.1) >>> print(x) [ -1.00000000e+00 -9.00000000e-01 -8.00000000e-01 -7.00000000e-01 -6.00000000e-01 -5.00000000e-01 -4.00000000e-01 -3.00000000e-01 -2.00000000e-01 -1.00000000e-01 -2.22044605e-16 1.00000000e-01 2.00000000e-01 3.00000000e-01 4.00000000e-01 5.00000000e-01 6.00000000e-01 7.00000000e-01 8.00000000e-01 9.00000000e-01] >>> type(x[0]) <type ‘numpy.float64’> >>> print(x.tolist()) [-1.0, -0.9, -0.8, -0.7000000000000001, -0.6000000000000001, -0.5000000000000001, -0.40000000000000013, -0.30000000000000016, -0.20000000000000018, -0.1000000000000002, -2.220446049250313e-16, 0.09999999999999964, 0.19999999999999973, 0.2999999999999998, 0.3999999999999997, 0.49999999999999956, … Read more

[Solved] How to simulate saturations and thresholds with Scipy?

[ad_1] You could try Steven Masfaraud’s block module simulator (BMS). As of August 2016 it has nonlinear block elements for Saturation, Coulomb, Dead Zone, and Hysteresis. Here’s a link to one of his examples. The other option on this Quora post is PyLinX. It looks like SciPySim may no longer be under development, from this … Read more

[Solved] Python – ” AttributeError: ‘str’ object has no attribute ‘Tc’ (Tc is one of the arguments) [closed]

[ad_1] It’s here: def preos(molecule, T, P, plotcubic=True, printresults=True): Tr = T / molecule.Tc # reduced temperature … preos(“methane”, 160, 10, “true”, “true”) You’re clearly passing “methane” into the preos function as a string, then trying to call .Tc on that string. The error is saying exactly that. This doesn’t have anything to do with … Read more

[Solved] scipy.io.loadmat() is not returning dictionary [closed]

[ad_1] Why do you think this a loadmat object not having a dictionary? The error is at: def get_events(matlab_obj): … subjects = matlab_obj[“s”][0] … for subject_object in subjects: try: subject_hash = subject_object.my_hashedNumber[0][0] # AttributeError here matlab_obj[“s”] successfully accesses the loaded object as a dictionary. subjects is a numpy record array of shape (106,), and 58 … Read more

[Solved] Make list of 2-value tuples of all possible combinations of another list

[ad_1] Update: Now the situation looks a bit different as you updated the question. Here’s a quick snippet thrown together using pandas and numpy (for the sake of simplicity we replace missing ratings with zero): import numpy as np importport pandas as pd from itertools import combinations df = pd.DataFrame(critics).T.fillna(0) distances = [] for critic1, … Read more

[Solved] ValueError when defining a lambda function in python

[ad_1] You have a bunch of 1000 element arrays: In [8]: p.shape Out[8]: (1000,) In [9]: K.shape Out[9]: (1000,) In [10]: R.shape Out[10]: (1000,) In [11]: np.minimum.reduce([p, K, R]).shape Out[11]: (1000,) In [12]: Vl(p).shape Out[12]: (1000,) In [8]: p.shape Out[8]: (1000,) In [9]: K.shape Out[9]: (1000,) In [10]: R.shape Out[10]: (1000,) In [11]: np.minimum.reduce([p, K, … Read more

[Solved] Code not working (python) [closed]

[ad_1] if d<r: vx,vy,ax,ay=0,0,0,0 return [vx,ax,vy,ay] This isn’t a function so you can’t use return. If you want to add those values to a list you can make a new list: new_list = [vx,ax,vy,ay] You don’t need to use return outside of a function because those variables are already in scope. When you use variables … Read more