Monday, July 16, 2007

SciPy

It turns out there are a lot of resources out there for scientific computing with Python. I'm exploring rewriting various bits of code I use in Python, particularly those that call Perl and Shell Scripts and are not self-contained. I like that Python is freely available, unlike IDL, and easy to program and use regularly, unlike IRAF. In fact, I think this is the motivation behind PyRAF.

SciPy is located here. I haven't explored the library much, but I bet it will be useful. The other important package, Numpy, is also here, but I acquired it from the STSci Institute. From STSci, I also got a key set of libraries called PyFITS, which allows FITS table and image handling. As of this writing, those couple of libraries were no larger than a few MB.

It looks like SciPy is a bit involved. It requires LAPACK libraries, which require the g77 FORTRAN compiler or something similar. I need to read up on this a bit more before I proceed. SciPy won't be as easy to install as I had hoped.

UPDATE:
I got lucky and found that binaries for FC6 have been created and are posted here, after you follow some links to this . Many thanks to this guy. He rightly advises not building LAPACK youself if you don't have to. I think you can set this up as a yum repo, but I just downloaded, rpm'ed:
1) rpm -ivh cushello
2) rpm -ivh refblas*.rpm
3) rpm -ivh lapack-*.rpm
4) rpm -ivh lapack3-*.rpm --replacefiles
5) rpm -ivh python-numpy
6) rpm -ivh python-scipy

Step 4 is a bit risky, but I forged ahead and have noticed no ill effects yet. If you don't RPM with this option, conflicts arise. I chose to brute force past the problem.

Reading NTFS on a USB hard disk (Part I)

This was done on Keren's LG computer, running FC2, with some 2.6 kernel. The USB disk is a Maxtor 320 GB. I'll add the model number later. The goal was to be able to read/write on the disk. Only the read part worked. Writing will come in part 2:
1) Enable NTFS reading, which required me to go here.
a) Check the docs here to be sure NTFS is enabled in your kernel.
b) Get the RPM for the kernel you're using and install it (rpm -ivh *.rpm).
2) Plug in the USB drive, check /var/log/messages to see which /dev or /udev
it was assigned to.
3) Simply run "mount -t ntfs /udev/sda1 /mnt/usbdisk/"
a) /udev/sda1 was returned by /var/log/messages
b) I made the directory /mnt/usbdisk

This was all quite easy. It doesn't mount automatically when plugged in, so you need to run step 3 each time. In the future, I'll enable automounting, if it's possible.
No matter which mask options or r/w permissions I tried, I could not write to the disk. It looks like this may be a general problem. The two options are to format the full disk FAT32, as some have suggested that this works, or to partition the disk into ext3 and NTFS/FAT32. The latter is probably the way to go, but I need to consult with my wife, since it's her disk. I will conclude this tiny little project in forthcoming post.

For future reference, here's the man page for mount.

Alternatively, if you have an external USB disk, most if not all linux distros recognize fat32 right off the bat, and both linux and windows can read and write to fat32. This is key for Fedora Core 2, which is what my wife is using. I'm finding that I can't get FC2 to write to NTFS.
1) Format the disk as FAT32, and in linux
2) 'less /var/log/messages' and look for something like /udev/sda1 or /udev/sdb1
3) mount the volume with "mount -t vfat -o umask=000 /udev/sdb1 /mnt/usbdisk/"

I think she was able to read and write fine with this. One problem we ran into was filenaming: it doesn't know the difference between AAA and aaa. We tried using the shortname option, but it is probably a limitation of vfat, that caps and smalls are indistinguishable. Bummer, but that's tradeoff for being able to read and write from both linux and windows with fat32.

Saturday, July 7, 2007

IRAF/PyRAF

IRAF is a free, widely-used image analysis tool. Installation went off without hitch (at least so far), following their instructions. I would love to rewrite them to be a little more transparent, at least to me. You could almost write a wrapper to install everything, except for maybe the creation of the IRAF user. It would be great if they could do away with that step, and I'm actually not sure why it's needed.

PyRAF was a different story this time around. I've installed it before with success, but this time has been more troublesome. There was a recent update (15 Jun 2007), which may be why things are things are different. I'm using their source dist'ns everywhere (instructions) I hit a problem when running the config step for tcl/tk, in which I get an error at line 6208. I'm not sure what the problem is here. Is it FC6? Or maybe I don't have all the right paths defined? I've tried dumb things like commenting this text out, but it doesn't fix the problem. I also tried using rpms and yum repositories for later versions of tcl/tk, but I think I really need to compile from source. I'm dropping this for now, and I'll come back to it when I have more patience.

Friday, July 6, 2007

SciSoft

While I'm busy installing stuff on this new laptop, my officemate pointed out a very cool astronomical mega-package: SciSoft with a huge list of free astronomical tools, some great, some pretty good. I'm trying the yum version. The repository is quite big, so make sure you have enough space in /var, or whereever your local repository lives. There are also rpm and tarball options. The yum and rpm versions are setup for FC6, while the tarball can be compiled for whatever.

Fedora Core 6 Wireless

I'm running Fedora Core 6 on a Dell Latitude D820 with on-board wireless: Intel(r) 3945 802.11a/g Dual-Band Mini Card. I've installed wireless cards on Linux laptops before. It sure has gotten a lot easier than the days of RedHat 7.*. This worked for me, but I don't claim that it will work for you.

The following does 3 things:
1) Installs the ipw3945 driver needed for this card
2) Installs the extras (I don't have the name right now), i.e. ieee80211, etc.
3) Makes them easily manageable with the Network Manager, a nice feature that popped up somewhere between FC2 and FC6.

I found a nice little page to help me with this, and I added some other things from other places in. I'm copying them almost verbatim here, just for my own use, and I doubt they are all necessary, but it's what worked. Here were the basic steps I took:
#########################
#Install Firmware
yum install ipw2200-firmware

#Install Freshrpms
rpm -ivh http://ftp.freshrpms.net/pub/freshrpms/fedora/linux/5/freshrpms-release/freshrpms-release-1.1-1.fc.noarch.rpm

#Get wireless drivers. I don't know if this requires prior dkms installation or not...
yum install ipw3945d ipw3945-firmware dkms-ipw3945

#Get the usual wireless packages (I've added these lines from this page.)
The binary microcode image, available here.
The binary user space regulatory daemon, available here too.
The ieee80211 subsystem version 1.1.11 or newer.
Linux kernel 2.6.13 or newer. See README.ipw3945 for information on specific options required to be enabled in the kernel.
Wireless Extensions (v17) and Tools (v28)

# Start the DBUS message system:
service dhcdbd start
# Start the NetworkManager system (awesome!):
service NetworkManager start
# Set both of these to start up automatically:
chkconfig --level 345 dhcdbd on
chkconfig --level 345 NetworkManager on
#############################

This page is the main sourceforge project page for the driver, and includes the 802.XX IEEE standard stuff, and a few other things. I'm not sure you need all of these extras, but it's likely you do need them according to the project folks.

One useful thing in this process was "modprobe ipw3945". You'might find that when you go through all the above steps, the driver isn't loaded for your card. It turned out for me that I probably didn't properly define some installation paths for the ieee packages, so that when the module was loaded, it went to look for those things and didn't find them. Running modprobe spat out some errors that diagnosed this, and all I had to do was make copies of said files in the places where they were expected. Sorry I didn't save the exact output to post here.