AipyFaq

From AstroBaki
Jump to navigationJump to search

Q: How do I know AIPY installed correctly?[edit]

Download this UV file, and unzip it with:

compress_uv.py -x test.uv.tar.bz2

Then try:

plot_uv.py -p yy test.uv

You should see:

AipyTest.png

If you see flat red inside the plots, see the next FAQ.

Q: When I plot with plot_uv.py, I get a graph, but the data is a solid color. What's wrong?[edit]

This is a problem with matplotlib not interfacing correctly to your window. Try the following:

import pylab ; pylab.imshow([[0,1],[3,4]]) ; pylab.show()

If you don't see:

AipyMatplotlib.png

then matplotlib screwed up, and you should reinstall it. This time, edit the setup.py file in matplotlib by changing "BUILD_TKAGG" to 1, and "BUILD_GTK", "BUILD_GTKAGG", and "BUILD_WINDOWING" to 0. If you don't get a window at all, make sure Tcl/Tk is installed on your system, and that the source for Tk is also available (if using Fedora, try "yum tk-devel").

Q: When I run plot_uv.py on a Miriad UV file, I get the following error:[edit]

File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/aipy/miriad.py", line 215, in read
   if nread == 0: raise IOError("No data read")
IOError: No data read

This is an endian problem associated with compiling Miriad C code on a PPC-based MAC. Unfortunately, work is still in progress on finding a work-around for this problem.

Q: I can't get matplotlib to install/build. Tips?[edit]

In order to get "easy_install matplotlib" to work on my Ubuntu machine, there were several dependencies I had to apt-get first:

sudo apt-get install libfreetype6-dev
libpng12-dev python-gtk2-dev

Q: What should I do if my installation is haywire / I get random errors / I upgraded and everything broke?[edit]

A first-shot solution to a lot of weird problems is to manually go to /usr/lib/python2.5/site-packages (or wherever python is storing your modules), and delete obsolete versions of packages such as numpy, matplotlib, basemap, and aipy. You may even try deleting all aipy installations and then rebuilding. This can very often fix your problem. Complications are also sometimes introduced when you have multiple python installations. Depending on your path settings, sometimes the python you used to build a package won't be the one that is called when you run a script. This problem seems to be particularly vicious on Macs.