Opened 6 years ago

Closed 6 years ago

#2564 closed defect (fixed)

atom.color[:3] NotImplementedError: Slices are not implemented.

Reported by: Tom Goddard Owned by: Eric Pettersen
Priority: moderate Milestone:
Component: Core Version:
Keywords: Cc:
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

Atom.color returns a tinyarray which does not allow slicing. ChimeraX code slices color rgba values in probably at least 30 places to get rgb from rgba, although apparently not atom.color. Maybe Atom.color should be changed to return a tuple since tinyarray does not support slicing.

This problem caused error #2561 saving marker colors.

a = session.models.list()[0].atoms[0]
rgb = a.color[:3]
NotImplementedError: Slices are not implemented.

type(a.color)
tinyarray.ndarray_int

Change History (2)

comment:1 by Eric Pettersen, 6 years ago

Status: assignedaccepted

comment:2 by Eric Pettersen, 6 years ago

Resolution: fixed
Status: acceptedclosed

Returning a tinyarray had the upside of being able to be compared to a numpy color without triggering the stupid "use a.any() or a.all()" thing. Consequently, also changed atomic.colors.element_color() to return a tuple instead of a 1x4 numpy array. atomic.colors.element_colors() still returns a numpy array.

Note: See TracTickets for help on using tickets.