HET focal plane fibre calculation

How to calculate the HPF fibre position on HET focal plane as well as ACAM camera

Scenario 1: Everything from scratch

Calculates all the coordinates from scratch using new measured positions

This is when you suspect the HPF's fiber puck inserted in the HET's focal plane has moved with respect to BIB, LRS2 etc..

Things to do:

  1. Measure the cCFB and sCFB positions in in ACAM
  2. Calculate all of the HPF fiber positions in the fplane.txt file
  3. Calculate the offsets in X & Y coordinates for moving from cCFB to science fibers.
  4. Calculate the ACAM pixel coordinates for all the fibers.

Step 1: Measure the cCFB and sCFB positions in ACAM

  1. Use the previous estimate of the ACAM coordinates to bring the star inside cCFB
  2. Guide the telescope using a guide probe and offset it to bring the star to the center of cCFB. (You cannot guide on cCFB unless the orientation is constrained later)
  3. Once the star is at the center of cCFB of HPF_ACQM, and guiding smoothly on the guide probe. Insert the ACAM and wait for it to stabilise before taking exposure.
  4. Take a few exposures, and then retract the ACAM. Make sure star is still at the center of cCFB
  5. Repeat the procedure of inserting the ACAM, taking images, retrieve,reinsert..
  6. Average the centriods to get a good accurate ACAM pixel position of cCFB.
  7. Do the same for sCFB and get its pixel coordinates on ACAM.

Step 2: Calculate all of the HPF fiber positions in the fplane.txt file

  1. Get the latest ACAM pixel positions of BIB, LRS2R, and LRS2B from https://het.as.utexas.edu:8001/trac/WFUCommissioning/wiki/NightOperations/Commissioning/Results
  2. Get the fplane.tx coordinates of BIB, LRS2R, and LRS2B from fplane.txt file
  3. Fits a linear transformation matrix to transform ACAM pixel coordinates to fplane.txt coordinates

How to run the CalculateHPFfiberpositions.py command once you have the coordinates measured for input file.

$./CalculateHPFfiberpositions.py -h

usage: CalculateHPFfiberpositions.py [-h] [--ShowPlots]
                                     {fromscratch,old2newacam} ...

Script to calculate the HPFs fiber and CFB positions on HET telescope.

positional arguments:
  {fromscratch,old2newacam}
                        Choose one of the subcommands below and add -h flag
                        for more help
    fromscratch         Calculate both ACAM positions as well as fplane
                        positions using cCFB and sCFB
    old2newacam         Calculate new ACAM positions based on old ACAM
                        positions

optional arguments:
  -h, --help            show this help message and exit
  --ShowPlots           Show Plots

We have to use fromscratch sub command for this Scenario

$./CalculateHPFfiberpositions.py fromscratch -h

usage: CalculateHPFfiberpositions.py fromscratch [-h] MeasuredCoordsFile

positional arguments:
  MeasuredCoordsFile  Input Coords file containing the New ACAM image
                      coordinate measurements of (Central CFB & Side CFB),
                      BIB, LRS2R, LRS2B, and Latest fplane.txt coordinates of
                      BIB, LRS2R, LRS2B

optional arguments:
  -h, --help          show this help message and exit

The input for this subcommand is a text file which contains the new ACAM coordinates of Central CFB & Side CFB), BIB, LRS2R, LRS2B, and Latest fplane.txt coordinates of BIB, LRS2R, LRS2B.

An example MeasuredCoordsFile file is shown below

# This is an example file input for the fromscratch sub command of CalculateHPFfiberpositions.py
# IMP: Keywords in this file should not be renamed. All are mandatory

# New ACAM measurements of Central CFB & Side CFB from 2018 October
ACAMcCFB = 145.8, 256.4     # This is the Central CFB of HPF ACAM
ACAMsCFB = 217.8, 182.5     # This is the Side CFB of HPF ACAM

# New ACAM measurements of BIB LRS2R and LRS2B from 2018 October 1st

BIB = 453.0, 401.5
LRS2R = 737.9, 581.7       # LRS2Red
LRS2B = 735.5, 212.6       # LRS2Blue

# Latest fplane.txt coordinates of BIB LRS2R and LRS2B from 2018 October 8th

fplaneBIB = 0.7, -73.13
fplaneLRS2R = 50, -150.0
fplaneLRS2B = -50, -150.0

Now, we can run the command with this file as input as shown below

$./CalculateHPFfiberpositions.py fromscratch MeasuredCoordsFile_fromscratchExample.txt

TRS transformation solution from Telecentric pixels to ACAM
Scale = -0.273230897883,theta =-0.0158378347056,TranX =322.763146343,TranY=356.957174513
Matrix of transformation : [[-2.73196630e-01 -4.32720489e-03  3.22763146e+02]
 [ 4.32720489e-03 -2.73196630e-01  3.56957175e+02]
 [ 0.00000000e+00  0.00000000e+00  1.00000000e+00]]
********************
New ACAM positions of two CFBs and all HPF fibers
********************
cCFB : 145.8 256.4
sCFB : 217.8 182.5
oct1 : 253.6 162.4
oct2 : 237.9 147.0
oct3 : 125.6 292.0
oct4 : 109.8 276.8
cir1 : 260.6 266.8
cir2 : 246.9 284.2
cir3 : 230.0 297.7
cir4 : 133.5 141.2
cir5 : 116.2 154.7
cir6 : 102.9 172.2
********************
TRS transformation solution from ACAM coordinates to fplane coordinates
Scale = -0.270928432103,theta =1.57717675667,TranX =-108.866551284,TranY=48.9029381786
Matrix of transformation : [[ 1.72862813e-03  2.70922917e-01 -1.08866551e+02]
 [-2.70922917e-01  1.72862813e-03  4.89029382e+01]
 [ 0.00000000e+00  0.00000000e+00  1.00000000e+00]]
Sanity Check of calculating the BIB, LRS2R, LRS2B coorindates in fplane
('TRS: BIB, LRS2R, LRS2B in fplane:', matrix([[   0.69206859,   50.00486446,  -49.99693305],
        [ -73.1310992 , -150.00553958, -149.99336122],
        [   1.        ,    1.        ,    1.        ]]))
Sanity Check of calculating the cCFB, sCFB coorindates in fplane
('TRS: cCFB, sCFB in fplane:', matrix([[-39.14988128, -59.04662365],
        [  9.84559708,  -9.78859859],
        [  1.        ,   1.        ]]))
********************
New fplane.txt positions of two CFBs and all HPF fibers
********************
cCFB : -39.1 9.8
sCFB : -59.0 -9.8
oct1 : -64.4 -19.5
oct2 : -68.6 -15.3
oct3 : -29.5 15.4
oct4 : -33.7 19.6
cir1 : -36.1 -21.2
cir2 : -31.5 -17.5
cir3 : -27.8 -12.9
cir4 : -70.4 13.0
cir5 : -66.8 17.7
cir6 : -62.0 21.3
********************
New guider fiducial offset command to go from cCFB to HR Sci fiber is
syscmd -T 'Guider1_offset_fiducial(dx_asec=-9.6,dy_asec=-5.5,compensate="true")'
--------------------

fplane.txt number to fibre names

Just for reference the numbers in fplane.txt file correspond to the fiber names as given below

600 : cCFB   # Central CFB
601 : oct1   # HR Sky fibre
602 : oct2   # HE Sky fibre (decommissioned)
603 : oct3   # HR Science fibre
604 : oct4   # HE Science fibre (decommissioned)
610 : sCFB   # Side CFB
611 : cir1
612 : cir2
613 : cir3
614 : cir4
615 : cir5
616 : cir6

Tip: HPF HR Science fibre is oct3

Scenario 2: Update the ACAM coordinates after an IHMP take down and IFU install

This is when there is only an overall shift to correct after IHMP take down and IFU re-install

Things to do:

  1. Get the old ACAM pixels positions of BIB, LRS2R, and LRS2B
  2. Get the latest ACAM pixel positions of BIB, LRS2R, and LRS2B from https://het.as.utexas.edu:8001/trac/WFUCommissioning/wiki/NightOperations/Commissioning/Results
  3. Fit a linear transformation from the old pixel coordinates to new pixel coordinates
  4. Apply the transformation to old HPF acam pixel positions to obtain new pixel coordinates

How to run the CalculateHPFfiberpositions.py command for Scenario 2 once you have the new ACAM coordinates measured for input file.

You have to use the old2newacam subcommand

$ ./CalculateHPFfiberpositions.py old2newacam -h
usage: CalculateHPFfiberpositions.py old2newacam [-h]
                                                 OldAndNewCoordsFile
                                                 OldCoordsToRecalculate

positional arguments:
  OldAndNewCoordsFile   Input Coords file containing the Old BIB, LRS2R, LRS2B
                        pixel coordinates in ACAM as well as new BIB, LRS2R,
                        LRS2B pixel coordinates in ACAM
  OldCoordsToRecalculate
                        Input Coords file containing the Old pixel coordinates
                        of HPF fibers in ACAM which needs to be recalculated

optional arguments:
  -h, --help            show this help message and exit

The input for this subcommand are two text files. First one should contain Old BIB, LRS2R, LRS2B pixel coordinates in ACAM as well as new BIB, LRS2R, LRS2B pixel coordinates in ACAM Second one should contain Old pixel coordinates of HPF fibers in ACAM which needs to be recalculated.

An example OldAndNewCoordsFile file is shown below

# This is an example file input for the old2newacam sub command of CalculateHPFfiberpositions.py
# IMP: Keywords in this file should not be renamed. All are mandatory

# Old ACAM measurements of BIB LRS2R and LRS2B from 2017 October
oldBIB = 452.6, 402.6
oldLRS2R = 744.5, 581.5     #LRS2Red
oldLRS2B = 741.8, 213.3     #LRS2Blue

# New ACAM measurements of BIB LRS2R and LRS2B from 2018 October 1st
newBIB = 453.0, 401.5
newLRS2R = 737.9, 581.7
newLRS2B = 735.5, 212.6

An example OldCoordsToRecalculate file is shown below

# This is an example file input for the old2newacam sub command of CalculateHPFfiberpositions.py
# Keywords in this file can be renamed and optional. But atleast one fiber should be provided.

# Old ACAM coordinates of fibers which needs to be recalculated to new ACAM coordinates

cCFB = 148.0, 254.8  # Central CFB
sCFB = 219.0, 179.5  # Side CFB
HRsci = 128.3, 290.9 # HR Science fiber (octogonal fiber 3)
HEsci = 112.2, 275.8 # HE Sci fiber currently de-scoped

Now, we can run the command with these two files as input as shown below

$ ./CalculateHPFfiberpositions.py old2newacam OldAndNewCoordsFile_old2newacamExample.txt OldCoordsToRecalculate_old2newacamExample.txt 
Scale = 0.99061667558,theta =0.00160541357815,TranX =2.53336221499,TranY=2.18453070333
Transformation matrix
[[ 9.90615399e-01 -1.59034878e-03  2.53336221e+00]
 [ 1.59034878e-03  9.90615399e-01  2.18453070e+00]
 [ 0.00000000e+00  0.00000000e+00  1.00000000e+00]]
Residue/Error in the fitted transform (PredictedNewCoords - NewCoords). This is a consistence and sanity check
[[-2.75438262  1.22173895  1.5326438 ]
 [ 0.2260822  -2.28860012  2.06251603]
 [ 0.          0.          0.        ]]
********************
New ACAM positions of old ACAM coordinates
********************
cCFB : 148.7 254.8
sCFB : 219.2 180.3
HRsci : 129.2 290.6
HEsci : 113.2 275.6
********************
--------------------

Tip : You can add a --ShowPlots flag in the beginning if you want to see a scatter plot of the newly calculated coordinates