Wednesday, December 9, 2009

Mac data analysis tip of the day

So, you have a lot of plots/images in a folder, but you now only want to look at some of them.
Fortunately, in a Terminal, you could easily 'grab' the right ones by shell globbing (=a form of pattern matching for you non-geeks out there), meaning:

Let's say you have plots/images ending in *.profile.png and *.histo.png, so you easily 'grab' only the profiles by ls *.profile.png, nothing easier than that, but how do you get Mac's Preview now to show this choice to you?

Well, as so often, Mac OS just does the right thing:
You type: 'open *.profile.png' and you get all plots/images nicely put into one Preview window.

A slight setback, but logical:
So far they are treated as single documents, so if you just hit Cmd-P to get a print of all your analyis work, you only get offered to print the currently-selected one.
Even a Cmd-A to select all does NOT change this completely, but is on the right track: After selecting all images you can use the File->Print Selected Images menu entry (Or Alt-Cmd-P) to do just that.
And of course with that you can now print again into a new PDF file to have your plots nicely saved all together.

So, I would call this 'efficiency-with-a-hickup', but nevertheless a much more workable and faster solution to produce a pdf out of a shell-globbed (you don't wanna mouse select every 2nd or 3rd image in your folder now, would you?) selection than possible under pure *nix or *doze..
(I timed it, took me rougly 20 seconds to get the pdf, and only because I couldn't decide nor type the resulting filename ;)

PS.: The way to combine/edit PDFs has slightly changed in SL, get the details here.

No comments:

Post a Comment