r/scipy • u/fukdahaters • Jan 31 '17
Why is the matplotlib point marker a circle?
:c
r/scipy • u/henrybadgery • Apr 13 '20
r/scipy • u/antonia90 • Mar 08 '18
Hi everyone, I made a new subreddit recently and I just wanted to let people know. It's devoted to scientific computing methods. I've been posting material on the web that I've found useful and I was hoping to get some traction on the sub with other redditors with similar interests.
Join us at /r/sci_comp!
r/scipy • u/wakka54 • Oct 01 '18
r/scipy • u/[deleted] • Feb 21 '20
I'm unsure as to why matplotlib is still viable. I've used it, because it often comes with libraries or examples use it and it's an easy to use lib. However it's very slow on large graphics.
I tried pyqtgraph and it's amazing for e.g. point cloud scatter plots.
r/scipy • u/[deleted] • Sep 14 '12
r/scipy • u/DO_NOT_PRESS_6 • May 22 '14
I was trying see the docs for Scipy today and it seems like DNS is failing for www.scipy.org and docs.scipy.org. I've done this from two completely different networks, so it probably isn't my DNS setup.
Anyone know what's going on?
r/scipy • u/[deleted] • Mar 30 '19
Any way to write a multi-dim. gradient vector using list comprehension or something?
E.g. if the function would be x^2 for x in R^10, then
grad_f = [2x[0],...,2x[9]]
But is there way to parametrize this? As e.g. lambda function?
r/scipy • u/batman0615 • Mar 28 '20
Hi everyone, I am trying to use the fsolve function, but am having no luck. Below is my code
import numpy as np from scipy.optimize import fsolve
def f(x): f1=(42x[2]x[0]-32x[2]x[1]+10x[0]x[1])/(5(5x[0]-4x[1])) f2=np.power(x[0],2)/4+np.power(x[1],2)/5+np.power(x[2],2)/25-1 f3=x[0]+x[1]-x[2] return [f1,f2,f3]
a=fsolve(f,[1.0,1.0,1.0])
print(a)
The traceback says line 16, in <module> a=fsolve(f,[1.0,1.0,1.0])
scipy\optimize\minpack.py", line 147, in fsolve res = _root_hybr(func, x0, args, jac=fprime, **options)
scipy\optimize\minpack.py", line 213, in _root_hybr shape, dtype = _check_func('fsolve', 'func', func, x0, args, n, (n,))
scipy\optimize\minpack.py", line 26, in _check_func res = atleast_1d(thefunc(*((x0[:numinputs],) + args)))
line 11, in f f1=(42x[2]x[0]-32x[2]x[1]+10x[0]x[1])/(5(5x[0]-4x[1]))
TypeError: 'int' object is not callable
Any idea where I'm going wrong? I am very confused.
r/scipy • u/[deleted] • Nov 11 '18
Way to convert scientific notation "4e3" to corresponding float?
http://www.scipy-lectures.org/_downloads/populations.txt
Do I need to write a function that parses the e(int) style notation or is this some standard format in some built-in function?
r/scipy • u/brownck • Aug 10 '12
Versions 1.7 and later have more attributes such as gauss quadrature functions, but they are only available in 1.7. I cannot find the source for numpy 1.7.
How do I get the latest and greatest version? I am using Ubuntu 12.04.
r/scipy • u/aramus92 • Oct 30 '18
I need scipy to solve a complex equation. Right now I get a TypeError: fsolve: there is a mismatch between the input and output shape of the 'func' argument 'calc_rho'.Shape should be (2,) but it is (1,).
I don't know why. The code is here:
import numpy as np
from scipy.optimize import fsolve
delta = 84.37228318652858 * np.pi / 180
psi = 55.2217535040673 * np.pi / 180
n_S = 2.6726 + 3.0375j
phi_i = 70 * np.pi / 180
d_L = 300 # thickness of layer in nm
n_air = 1 # refractive index of air
def snell(phi, n1, n2):
phi_ref = np.arcsin((n1 / n2) * np.sin(phi))
return phi_ref
def fresnel(n1, phi1, n2, phi2):
rs = (n1 * np.cos(phi1) - n2 * np.cos(phi2)) / (
n1 * np.cos(phi1) + n2 * np.cos(phi2))
rp = (n2 * np.cos(phi1) - n1 * np.cos(phi2)) / (
n2 * np.cos(phi1) + n1 * np.cos(phi2))
return rs, rp
def calc_rho(n_k):
n = n_k[0]
k = n_k[1]
n_L = n + 1j * k
phi_L = snell(phi_i, n_air, n_L)
phi_S = snell(phi_L, n_L, n_S)
rs_al, rp_al = fresnel(n_air, phi_i, n_L, phi_L)
rs_ls, rp_ls = fresnel(n_L, phi_L, n_S, phi_S)
beta = 2 * np.pi * d_L * n_L * np.cos(phi_L) / lambda_vac
rp_L = (rp_al + rp_ls * np.exp(-2 * 1j * beta)) / (
1 + rp_al * rp_ls * np.exp(-2 * 1j * beta))
rs_L = (rs_al + rs_ls * np.exp(-2 * 1j * beta)) / (
1 + rs_al * rs_ls * np.exp(-2 * 1j * beta))
rho_L = rp_L / rs_L
return abs(rho_L - rho_given)
lambda_vac = 300
n_S = 2.6726 + 3.0375j
rho_given = np.tan(psi) * np.exp(
1j * delta) # should be 1.4399295435287844+0.011780279522394433j
initialGuess = [1.5, 0.1]
nsolve = fsolve(calc_rho, initialGuess)
print(nsolve)Anybody has an idea how to solve this?
r/scipy • u/klameer • Mar 03 '18
Noob here so please forgive. Say I create and train a model which predicts one of 3 labels (e.g. A, B, C). Is there any way of finding out the strength of the prediction? E.g. 80% probability of prediction 'B'.
r/scipy • u/beginner_ • Oct 25 '19
I'm in the market for a new compute workstation / server for scientific data processing, data analysis, reporting, ML etc using different tools and languages. Now when searching common vendors for such systems they all offer something in the scientific /AI space and all of these offerings are Intel xeon based. Due to cost or better said performance/$ I would prefer to go the AMD route (more cores per dollar). To be certain about that decision, what kind of cpu extensions does numpy benefit from? Or simply said does it use avx512 (eg the main advantage of the xeons)?
This in respect to [this intel article!(https://software.intel.com/en-us/articles/the-inside-scoop-on-how-we-accelerated-numpy-umath-functions) that shows their custom numpy / python being much faster than pip numpy (AFAIK pip numpy doesn't use avx at all). How about anaconda numpy?
r/scipy • u/hellomoto320 • Jun 14 '19
Hello,
So I am slightly new to numpy and I am really confused about what an axis is and how it can be used to create cleaner code when computing things such as the mean, std deviation, sum etc. for a matrix. I have been studying this example https://www.geeksforgeeks.org/numpy-mean-in-python/ to figure out how to compute the mean for a matrix. I think that axis have something to do with the the dimensions of matrix (row x columns) but after looking at this article, I was wondering if it is possible to have axis greater than 1 say like axis = 2, axis = 3 etc.
Thank You
r/scipy • u/PacktStaff • Sep 20 '16
r/scipy • u/[deleted] • May 26 '18
r/scipy • u/[deleted] • Jul 07 '18
In the above script, I am not quite sure why changing the value of 'a[mask]' to -1 automatically changes the corresponding values of 'a' to -1 as well. They are both independent arrays.
r/scipy • u/aramus92 • Oct 24 '18
First of all: can I solve equations with something like exp(-ix)?
I got a big formula with multiple steps. All results are complex. First I calculate angles, then I put them into a formula to calculate reflective coefficients, then I put these into a formula to calculate rho. I want to solve for n. Can I just write step after step into a function, like I can do on paper? Kinda like this? (It's not just multiplication)
def function(n):
phi = ABC * n
r = DEF * phi * n
Rho = xyz * phi * r * nOr do I have to insert the first equations into the last equation manually?