1 | import numpy as np |
---|
2 | # make these smaller to increase the resolution |
---|
3 | dx, dy = 0.1, 0.1 |
---|
4 | |
---|
5 | # generate 2 2d grids for the x & y bounds |
---|
6 | y, x = np.mgrid[slice(3, 7 + dy, dy), |
---|
7 | slice(3, 7 + dx, dx)] |
---|
8 | |
---|
9 | z = np.sin(x) ** 10 + np.cos(10 + y * x) * np.cos(x) |
---|
10 | |
---|
11 | |
---|
12 | z=(z*5+5).astype(int) |
---|
13 | z[np.where(z<0)]=0 |
---|
14 | |
---|
15 | location = "/Users/spu92482/Desktop/AndreiEvents.txt" |
---|
16 | f1=open(location,"w") |
---|
17 | f1.write("DIMENSIONS\n") |
---|
18 | f1.write("Qx Qx rlu 40\n") |
---|
19 | f1.write("Qy Qy rlu 40\n") |
---|
20 | f1.write("MDEVENTS\n") |
---|
21 | #f1.write("#") |
---|
22 | for 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") |
---|
26 | f1.close() |
---|
27 | |
---|
28 | mdws =ImportMDEventWorkspace(Filename=location) |
---|