Pointing

Pointing Data Reduction Strategy

  1. Load Data using TasLod?, or Fits2Mat
  2. Fit Point Source Scans using ScanPSFit?
  3. Calibrate for the pointing offset using ScanPSCalibration?
  4. Convert the Data into a pointing matrix using pointform?
  5. Calculate Pointing offsets using nomoffcalc?
  6. Develop a 2D polynomial fit to the Pointing offset data

1. Loading the Fits file data into MATLAB

Fits2Mat is an interactive GUI that lets you select either a single or multiple fits files and then lets you save a single MAT file which Bricky/MATLAB can read.

TasLod? is the command line script version of Fits2Mat and is designed to be used in reduction scripts.

2. Fitting the Scans

ScanPSFit? is a fitting script. For the purposes of pointing it's best to use this script with the default settings, i.e.

ScanPSFit('DataFile.mat')

This produces a file called DataFilefreefit.mat.

3. Scan Adjustment

ScanPSCalibration? is a calibration script which applies several corrections, including pointing and gain elevation. For pointing you can simply using the following, i.e.

ScanPSCalibration('DataFilefreefit.mat',0,0,0);

This will generate a file named DataFilefreefitcal.mat.

4. Generating Pointform Data

Pointform? is a routine which places the pointing information of the two IF's into matrices which can be understood by the nomoffcalc procedure. Pointform simply requires an input file, and can be run from the MATLAB command window as,

pointform('DataFilefreefitcal.mat')

This will produce a file called DataFilefreefitcalpoint.mat, this file can be loaded into to MATLAB by typing load DataFilefreefitcalpoint.mat, you can then run the nomoffcalcho or nomoffcalcd for Hobart or Ceduna respectively, to produce the pointing offsets.


At the end of this, you should have long vectors of X_nom, Y_nom, X_off and Y_off. These should be examined to flag any obviously flawed data. This is best done using the find command to clip extreme offsets, etc. It's also worth check for any NaN points - removing these early can save you some grief. Any bad points that are identified can be clipped by using the commands

A=find(isnan(X_nom));
X_nom(A)=[];X_off(A)=[];Y_nom(A)=[];Y_off(A)=[];

and repeating for A=find(isnan(Y_nom));, etc. To clip extreme offsets, try A=find(X_off>10/60); to clip X offsets larger than 10 arcminutes.
Currently, the model is produced by fitting a smooth 2D polynomial to the data, via the script polyfit2d and then creating it using polyval2d. The commands below will do this, fitting a 3rd order polynomial in both X and Y, using uniform weighting. Creating more elaborate weighting schemes, etc, is left as an exercise to the reader...

P_X_3=polyfit2d(X_nom,Y_nom, X_off, 3, 3);
P_Y_3=polyfit2d(X_nom,Y_nom, Y_off, 3, 3);}
[XI,YI]=meshgrid(-84:84,-76:76);
Xoff_3=polyval2d(P_X_3,XI,YI);
Yoff_3=polyval2d(P_Y_3,XI,YI);

The main problem encountered at this stage is at the fitting stage where the message appears Warning: Rank deficient.... In this case, you need to either reduce the order of the polynomial fit or to scale the XI and YI data (The order of the fits in X and Y are given by the last two numbers in the polyfit2d formula). To scale the data, please follow the recipe below.

[XI,YI]=meshgrid(-84:84,-76:76);
XI_poly=XI/mean(std(XI'));
YI_poly=YI/mean(std(YI));
P_X_3=polyfit2d(X_nom/mean(std(XI')),Y_nom/mean(std(YI)), X_off, 3, 3);
P_Y_3=polyfit2d(X_nom/mean(std(XI')),Y_nom/mean(std(YI)), Y_off, 3, 3);
Xoff_3=polyval2d(P_X_3,XI_poly,YI_poly);
Yoff_3=polyval2d(P_Y_3,XI_poly,YI_poly);

You should examine the output matrix. The best way to do this is using imagesc(XI(:,1), YI(1,:), Xoffset_3); colorbar.

  • Load the Telescope Pointing Model

The drive PC for the 26m telescope is located in the drive room and boots off a floppy disk. At present, there are several versions of this boot disk using different pointing models, windstow limits, etc. As such, use the one that it currently in the drive to get the most up-to-date version. A windows PC can make a copy of this disk using the MSDOS prompt and the command diskcopy a: a: . Use a blank floppy to make a copy which you can then edit. It's extremely important to make sure that you keep an intact copy of disk in case something happens. The pointing information is in the file XY_GRID.BIN on the boot floppy. To load this into MATLAB, copy it to your local machine and then use the MATLAB commands

fid=fopen('XY_GRID.BIN') and A=fread(fid, 'int16')

The pointing model is now correctly loaded as the vector A . The first 4 numbers of A tell the sys26m machine the dimensions of the matrix and should be something like 169 0 153 0 . In this case, the model covers X between ±84 and Y between ±76, in 1 degree steps. These first 4 numbers need to be written out at the start of your new pointing file and so should be preserved by

StartMessage=A(1:4);

The rest of the file are the model's X and Y offsets in arcseconds. To recreate the matrices, use the following MATLAB commands.


for i=1:153
X_off_current(i,1:169)=A(4+((169*i-168):(169*i)))';
Y_off_current(i,1:169)=A(4+169*153+(((169*i-168):(169*i))))';
end

To display these, use imagesc(X_off_current);colorbar . The orientation of these matrices has been chosen to agree with the previously generated XI and YI matrices.

  • Add the 2D polynomial fit to the Telescope pointing model

To create the new model, we need to add the offsets to the existing model. Following the sign conventions that I've used throughout and if the offsets haven't been rescaled from degrees, the new model is simply

X_off_new=X_off_current+Xoff_3*3600 and
Y_off_new=Y_off_current+Yoff_3*3600 .

This may not be appropriate for your data if you have measured the offsets using some other method. It's a sensible precaution to make two pointing models, where the offsets are added and subtracted.

  • Produce a Telescope Pointing model Binary File

To write out the models, we first need to convert the matrices back to vectors and append the StartMessage. The following MATLAB commands should do this.


temp=X_off_new';temp=temp(:);
temp2=Y_off_new';temp2=temp2(:);
OUT=[StartMessage; temp; temp2];

The temp commands first rotate the matrix and then vectorize it correctly. To write out a file, we need to open a file to write to, write to it and then close it. The commands below should create a file called XY_GRID_NEW.BIN in the current directory.


fid=fopen('XY_GRID_NEW.BIN', 'w')
fwrite(fid,OUT,'int16')
fclose(fid)

Check the outputs of the fwrite and fclose commands. These should be the length of the OUT vector and 0 respectively, if the process was successful.

  • Create a new Drive PC Diskette

This done, all that remains is to copy the new pointing file to your copy of the sys26m boot disk, rename the current XY_GRID.BIN as XY_GRID.OLD, XY_GRID_NEW.BIN as XY_GRID.BIN and document your changes!. The XY_GRID.info file is there for this purpose - please record your name and the date as well as the new identity of XY_GRID.OLD.

All that remains now is to load the new model by booting sys26m from your new boot disk - load it into sys26m (in the drive room) and press the small black reset button on the breakout box. It should take about 2 or 3 minutes to load. If it takes significantly longer than 4 minutes, something has gone wrong. Try resetting the PC but if it fails to load twice, there is a problem. When this has happened to me, it has generally been due to either a bad disk, not using diskcopy (Using windows drag-and-drop is ok for copying XY_GRID.BIN but fails when copying the entire disk) or not using capitals in renaming XY_GRID.BIN. Once sys26m boots off your disk, the telescope is now using the updated pointing model. Please make some pointing observations to check that it is working and send an email to rag@kerr.phys.utas.edu.au to let everyone know.