SMA Quick Links
DR home
Convert format
Using CASA
Tutorials
FAQs

MIR/IDL Useful Tips


Memory

MIR is very memory intensive, typically requiring 2.3-3x the filesize. To reduce the amount of memory needed to process a file process each receiver and sideband separately.

IDL> readdata,dir='', sideband='l', rx='345'

Plotting

When a plot is displayed you can navigate with the following options:

  1. Left click to zoom on current panel
  2. Right click to scroll to next page or unzoom
  3. Middle click to bring up options in the terminal window (including exit).
Make sure the plot window is selected when you middle-click, and that the terminal window selected when you chose a letter option.

There is no option to change the axes ranges. Instead you must select only the subset of data you want to plot then let IDL scale it for you.

Bands

Every data file has a continuum channel named c1. Spectral bands (or chunks) were numbered s1-s48 for the ASIC correlator. When the four SWARM chunks were introduced, the chunk numbers got appended to the existing ones until the full range was s1-s52. Note that some SWARM chunks overlapped with ASIC windows in frequency if not in numbering. Once ASIC was turned off the SWARM chunks were relabeled s01, s02, s03 and s04.

s01-s48 = ASIC data
s01-s49 = ASIC + SWARM chunk 1
s01-s50 = ASIC + SWARM chunks 1 & 2
s01-s51 = ASIC + SWARM chunk 1,2 & 3
s01-s52 = ASIC + SWARM chunk 1,2,3 & 4
s1-s4 = SWARM only

Be aware that ASIC bands/chunks can have different spectral resolutions depending on the exact correlator setup. You can see the resolution for each spectral window with

IDL> print, sp[0:48].fres

The first number reported (0) is the continuum channel. You can also print sp[0:48].nch which gives the number of channels. If you just want to see what different ones are present, you can only show one instance of each match with

IDL> print,uti_distinct(sp[psf].nch,nnch,/many)

SWARM data have a fixed resolution of 140kHz.

Selecting

For an overview of your data use select with no options

IDL> select

You have two options for selecting data - select or dat_filter. There is some overlap but they have different capabilities.

select - used with the options returned when using select alone (as above). i.e sources, baselines, receivers, bands, sidebands, polarization states and integration numbers.
dat_filter - can be used with the select options above, but also used for selections based on filtering the data array itself - e.g. scan length, system temperature, amplitude.

See the MIR manual: Data Inspection and Flagging for detailed examples.

both examples below are selecting only positive weighted data (i.e. unflagged). The reset option means that the results of any previous select commands are ignored and all data is used when making this new selection.

IDL> select,/pos_wt,/reset
IDL> result=dat_filter(s_f,' "wt" gt "0" ',/reset)

Commands can be abbreviated so that the select command above can be written as:
select,/po,/re

Flagging

To flag data to must select (isolate) the data you wish to flag using either select or dat_filter, the flag them. Afterwards reselect only positive weighted data in order to exclude the flagged data.

IDL> result=dat_filter(s_f,' "tssb" gt "1000" ',/reset)
IDL> flag,/flag
IDL> select,/pos,/re

Statistics

To get statistics (mean, median, standard deviation) on the continuum amplitudes (ampave) and phase (phaave) amplitudes of 3c279.

IDL> select,/pos,/res,source='3c279'
IDL> print,stddev(bl[pbf].ampave)
IDL> print,median(bl[pbf].ampave)
IDL> print,mean(bl[pbf].phaave)

View Header Information

Printing a value from codes_read. Here it's filever which reports the version of the dataCatcher software.

IDL> print,c.filever

Print the polarization value for each scan. This is the ipol flag found in bl_read.

IDL> print,bl[pbf].ipol

This displays a value for each scan. If you have hundreds of scans it can be more useful to display the number of different values reported. For a non-polarization dataset the number will be 1 (i.e. all ipol values are the same), while a full polarization data the number will be 4 (as ipol will be one of four possible values - 1 (RR), 2 (RL), 3 (LR), 4 (LL). In the line below, npol is the variable to which the number of distinct (unique) values is written.

IDL> uti_distinct(bl[pbf].ipol,npol,/many)
IDL> print,npol
     4

Check if a source is flagged as a passband (ipq) or gain (igq) calibrator. The output will be either ones or zeroes.

IDL> select source='3c84', /pos,/re
IDL> print,sp[psf].ipq
IDL> print,sp[psf].ipg

To flag a source as a gain calibrator for scripting purposes, select it then set igq to 1.

IDL> select source='3c84',/re
IDL> sp[psf].igq=1