Showing posts with label tips n' tricks. Show all posts
Showing posts with label tips n' tricks. Show all posts

Tuesday, November 8, 2011

Remote login to AIPS

So, you're away from your computer (say it's in Wisconsin and you're in South Africa), but need to log in to AIPS remotely to get some (simple) work done. Since I do this about once every six months and have to relearn how to do it every time, here's the solution.
ssh into your machine, then instead of just typing at the terminal:

> aips
or
> aips da=<computer name=>
both of which give me errors or repeatedly ask for me to retype my password, try:
> aips notv da=<computer name>
Eh, voila! I can use AIPS without complaint.
True, you can't use the tv to view your data, but that would be a pain to do remotely anyway. When I make an image, I output an .PS file and rsync it to my local machine. rsync is nifty and worth learning, if you don't know it already.

Read more!

Friday, September 25, 2009

"Air Mass Chart" for Radio Observations?

A question that has plagued me for quite some time, as I prepare my EVLA proposal:
Do you all know of a tool to find the rise/set times and elevations of radio sources? My favorite tool for seeing the trajectory of an object through the sky is 'airchart' in IRAF, but unfortunately IRAF assumes you are an optical astronomer and only tracks your sources through the nighttime. Anyone know of something similar for all 24 hours? (the GMRT has one, but it assumes the GMRT's latitude, which is rather different than the VLA's).


Read more!

Monday, September 14, 2009

Combining VLA Spectral Line Data with Different Channel Spacings: a Solution!

I remember thinking about this briefly in a post further down, and neither Amanda nor I could come to a good solution without resorting to Miriad. After running into the problem myself and spending a lot of time dealing with AIPS, I think I've come to a solution.

Caveat: this is only valid for combining VLA data with other VLA data. I don't think it will work with ATNF/GMRT + VLA data, but I haven't tried.

I managed to fix this problem in the case of VLA data with a combination of UVCOP, SPECR, and CVEL. Basically, it works because the VLA correlator setup is all multiples of two. In general, if you have a data set with twice as many channels, it has half the channel spacing. This is not always true due to an observer's ability to set up IFs in different ways, but the channel spacings should always differ by some power of two.

Now for the solution(s).

For example, imagine you have spectral line data set A with 127 channels and spacing of 6.1 kHz, and data set B with 255 channels and spacing of 3.05 kHz. (The extra channel from each needed to make a power of two is the Channel 0 data set. So you really only have 127 instead of 128 and 255 instead of 256 channels.) Effectively, you will have to either double the channel spacing of data set B, or half the channel size of data set A.

In order to DBCON, you will need to jump through many AIPS hoops in order to make sure that both data sets have:
- the same number of channels
- the same spectral resolution
- the same frequencies assigned to the same channels

To degrade the high-resolution data:
- First, you will need to use UVCOP to chop off one channel in data set B, so an integer number of channels in SPECR will give you the correct velocity resolution. It shouldn't matter if you chop one off from the beginning or from the end, as these are generally line free.

- Next, use SPECR to regrid data set B to the proper channel spacing. In this case, you will want a channel spacing of 6.1 kHz. This means that you need to tell SPECR to regrid to half as many channels. Each new channel has twice the original channel spacing. In this case, you will tell SPECR to use npoints 127, which is conveniently half of 254.

- Now run CVEL on both data sets. The correct inputs are described at the bottom of this guide. The main APARM values to set are:

aparm(1) = [velocity in m/s to be assigned to..]
aparm(2) = [..this channel number]

Essentially, you have regridded both of your data sets to a system where the given velocity is assigned to the given channel. It may spit out a lot of errors saying that it is shifting the channels by many km/s, but as long as the same channels in both data sets correspond to the same velocities, you're set.

- Run UVCOP to chop off additional channels if necessary. In this case, the data sets should be the same, but depending on correlator settings, you may have to chop off additional channels. This time, always chop them off from the end, because you have regridded your data so that the first channels in the set line up with the first channels in the other data set.

- Run DBCON to combine both data sets. DBCON will shift RA and Dec as long as the pointing centers aren't vastly different.

To oversample the low-resolution data:

- Use SPECR to regrid data set A to 254 (NOT 255) channels. This will effectively chop your channel width in half, so it matches data set B. You will deal with the fact that both data sets have a different number of channels in a few steps, so don't worry.

- Use CVEL to assign the same frequency to the same channel for both observations. This will shift each spectrum in frequency/channel, but will not resize the channel spacing. More instructions for using CVEL are at the bottom of the guide. The important inputs are:

aparm(1) = [velocity in m/s to be assigned to..]
aparm(2) = [..this channel number]


Essentially, you have regridded both of your data sets to a system where the given velocity is assigned to the given channel. CVEL may spit out a LOT of errors telling you that you are shifting your channels by a lot, but as long as your galaxy shows up in the same channels in both datasets, you should be okay.

- use UVCOP to chop off additional channels. Data set A (after SPECR) has 1 fewer channel than data set B. Fix this by chopping off the last channel of data set B using UVCOP. Set BCHAN 0 and ECHAN 254.

- Use DBCON to combine data set A (after SPECR + CVEL) and data set B (after CVEL + UVCOP). It should shift the RA and Dec of the one of the data sets unless they have vastly different pointing centers.


Now for something completely different (aka additional notes):

Occasionally you will have to chop off more channels from data set A, depending on your correlator set up for both observations. The key point is to make sure that both data sets have the same number of channels with the same channel spacing and the same velocity definition (e.g., channel 52 = -50 km/s).

And now some info on running CVEL. In some of our observations, we did not use Doppler tracking (Oh, EVLA, you'll be awesome one day), so we also had to tell CVEL the rest frequency of our HI line so it could calculate gas velocity. You may not need all of these inputs, but here's how I had to set the APARM values, which is really the meat of CVEL:

aparm -50000 52 1 0 1.420e09 5752 1 0

What does this mean? Well!


aparm(1) = -50000
aparm(2) = 52


Together these two values shift the spectrum so that a velocity of -50000 m/s lines up with channel 52. This will be different for each galaxy - in our case, it's a galaxy with a systemic velocity of -50000 m/s (NGC 404 in fact).


aparm(3) = 1
aparm(4) = 0


These set the velocity definition. The first sets the reference to heliocentric velocity, and the second tells AIPS to use the optical definition.


aparm(5) = 1.420e09
aparm(6) = 5752


This sets the rest frequency of your line in GHz. AIPS does not have enough precision for all the significant figures, so you have to use two APARM values. If you're working with something other than HI, I recommend reading the help file to figure out how to input your frequency.


aparm(7) = 1


This is set to 1 for VLA data.

Read more!

Sunday, August 17, 2008

MSGSRV Aesthetics

I've been wanting a scrollbar in my MSGSRV for as long as I can remember, and I finally got one! This is how I did it (on my Mac, running X11)...

I made a .Xdefaults file in my home directory with these lines:


AIPSmsg*scrollBar: True
AIPSmsg*saveLines: 500

I quit out of AIPS and in the xterm where I was running aips, I typed:

xrdb -load ~/.Xdefaults

to make my computer register the .Xdefaults file.

When I started up AIPS again, I had a scroll bar! This page gave me this hint, plus tells you how to change other MSGSRV settings, like colors.

Read more!

Thursday, August 14, 2008

Reading ASCII Tables into AIPS?

I'm trying to write a script where I repeat some steps on lots of different objects, and therefore I want to read a list of coordinates into AIPS. I currently have an ASCII list of x and y values. Can i read it into AIPS as two arrays so that my script can access them? Or do I have to do something hideous like manually fill the arrays within my script?


Read more!

Monday, June 30, 2008

Need Larger Fonts on Plots

I'm trying to get the labels for my plots in AIPS to be much larger than the default. LWPLA has an option to specify the font size, dparm(8), but after playing with it, it seems like 24pt is the maximum font size. I would really like to use something bigger than this. I can modify the labels manually in Illustrator, but that requires repositioning all the labels, which is way too time intensive. Any other ideas?

UPDATE: Solution using ASPMM parameter in LWPLA detailed in comments.



Read more!

Saturday, June 28, 2008

Bins in UVPLT

You know what is a great easy way to visualize your data that I often forget about? Bin your data in UVPLT! For example, if you are making a UV distance vs. Amplitude plot, then you can actually see the amplitude structure instead of just seeing tons of points ranging all the way down to an amplitude of zero.

All you have to do is set BPARM(8) = 50 or the number of bins you want.

I think it also plots up faster this way then plotting lots of individual points!
Of course, if what you care about is a handful of really pathelogical points, than this is not the right strategy. But if you are, say, trying to identify a bad baseline or something, this works great!


Read more!

Monday, December 3, 2007

Setting up New Data Disks

My latest organizational scheme for AIPS is to give each project a new AIPS data disk. I just spent some time adding a new data disk to my AIPS installation on my laptop. Here's what I did to get it. (BTW, I've got a MacBook, but that shouldn't matter for this.)



In $AIPS_ROOT, cd to DA00. Save a copy of the DADEVS.LIST file as DADEVS.LIST.old. Then edit the DADEVS.LIST. I just copied the first uncommented line (set up by AIPS) and incremented the data disk number by 1, i.e., LOCALHOST_2. Now save a copy of the NETSP file in the same directory to NETSP.old. Again, edit the file by copying the first uncommented line and incrementing the data disk number by 1. Finally, cd to $AIPS_ROOT/DATA, mkdir LOCALHOST_2 (or whatever your new data disk is named), cd to LOCALHOST_2, and create a file named SPACE (touch SPACE). Now when you start up AIPS you should have additional data disks available.

Most of this tip was taken from the AIPS Manager FAQ (see "How do I configure new AIPS data areas?").

Read more!

Thursday, October 4, 2007

Your friend, the tilde

Ever had to enter a lot of numbers into an array in an AIPS script and run out of room (like in this post)? Trying to figure out the mysteries of plcolor without typing 5 million numbers? In your time of need, the handy tilde will help you out. See below the fold for more details.



The popsym help file (type help popsym to access) gives you this handy tidbit of information on the tilde

A(i) ~ 1,2,3 Store values in A(i),A(i+1)... (change only as many as on RHS)


Now here's an example,


filename = '10208722.UVF','10208724.UVF','10208726.UVF','10208727.UVF'
filename(5) ~ '10208733.UVF','10303423.UVF','10303424.UVF','10303461.UVF'


Tah-Dah!! That's all there really is to it. Use the tilde, Luke -- your fingers will thank you.



Read more!

Tuesday, June 12, 2007

Tricky, Tricky FOR Loops

I was just trying to write a FOR loop which would run UVCOP many times. When I ran

for i = 1 to 10; bchan i; echan i; go uvcop; end

AIPS would set bchan and echan to 1, then it would run UVCOP once, then it would set bchan and echan to 2, and end the FOR loop. I really didn't know what the problem was-- this loop should work. Then Eric told me this trick: put WAIT before the END, so that now your loop looks like this:

for i = 1 to 10; bchan i; echan i; go uvcop; wait; end

I guess what was happening was that the loop was continuing on before uvcop had finished running, and the loop was getting all confused. It worked with a WAIT!


Read more!

Monday, June 11, 2007

XYZ

What does AIPS consider the x, y, and z axes? For example, XSMTH smoothes your data along the x axis. What on earth does this mean? I would think the z axis would be velocity.


Read more!

Friday, June 8, 2007

File Sizes

Anybody know how to figure out how much hard drive space each aips file is taking up? I can look in the DATA directory, but all the names are written in code there. It would be so much nice if there was an actual aips command.


Read more!

Wednesday, May 16, 2007

cleaning up your catalog

this is a cool trick I learned recently. You know how catalogs become a mess, especially if you're dealing with data from multiple nights and/or multiple sources? I like to group my files to keep them straight (like putting all the CVEL or SPLIT files together), but sometimes due to timing the catalog gets messy. Renumbering items in the catalog can be a huge pain in the rear if you have to move everything up 1 to make room for a file, the trick I learned removes this frustration.

For example, if you have 200 files and you want to move file #140 to slot #40, you'd have to first make slot #40 empty. You can do this by moving 200 to 201, 199 to 200, etc, until you move 40 to 41 and slot 40 is available:

getn 200; slot 201; renum
getn 199; slot 199; renum
...
getn 40; slot 41; renum

Then,

getn 141 (since you moved 140 up to 141!) ; slot 40; renum; recat (to get rid of any new gaps in the catalog)

the painful part is moving up all the files, but never fear! Use this instead:

for i=200:40 by -1;getn i;slot i+1;renum;end;

and it will move files 200 to 40 up one entry in the catalog. Obviously, the first number has to be the highest numbered file in the catalog to work. Also, the slot i+1 part can be modified depending on how many spaces you want to create.

Read more!

Thursday, April 19, 2007

TV Trouble?

Having trouble with your TV? If you're on a funny network setup, the AIPS TV display can run slow or refuse to open. Try starting AIPS with aips tv=local and see if that fixes the problem.

Read more!

Monday, April 2, 2007

Number of Channels = One Less Than I Expect

4/2/07: When I write my observe file, I ask for 8 channels. And when I get the data and FILLM, there are always 7 channels there.
Now, I have a new data set in which I asked for 4 channesl, and when I FILLM I am again missing a channel, there are only 3! This is a pretty significant loss of signal; I'd like that channel back.

I think I'm using pretty standard, default parameters in FILLM. Has anyone ever found a way around this problem? (I'm sure it's not a big deal if you're doing bona fide spectral line data).

UPDATE as of 4/14/07: After talking to my advisor Eric, it appears that Channel 0 actually counts as one of your channels!!! So when you ask for a correlator setup of 4 channels, you actually get 3 channels of original data, and then one of the channels is taken up by the average of these, CH 0. This is really one of the stupider things I've heard yet about radio interferometry. And let this be a warning to you, don't ever ever use the 2-channel correlator setup at the VLA!!!! I guess it's the same as doing continuum observations, but with less bandwidth!

Read more!

Getting TELL to Work

TELL sounds like a really great idea; For example, I might accidentally turn off the TV in the middle of a 6 hour long IMAGR session, and I could turn it back on by telling AIPS dotv =1!

BUT--does anyone know how to get TELL to work? Unfortunately, it appears that you need a prompt to be able to use TELL, and the long routines that one runs usually withold the prompt.

The way I see it, I think there are two ways to get a prompt, and to be able to communicate with AIPS and TELL it something.

1) dowait = false
haven't actually tried this, but i think that it will give you the prompt back after you start IMAGR. However, from quick glances at the help pages, this may limit how IMAGR interacts with the user.

or

2) open up a new AIPS window and log in with the same user ID. But when I did this, it didn't recognize that I was running IMAGR. Maybe there is something fancy to make AIPS recognize other windows of the same user?

Read more!

Saturday, March 31, 2007

Deleting multiple catalog files

You just made lots of images with lots of facets, but you messed up and some need to be deleted. You don't want to ZAP everyone individually! Here's a simple "for" loop you can type into the command line, that will delete the files numbered 400-405:

for i=400 to 405; getn i; zap; end

If you want to be cautious, leave out the 'zap' the first time you run the loop, to list the files and make sure you're about to delete the correct ones!

Read more!