Skip to content

Unable to set *some* filter_indices, only *all* #687

@chris-langfield

Description

@chris-langfield

ImageSource.filter_indices is a 1D Numpy array of length ImageSource.n indexing which CTF filter corresponds to which particle.

Currently the setter and getter decorators block this from being partially updated:

@property
def filter_indices(self):
return np.atleast_1d(self.get_metadata("__filter_indices"))
@filter_indices.setter
def filter_indices(self, indices):
# create metadata of filters for all images
return self.set_metadata(["__filter_indices"], indices)

Example behavior

from aspire.source import ArrayImageSource
import numpy as np
src = ArrayImageSource(np.empty((5,5,5)))
src.filter_indices
>>> array([0, 0, 0, 0, 0])
src.filter_indices[0:3] = 1
src.filter_indices
>>> array([0, 0, 0, 0, 0])
src.filter_indices = np.array([1,1,1,0,0])
src.filter_indices
>>> array([1,1,1,0,0], dtype=object)

I think this should be changed to allow partial update

Metadata

Metadata

Labels

invalidThis doesn't seem right

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions