I’ve found out that there is no example of how to reflect symmetric 4d data, which can be very useful when 3d simulations wants to be performed using a symmetric plane to reduce calculations(e.g. ANSYS, COMSOL, etc). This example shows a data file structure corresponding to a COMSOL simulation, which has the structure: X, Y, Z, Amplitude The model had
Tag: scipy
Python scipy.io write a mat file of n by 1
I need to save a .mat file from python. The mat file should be a cell array of n by 1. The code below does what I need except the output mat file is 1 by n. How do I generate the desired n by 1 file? Answer Just do a list of lists.
Conformal plotting python
I’m working on the joukowsky transformation for plotting airfoils and I’m trying to do so with python. The conformal mapping should be pretty straight forward but can’t seem to find a guide on how to approach the problem on python. by the math: According to the theory, by plotting z i should get a circle on that plane and by
How to use values of find_peak function Python
I have to analyse a PPG signal. I found something to find the peaks but I can’t use the values of the heights. They are stored in like a dictionary array or something and I don’t know how to extract the values out of it. I tried using dict.values() but that didn’t work. The PPG signal looks like this. To
ValueError: x and y must have same first dimension, but have shapes (1, 2) and (2,)
I want to find maxima and minima from a list, but after running my program, terminal shows error like “ValueError: x and y must have same first dimension, but have shapes (1, 2) and (2,),”. How to fix this problem? Code: Answer As you can see in the documentation, maxima and minima are not 1 dimensional arrays but tuples of
How do I plot an fft in python using scipy and modify the frequency range so that it shows the two peaks frequencies in the center?
The following Python code uses numpy to produce a frequency plot of a sinusoid graph : Based on the code above , we are plotting a sine wave with two frequencies, one at 50Hz and another at 80 Hz. You can clearly see the Fourier transform plot shows peaks at those two frequencies. My question: How do I modify the
Numerical Python: Solving a BVP with a boolean condition?
I am not sure about the best way to ask this question, but I am trying to find the long-term state of an ODE system with an arbitrary extra constraint that needs to be fulfilled. Ex: In the code above, f is the right-hand-side of my ODE model. N is the dimension of my state vector X, t_range is the
Python – Differential equation solver for time-dependent coefficients gives different dynamics for different time offsets
I am solving the dynamics of a system when it interacts with a pulse, which basically is solving a time-dependent differential equation. In general it works fine, but whenever I take the bandwidth of the pulse small, i.e. around unity, the solver depends on where the pulse starts t0. Let me give you the code and some pictures and then
Fastest way for computing pseudoinverse (pinv) in Python
I have a a loop in which I’m calculating several pseudoinverses of rather large, non-sparse matrices (eg. 20000×800). As my code spends most time on the pinv, I was trying to find a way to speed up the computation. I’m already using multiprocessing (joblib/loky) to run with several processes, but that of course increases also overhead. Using jit did not
Cupy says it has scipy’s cg implemented, but cannot find cg(conjugate gradient method) when installed
I am unable to find this https://docs.cupy.dev/en/latest/reference/generated/cupyx.scipy.sparse.linalg.cg.html#cupyx.scipy.sparse.linalg.cg after the installation of cupy. It says module not found Can anyone help me? I don’t know what’s wrong, but I have installed cupy via pip, and this library was supposed to be there, but its not present. Answer The module is available in CuPy v9 betas. (The v: latest docs are generated