Ticket #8748: AndreiEvent.py

File AndreiEvent.py, 714 bytes (added by Owen Arnold, 7 years ago)
Line 
1import numpy as np
2# make these smaller to increase the resolution
3dx, dy = 0.1, 0.1
4
5# generate 2 2d grids for the x & y bounds
6y, x = np.mgrid[slice(3, 7 + dy, dy),
7                slice(3, 7 + dx, dx)]
8
9z = np.sin(x) ** 10 + np.cos(10 + y * x) * np.cos(x)
10
11
12z=(z*5+5).astype(int)
13z[np.where(z<0)]=0
14
15location = "/Users/spu92482/Desktop/AndreiEvents.txt"
16f1=open(location,"w")
17f1.write("DIMENSIONS\n")
18f1.write("Qx Qx rlu 40\n")
19f1.write("Qy Qy rlu 40\n")
20f1.write("MDEVENTS\n")
21#f1.write("#")
22for i in range(41):
23    for j in range(41):
24        for ev in range(int(z[i][j])):
25            f1.write("1.\t1.\t"+str(x[i][j]-3)+"\t"+str(y[i][j]-3)+"\n")
26f1.close()
27
28mdws =ImportMDEventWorkspace(Filename=location)