Skip to content
Snippets Groups Projects
Commit 18144b0f authored by Jakobsen, Mads Bregenholt's avatar Jakobsen, Mads Bregenholt
Browse files

added auto generated cython c file output to gitignore

parent 4a0ea0ad
No related branches found
No related tags found
No related merge requests found
...@@ -8,4 +8,4 @@ testing/abc.png ...@@ -8,4 +8,4 @@ testing/abc.png
*.egg-info *.egg-info
fastXPCS/fastXPCS/cython/welford.c fastXPCS/fastXPCS/cython/welford.c
fastXPCS/fastXPCS/cython/fxpcs_sparse.c fastXPCS/fastXPCS/cython/fxpcs_sparse.c
fastXPCS/fastXPCS/cython/dense.c fastXPCS/fastXPCS/cython/dense.c
\ No newline at end of file
...@@ -10,6 +10,8 @@ from fastXPCS.algos import TTCdata, do_sparse_train ...@@ -10,6 +10,8 @@ from fastXPCS.algos import TTCdata, do_sparse_train
from fastXPCS.fxpcs_sparse import sparsify, sparsify2 from fastXPCS.fxpcs_sparse import sparsify, sparsify2
from PIL import Image from PIL import Image
from function_call import doXPCS;
dataShape = (352, 512, 128) dataShape = (352, 512, 128)
photonEnergy = 13.3 # in ADU photonEnergy = 13.3 # in ADU
# this is a function that generates a dummy panel dataset given a shape # this is a function that generates a dummy panel dataset given a shape
...@@ -47,7 +49,6 @@ def getDummyData(shape, chanceOfPhotonPerPixel = 0.01, correlationPerBunch=0.5, ...@@ -47,7 +49,6 @@ def getDummyData(shape, chanceOfPhotonPerPixel = 0.01, correlationPerBunch=0.5,
p=[q**0, q**1, q**2, q**3, q**4, q**5, q**6]/np.sum([q**0, q**1, q**2, q**3, q**4, q**5, q**6])),(shape[1], shape[2])) p=[q**0, q**1, q**2, q**3, q**4, q**5, q**6]/np.sum([q**0, q**1, q**2, q**3, q**4, q**5, q**6])),(shape[1], shape[2]))
def evolveImageFrom(image, c=correlationPerBunch): def evolveImageFrom(image, c=correlationPerBunch):
print(c)
randMask = np.reshape(np.random.choice( randMask = np.reshape(np.random.choice(
[0, 1], [0, 1],
size=numPixelPrImage, size=numPixelPrImage,
...@@ -58,7 +59,7 @@ def getDummyData(shape, chanceOfPhotonPerPixel = 0.01, correlationPerBunch=0.5, ...@@ -58,7 +59,7 @@ def getDummyData(shape, chanceOfPhotonPerPixel = 0.01, correlationPerBunch=0.5,
data[0,:,:] = np.reshape(getRandomImage(), (shape[1], shape[2])) data[0,:,:] = np.reshape(getRandomImage(), (shape[1], shape[2]))
for pulseNr in range(1,dataShape[0]): for pulseNr in range(1,dataShape[0]):
correlationPerBunch += (1-correlationPerBunch)*0.001 correlationPerBunch += (1-correlationPerBunch)*0.01
data[pulseNr, :, :] = evolveImageFrom(data[pulseNr-1,:,:], correlationPerBunch ) data[pulseNr, :, :] = evolveImageFrom(data[pulseNr-1,:,:], correlationPerBunch )
# if we do not returned photnoized data, then add a gaussian random variable # if we do not returned photnoized data, then add a gaussian random variable
...@@ -66,7 +67,7 @@ def getDummyData(shape, chanceOfPhotonPerPixel = 0.01, correlationPerBunch=0.5, ...@@ -66,7 +67,7 @@ def getDummyData(shape, chanceOfPhotonPerPixel = 0.01, correlationPerBunch=0.5,
data += sigma * np.random.standard_normal(size=shape) data += sigma * np.random.standard_normal(size=shape)
data *= energy data *= energy
return data return data.astype(np.float32)
data = getDummyData( data = getDummyData(
...@@ -142,9 +143,19 @@ t = time.time() ...@@ -142,9 +143,19 @@ t = time.time()
out = xpcs(data, photonEnergy) out = xpcs(data, photonEnergy)
elapsed = time.time() - t elapsed = time.time() - t
print(f"elapsed {elapsed}") print(f"elapsed {elapsed}")
print(out.shape)
print(np.min(out))
print(np.max(out)) print("my xpcs")
output = np.zeros(shape=(2,2),dtype=np.float32)
errorCode = doXPCS(data, output)
print(data)
print(output)
print(output[0][0])
print(output[0][1])
print(output[1][0])
print(output[1][1])
print(output.ravel())
def plot(data): def plot(data):
data = data.astype(np.float32) data = data.astype(np.float32)
cmap = pl.get_cmap('viridis') cmap = pl.get_cmap('viridis')
......
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