Occasionally I've encountered line data that are taken in 4-IF mode - that is, where you have 2 IFs, each tuned to different frequencies, that overlap on their edges. I found these to be a pain to combine the last time I worked with them (in my first Astronomy research project ever!), and they have resurfaced again now.. but I've discovered a much easier solution: `UJOIN`

!`UJOIN`

takes a data set with 2 IFs tuned to different frequencies (as from 4-IF mode at the VLA), and joined them together. It even deals with re-weighting the overlap regions because now there's more data there! You will want to use `UJOIN`

on data that has **already been calibrated (gain AND bandpass)**.

Here are the inputs:

AIPS 1: UJOIN Converts IFs to additional spectral channels

AIPS 1: Adverbs Values Comments

AIPS 1: ----------------------------------------------------------------

AIPS 1: INNAME ' ' Input UV file name (name)

AIPS 1: INCLASS ' ' Input UV file name (class)

AIPS 1: INSEQ 0 Input UV file name (seq. #)

AIPS 1: INDISK 0 Input UV file disk unit #

AIPS 1: OUTNAME ' ' Output UV file name (name)

AIPS 1: OUTCLASS ' ' Output UV file name (class)

AIPS 1: OUTSEQ 0 Output UV file name (seq. #)

AIPS 1: OUTDISK 1 Output UV file disk unit #.

AIPS 1: CHANSEL *all 0 Begin, end input channels,

AIPS 1: begin output channel each IF

AIPS 1: OPCODE ' ' 'DIFF' to output the vis

AIPS 1: difference in the overlap

AIPS 1: DOWEIGHT 1 0 => delete spectrum if any

AIPS 1: IF or channel is flagged

AIPS 1: < -0.5 => keep data even if

AIPS 1: one of the IFs is flagged

AIPS 1: > 0.5 => delete channel if

AIPS 1: one of the IFs is flagged

The main thing to set is

`CHANSEL`

. This is a 6-element array:

chansel(1) - first channel to use from IF 1

chansel(2) - last channel to use from IF 1

chansel(3) - output channel that corresponds to 1st input channel from IF 1 (ugh)

chansel(4) - first channel to use from IF 2

chansel(5) - last channel to use from IF 2

chansel(6) - output channel that corresponds to 1st input channel from IF 2 (ugh again)

The AIPS help file on

`UJOIN`

has some helpful information on how to set these values properly, but I will reproduce what *I*did to set these - it's not completely straightforward.

**Using UJOIN on your own data**

First, you should apply all your calibrations in

`SPLIT`

. Make sure that when you `SPLIT`

off your science source, you keep `BIF`

and `EIF`

set to 0 - this will create a single source file with both IFs.Then, you will need to figure out the frequency and reference pixel of each of your observations (

*f_1, p_1, f_2, p_2*). I did this by

`SPLITting`

each IF off separately from the LINE data and then running `IMHEAD`

on each. You should also record *delta_f*(from

`IMHEAD`

again - this should be the same for each IF). In my case, *f_2*was bigger than

*f_1*- if this is different for you, you'll have some sign differences somewhere and

`CHANSEL`

will be in a different order.Next, figure out if any of the channels in your IFs are on the edges of the bandpass. You will not want to keep these channels as they will add noise into the final, combined UV data. Typically, look at the region where the bandpass is flat-ish, and use that. To find these, you will want to use

`POSSM`

to take a quick look at your bandpass solutions for each antenna:

default possm

aparm = 0, 1, 0.7, 1.3, -180, 180, 0, 2, 0, 0

source [bpass calibrator]

solint -1

nplots 9

dotv 1

bpver 0

Find the first and last channels of the flat-ish region for each IF (

*n_first,1; n_last,1; n_first,2; n_last,2*).

Now you can start setting

`CHANSEL`

with the first and last channels for IF 1:

chansel(1) = n_first,1 # first channel from flat-ish part of bpass, if 1

chansel(2) = n_last,1 # last channel from flat-ish part of bpass, if 1

chansel(3) = 1 # ichansel(1) goes into output channel 1

chansel(4) = n_first,2 # first channel from flat-ish part of bpass, if 2

chansel(5) = n_last,2 # last channel from flat-ish part of bpass, if 2

Now we move on to

`chansel(6)`

, which is not nearly as easy as the above part was. Here you have to figure out which output channel corresponds to `chansel(4)`

. You'll have to take into consideration all the other ichansel values. Here is the equation I came up with for `ichansel(6)`

:You can find the derivation at the end of this post if you're interested or getting incorrect answers. (As Martha Haynes once said, "You get what you pay for and this is free!")

As a reminder, here's what all of the variables stand for:

n = this is the value for ichansel(6)

f_1,0 = reference frequency of IF 1

f_2,0 = reference frequency of IF 2

delta_f = frequency steps between channels

n_first,1 = first channel of IF 1 used in output

n_first,2 = first channel of IF 2 used in output

p_1 = reference channel of IF 1

p_2 = reference channel of IF 2

**Testing that UJOIN did the right thing**

You'll probably want to check that this actually worked correctly. The

`UJOIN`

help recommends that you use `POSSM`

to check that the spectrum of the phase calibrator is flat.- First,

`SPLIT`

off the phase calibrator separately.- Next, run

`UJOIN`

on this phase calibrator file with the same inputs as for the galaxy.- Check that the spectrum of the

`UJOIN`

data is flat in `POSSM`

:

default possm

aparm 0

solint 0

nplots 0

source [phase calibrator]

This should plot the phase calibrator spectrum with data from all antennas averaged together.

**My derivation of the ichansel(6) equation:**

To figure this out, I wrote some equations to find the frequency at a given channel (

*f1, f2*):

These tell you the frequency (

*f_1, f_2*) at an arbitrary channel (

*n_1, n_2*) for each IF.

*f_1,0*tells you the frequency at reference pixel

*p_1*for IF 1.

*f_2,0*tells you the frequency at reference pixel

*p_2*, for IF 2.

*delta_f*is the frequency steps between each channel.

Now we can write an equation to for the frequency of the output channels:

We can sub in for

*f_out,0*because we know what channel we're setting as the first output channel (ichansel 1!), and we know its frequency from the above equation for

*f_1*(

*n_1*) for IF 1:

Now we want to know what output channel (

*n*) corresponds to the first channel of IF 2 (

*n_first,2*). Where does this occur in

*f_out*?

Now just rearrange that for

*n*!

Read more!