Skip to content

image.downsample broken for source with integer `offsets #926

@j-c-c

Description

@j-c-c

Example script for bug:

from aspire.source import Simulation
src = Simulation(offsets=0)
src.downsample(4)

Gives the following error:

UFuncTypeError                            Traceback (most recent call last)
Cell In[5], line 1
----> 1 src.downsample(4)

File ~/Work/ASPIRE-python.Symmetry_Groups/src/aspire/source/image.py:119, in as_copy.<locals>.wrapper(self, *args, **kwargs)
    117 obj_copy = copy.deepcopy(self)
    118 func_copy = copy.deepcopy(func)
--> 119 func_copy(obj_copy, *args, **kwargs)
    120 return obj_copy

File ~/Work/ASPIRE-python.Symmetry_Groups/src/aspire/source/image.py:699, in ImageSource.downsample(self, L)
    697 ds_factor = self.L / L
    698 self.unique_filters = [f.scale(ds_factor) for f in self.unique_filters]
--> 699 self.offsets /= ds_factor
    701 self.L = L

UFuncTypeError: Cannot cast ufunc 'divide' output from dtype('float64') to dtype('int64') with casting rule 'same_kind'

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