Perl 6 - the future is here, just unevenly distributed

IRC log for #pdl, 2012-06-28

| Channels | #pdl index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
01:41 run4flat_ joined #pdl
02:11 run4flat__ joined #pdl
02:11 dcmertens joined #pdl
09:50 Mithaldu joined #pdl
12:33 lungching Happy Tau Day everyone!
12:46 Mithaldu run4flat: see that? see #win32?
13:19 run4flat Mithaldu, never forget that we are supposed to make our bots *look* omniscient
13:20 run4flat clearly, dipsy failed to fulfill this role
13:20 run4flat :-)
13:38 Mithaldu run4flat: i don't even know whose bot dipsy is :)
13:47 run4flat_ joined #pdl
14:14 joelberger joined #pdl
14:14 liddle_piddle_bot Welcome back, joelberger
14:19 run4flat__ joined #pdl
15:18 joelberger run4flat: is there any way to get the position of a click on a prima plot from a script
15:18 joelberger say I pop up a window with a 2d image
15:19 joelberger and I want to click on a point
15:19 joelberger and use that point to do some further analysis
15:19 joelberger (a lineout in each direction, and gaussian fitting)
15:19 run4flat yes
15:19 joelberger cool
15:19 joelberger how do I do that?
15:19 run4flat I think that's even given as an example at the end of P::G::P::s
15:20 run4flat ::Simple
15:20 * run4flat checks
15:20 * joelberger goes to look
15:21 run4flat search the page for "onMouseMove"
15:21 run4flat except you would use the onMouseClick event
15:22 run4flat all the widget events that can be fired are documented here: http://search.cpan.org/~karasik/Pri​ma-1.29/pod/Prima/Widget.pod#Events
15:23 joelberger cool thanks
15:23 joelberger one more thing, can the click also close the window? and I assume that I need -sequential here right
15:24 joelberger actually this is really cool
15:24 run4flat I don't think you need sequential for this
15:24 run4flat actually, it would be easier if it wasn't sequential
15:24 run4flat then it forks a seperate process, and you can just tell the Prima application to quit
15:24 * run4flat looks up the docs
15:25 run4flat you could probably include something like $::application->close in the callback
15:26 run4flat if you did that in sequential mode, it would prevent any further windows from popping up
15:28 joelberger maybe it wont matter, I'll see how this works from here
15:28 joelberger thank man!
15:31 run4flat n/p
15:32 run4flat note, there are some handy functions for converting mouse location to real coordinate values
15:33 run4flat $x = $plot_obj->x->pixels_to_reals($x_value)
15:34 run4flat oh, but that's already shown in the example!
15:34 run4flat got ahead of myself. :-)
15:39 joelberger yep, I see it, thanks
15:40 run4flat is it working? I just realized that the callback will be called in separate (forked) process if you're in non-sequential mode
15:41 run4flat which means that you can't, say, modify a variable that you've closed over
15:43 run4flat However, you can write to a file, and in your main perl script you can wait for that file to be written
15:47 joelberger right, that is the problem I'm worried about
15:48 joelberger but that may not be a problem if I have the onMouseClick callback do all the work (there isn't much)
15:49 run4flat oh, perfect
16:43 Mithaldu joined #pdl
16:51 joelberger once I use pixels to reals, what am I getting
16:51 joelberger ?
16:51 joelberger is it a percentage across the space?
17:04 joelberger it seems to be
17:16 joelberger $self->get_parent->close;
17:17 run4flat sorry, just saw this
17:17 run4flat when you use pixels to reals, you get the value of the actual coordinate
17:18 run4flat a trivial conversion for linear axes
17:18 run4flat but more difficult for logarithmic axes
17:18 run4flat joelberger, are you just displaying images?
17:19 run4flat if so, it would probably be best to set the x-bounds and y-bounds as [1, width] and [1, height]
17:19 run4flat that way if you resize your window, the "real" value is the actual x/y image pixel
17:19 run4flat make sense?
17:20 joelberger yeah
17:20 joelberger cool
17:21 joelberger though I still need int
17:22 run4flat sure, but you know how to do that. :-)
17:30 joelberger can I put a cross at a point on the image?
17:30 joelberger -max => ds::Pair(
17:30 joelberger $max_x, $max_y,
17:30 joelberger plotTypes => [ppair::Crosses],
17:30 joelberger ),
17:31 joelberger but I don't see anything
17:31 run4flat what's the name of the other dataset?
17:31 joelberger data
17:31 run4flat also, this can be abbreviated with plotType => ppair::Crosses
17:31 run4flat so max should be plotted afterwards...
17:32 run4flat hmm
17:32 joelberger could it be a ranging problem?
17:33 run4flat I'm not quite sure what you mean
17:33 joelberger maybe I should make it a ds::Grid
17:33 run4flat which?
17:33 run4flat data?
17:33 joelberger the max point
17:33 run4flat max should be a pair
17:33 joelberger you're the boss
17:33 run4flat :-)
17:33 joelberger -data => ds::Grid(
17:33 joelberger $pdl,
17:33 joelberger x_bounds => [1,$x_dim],
17:33 joelberger y_bounds => [1,$y_dim],
17:33 joelberger plotType => pgrid::Matrix(
17:33 joelberger palette => pal::BlackToWhite,
17:34 joelberger ),
17:34 joelberger ),
17:34 joelberger -max => ds::Pair(
17:34 joelberger $max_x, $max_y,
17:34 joelberger plotTypes => ppair::Crosses,
17:34 joelberger ),
17:34 joelberger and max_* are in the same numberspace as *_dim
17:34 run4flat try adding: colors => pdl(255, 0, 0)->rgb_to_colors
17:34 run4flat to your -max dataset
17:35 run4flat and/or lineWidths => 3
17:35 run4flat both of those should make it pop out
17:36 * run4flat checks the syntax for rgb_to_colors
17:36 run4flat sorry, its should be singular
17:36 run4flat use PDL::Drawing::Prima::Utils
17:36 run4flat ...
17:37 joelberger still don't see it
17:37 run4flat gimme a sec, I'll nopaste it
17:38 joelberger wait
17:38 shadowpaste "run4flat" at 217.168.150.38 pasted "Plotting a cross at the max" (14 lines) at http://paste.scsys.co.uk/201459
17:38 joelberger I see it once I drag the data in the window
17:38 run4flat really?
17:38 joelberger its like it doesn't refresh until I do something
17:38 * run4flat is surprised
17:38 run4flat a bug!
17:38 run4flat :-)
17:39 shadowpaste "run4flat" at 217.168.150.38 pasted "Plotting a cross at the max" (19 lines) at http://paste.scsys.co.uk/201460
17:39 run4flat hmm, ok, I'll have to check that out
17:41 joelberger moving the window and resizing the window don't work
17:41 joelberger only dragging inside the plot
17:41 joelberger I can send you the script and the image file if you want to try it
17:41 run4flat yes, that'd be helpful
17:42 run4flat I'm cooking up something now with M51, but the exact script would be great
17:44 joelberger https://gist.github.com/3012794
17:44 * run4flat retrieves the file
17:44 run4flat files*
17:46 joelberger call with the filename as argument
17:46 joelberger I'm sure you can figure that out
17:46 run4flat :-)
17:47 joelberger eventually I need to do this over a bunch of files
17:47 joelberger but I cannot be sure that the automated maxfinding will work
17:47 joelberger because some of the images are really noisy
17:47 joelberger so I want the onclick handler so I can pick a new center
17:48 run4flat I see
17:48 joelberger and maybe a onReturnKey or whatever to accept the found point
17:49 run4flat haha, your handler prevents zooming in and out
17:50 run4flat because scroll wheel turning triggers a mouse click event
17:50 run4flat alright, we're off to lunch
17:50 run4flat I'll have to work on this after I get back, if I have time
17:51 run4flat btw, I *really* appreciate that you're using the library. :-)
17:54 joelberger hey, I use what does the job, it seems to (mostly) be doing it
17:54 joelberger so I'm happy to use it
17:54 joelberger well written sir
18:00 joelberger can you make the zoom a MouseWheel event?
21:04 run4flat joelberger, sorry, long lunch, then lab meeting
21:04 joelberger no worries, I just got back from long soccer match
21:05 run4flat sweet
21:05 joelberger as a true american mutt, any western european win means that my team won :-)
21:05 run4flat ha, right. :-)
21:06 run4flat yesterday I was voting for Spain over Portugal
21:06 joelberger anyway, before I left, I generalized the code out a little
21:06 joelberger acutally I don't have either of those bloods
21:06 joelberger though I guess my half filipina wife must have a little spanish
21:07 run4flat ha
21:07 run4flat well, to answer your questions, the mousewheel triggers a mousewheel event *and* a mouse click
21:07 run4flat I'm not sure how to prevent a mouse click by the mouse wheel
21:07 run4flat but it's easy to get the mouse button and screen for only left button clicks
21:07 run4flat anyway, to your code
21:07 run4flat the gist is modified?
21:07 * run4flat checks
21:08 run4flat ah, yes, keyboard input, which means "the current max is good"
21:12 run4flat The second argument is the button, so try this: https://gist.github.com/3013911
21:12 run4flat notice that now I *have* to use sequential mode because I need to load Prima
21:13 run4flat in order to have mb::Left
21:13 joelberger I am using sequential anyway
21:13 joelberger 30 windows popped up and I had no idea which was which !
21:14 run4flat haha
21:19 joelberger hmmm, my latest update doesn't require the <return> key
21:20 joelberger though I tried to make it do so
21:21 run4flat key down just screens for any key presses
21:22 joelberger it shouldn't
21:22 run4flat unless you've modified your code since you last gist
21:22 joelberger I have
21:22 joelberger refresh the gist
21:23 run4flat hmm
21:24 run4flat You know, it'd be really handy to have a way to dump keyboard combinations in a descriptive way
21:25 joelberger I keep killing the window by switching to it (via keyboard shortcut)
21:25 run4flat haha
21:26 joelberger you know what, right click
21:26 run4flat Hmm, so, I solved this in my InputHistory widget (in prima-repl) by hooking the keyboard acceleration table
21:27 run4flat which is beyond the scope of the ::Simple interface
21:27 joelberger and what did it say?
21:28 run4flat I'm not sure what you mean by that. Can you clarify?
21:29 joelberger you solved it, can you figure out why it wasn't sending the correct input?
21:30 joelberger or you just overrode the whole thing
21:30 joelberger this problem seems to be a Prima one not your module, is it something that should be reported to Prima?
21:32 run4flat Alas, I do not understand the details of Prima's signals
21:32 run4flat for keyboards, at least
21:32 joelberger I don't think that the bitwise & is the correct comparison
21:32 run4flat I believe it is, but maybe equality is correct
21:32 run4flat but either one should return a true value when you hit Enter
21:33 run4flat Oh: Enter, not Return
21:33 joelberger tried both
21:33 joelberger perl -E 'use Prima; say kb::Return | kb::Space'
21:33 joelberger vs
21:33 joelberger 'use Prima; say kb::Return == kb::Space'
21:36 joelberger https://gist.github.com/3012794
21:36 joelberger now all mouse based
21:38 joelberger other than the marker bug, this is totally cool
21:38 joelberger any idea where that is coming from?
21:39 run4flat sorry, I was just busy
21:40 run4flat HA
21:40 run4flat hahaha
21:40 run4flat mouse based, as in, mouse-and-button
21:40 run4flat I thought you had gone all object oriented on me
21:40 run4flat Now it's Mouse based, he says
21:40 run4flat great. Why not just use Moose?
21:41 run4flat anyway, looks good to me
21:42 run4flat another approach would be to go back to the keyboard input and use chr($_[1]) == "\n"
21:42 run4flat I think
21:44 run4flat nope, nevermind, that didn't work
21:52 run4flat alright, I'm on my bike, so I'm going to head out.
21:52 run4flat And for those not in Chicago: it's really hot, and it happens to be cloudy at the moment
21:53 run4flat so I'll ride while clouds are around. :-)
21:53 run4flat cya!

| Channels | #pdl index | Today | | Search | Google Search | Plain-Text | summary