Code indexing in gitaly is broken and leads to code not being visible to the user. We work on the issue with highest priority.

Skip to content
Snippets Groups Projects
Commit 7781aa71 authored by hartmann_m's avatar hartmann_m
Browse files

Gaussian beam rotated

parents
No related branches found
No related tags found
No related merge requests found
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from matplotlib import ticker
def norm(data):
return(data)/(sum(data))
def makeGaussian2(x_center=0, y_center=0, theta=0, sigma_x = 10, sigma_y=10, x_size=640, y_size=640):
# x_center and y_center will be the center of the gaussian, theta will be the rotation angle
# sigma_x and sigma_y will be the stdevs in the x and y axis before rotation
# x_size and y_size give the size of the frame
theta = 2*np.pi*theta/360
x = np.arange(-x_size,x_size, 1, float)
y = np.arange(-y_size,y_size, 1, float)
y = y[:,np.newaxis]
sx = sigma_x
sy = sigma_y
x0 = x_center
y0 = y_center
# rotation
a=np.cos(theta)*x -np.sin(theta)*y
b=np.sin(theta)*x +np.cos(theta)*y
a0=np.cos(theta)*x0 -np.sin(theta)*y0
b0=np.sin(theta)*x0 +np.cos(theta)*y0
return np.exp(-(((a-a0)**2)/(2*(sx**2)) + ((b-b0)**2) /(2*(sy**2))))
framesize=23
theta=0
std = 12/2.
z=np.zeros((2*framesize,2*framesize))
radius=18/2.
for angle in np.arange(0,360,1):
x0=np.cos(angle)*radius
y0=np.sin(angle)*radius
z += makeGaussian2(x0, y0, angle, std, std, framesize, framesize)
plt.plot(np.arange(0,2*framesize,1),norm(z[framesize,:]))
plt.ylim(bottom=0)
plt.show()
plt.imshow(z)
#plt.pcolor(x,y,z,cmap='seismic',vmin=-3,vmax=3,shading='auto')
plt.clim(0,100)
plt.colorbar()
plt.show()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment