uPrompt Functionality
-
Hi, I'm having some trouble with using the Prompt mechanism to create new fields. I've followed the notes on edpaget's GitHub page https://github.com/edpaget/uPrompt.
The operators '+', '-', '*' appear to work.
New Field test_add, .u + .g
New Field test_sub, .u - .g
New Field test_mul, .u * .g
The operators '/', '^', 'log', 'recip' are not accepted.
New Field test_div, .u / .g
New Field test_sqr, .u ^ 2
New Field test_log, log .u
New Field test_rec, recip .u
Obviously these are not exhaustive tests. Random thought: perhaps we don't have the latest parser tweaks?Any help much appreciated. 😃
[originally posted in Science: Tools: questions, issues, and comments]
Posted
-
by trouille scientist, moderator, admin
Hello,
Thank you for posting about this. I've emailed Ed about this. He'll either reply here or I'll post his response over. We can definitely get this fixed and working ASAP.
Posted
-
by trouille scientist, moderator, admin
Hello,
True to form, Ed has already gotten back to me with fixes for these issues. Take a look and let me know.
Ed's email to me: I think I've resolved all those problems with the Prompt. I also made a few minor tweaks to its syntax so 'New Field' and 'New Filter' are now just 'field' and 'filter'. Naming the field now also takes a string contained in single-quotes (New Field color, .u -g can
now be field 'u - g color', .u - .g).I've updated everyone's dashboards to reflect the change, so there shouldn't be errors. I've also updated the tutorial.
Posted
-
by JeanTate in response to trouille's comment.
I tried again, from scratch (i.e. a new dashboard), but got the same results:
- "/" doesn't work
- New Field is fine, but field doesn't work
etc.
Posted
-
by james_involute in response to trouille's comment.
Hi trouille and Ed,
Thanks for looking into this. More operators are working but I've found that some are still not working for me.
Working operators: '+', '-', '*', '/', '^', 'recip'
field 'test_add', .u + .g
field 'test_sub', .u - .g
field 'test_mul', .u * .g
field 'test_div', .u / .g
field 'test_sqr', .u ^ 2
field 'test_rec', recip .u
Documented operators that are still not accepted for me: 'log', '==', '!=', '<=', '>=', 'is'
field 'test_log', log .u
field 'test_eqd', .u == .g
field 'test_ne', .u != .g
field 'test_lte', .u <= .g
field 'test_gte', .u >= .g
field 'test_is', .u is .g
The following operators were accepted but always returned false (I tried both floating point and integer data types)
field 'test_lth', .u < .g
field 'test_eqs', .u = .g
field 'test_gth', .u > .g
Any help much appreciated.Posted
-
by JeanTate in response to james_involute's comment.
I've just tried almost the same thing, using Quench Sample, and have almost the same results. With the following exceptions:
These were accepted for me:
field 'test_eqd', .u == .g (BUT always false)
field 'test_ne', .u != .g (BUT always true)
field 'test_lte', .u <= .g (BUT always false)
field 'test_gte', .u >= .g (BUT always false)
(I didn't try 'is')
Posted
-
by edwardothegreat in response to james_involute's comment.
Comparison operations are not supported when creating fields; they're used for doing filtering, so 'filter .u > .g' reduces your dataset to only subjects where u is greater than g.
Likewise log needs a base as its second argument. The syntax is 'log expression, base'. So 'field 'log u', log .u, 10' should produce a field with the log10 of u as its value. I could create a default value (natural or 10 whichever is more useful) for log's base if you think that makes sense.
Posted
-
by JeanTate in response to edwardothegreat's comment.
Thanks, oh Great Edward!
All along I was thinking "I wonder if there's supposed to be a base here somewhere? Perhaps "log" doesn't mean "log10?" But I didn't try it.
Then. I tried it just now ... and it works! 😄
So, either you add a note about the 'special syntax' for 'log', or change it so it is, by default, log10. That would be my suggestion.
General question about filters: after you've applied one, how do you 'un-apply' it?
And a nice feature I discovered, one which does not seem to be written up, is that you can sort a table by a field! Either up or down! 😃
Posted
-
Yeah that's related to the inability to delete fields as well. I made a mistake in how I'm updating the tools the data. Currently the way to go is to delete the filter then refresh. I'll have a fix early next week.
Posted
-
by james_involute in response to edwardothegreat's comment.
Thanks for the notes on the use of the log operator and the applicability of the comparison operators. I had assumed log was simply log10 as there weren't any other clues.
Ultimately I've been trying to create the following fields:
field BPTy, log (.oiii_flux / .hbeta_flux), 10
field BPTx, log (.nii_flux / .halpha_flux), 10I dare say I could create intermediate fields for the results of the division and then refer to those as the arguments to log. However, given the support for parentheses, I assumed I would be able to use the expressions above - you even used the phrase 'infinitely nested' if I remember correctly! Sorry if I'm being a little slow - I have tried quite a few combinations/permutations of these expressions and I can't seemed to hit on something that's accepted.
Posted
-
by JeanTate in response to edwardothegreat's comment.
Thanks.
Note to self: "what does he mean by 'refresh'? I don't recall seeing any Refresh button ..."
Posted
-
So that command works for me, just make sure to wrap the field name in single-quotes (sorry that was a change I made yesterday so we could have multi-word field name).
http://tools.zooniverse.org/#/dashboards/galaxy_zoo_starburst/51fbd0a1be70a627ec000010
Posted
-
by edwardothegreat in response to JeanTate's comment.
Sorry refresh your browser. Or reload I depending on what your browser decides to call it.
Posted
-
by james_involute in response to edwardothegreat's comment.
Doh! Thanks!!! Success 😃
Posted
-
by JeanTate in response to james_involute's comment.
Thanks EotG!
Me too ... my dashboard with a BPT diagram is posted in this Talk thread: Automated creation of BPT diagrams, in GZ Tools?
Posted
-
by JeanTate in response to james_involute's comment.
Normally, I'd create intermediate fields and play with them, when setting out to do something as radically new (for me, at least) as analysis-by-GZTools.
In this case there's a very good reason to do so!
Some of the objects have negative fluxes (log doesn't like that); some zero. There are also outliers, with ridiculously large fluxes, or small (making the ratio ginormous, if said flux is in the denominator). Etc. If you leave all these in, and try to do a scatterplot, you get ... nothing.
I used some comparison operators, per EotG's post, in filters, to produce a clean(-ish) dataset; worked like a charm! 😃 Now to find out how to share it, properly ...
Posted
-
by JeanTate
New problem: after creating intermediate fields, I tried to perform calculations using the data in them. I got NaN ('not a number', right?) in every case.
Here's the dashboard:
http://tools.zooniverse.org/#/dashboards/galaxy_zoo_starburst/51fd0ef4be70a677d2000007
The intermediate fields are Niiha and Oiiihb; clearly they contain floating point numbers; however, even the simplest of operations (e.g. "field 'testx', .niiha + 1.0") produces NaN.
Posted