Skip to content

Merge Raw vis into Scalar vis#1770

Merged
axelboc merged 3 commits into
mainfrom
scalar-vis
Mar 23, 2026
Merged

Merge Raw vis into Scalar vis#1770
axelboc merged 3 commits into
mainfrom
scalar-vis

Conversation

@axelboc
Copy link
Copy Markdown
Contributor

@axelboc axelboc commented Mar 14, 2025

Finally getting rid of some code 😂 image

The diff is not tooo bad, but I've actually done the refactoring in three commits:

  1. First, I extracted the value formatting code from RawVis so it just accepts a string value like ScalarVis.
  2. Then I let RawVisContainer handle printable scalar datasets and removed ScalarVisContainer and ScalarVis completely. The core change here was the merger of the scalar vis formatter into the raw vis formatter.
  3. Finally, I renamed everything starting with the prefix "raw" back to "scalar".

You'll note that none of the screenshots change. The only visible changes for users are that:

  • datasets that would previously be visualized with the Raw visualization (i.e. "Raw" tab) are now visualized with the Scalar visualization ("Scalar" tab);
  • datasets that would previously be visualized with the Scalar visualization now have a toolbar (ScalarToolbar, previously RawToolbar) with the "Fit image" control and the ability to export to JSON.

I'm planning to clean-up the mock file and the tests a fair bit (raw, raw_large, etc.) but didn't want to clutter this PR, which is already confusing because of all the files that are moved and renamed.

image image image image


{isImage ? (
<RawImageVis
<BinaryImageVis
Copy link
Copy Markdown
Contributor Author

@axelboc axelboc Mar 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I renamed this component, since the term "Raw" no longer makes much sense.

@axelboc axelboc requested a review from loichuder March 14, 2025 15:53
@axelboc axelboc marked this pull request as draft March 18, 2025 07:56
@axelboc axelboc removed the request for review from loichuder March 18, 2025 07:56
@axelboc axelboc force-pushed the array-vis branch 2 times, most recently from f224ad4 to 193b553 Compare March 20, 2026 08:34
@axelboc axelboc force-pushed the array-vis branch 8 times, most recently from 7260a8c to ecff171 Compare March 20, 2026 14:38
Base automatically changed from array-vis to main March 20, 2026 14:57
Comment on lines -17 to -18
assertScalarShape(entity);
assertPrintableType(entity);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ScalarVisContainer now accepts anything with a non-null shape.

Comment on lines -38 to -42
const scalarUint = dataset('uint', scalarShape(), intType(false));
const scalarBigInt = dataset('bigint', scalarShape(), intType(true, 64));
const scalarFloat = dataset('float', scalarShape(), floatType());
const scalarStr = dataset('float', scalarShape(), strType());
const scalarBool = dataset('bool', scalarShape(), boolType(intType(true, 8)));
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing CORE_VIS.Scalar with all these is now overkill since it doesn't care about the dtype any more.

@axelboc axelboc marked this pull request as ready for review March 20, 2026 16:04
@axelboc axelboc requested a review from loichuder March 20, 2026 16:04
onChange={setDimMapping}
/>
)}
<VisBoundary resetKey={dimMapping} isSlice={dims.length > 0}>
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code comes from RawVisContainer with one subtle fix here caught by our Scalar vis tests: isSlice is now set dynamically to ensure that the correct loading message is shown ("Loading data" instead of "Loading slice" when fetching the value of a scalar dataset)

Copy link
Copy Markdown
Member

@loichuder loichuder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation looks good but it feels very wrong to call Scalar, something that actually support any shape, including images.

Perhaps we should have merged Scalar vis into Raw vis ? 😂

@axelboc
Copy link
Copy Markdown
Contributor Author

axelboc commented Mar 23, 2026

Yeah, I had the same hesitation... I was initially going to keep only the Raw vis but ended up changing my mind.

I reminded myself that:

  • We use the term "scalar" in the context of HDF5, not in the strict maths/physics sense.
  • The tab refers to the shape that we end up with in the visualization area, after slicing. It's similar to how we visualize a 3D numerical dataset as a "Heatmap" rather than as a "Stack".

I also didn't like the term Raw for visualizing simple scalars like numbers, strings, booleans, etc.

@axelboc
Copy link
Copy Markdown
Contributor Author

axelboc commented Mar 23, 2026

What about Primitive?

@axelboc axelboc merged commit c9731a0 into main Mar 23, 2026
13 checks passed
@axelboc axelboc deleted the scalar-vis branch March 23, 2026 09:33
@axelboc axelboc mentioned this pull request Mar 23, 2026
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.

2 participants