diff --git a/.gitignore b/.gitignore index a3b8a68577ea77305d2462b4e8bd46bbb702c7ef..cdb6c4afd88c4830f53e598228af0573b746bbe9 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 a111fdd9bcea9d679236510ad8e5fda1ab05fd7a..a13c4e3982614ca579351ab4c625bfc01b39826e 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')