-
-
Notifications
You must be signed in to change notification settings - Fork 404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add operation for group-wise normalisation #6124
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6124 +/- ##
==========================================
- Coverage 88.70% 88.12% -0.58%
==========================================
Files 314 319 +5
Lines 65993 67212 +1219
==========================================
+ Hits 58537 59232 +695
- Misses 7456 7980 +524
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
We should probably adjust the range limit without changing the data itself. Unless I'm not understanding something about the subcoordinate_y mechanism, it involves setting ylim on each subcoordinate axis group to fit the largest of timeseries in that group. |
Take 2 on this. This time the operation doesn't update the data but just records the min-max per group in the Setting the The code is the same as in the original post, with the same output, except this time the data is unchanged. |
dims = [dim] | ||
v0, v1 = dim.range | ||
axis_label = str(dim) | ||
specs = ((dim.name, dim.label, dim.unit),) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically ylim
should be supported as well...I'll open an issue about this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heya, have you opened an issue about it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An issue about this bit of code once this PR is merged ;-p
Looks good! Made a few comments and this approach is definitely much more sensible than rescaling the data itself. Once these comments are addressed and a couple of unit tests are added, I would be happy to see this merged. |
Just to clarify, this operation is meant to be invoked explicitly by a user or could we use compositors to automatically apply this if |
I didn't think about compositors so yes it is meant to be invoked explicitly. If it was applied through a compositor, would it be possible for users to disable it if they don't want this behavior? (I'll fix the conflicts) |
Sure, if we exposed a |
So you would prefer this was implemented and applied by default via a registered compositor? If so, I may need some pointers as I just tried that but didn't manage to get the compositor operation registered on an "Overlay" to run. |
I guess I'd like to hear what others think. Should this behavior be automatic or toggleable with a plot option? |
My own feeling is that this operation addresses a very niche use-case. Having the operation be explicit helps make it a bit clearer how things work, especially as it is an unusual way to use the group/label system (which we have generally been moving away from over the years). My own feeling is that we should document this operation and simply tell users how to register a suitable compositor if they really want it (i.e. if they will be using this feature all the time) and not make it a default compositor that is enabled by default. So in short, my own feelings are:
As for a plot option, if we want to add one then definitely it should be disabled by default (imho). |
As far as I can see compositors aren't documented outside of the reference API. I'm not really planning to document compositors part of this PR 🙃
I'm not sure how to convert the operation to be usable in a compositor. As far as I can see, compositors apply to an operation to each element of an Overlay. In this case, we need to compute the min-max over multiple elements (those with the same |
It already is, my request to make it a no-op was the main thing that's needed.
Compositors operate at the level of an Overlay and can combine one or more layers. |
I'm fine with merging this without the compositor for now. |
I am a little unclear about one thing though, @jlstevens makes it sound this operation is extremely niche but I thought it is the desired behavior for grouped layers when
|
Ok I must have messed up then when trying to register is with a compositor since
Nice! Are you done reviewing it? @droumis I would like to update the subcoordinate-y docs when we're done with the series of changes we're making this month. |
I think for the compositor to work we'd have to add support for patterns that match on any number of elements, currently you can only do something like this: Compositor.register(Compositor("Curve * Curve", subcoordinate_group_ranges, None,
'data', transfer_options=True,
transfer_parameters=True,
output_type=hv.Overlay,
backends=['bokeh', 'matplotlib', 'plotly'])) Additionally we'd have to wrap the operation so it checks the layers have |
I'd like an answer to my question above first, as it currently stands this does not address the ask outlined in the issue. |
I suppose I consider all use of Essentially, I am always wary of introducing additional complexity and I do think that this normalization behavior based on group isn't entirely intuitive (good docs will help!). If we do as Philipp suggests and only do anything when |
Got you, yes the proposal was never to enable this for all overlays, only for subcoordinate plots. I had vaguely recalled you could make a compositor dependent on a plot option already but I guess that was me misremembering as I can't find any mention of that now. |
Good catch, I'll see with Demetris. Meanwhile:
Yes true! I've also tried I'll make the operation a no-op is the overlay is not a subcoord-y overlay and will chat with Demetris. |
I'm actually not sure how to find whether an overlay is a subcoord-y overlay in the operation. I've added some warnings inspired by the checks added in #6122. @droumis can you remind me of the outcome of our discussion on Thursday about applying the normalization per group by default or not? I think we said we're fine with this not being the default behavior but I'd like you to confirm this (my brain 🧀 ). If not,
|
Yea, we agreed that because of the complexity involved, it would be sufficient (for now) to require group-wise normalization to be explicitly enabled, and so not applied by default. |
Thanks! Then I'll just ask @philippjfr to have a look again at this PR 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
Operations typically don't use the plot options but here they are simply checked to generate a warning. That seems entirely reasonable to me.
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
resolves #6123
Very much WIP and I've never written any operation! But it works:
@droumis let's chat more about the CZI use case we're trying to solve, with a much much larger dataset that comes with more constraints.