Conversation
There was a problem hiding this comment.
just adding a missing validator and fixing a couple linter errors
There was a problem hiding this comment.
The main contribution--the ShowParams class. Written to be a wrapper and therefore not break existing workflows or change the underlying viz stuff that @gvarnavi wrote.
| logarithmic_index: float = 1000.0 | ||
| asinh_linear_range: float = 0.1 | ||
|
|
||
| def __post_init__(self) -> None: |
There was a problem hiding this comment.
This got pretty long once I added warnings for adding incompatible args. The alternative would be to further nest the different interval or stretch types, but that would be worse I think.
| if TYPE_CHECKING: | ||
| from quantem.core.datastructures import Dataset2d | ||
|
|
||
| ArrayLike: TypeAlias = Union[NDArray, torch.Tensor, "Dataset2d"] # union required here |
There was a problem hiding this comment.
So show_2d doesn't give linter errors when directly passing tensors and such.
| norm: NormalizationConfig | ||
| | ShowParams.Norm | ||
| | dict | ||
| | str |
There was a problem hiding this comment.
the type hinting is really messy... there's probably a way to clean it up but idk what it would be.
|
Tagging @cophus @gvarnavi @bobleesj and @cedriclim1 so that you can take a look and/or review. |
What does this PR do?
This PR improves how
show_2daccepts normalization and scalebar settings by introducing a small, autocomplete-friendly API, while keeping existing dict/string usage working.Primarily it adds
ShowParamswith nestedShowParams.NormandShowParams.Scalebardataclasses so users can discover fields via the editor instead of ad hoc dicts.Tutorial notebook and examples: quantem-tutorials PR #7 (to be merged once this is)
What should the reviewer(s) do?
Run the tutorial notebook and suggest any changes to either the notebook itself or the API.
Review
show_params.py,visualization.py,custom_normalizations.py, andvisualization_utils.pyfor API clarity and backward compatibility.This PR introduces a public-facing change (e.g., API, CLI input/output).
Reviewer checklist