Skip to content

Color particles by an attribute - #279

Open
WeiqunZhang wants to merge 18 commits into
mainfrom
particle-color-by-attribute
Open

WeiqunZhang wants to merge 18 commits into
mainfrom
particle-color-by-attribute

Conversation

@WeiqunZhang

Copy link
Copy Markdown
Member

Addresses the color item of #275. The Particles dialog gains Color by (any component name a species has), a colormap, a log scale and a fixed range; species without the component keep their color, and a particle color bar appears in the Color Scale dock.

The reader keeps component names and reads one attribute per point; sessions and frame specs carry it, and protocol 1.9 sends names and values (a 1.8 peer's attribute is refused by version). A pure-SoA plotfile written by AMReX (with amrex#5698's int-init fix) tests the reader against the real writer.

@WeiqunZhang
WeiqunZhang added this pull request to stack #280 September 29, 2026 22:41
@WeiqunZhang
WeiqunZhang force-pushed the particle-color-by-attribute branch from 578f76d to fb1ed4b Compare September 29, 2026 23:50
Base automatically changed from particle-marker-shapes to main September 29, 2026 23:59
@WeiqunZhang
WeiqunZhang force-pushed the particle-color-by-attribute branch from fb1ed4b to 7dcfc45 Compare September 29, 2026 23:59
Addresses the color item of #275. The Particles dialog gains Color by
(any component name a species has), a colormap, a log scale and a
fixed range; species without the component keep their color, and a
particle color bar appears in the Color Scale dock.

The reader keeps component names and reads one attribute per point;
sessions and frame specs carry it, and protocol 1.9 sends names and
values (a 1.8 peer's attribute is refused by version). A pure-SoA
plotfile written by AMReX (with amrex#5698's int-init fix) tests the
reader against the real writer.
@WeiqunZhang
WeiqunZhang force-pushed the particle-color-by-attribute branch from 7dcfc45 to b345103 Compare September 30, 2026 00:01
Particles moved under Overlays when View was split, where P is free,
so Overlays > Particles... is now Alt+O, P instead of T.
While particles are colored, image and animation exports of the
primary's panels carry the particle scale right of the field's. An
export layout can hold a second color bar; a frozen movie layout
without room for it leaves it out.
The particle scale normalized with its own arithmetic, which overflowed
for a range like [-1e308, 1e308]: 0 took the lowest color and the
maximum turned NaN before its cast to a slot. Particles now take their
slot through ValueMapping, as slices do.
Each palette-slot batch copied the whole species overlay, points and
all, then replaced the points: a million particles over every slot
meant 253 full copies per view. Batches now take only the style.
A frame's samples are drawn view by view, and only the all-views
redraw refreshed the bar, so a frame whose masses ran 10 to 80 kept
the previous frame's 1 to 8 legend. Every view redraw now refreshes
it. The smoke test's second frame has scaled masses, and its accessor
reads the widget's own range.
The range spin boxes were set to 17 decimals, overriding the
scientific spin box's own precision, so any bound below about 1e-17,
such as a mass in kilograms, rounded to 0 and Apply refused the range.
With Color by back on species colors, a bad fixed range left behind
still blocked Apply, though its controls were disabled and could not
be corrected. The range is now checked only when an attribute is chosen.
If this frame's species lacked the chosen attribute, Color by fell
back to species colors, and an Apply made only to change alpha cleared
the coloring for every frame. The attribute now stays listed, marked
as not in this frame.
Opening another dataset or a sequence cleared the particle samples but
left their color bar up until the next redraw, or for good if the open
failed. Both teardowns now refresh it.
The on-screen particle bar now says " (log)" on a log scale, as the
exported one and the field's bar do. The batching comment claimed
values past the range keep the species color; they take its end colors.
A movie's layout freezes on its first frame, which reserved the
particle color bar only when that frame had usable values, so a movie
starting on NaN attributes never showed the bar. A movie now keeps the
room whenever an attribute is chosen and paints the bar on frames with
a range. The materializer gains --mass-scale, NaN allowed.
A movie kept room for the particle color bar whenever an attribute was
chosen, so with no species selected, or none that has the component,
every frame carried an empty column. It now also needs a selected
species with that component.
When a movie's first frame had no usable particle values, its frozen
layout kept the label format worked out from the 1-10 stand-in range,
and every later frame's bar was labelled with it. The layout now keeps
only the room; each frame labels the bar from its own values.
Each view redraw filled a per-point value vector for every sample even
when no attribute was chosen, only to leave it unread. It is now filled
only for a colored sample. Also correct the fixture's mass comment,
which predates --mass-scale.
A sample counted as colored if it carried any attribute, so switching
Color by while a sequence frame loaded drew the old attribute's values
under the new one's name, for good if the reload failed. A sample is
now colored only when its attribute is what the chosen name resolves
to for its species.
The settings restore passed the saved format to the field's color bar
but not the particle bar, created earlier with the default, so after a
restart the two labelled their ticks differently.
The fixed bounds were filled for the attribute the dialog opened on and
kept when another was chosen, so switching from mass over [0, 1] to an
attribute near 1e6 colored every particle with the top color. Choosing
another attribute now unticks Fixed range.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant