Tag Archive for 'computing'

Install Python 2.6 with iPython, Numpy, Scipy, Matplotlib on Leopard 10.5

I’ve been through this a few times, sometimes someone else makes it easy, sometimes not. This is somewhere between the two…

  • Get python 2.6 from here and install it. Since I already have a link through to the /System python from /Library/Frameworks/Python.framework it goes in /System/Library/Frameworks/Python.framework/Versions/2.6
  • Get numpy for python 2.6 from here and install it. It goes in /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/
  • Get scipy for python 2.6 from here and install it. It goes in the same place.
  • Get freetype2 and libpng using fink. These are needed to build matplotlib. You could always try building matplotlib first to see if it works.
  • Get matplotlib from here. There wasn’t a binary for 10.5 when I looked so I had to build it, thus the above step.
  • Build and install matplotlib with the command “python2.6 setup.py build” and then “sudo python2.6 setup.py install”
  • Get easy_install from here, instructions are on the same page. You’ll have to chmod the egg to be executable. This program is great for installing other packages, it’s in the location used below.
  • Install ipython using easy_install with “sudo /Library/Frameworks/Python.framework/Versions/Current/bin/easy_install-2.6 ipython”, it’s in the same place as the easy_install program.

That got me sorted for these packages, however if you wanted to test your installs or numpy and scipy [using numpy.test() and scipy.test()] you need nose, which you can also get with easy_install. You may also want to modify your path or create links to the executables so you don’t have to write the full path into the Framework bin directory.

Since I use python for astronomy I also installed a bunch of other modules including pyFITS, pywcs, vo, and APLpy. Most were found from links on the APLpy website with commands like “sudo /usr/local/bin/python2.6 setup.py install” and APLpy itself with easy_install.

Installing PIL (python imaging library) was a bit trickier, since you need to get the libjpeg and freetype2 libraries (I got them with Fink) first. When you try and build it it’ll likely give errors because the gcc commands include –arch ppc. That can be avoided by executing “export ARCHFLAGS=”-arch i386″ before you build. Also, the selftest craps out, but doesn’t mean that the build didn’t work.

Good luck. I’m not an expert but I find it handy when I find lists like this…

via email

see if I can post by email…

(0)

Update

I felt it was time for an update of the look to allow for large photos. This is it. I did it as a child theme in case I want to modify things further, but so far it’s all just css.

(0)

Vancouver

Free WiFi at Vancouver Airport!

(0)

Stop motion movies on my mac

I spent a wee bit of time getting this right… but it’s easy enough to make a stop motion movie like this one from a bunch of still frames. Previously I’ve used FrameByFrame, which is pretty good, but one can also do it on the command line with the ImageMagick command convert and mpeg2vidcodec, which you can get with Fink (with rsync). Then the command is:

convert *.jpg -quality 50 mov.mpeg

Aperture 3

So I went out and bought Aperture3, it’s nice and shiny and this time I was allowed an upgrade from the academic versions I’ve been buying. It seems nice with a few improvements.

One thing though, the Faces stuff allows the same person to be a photo multiple times. I can see where that might happen one in a while with reflections, but really? Only allowing a person to appear once would get rid of a lot of wrong suggestions for possible matches, which might help considering it seems to have enough trouble discerning between people and car tyres, trees, walls, anything…

On the upside, I identified Queen Victoria once (the statue with the new nose outside Buckingham Palace) and sure enough Aperture found her in another photo!

[I should add that there were absolutely no issues with upgrading my library (~10,000 images, ~100Gb) from Aperture2. Everything came over just fine, and I’ve not experienced any of the memory leaks being reported by others.]

QuickLook plugins

Recently I’ve caught onto QuickLook plugins for my Mac. I went and got the QLColorCode one, which syntax highlights the languages I use that aren’t highlighted by default (i.e. IDL) and also the EPSQLPlugin.

Since the EPS plugin only works for .eps files by default, you can open the EPSQLPlugin.qlgenerator ‘file’ you copied into /Library/QuickLook or ~/Library/QuickLook and then edit the Info.plist file. Add a line below

<string>com.adobe.encapsulated-postscript</string>

which reads

<string>com.adobe.postscript</string>

Then you’ll get previews of both .eps and .ps files. Yay!

[Unfortunately the preview doesn’t seem to work for .ps files generated by everything. I can preview ones made by PGPLOT but not IDL]

CAMRA Beer festival calendar

[THIS CALENDAR NO LONGER EXISTS, sorry]

So I was looking for an online iCal/ics calendar for CAMRA beer festivals and couldn’t find one. Here is one I’ve put together with events grabbed straight from the CAMRA website, import it to whatever you use and hopefully I’ll remember to update it!

There are other lists which will likely be more comprehensive than mine, such as www.realalenet.co.uk and www.camra.org.uk though not in ics format.

Switch between buttons in Mac OS X

Something that always bugged me about macs was the inability to do without a mouse. Having previously been a long time windows user I was adept enough to be able to do pretty much anything with just a keyboard. On the mac however, various things have always required a mouse, like clicking the OK button on various dialogue boxes.

So in an idle moment I was looking for a way to change the useless §/± button on my euro macbook to be the infinitely more useful ~/` button, and happened across the “Full keyboard access” option in the keyboard and mouse options. Ticking “All controls” allows you to tab between things just like the good old days!

I didn’t find how to change what the §/± button does. I think the euro layout is useless… I wonder if there is a deficit of Perl programmers in this part of the world just because they couldn’t find where the # key was? (and like me haven’t figured out how to type a # in Emacs…)

How to make IDLWave work with Aquamacs and IDL 7.0

[this still applied when I installed IDL8.1]

It took me ages to find why my IDLWave wasn’t working with Aquamacs, and googling terms such as “idlwave aquamacs problem” didn’t help. It turns out the solution is given in a ITT tech tip. You basically have to add the IDL 6.4 help infrastructure to your 7.0 install since IDLWave expects the 6.4 structure.

I also found that putting /Applications/itt/idl/bin in my path was needed to make things work. I don’t know why I couldn’t just set the idlwave-system-directory but it didn’t seem to help. Once you’ve got it going, you do the IDLWAVE->Routine Info->Select Catalog Directories to make IDLWave scan all your directories for personal pro files, and you’re done!

Upgrading to 2.8

Oooh wordpress 2.8! Don’t forget to disable your plugins before you upgrade, or you’ll get a blank screen like I did (caused by K2 disable widgets plugin which I shouldn’t be using anyway). If you don’t and get the blank screen, go to your wp-content folder and rename the plugins directory to something else. Then the plugins will be disabled and you can go to the web interface (after restoring the plugins folder to its previous name) and re-enable them one by one until something breaks…

Also, I use svn to get my wordpress, and you might notice that the recommended address has moved. I first did the upgrade with the old address, and then changed it with the command

svn sw --relocate http://svn.automattic.com/wordpress/tags/2.8 http://core.svn.wordpress.org/tags/2.8

Install Python with iPython, Numpy, Scipy, Matplotlib on Leopard

[now out of date, the macinscience website no longer exists. see a new method for installing python 2.6 with these packages here]

So previously I went through this epic effort to install matplotlib and associated Python stuff on my mac with Leopard. Some time after I noticed that it might be possible to do it in a much easier way. I’ve just done it and it’s great!

Install IDLE if you want it. I don’t even know what it does, but I do know it works. Download the MacPython package, open it up and install the applications. Delete the launcher (and and the build applet if you have Xcode) since you have them already. Part of the IDLE install instructions are to add symbolic link: sudo ln -s /System/Library/Frameworks/Python.framework/ /Library/Frameworks/Python.framework

Get the scipy superpack. This guy in NZ (but not a NZer sadly) has made a script that gets everything for you and puts it in /Library/Python/2.5/site-packages for you. When I installed it it was almost right. As noted in the comments, remove the pyreadline egg and get one with the gnu readline in it. Edit the easy-install.pth file (using sudo) and change the line to reflect the new readline egg.

You’re done!

Setting up my new MacBook Pro

So just scored a new MBP and a 24″ iMac for work. First impression is that the screen on the MBP  is WAY brighter than my old MBP. I thought it might be handy to keep track of everything that needs to happen to get it up to speed… here is the list so far.

Apps

There will be plenty more, I haven’t even thought about the Perl modules I need or Python yet, but this is enough to get me started…

Website moved

This website has MOVED here to here. Update your links to http://www.ast.cam.ac.uk/~gkennedy !

(0)

Airbus A320 entertainment system runs Redhat.

I flew Dunedin to Sydney on a new Airbus A320. The entertainment system has a USB port to look at photos/listen to MP3s on a USB device.

I was fiddling with it when it froze, and then proceeded to reboot. I took a few piccies of the system rebooting itself, evidently Redhat linux. Unfortunately they’re pretty crap, and unfortunately I couldn’t crash it again despite my best efforts. In the 5th photo you can see X starting…

[svgallery name=”a320-linux”]

Cool eh?

Firefox CSS background color problem

Ok, so I don’t really know what I’m doing, but I’m pretty sure I’ve asked for the background colour below the image of the White Mountains at the side of this blog to be #35576d. In Safari it is, but in Firefox it’s #22455b for me. (Style file grant.css, first line) Whats wrong?

[Edit] So finally with Firefox 3.5 this issue has been fixed! Apparently in Firefox it was fixable with the gfx color management in about:config, but I never had any luck.

(0)

Crayon physics

Remember “The Incredible Machine?” Crayon physics is kind of similar but perhaps a lot more fun…

(0)

Panorama-rama

I seem to have been on a panorama binge lately… I use Hugin to do these.

Port Craig and region

Port Craig and region

South Coast beach

South Coast beach

South Coast beach

South Coast beach

Stewart Island

Stewart Island

Traffic

Curious, my photo of the nifty moon-jupiter-venus configuration generated half as many visits as my most popular blog entry, but in only a few days. It appears the title “smiley moon” was what everyone would be googling…

(0)

Olympus 1030SW video problems

Not that I take videos with my little 1030SW very often, but when I do I’d at least like to be able to play them on my mac. As it was my Finder would crash every time I’d try and preview an AVI, or Aperture would crash on trying to import when these avi’s were present.

It turned out the problem was with the AviImporter Quicktime plugin, which I fixed by replacing it with the Perian plugin (in /Library/QuickTime). Now they play no worries.

Aperture, and keeping GPS metadata

So after starting to use Maperture to geotag my photos, I’ve discovered that exported versions don’t include the GPS EXIF data (masters are ok). A few people have noticed this problem(1, 2), and there is a “fix.” This fix involves storing your piccies outside the Aperture library, which seems like a really sucky option to me.

I’ve found that exporting a project, and then reimporting it is an alternative solution. Evidently something doesn’t get updated when Maperture changes the original files (though the metadata turns up in Apertures info), but this gets re-done when the project is reimported.

Another thing I’ve noticed is that it doesn’t support DNG files. It will let you try and tag them, and adds the “Geotagged” keyword, but doesn’t edit or add the GPS exif data.

Save 2Gb on your mac – if you don’t use garageband

If you don’t use garageband on your mac, you can remove all the files in /Library/Application Support/Garageband and get about 2Gb of free space.

Instead of deleting mine, I shifted it to an external hard drive. Next time I started Garageband, it asked me to point to the new location. From googling the issue, it’s not clear whether you can reinstall the files if you delete them permanently. There appear to be some versions of Leopard that came with a second disk that has the files. My Leopard came on a single DVD.

Cool rss reader

MSNBC has a very cute rss reader… I use Newsfire which seems to work ok, though now seems a bit short on bells and whistles.

(0)

Ssh keygen trap for non-z spellers

Make sure you spell authorized_keys(2) with a ‘Z’ when creating the public key file after running ssh-keygen! It took me a while to catch on that my spelling it with an S was stopping it from working (tutorials here and here for example, or google ssh keygen). If you don’t enter a passphrase the ssh will be passwordless, so don’t let your computer get stolen if you opt for this…

(0)

iPod photo cache

Always running out of space on your computer? Have iTunes and an iPod or two, and a lot of photos? I just cleared out 3Gb of thumbnails for my iPods that I never look at. Just remove the folder “iPod Photo Cache” from your iPhoto or Aperture library.

(1)

Escher like PS3 game

I haven’t felt the need for a playstation for many years, not until I saw a demo of this clever PS3 puzzle game. A cross between your typical platform game and one that M.C. Escher would have made.

(0)

Old Perl IRAF module and (e)cl

So I found this old perl module Astro::IRAF::CL.pm which is a perl interface to the IRAF cl. It’s rather old and doesn’t work because the ecl is too high tech for the old module. I fixed this by changing the CL.pm file on line 127:

my $t = Expect->spawn('cl') || croak "Cannot spawn CL: $!";

to

my $t = Expect->spawn('cl -old') || croak "Cannot spawn CL: $!";

so that the module uses the old cl rather than the extended one. I also changed the maximum line length allowed in the _break_into_strings subroutine to stop error messages. I ran into trouble with too long lines (help pages say see hconfig$iraf.h, mine is a binary however) so put it back. All seems to work fine….

Flash site

Here’s a clever way to show a bunch of images, good ones too…

Also, I like the way Aperture 2 shows the photos inside an album with a mouseover.

(0)

Aperture vault backup speed

I recently realised (from the Aperture forums I think) that for the Aperture vault feature to work nicely one needs to have a Mac OS formatted drive to backup to. Previously my external drive was DOS formatted so I could read it from my PC, and the backup took forever. I also had this problem, which appears to have gone away, though I’m not sure if it was related. Now with my Mac OS Extended partition, the vault backup of my 25Gb library doesn’t even take a minute.

Panorama photos

I’ve been playing with Hugin, an application for making panoramic images from a set of overlapping photos. Here’s an example, which shows how the images are screwed around to make things line up… in this case I didn’t take different exposures into account when the photos were taken.

panorama taken from Mt John in NZ

How not to upgrade to wordpress 2.5

So I made a huge screw up last night, thinking I was smart enough to simply svn the new version of wordpress without doing all the sensible backing up normal people would do. Things got ugly very quickly, starting with a simple incompatibility of k2 RC3 with 2.5. I then made things worse by selecting the default theme or something and the whole install died.

Trying to fix things up by creating a new install in a new folder wasn’t working, until I realised the database was telling the new install is was in the folder wp, not my new wp25. Renaming the new install wp (as in the original working 2.3 install) made things get better quickly. I fetched the latest nightly of k2 (RC5) and things were looking up.

It then remained to copy across all the custom/upload stuff, such as wp-content/uploads and a few other bits and pieces such as custom css for k2. I think I’m back to normal now, and yes, of course I learned my lesson about backing up first.

upgrading…

I’m in the process of upgrading to 2.5, and doing a very bad job…

(0)

Nearby blogs

So there is a site where you can add some things to your header (here‘s how), and then see which blogs are geographically nearby

(1)

Human tetris

Human tetris!

(0)

clever flash

whalehunt.org and wefeelfine.org are beautiful and clever flash sites.

(0)

Getting PHP to work after upgrading to Leopard

After getting MySQL going I realised php5 wasn’t doing any better. This problem is caused by new settings for php and apache. To edit these files you need to do something clever like change the permissions or use something like vi. I used “sudo vi httpd.conf.”

Edit etc/apache2/httpd.conf by uncommenting the line #LoadModule php5_module libexec/apache2/libphp5.so (that means you remove the “#” from the start of the line).

Edit httpd.conf, which is in /etc/apache2. I changed the line Deny from all to Allow from all within the <Directory> tags. Then you simply restart apache with “sudo apachectl graceful.” Another way is here.

(0)

Getting MySQL to work after Leopard upgrade

I found MySQL wasn’t working after my Leopard upgrade, but there is a fix here for getting it to go. If you had it running previously then you probably don’t need that step. However, there is a fix here to make the preference pane work again, which I did need. Thanks!

(0)

Installing iPython, Numpy, Scipy, and Matplotlib on Leopard

[EDIT: This is pretty old now, it probably works if you want a whole separate install, but I’ve recently obtained some new macs and found it can be much easier. Details in this post]

So after upgrading to Leopard I found my Python plotting stuff didn’t work, so had to reinstall it. My last setup was decidedly dodgy, being something of a mix of 2.4 and 2.5, which wouldn’t work if I removed one. Very suspect.

I have a MacBook Pro, recently upgraded to Leopard. Mostly I followed these instructions, but there were some steps skipped that I had to include for my particular case. Possibly because I’m on an intel macbook and the steps were for a ppc.

[I recently noticed this page, which you might want to read first since you might not really have to do a whole new install]

First thing I needed to do was get the latest XCode (3). A 1Gb download since my X DVD was at home. I also got the latest gfortran from here (gfortran-4.2.1.dmg) and installed fftw as decribed on the scipy pages.

I started totally from scratch, removing /Library/Frameworks/Python.framework/ , MacPython from Applications, and the executable links in /usr/local/bin . I also got rid of the other stuff I’d installed in /Library/Python/2.X/site-packages .

I first got the MacPython 2.5.1 install and put that on. You get it from here, and it’s a simple click and install thing. Done. It gave me some thing about a postflight error, which apparently adds the Python.framework to my path, but it didn’t seem to matter.

Next was iPython from here. I got version 0.8.2. This install went fine. Checked by running ipython in a terminal. Most of the python things are installed by typing

sudo python setup.py install

Next was getting numpy and scipy from here. I installed numpy first no worries, and tested it with “import numpy” and then “numpy.test(1,10)” within the ipython shell. Scipy installed easily too. Like the guy I copied, I get one failure when running the test “import scipy” and “scipy.test(1,10)”. No worries.

Finally it came to matplotlib, from here. At this point I followed the steps here, and some other bits I found. There was a problem where the python I was trying to install with wouldn’t deal with a ppc/intel universal compile, and I had to use /System/Library/Frameworks/Python.framework/Versions/Current/bin/python instead of the default in the /Library framework. After finishing successfully, I had to manually copy the dateutil directory to /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/ for some reason.

Finally I had to get wxPython from here, and do the click install.

After all that it finally works. I can’t really say I’m an expert since it took me a day to figure all that out. I think it’s worth it for how great the matplotlib interface is when it works though. Where else can you make nice plots that are draggable, zoomable, customisable so easily?

Quake style terminal

So anyone who played Quake back in the day will appreciate this… a drop down visor style terminal at the press of a key comb0! By the same people who brought you another indispensible app: quicksilver

(0)

Leopard upgrade

Being at Harvard means I can get computer software a little cheaper than normal, so I went out and picked out a copy of the latest OSX: Leopard 10.5. After holding off for a few days I popped the DVD in the good ol’ clunky sounding MacBook Pro drive, and let it do its thing…

After restarting it took something like an hour to check the DVD, and then at least that long again to do the install. I wasn’t paying attention too much. But it was long enough to cook and eat dinner, and for the Bruins to be 2-0 up against the Senators.

Successfully installed, it was time to find all the broken pieces and get them running again. Doing so was easy:

  • X11: The macsingularity.org site has a note and link to the macosforge X page, where I downloaded the X11 installer. I got 2.1.3 and it works nicely. The only trick was to remove a line setting the DISPLAY environment variable, which is not redundant in X11.
  • Growl: I didn’t have to do anything with growl, but the mail notification stops working. There is a workaround here that I haven’t gotten around to trying yet. More info in the forums.
  • .mac thingy in menu bar: Leopard has a .mac sync icon in the menu bar by default. You can get rid of it by ctrl-dragging it out of the bar.
  • Boinc: I use a few spare cpu cycles to look for alien signals from outer space. I had to reinstall boinc to continue doing so.
  • Gimp: I realised I was way out of date with my gimp installation, so got the latest copy.
  • Onyx: To keep my mac nice and tidy I use onyx to clean things up every once in a while. There’s a new version compatible with Leopard.
  • Aperture: I value my Aperture library a lot (A LOT) so don’t include it in my time machine backups. I don’t actually use time machine anyway (I do my own thing) so it’s not a problem.

Simple really. Upgraded without a missed step… but see these other posts for my issues with MySQL and php

Replacement MacBook Pro battery

So yesterday I wandered down to my local apple store (Cambridgeside Galleria in Boston) to see if I could get a replacement for my dead 11 month old battery. They have this “Genius Bar” where black belt OSX dudes give help on mac related problems. They were very busy, but I got an appointment for this morning.

So I wandered down there this morning to see what they could do. The guy fired up the system profiler and said something like “my goodness” when he saw the available charge and number of cycles. New FREE battery for Grant. I am within my 1 year warranty, and have applecare too so there were no worries. A mate of mine had his replaced the other day, with a 13 month old macbook and no applecare, so it’s worth a go…

See the mac page for a few more comments on how to avoid the problem with your new one.

Mac ads

I haven’t made the jump to Leopard yet (waiting for some of the bugs to be ironed out…), but there’s a clever ad on the New York Times home page…

(1)

Workaround for scripts in WordPress K2 HTML sidebar module

I found the other day that I couldn’t create a del.icio.us link roll on my K2 sidebar. There is some problem where it doesn’t like <script> tags in the “Text, HTML, and php” module, and won’t save. I’m not the only one who has had this problem. It might be platform dependent, since it works on my mac, but not on the solaris based computer hosting this blog.

I found I can get around the problem by exporting the working sidebar settings from my mac, and importing them to the real wordpress site. Another way is to create a dummy HTML module, and then edit it, replacing the dummy text with the <script> code. The number just before the text is the number of characters in the text, and needs to be correct.

Macbook Pro battery issues

This morning my macbook pro’s battery was clearly in trouble. It had been charging overnight, and was displaying 74%. I unplugged it for a while, and it went flat in half an hour. It then wouldn’t charge, remaining at 2-4% for an hour or so.

I found this article, showing how to reset the “system management controller.” I did this, and now the battery is charging as normal. No new battery for me! (for now at least)

UPDATE: Now my battery is completely screwed. iStat Pro tells me I have about 25% health and I usually get less than half an hour of charge. My computer tends to die randomly when the charge goes below half or so, so I just leave it plugged in all the time now. A trip to my local mac shop is order when I find time…

UPDATE AGAIN: Battery replaced for free!

gmail POP accounts

So for a while I was using the gmail “check other POP accounts” feature, but no more. The last few days I’ve had emails arrive an hour after they were sent, and in one case this led to me missing cake. Apparently the checking frequency drops to an hour after a while. Not good enough I’m afraid…

Importing Thunderbird emails into Apple Mail

I wasted a lot of time trying to import mail from Windows XP Thunderbird into Apple Mail. I found a failsafe (well twice) way to totally crash my new Macbook Pro by trying to import mail when I’d already done so.

Eventually I found Eudora Mailbox Cleaner, which pretty much does everything. The only extra step is to go through and rebuild all the imported mailboxes. It didn’t do a totally perfect job, missing one folder for some reason, but otherwise worked beautifully.

the new look

Thanks once again to the cool people who wrote Simple PHP Blog. I’ve just updated to 0.4.8 and it has this cool looking new theme, and a few other nice bits and pieces.

startup

yeah so here it is, i don’t quite know how to work it yet…or how to change the crappy image at the top