Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Fit straight line to pandas time series data with semilog plot
Post: RE: Fit straight line to pandas time series data w...

For some reason the fit became more accurate when I changed x = np.arange(df.iloc[:,-1:].size) to x = np.linspace(0,1,len(df.iloc[:,-1:])). Grateful for an explanation if this really is the solution.
schniefen Homework 2 1,531 Mar-06-2023, 07:24 PM
    Thread: Fit straight line to pandas time series data with semilog plot
Post: Fit straight line to pandas time series data with ...

I have sets of data, which look like this: [attachment=2270] I do the following: df=pd.read_csv('data.csv') timestamp_fields = ['Year', 'Month', 'Day', 'Hour', 'Minute','Second'] df['Date']=pd.to_d...
schniefen Homework 2 1,531 Mar-06-2023, 05:16 PM
    Thread: Plot time series data
Post: RE: Plot time series data

(Mar-04-2023, 03:56 PM)noisefloor Wrote: Hi, if you combine the first six columns to one column holding a datetime object, plotting should be easy. Regards, noisefloor Here is my current solution,...
schniefen Homework 3 1,309 Mar-04-2023, 04:14 PM
    Thread: Plot time series data
Post: Plot time series data

I have a long list of data looking like this: [attachment=2269] Minute and Second are always zero since the data is the 1 hour average of a measurement, which is the last column. I would like to plo...
schniefen Homework 3 1,309 Mar-04-2023, 02:17 PM
    Thread: extract lower/upper antitriangular matrix
Post: extract lower/upper antitriangular matrix

In numpy you can use np.tril(x) to extract the lower triangular matrix of an array x. However, I am interested in extracting the lower (upper) antitriangular matrix, that is, with zeros above (below) ...
schniefen Homework 2 1,411 Dec-09-2022, 05:43 PM
    Thread: rotate error function
Post: rotate error function

I would like to rotate a function that is defined in terms of the error function, see here. I am unsure how to go about it, but I would like the resulting plot to be diagonal along the line y=-bx, whe...
schniefen Homework 0 888 Dec-07-2022, 02:40 PM
    Thread: animating 2d heat map
Post: animating 2d heat map

Consider the following heat map: from scipy import special import numpy as np import matplotlib.pyplot as plt u0=200 r0x=25 r0y=25 rmax=2.5 alpha=2 t=0.575 y, x = np.meshgrid(np.linspace(0, 50, 100...
schniefen Homework 0 1,341 Nov-20-2022, 10:00 PM
    Thread: Simple animation -- time evolution of function
Post: Simple animation -- time evolution of function

I would like to animate how a function evolves over time. I would like to do this using only plt.blablabla, not ax.blablabla. The function is defined as follows: import numpy as np from scipy import ...
schniefen Homework 0 1,020 Nov-20-2022, 08:05 PM
    Thread: Plotting periodic function with fft
Post: Plotting periodic function with fft

I want to plot a T-periodic function using a restricted set of Fourier coefficients. The function equals sin(x/tau) for 0<=x<(2*pi*tau) and 0 for (2*pi*tau)<=x<T (it is periodically repeat...
schniefen Homework 0 1,012 Nov-10-2022, 11:53 AM
    Thread: 4D array with only elements on one side of the diagonal
Post: 4D array with only elements on one side of the dia...

Given the parameters n and m, I'd like to initialize a n x n4D array where each entry is an m x m matrix, and where each column of the matrix is an array of type numpy.linspace(0,1,m). Furthermore, I'...
schniefen General Coding Help 0 1,682 Dec-24-2020, 11:32 AM
    Thread: Level curves don't match after rotation
Post: RE: Level curves don't match after rotation

This has been solved. The curves do match, it is just that, when the function is rotated, its central axes changes, and in the square, it is longer than that of the non-rotated one.
schniefen General Coding Help 1 1,531 Dec-14-2020, 09:56 PM
    Thread: Level curves don't match after rotation
Post: Level curves don't match after rotation

Consider the general 2D Gaussian function, centered at (0.5,0.5), A*exp(-a*(-0.5 + x)**2-b*(-0.5 + x)*(-0.5 + y)-c*(-0.5 + y)**2)where the covariance matrix can be written in terms of the coefficient...
schniefen General Coding Help 1 1,531 Dec-14-2020, 06:01 PM
    Thread: Rotate 2D Gaussian given parameters
Post: RE: Rotate 2D Gaussian given parameters

A rotation by 45 degrees, with the means (0.5,0.5) fixed, gives a’=(a-b+c)/2, b’=a-c=0 and c’=(a+b+c)/2 for a counterclockwise rotation and a’=(a+b+c)/2, b’=a-c=0 and c’=(a-b+c)/2 for a clockwise rota...
schniefen General Coding Help 4 2,896 Dec-11-2020, 03:34 PM
    Thread: Rotate 2D Gaussian given parameters
Post: RE: Rotate 2D Gaussian given parameters

(Dec-10-2020, 06:44 PM)schniefen Wrote: (Dec-10-2020, 06:37 PM)ndc85430 Wrote: Can't you make use of a rotation matrix? For each point (x, y) the rotation matrix would give you new points (x', y')...
schniefen General Coding Help 4 2,896 Dec-10-2020, 06:45 PM
    Thread: Rotate 2D Gaussian given parameters
Post: RE: Rotate 2D Gaussian given parameters

(Dec-10-2020, 06:37 PM)ndc85430 Wrote: Can't you make use of a rotation matrix? For each point (x, y) the rotation matrix would give you new points (x', y') and then you simply compute f at those ne...
schniefen General Coding Help 4 2,896 Dec-10-2020, 06:44 PM
    Thread: Rotate 2D Gaussian given parameters
Post: Rotate 2D Gaussian given parameters

I have a Gaussian function of the form: def f(x,y): a=some number b=... c=... return 3*np.exp(-a*(-0.5 + x)**2+b*(x-0.5)*(y-0.5)-c*(-0.5 + y)**2)This is a Gaussian function symmetric around ...
schniefen General Coding Help 4 2,896 Dec-10-2020, 06:17 PM
    Thread: Plotting “simple” diagram with gridlines at specified intervals
Post: RE: Plotting “simple” diagram with gridlines at sp...

(Dec-03-2020, 11:46 AM)schniefen Wrote: I’d like to plot a diagram according to the sketch in the link. The lines emanating from the y-axis should be dotted, and the boxes above the x-axis are suppo...
schniefen General Coding Help 1 2,407 Dec-03-2020, 05:54 PM
    Thread: Plotting “simple” diagram with gridlines at specified intervals
Post: Plotting “simple” diagram with gridlines at specif...

I’d like to plot a diagram according to the sketch in the link. The lines emanating from the y-axis should be dotted, and the boxes above the x-axis are supposed to be squares. The square enclosed by ...
schniefen General Coding Help 1 2,407 Dec-03-2020, 11:46 AM
    Thread: How to plot level surfaces
Post: How to plot level surfaces

This is a nice introduction on how to plot level curves given a function z=f(x,y), i.e. via plt.contour. Is there an extension to this in 3D? I'd like to plot some surfaces of C=f(x,y,z), where C is a...
schniefen General Coding Help 0 1,640 Nov-19-2020, 07:08 PM
    Thread: Getting largest indices of array less than or equal to an array of numbers
Post: RE: Getting largest indices of array less than or ...

Current solution: y_i=np.linspace(np.zeros(d),np.ones(d),m+1) y=np.random.uniform(0,1,d) ind=np.zeros(d) for k in range(d): k_i=y_i[:,k] i=np.argmax(k_i >= y[k]) in...
schniefen Homework 5 2,616 Nov-02-2020, 08:14 PM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020