Skip to content

ImageSource.downsample moves particles #1196

@j-c-c

Description

@j-c-c

It looks like ImageSource.downsample might be applying the updated offsets to original src prior to applying downsample. Looks like the downsampled particles have different offsets from the original.

Here is a minimal script to illustrate:

import numpy as np

from aspire.source import Simulation
L = 64
n = 10

offsets = np.random.choice([L//4, -L//4], size=(n, 2))
src = Simulation(L=L, n=n, offsets=offsets)
src2 = src.downsample(L//4)

print(f"src.offsets: {src.offsets}\n")
src.images[:10].show()

print(f"src2.offsets: {src2.offsets}")
src2.images[:10].show()

with output:

src.offsets: [[-16.  16.]
 [ 16. -16.]
 [-16. -16.]
 [ 16.  16.]
 [ 16.  16.]
 [ 16.  16.]
 [-16. -16.]
 [-16.  16.]
 [-16. -16.]
 [ 16.  16.]]
Screenshot 2024-10-10 at 2 27 09 PM
src2.offsets: [[-4.  4.]
 [ 4. -4.]
 [-4. -4.]
 [ 4.  4.]
 [ 4.  4.]
 [ 4.  4.]
 [-4. -4.]
 [-4.  4.]
 [-4. -4.]
 [ 4.  4.]]
Screenshot 2024-10-10 at 2 28 41 PM

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions