From 18144b0fd9f788438fb332816afb099a31b191d4 Mon Sep 17 00:00:00 2001 From: Mads Jakobsen <mads.jakobsen@xfel.eu> Date: Thu, 25 Apr 2024 14:45:19 +0200 Subject: [PATCH] added auto generated cython c file output to gitignore --- .gitignore | 2 +- testing/test.py | 23 +++++++++++++++++------ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index a3b8a68..cdb6c4a 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,4 @@ testing/abc.png *.egg-info fastXPCS/fastXPCS/cython/welford.c fastXPCS/fastXPCS/cython/fxpcs_sparse.c -fastXPCS/fastXPCS/cython/dense.c +fastXPCS/fastXPCS/cython/dense.c \ No newline at end of file diff --git a/testing/test.py b/testing/test.py index a111fdd..a13c4e3 100644 --- a/testing/test.py +++ b/testing/test.py @@ -10,6 +10,8 @@ from fastXPCS.algos import TTCdata, do_sparse_train from fastXPCS.fxpcs_sparse import sparsify, sparsify2 from PIL import Image +from function_call import doXPCS; + dataShape = (352, 512, 128) photonEnergy = 13.3 # in ADU # 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, 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): - print(c) randMask = np.reshape(np.random.choice( [0, 1], size=numPixelPrImage, @@ -58,7 +59,7 @@ def getDummyData(shape, chanceOfPhotonPerPixel = 0.01, correlationPerBunch=0.5, data[0,:,:] = np.reshape(getRandomImage(), (shape[1], shape[2])) for pulseNr in range(1,dataShape[0]): - correlationPerBunch += (1-correlationPerBunch)*0.001 + correlationPerBunch += (1-correlationPerBunch)*0.01 data[pulseNr, :, :] = evolveImageFrom(data[pulseNr-1,:,:], correlationPerBunch ) # 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, data += sigma * np.random.standard_normal(size=shape) data *= energy - return data + return data.astype(np.float32) data = getDummyData( @@ -142,9 +143,19 @@ t = time.time() out = xpcs(data, photonEnergy) elapsed = time.time() - t 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): data = data.astype(np.float32) cmap = pl.get_cmap('viridis') -- GitLab