-
Notifications
You must be signed in to change notification settings - Fork 15
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
feat: add colours to ModFill #505
Conversation
Ok sorry for the rebase mess, this one should be clean but I see now something is wrong -- presumably something to do with my new formula parameter and your formula changes. I'll take a look at that when I get a chance. |
OK, just let me know when you're ready for me to look. |
Ok, the merge issue is fixed, it should run and be ready except for the snapshots. |
First some general high-level feedback:
|
One more general philosophical question here: When the transparency level is low, the bottom-left corner is always darker than the right-hand side, simply because there are fewer residues so each on average occursmore times. In many cases, this is visual noise, there's not really "more hits" in the smaller residues than the larger residues, in that each term does in fact have one residue per modulus; they're just spread out over more different residues in the higher moduli. Should there be an option, perhaps even an option turned on by default, to allow the transparency to depend on n so that you can adjust things so that "all else being equal", the diagram would be uniformly saturated left to right? |
More small-bore comments (as with most of my feedback, more questions than directives):
|
I searched around. There is no browser-native rgba color picker, but it appears that it would be pretty easy to create a RGBA param type and roll our own input setup with a combination of a color picker and 0-1 slider. If you think that would be useful, I am happy to help. We could use the rgba color in Turtle, too, I suppose -- Wait For It would definitely look different with some transparency for the turtle path, for example. |
Code is all nice and straightforward. Once the design/wording stuff above is decided/resolved, we should be good to go. |
I think this would be lovely! Yes, Turtle would benefit too, and it would simplify parameter panels (although it hides powerful functionality in some cases, so we might want to add a hint or something). Would the roll our own basically use the browser RGB plus a slider? Do you imagine doing that as part of this PR or another one? |
I need help with a weird (race condition?) bug. Try this URL: |
For me it is only happening on page load. If I click your URL and then enter a "2" in the number of terms to use, I get both horizontal stripes. Similarly if I change any other parameter of the the visualizer i seem to be getting all of the horizontal stripes. Does that mesh with what is happening for you? |
Wow, and I agree, I can't get it to happen with formula |
Finally some progress, but now a different mystery. Somehow the cache for formula |
OK, it's an async initialization mess with sequences. Roughly the problem is that Specimen.makeSequence returns right away, but it has initiated an asynchronous validate, which may eventually conclude that the parameters have changed, and that it needs to initialize the sequence, but that might end up happening after the sequence has filled its cache, and then the cache gets destroyed... Will try to untangle, but the sequence of events is really muddled. This is not a proud part of Numberscope's design :-( |
Oh wow, thank you for figuring that out! I thought maybe it was something beyond this visualizer. But why doesn't it happen to Turtle etc? |
Not sure why it isn't happening to other visualizers but I think it is because of a quasi-bug in modfill that we should fix: it increments its index before draw has succeeded. Since eventually there will be a cache miss, that's not actually kosher. But it has been a useful quasibug, in that there shouldn't be a cache miss on the first call to compute |
So far haven't tackled more of this.
Correct.
Done.
Tried to improve.
Done.
Not sure how to do this -- currently the params system doesn't have something like that. Should I consider adding it? Seems useful.
Not addressed right now (and this most recent commit doesn't change the gallery which is a bit broken by this commit.
Done. |
I made transparency a value that could also be a function of m. That way, someone can play with this. But in my experiments, the way it is set by default is the most visually pleasing. You can try a few combos, and if there are good ones we can add them to the docs. |
Tried a reword.
Tried to improve.
Tried a new wording.
Fixed.
This is a cool idea, but now that I made transparency possibly a formula in m, modulus, this would be undoing that capability. |
I have updated the PR checklist to show the items that are currently outstanding. |
I believe I fixed this quasibug, but the underlying cache bug still remains. |
Here's an example where a formula is still popping up some errors while trying to type: backspacing the variable inside "isPrime(a)" produces a pop-up, but only for the formula field in ModFill, not for the formula field in Sequence. Do you know how to easily fix this (seeing as you were just fixing this in another PR)? |
My newest commit allows for variables n (index) and a (value) in the highlight formula. I also added checking whether they were actually in the parsetree and avoiding even trying math.safeNumber() on things that aren't in the parsetree, so as to avoid pointless failures. This is necessary, for example, if you want to use highlight formula involving n but not a on VF numbers, where a is not a safe number after just 79 terms, but n is fine. |
OK, I'm going to take a quick look at this bug insofar as I can given that it's not happening on my machine. When you get a chance, let me know what exact version of Firefox you are running (and/or try updating to as recent a version as you can, but check the version number before you update). Also please check: when you have the specimen as the screenshots above, with the number of terms set to 2 (i.e., highest number where you see nothing), if you quickly resize the browser, do you see any flashes of black, or of blue stripes near the bottom of the canvas, i.e. glimpses that it is drawing only to get wiped out by new white. In the meantime, I will try to follow up on the one weirdness I can observe here, which is that it seems to be initializing twice on page reload, when it seems like once would suffice. I speculate that maybe if I could get rid of the double initializing here, then it might start displaying properly on your end. |
Oh wait, I take it back. With the latest code, I only seem to be initializing once. So please do post that further information when you get a chance, and then if that doesn't ring any bells, I don't see any option but a joint debugging session when we can find the time, since nothing tangible awry is happening here :-/ |
The bug has apparently disappeared (?!??!!?) so we forge onwards! |
OK, passing the baton back. Let me know how that works for you, in terms of error checking in all formula entry boxes and using the Opacity formula if there is no Highlight Opacity formula. |
Incidentally, |
@gwhitney I don't know why, but the "changing a sequence" e2e test is timing out. Are you seeing this? |
Can't run tests right now since internet on plane is too slow. But there is one test -- I can't remember which -- that erratically times out for me (roughly one time in 3 or 4). It always passes on a re-run, in my experience. If you are getting one consistently timing out, try running just that one and then looking at the web report to see if you can see what's going on. If you're still stuck next time I have some time to look at this (likely Friday), I will poke around. |
Interestingly your bug fix resulted in a 2 pixel difference in the Chaos snapshots. So there was something (undetectable) wrong happening from it. :) |
Ok, I think this is ready for review. I think it's a big enough PR, that I've not implemented any new colour schemes or features in this latest round. If you'd like to keep something for future, let me know and we can file an issue or you could feel free to add something or request something. But nothing seems like a burning need for me right now, so I'm marking it ready. |
Also, I must add, it never ceases to amaze me how a PR I think will be small -- some colour changes in ModFill -- will end up touching 60 files! I guess I see why you try not to overlap PRs and rebase too much. |
Well, "only" a dozen source files, the rest are all tests. And it's happening because we are still in process of flushing out fundamental bugs, and not being very disciplined about pausing the PR, doing a separate bug fix PR, and then rebasing the feature PR, since we are a small pre-alpha project. I take it the test timeout stopped bothering you? |
Just in the CI snapshots, right? |
Correct! |
Right, that seems like a perfectly fine decision. Do any of the other colour scheme suggestions seem like they are worth leaving as issues (meaning we intend to do them at some point)? Or should one of us move them to Discussions (meaning we will think about them someday but have not made any specific decision to necessarily ever implement them)? I am fine either way, just let me know your inclination. I will review what's here so far when I have the chance, my guess is Fri or Sat. |
Suggestion: I find the current incarnation of "Picasso's Periods" very strobe-y, to the point of being a bit unpleasant, and the blue/rose "periods" to go by bit too quick. I'd suggest dialing the frame rate down to 30? What do you think? I understand you may not be able to respond for a while; I'll just hold on the review until you do have a chance to get back on this. If you decide you like the decision, I can push the change to defineFeatured if you want (super tiny change); if you decide you'd like to leave it as it is, I will just go ahead with the rest of the review (I already fixed one little bug, where a parameter was not disappearing if the default value of the parameter its visibility depended on was a value on which it should not appear). |
I think that's a good call. Could even go to 20 if you prefer. Also, you might decrease the opacity on the highlight from 0.4 to 0.3 -- if you think that looks good, you could fiddle with that too. I'd be happy with any of these variations. If you don't mind pushing your favourite variation in this general vicinity, that's great! |
Wow, I wasn't expecting a response any time soon. I ended up at 24fps, a common speed between 20 and 30; and I didn't mind the "prime bursts" being so bright, but I did ramp up the saturation of the blue periods slightly. Proceeding with review. |
I have just gone through the PR checklist and all seems good; merging. |
With this PR, the person making a visualization can specify background, fill, and highlight colors, as well as specify a criterion based on entry index, value, and modulus as to which cells will be highlighted. The new capabilities are documented, and new featured specimens are created to make use of the new features. Along the way, fixes some async timing bugs with visualizer setup. --------- Co-authored-by: Glen Whitney <glen@studioinfinity.org>
By submitting this PR, I am indicating to the Numberscope maintainers that I have read and understood the contributing guidelines and that this PR follows those guidelines to the best of my knowledge. I have also read the pull request checklist and followed the instructions therein.
This is still marked draft but feedback is welcome. It adds several colouring abilities to ModFill:
Things to do: