ComputationalCryoEM / ASPIRE-Python

Algorithms for Single Particle Reconstruction
http://spr.math.princeton.edu
GNU General Public License v3.0
45 stars 21 forks source link

`CLOrient3D` lazy eval #1099

Closed garrettwrong closed 3 months ago

garrettwrong commented 4 months ago

In CLOrient3D.__init__, the final step is _build which includes the following code:

    def _build(self):
...
        imgs = self.src.images[:]

....
        self.pf = self.pft.transform(imgs)
....
        self.pf = self.pf[:, :, 1:]

Probably not be worth building out batching at this time, since we expect the total number of images at this stage to be manageable.

It would be preferable if the (pf) images are generated when the OrientedSource calls for the estimated rotations (ie when the source is asked to serve up images).

I think this might just involve moving pf to an attribute that is generated on first touch. Or perhaps delaying the call to _build to first touch. Requires inspecting the classes.

j-c-c commented 3 months ago

Resolved by #1101. Closing.