scientific-computing

How to speed up the following code using numba?

随声附和 提交于 2021-02-10 23:38:52
问题 I am doing a molecular dynamics simulation. It consists of numerical integration, many for loops, manipulating large NumPy arrays. I have tried to use NumPy function and arrays wherever possible. But the code is still too slow. I thought of using numba jit as a speedup. But it always throws an error message. Here is the code. # -*- coding: utf-8 -*- """ Created on Sat Mar 28 12:10:42 2020 @author: Sandipan """ import numpy as np import matplotlib.pyplot as plt from numba import jit import os

Finding the average pixel values of a list of blobs identified by scikit-image's blob_log (Laplacian of Gaussian) method

好久不见. 提交于 2021-01-28 06:00:23
问题 Input is a uint16 grayscale .tif-image, 512 x 512 pixels. As the title to this question implies, I would like to calculate the average pixel intensity of blobs identified by the blob_log method (see: http://scikit-image.org/docs/dev/api/skimage.feature.html#skimage.feature.blob_log ) but am unsure how to access the pixel values of each individual blob. Average intensity values must be returned in uint16 range (0 to 65535). Below is what I have so far. Apologies in advance if I haven't been

What does the letter k mean in the documentation of solve_ivp function of Scipy?

ぃ、小莉子 提交于 2021-01-24 12:07:43
问题 Solve_ivp is an initial value problem solver function from Scipy. In a few words scipy.integrate.solve_ivp(fun, t_span, y0, method=’RK45’, t_eval=None, dense_output=False, events=None, vectorized=False, args=None, **options) Solve an initial value problem for a system of ODEs. This function numerically integrates a system of ordinary differential equations given an initial value. In the solve_ivp function documentation (Scipy reference guide 1.4.1 page 695) we have the following Parameters

What does the letter k mean in the documentation of solve_ivp function of Scipy?

心不动则不痛 提交于 2021-01-24 12:06:52
问题 Solve_ivp is an initial value problem solver function from Scipy. In a few words scipy.integrate.solve_ivp(fun, t_span, y0, method=’RK45’, t_eval=None, dense_output=False, events=None, vectorized=False, args=None, **options) Solve an initial value problem for a system of ODEs. This function numerically integrates a system of ordinary differential equations given an initial value. In the solve_ivp function documentation (Scipy reference guide 1.4.1 page 695) we have the following Parameters

What does the letter k mean in the documentation of solve_ivp function of Scipy?

我怕爱的太早我们不能终老 提交于 2021-01-24 12:05:42
问题 Solve_ivp is an initial value problem solver function from Scipy. In a few words scipy.integrate.solve_ivp(fun, t_span, y0, method=’RK45’, t_eval=None, dense_output=False, events=None, vectorized=False, args=None, **options) Solve an initial value problem for a system of ODEs. This function numerically integrates a system of ordinary differential equations given an initial value. In the solve_ivp function documentation (Scipy reference guide 1.4.1 page 695) we have the following Parameters

How to join these two 3D lines together with a surface in Python's matplotlib

筅森魡賤 提交于 2020-11-28 02:09:13
问题 I have two orbits which occur at different heights. I plot them in 3D, but I wish to join them together with a surface. So far I have this picture: which I get using this script: import numpy as np import matplotlib import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D font = {'size' : 18} matplotlib.rc('font', **font) fig = plt.figure() ax = fig.add_subplot(111, projection='3d') #Read in data data = np.genfromtxt('mu8.txt') x, y = np.hsplit(data, 2) N = len(x) z = np.zeros

How to join these two 3D lines together with a surface in Python's matplotlib

流过昼夜 提交于 2020-11-28 02:08:31
问题 I have two orbits which occur at different heights. I plot them in 3D, but I wish to join them together with a surface. So far I have this picture: which I get using this script: import numpy as np import matplotlib import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D font = {'size' : 18} matplotlib.rc('font', **font) fig = plt.figure() ax = fig.add_subplot(111, projection='3d') #Read in data data = np.genfromtxt('mu8.txt') x, y = np.hsplit(data, 2) N = len(x) z = np.zeros