seantronsen / pvt

GNU General Public License v3.0
0 stars 0 forks source link

BUG: Trackbar steps out of bounds for specified range - see image #37

Closed ghoulapool closed 6 months ago

ghoulapool commented 6 months ago

Here's an image: image

For this tracker:

trackbar_sigma_8 = ParameterTrackbar("sigma_8", 0.7, 0.89, step=0.01, init=0.8)

Which I think should stop at 0.89, but it seems to go past that to 0.90. Notice the "tick" on the far right in the image.

seantrons commented 6 months ago

After reading numpy's docs a little more, this is due to several isues that may occur when using np.arange like numerical instability and general floating point weirdness.

The range calculation will have to be made more manual. Shouldn't be much of an issue.

seantrons commented 6 months ago

Issue fixed as of: ee0e12c

I redesigned the custom trackbar/slider used by the library to have better numerical stability. The new design was tested against a few previous issues as well as the settings shown in image of the first post.

Important: Do note the new trackbar uses truncated integer division to handle weird, but still valid cases where the specified start, stop, and step values would result in a fractional number of steps. See the new docstring for more details. image

Trackbar configurations tested after the redesign: image

image image image

Closing issue.