chuckie82 / pysingfel

3 stars 7 forks source link

experiment.generate_image versus detector.get_photon #101

Open apeck12 opened 3 years ago

apeck12 commented 3 years ago

For the same beam, detector, and particle in the same orientation, I anticipated experiment.generate_image and detector.get_photons to yield the same result within Poisson noise/quantization error. However, they appear to be transposes, as shown in the attached. I think experiment.generate_images rotates the particle while detector.get_photons rotates the diffraction volume, but I don’t understand why this would swap the axes of the resulting image. approaches

AntoineDujardin commented 3 years ago

Hi! If I remember correctly, the experiment uses the "room" coordinates system, with a vertical Y axis and an horizontal X axis, while the detector might have a vertical X axis and a horizontal Y axis.

Le jeu. 3 déc. 2020 à 21:05, apeck12 notifications@github.com a écrit :

For the same beam, detector, and particle in the same orientation, I anticipated experiment.generate_image and detector.get_photons to yield the same result within Poisson noise/quantization error. However, they appear to be transposes, as shown in the attached. I think experiment.generate_images rotates the particle while detector.get_photons rotates the diffraction volume, but I don’t understand why this would swap the axes of the resulting image. [image: approaches] https://user-images.githubusercontent.com/6363287/101081966-9ef5b480-355f-11eb-9d0a-2bdb005572ea.png

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/chuckie82/pysingfel/issues/101, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACNUYTKXQR3I5JB5RLLWF7DSS7VPFANCNFSM4UMPCC6Q .

chuckie82 commented 3 years ago

Hey, good to hear from you Antoine. Ariana is our new group member.

This sounds like experiment is defined using lab coordinates (+z along x-ray beam, +y towards sky, +x completes the right hand rule) and Detector uses psana coordinates.

Latest psana has a way of returning lab coordinates instead. Maybe that will make this consistent.

apeck12 commented 3 years ago

Thanks for these explanations!

irischang020 commented 3 years ago

I've checked again that, with the same beam, detector, and particle (3iyf.pdb) in the same orientation (np.array([[1., 1., 0., 0.]])/np.sqrt(2)), the diffraction pattern created with experiment.generate_image and with detector.get_photons would yield the same orientation by setting inverse=True in geometry.take_slice.

experiment generate_image detector get_photons

chuckie82 commented 3 years ago

I suggest changing the vmax and vmin to inspect the speckles more closely. You can hardly see the speckles.

Also, quantitatively check the difference between the two.

irischang020 commented 3 years ago

experiment generate_image geometry take_slice experiment generate_image: img.sum() = 4461113.0 geometry.take_slice (detector.get_photons): img.sum() = 4466667.0 The orientation of the particle in both diffraction patterns seems to be the same. I think the difference in img.sum() comes from applying quantization (passion noise).