Closed MaximeScope closed 8 months ago
I should note that I've implemented a _colorfunction that includes a check for undefined values (such as when taking the square root of a negative value of the selected property). In such cases, the atom is assigned a gray color.
I think you should start by adding a minimal example to the python/examples
folder. I tested it on the chemical shielding dataset and my impression is that it doesn't really work but it's hard to make a reproducible example with this much data.
I have it loaded with these parameters
and I'm looking at structure 276, atoms 75 and 78. They have a CS_total of 24 and 26 (quite close on a range between 15 and 30) but they end up colored in bright red and bright blue as if they were pretty much extreme.
Another observation is that IMO we REALLY need to provide a rudimentary color scale, otherwise it's very hard to read the figures. I read a bit and it seems the best way to do this would be to add an HTML entity outside the widget, a bit like the floating buttons in the top-right cornier.
I read a bit and it seems the best way to do this would be to add an HTML entity outside the widget, a bit like the floating buttons in the top-right cornier.
The idea was to us a custom label, for which we can set the background to an arbitrary HTML canvas, for which doing a gradient would be fairly easy.
But let's make sure the core of the functionality works first, merge it and then work on the color bar in a separate PR to reduce the size of the individual PRs.
I think you should start by adding a minimal example to the
python/examples
folder. I tested it on the chemical shielding dataset and my impression is that it doesn't really work but it's hard to make a reproducible example with this much data. I have it loaded with these parametersand I'm looking at structure 276, atoms 75 and 78. They have a CS_total of 24 and 26 (quite close on a range between 15 and 30) but they end up colored in bright red and bright blue as if they were pretty much extreme.
I have addressed the issue, and the code should now work correctly. Initially, the code was selecting the first atoms independently from the structure. With the help of the environnements, the visualizers should now accurately assign colors based on the correct atoms property value.
OK I have added an example that generates a simple color-coded figure. I have also renamed the RWB color scheme because it's blue first. I think one important thing is we can do to make it possible to have a reference for the colors is to make sure we have color schemes that match the plotly one. BWR is very similar to seismic (and this I have used in the example) but it'd be nice to have exactly the same schemes - at least viridis and magma for instance. Looks like you just need to sample the plotly/matplotlib palettes and hardcode say 16 intermediate points. Could you do this?
Just commenting that this Fixes #118 for good
Just commenting that this Fixes #118 for good
This kind of comment needs to be in the first message of the PR for github to automatically close the issue
merged! 🎉 Thanks @MaximeScope and @angerossi for your work implementing this!
It should finally be possible to merge the coloring of the 3d structure with master.
There is an additional option to color the background atoms by property => (Environments -> more options -> color: prop, style: ball and stick)
EDIT:
Fixes #118