Documentation for the scripts included with TUI.

  • Run Commands
    • Drift: take a time series of spectra by moving the object along the slit during each exposure.
    • Focus: determine the best focus.
    • Drift: take a time series of spectra by moving the object along the slit during each exposure.
    • Focus: determine the best focus.
  • Echelle
    • Focus: determine the best focus.
    • Trail: trail the object back and forth along the slit during each exposure.
  • NA2 Guider
    • Focus GMech: determine the best gmech focus.
    • Focus Sec: determine the best secondary mirror focus.
  • NICFPS
    • Data Cube: take a sequence of exposures over a range of wavelengths.
    • Focus: determine the best focus.
    • FPCalibrate: take a sequence of images over a range of Fabry-Pérot etalon positions, as specified in a file.
    • Dither
      • Point Source: take a sequence of exposures in a small 5-point dither pattern.
      • Extended Source: take a set of pairs of exposures (one on object, one off object) while also moving around a small 5-point dither pattern.
  • SPIcam
    • Focus: determine the best focus.
    • Sky Flats: take a sequence of twilight or morning flats, automatically increasing or decreasing the exposure time.
  • Telescope
    • Pointing Data: collect data that can be used to fit a pointing model.
  • TSpec
    • Focus: determine the best focus.
    • Nod: take a set of TripleSpec exposures alternating between two points A and B in the pattern A1 B1 B2 A2.

Run Commands

Run a set of commands, one at a time. Each command runs to completion before the next command is executed. If any command fails, the script aborts. You may save your commands to a file and retrieve them again later.

The results of the commands do not show up in the Run_Commands window. If you can't see what you want in TCC's various displays then open the Log Window

Commands Format

Each line must be one of:

A command for an actor, in the form: actor command A tui wait command: tui wait sec A blank line (ignored) A comment starting with # (ignored)

Example:

# sample commands that are safe to run

  • tcc show status
  • tui wait 0.3
  • tcc show time
  • Controls
  • The file bar cross the top
  • File Menu:: the usual Open, Save and Save As menu options.
  • Current file a field showing the name of the current file (if any).
  • Commands area: the commands to execute. The currently executing command is highlighted (and remains highlighted if the script aborts or is cancelled.)

The rest of the window shows the usual script status bars and controls.

Caveat

Run_Commands provides a simple way of running a fixed set of commands. It is very easy to use, but also very limited. If you find yourself wanting more control or flexibility then I encourage you to write your own script.

DIS Drift

The DIS:Drift script allows you to take a time series of spectra by moving the object along the slit in the +X direction during an exposure.

The range of motion is centered on your starting position, so typically you should begin by putting your object in the center of the slit. Note that the slit is 400" long, but the slit viewer can only see the middle 150" of that. If you try to use the full 400" you risk losing some of your exposure because we are not sure the slit is precisely lined up along the X axis.

In detail, the script performs the following sequence:

  • Slew to the starting position (actually a bit farther because the script allows some time for the telescope to ramp up to speed).
  • For each exposure requested:
    • Start drifting in +X along the slit.
    • Wait a few seconds for the telescope to ramp up to speed.
    • Take an exposure.
    • As soon as integration is finished, slew to the starting position again (or the initial position if there are no more exposures to be taken).
    • Wait for the exposure to finish reading out.
  • If you cancel the script or an error occurs, the telescope will slew back to the initial position. Thus the script should always leave the telescope where it began (presumably in the middle of the slit).

Echelle Trail

The Echelle:Trail script allows you to "trail" the telescope up and down along the slit while taking an Echelle exposure. You specify the number of trails (drifts in +Y or -Y along the slit) and length of each trail.

As Don York explained: trailing is used with the echelle to distribute charge over the CCD, especially for bright star work. The CCD saturates around 34,000 DN. The S/N per exposure can be increased by root 2 with trailing and the readout per unit S/N is reduced, a significant savings for exposures on stars brighter than 6th mag (6 minute exposure to just saturate.)

The range of motion is centered on your starting position, so typically you should begin by putting your object in the center of the slit.

Warning: trail length is input in arcsec but is also reported in percent. Unfortunately, this is percent of the default slit, and so is not necessarily correct for the current slit. This problem can only be fixed if the hub starts reporting the length of the current slit.

In detail, the script performs the following sequence:

  • Slew to the starting position (actually a bit farther because the script allows some time for the telescope to ramp up to speed).
  • For each exposure requested:
    • Start drifting in +Y along the slit (or -Y if exposure 2, 4, 6, ...).
    • Start an exposure.
    • Wait for flushing to end and integration to begin.
    • Start the telescope drifting back and forth along the slit.
    • Wait for integration to end.
    • Slew to the starting position for the next exposure (or the initial position if there are no more exposures to be taken).
  • If you cancel the script or an error occurs, the telescope will slew back to the initial position. Thus the script should always leave the telescope where it began (presumably in the middle of the slit).

NICFPS Data Cube

The NICFPS:Data Cube script allows you to take a sequence of exposures over a range of wavelengths. Controls (items in bold are required):

  • Time: the exposure time.
  • #Exp: the number of exposures per etalon Z spacing.
  • Name: the file name.
  • Comment: a comment for the FITS header.
  • Initial Index: specify this to restart a partial data cube; otherwise leave it blank.
  • Initial Z: the initial etalon Z spacing.
  • Delta Z: the etalon Z spacing interval. This may be negative.
  • Num Zs: the desired number of Z spacings.
  • Final Z: the final Z spacing (computed once the previous three items are specified).
  • Num Passes: the number of interleaved passes in which to sample the range of Z spacings. For example, if Beg Z = 100, Delta Z = 10, Num Zs = 5 and Num Passes = 2, then the spacings will be sampled in these two passes:
    1. 100, 120, 140
    2. 110, 130

Warning: this script does not restore the etalon z spacing to its original value when done. So NICFPS will almost certainly have a different spacing after you run this script.

Restarting a Partial Data Cube

If you must interrupt a data cube partway through, record the Current Index plus all input parameters. Then to restart the data cube later, set Initial Index to the recorded Current Index and restore all other input parameters.

Warning:> if you wait too many days before restarting the data cube, the earth's velocity may have changed too much with respect to your target (producing a doppler shift). If in doubt, discuss this with the telescope operator or (during the day) the instrument scientist.

NICFPS FP Calibrate

The NICFPS:FPCalibrate script allows you to take Fabry-Pérot calibration data. The script takes a sequence of images over a range of Fabry-Pérot etalon positions, as specified in a file.

The file format is as follows:

  • Zero or more lines of X Y Z etalon positions, in steps:
    • Values may be separated with any whitespace, but not commas.
    • Values must be integers.
    • Leading and trailing whitespace are ignored.
  • Blank lines are ignored.
  • Comments: lines whose first non-whitespace character is # are ignored.

Here is a short sample file:

# Data for the NICFPS:FPCalibrate script
    
    # x	y	z position (integer steps)
      0	   0	 0
    100	 -25	33
    

The input controls for the script are as follows:

  • Time: the exposure time.
  • #Exp: the number of exposures per etalon position.
  • Name: the file name.
  • Comment: a comment for the FITS header.
  • Input File: select a file containing lines of X Y Z etalon positions.

Warning: this script does not restore the original etalon position when it is done, so the etalon will almost certainly be in a new position after you run this script.

NICFPS Dither Point Source

The NICFPS:Dither:Point Source Random script allows you to take a sequence of exposures in a square pattern plus a point in the middle. This pattern is typically used for point sources.

The requested number of exposures is taken at each point before moving on to the next. The order is as shown below. Any dither point may be omitted by unchecking its checkbox before running the script. Ctr is always your current telescope pointing, even if you omit Ctr.


Dither pattern without randomization

Controls include:

  • A checkbox for each dither point. Uncheck the box (before running the script) to skip the point.
  • Box Size: the size of one side of the square pattern, in arcseconds on the sky.
  • Randomize: check this to apply a small random offset before taking each exposure after the first.

Randomization helps to reduce residuals when median combining the images, especially with #Exp > 1. The random component is evenly distributed across the region independently in x and y.

For example, if #Exp = 3 and Box Size = 20", the script might do the following, taking exposures in the order indicated by red numbers:


Dither pattern with randomization

Acknowledgements

Thanks to Corey Wood for the first implementation of randomization and for the images used in the documentation.

NICFPS Dither Extended Source

The NICFPS:Dither:Extended Source script allows you to a set of take pairs of dithered source/sky exposures. These pairs of exposures are taken over various points of a small 5-point dither pattern.

The sequence is to take NExp exposures at each point before moving on to the next, in this order:

  • dither point 1 on source
  • dither point 1 on sky
  • dither point 2 on sky
  • dither point 2 on source
  • ...

Controls include:

  • A checkbox for each dither point. Uncheck the box (before running the script) to skip the point.
  • Box Size: the size of one side of the square pattern, in arcseconds on the sky.
  • Randomize: check this to apply a small random offset before taking each exposure after the first. For more information see NICFPS:Dither:Point Source

The input controls are ignored once the script starts (as usual for scripts).

As the script runs the status of each dither point is updated. This status is retained when the script ends so you can see what happened. It is cleared when you start a new run.

Note: the small dither pattern is aligned with the axes of your coordinate system (typically RA/Dec). This differs from the NICFPS:Dither:Point Source script, whose dither pattern is aligned with the detector. This is because Extended Source uses object offsets whereas Point Source uses boresight offsets. If north is up on your image then the patterns will be the same.

Acknowledgements

Thanks to Corey Wood for the first implementation of this script.

Sky Flats

The SPIcam:Sky Flats script allows you to take a series of twilight or morning flats, automatically increasing or decreasing the exposure time to roughly maintain a constant brightness for the images and dithering the telescope (using a 15" box) between each exposure. If you don't want automatic adjustment of exposure time then please use the normal SPIcam Exposure window, instead.

This script uses the current time to decide whether you are taking twilight flats or morning flats. For evening flats the time increases using equation:

nextEveTime = -288 log(e-prevTime/288 + e-(prevTime+45)/288 - 1) - (prevTime+45)
(or 160 if prevTime is too large)

and for morning flats the time decreases using equation:

nextMornTime = 288 log(eprevTime/288 + e(prevTime+45)/288 - 1) - (prevTime+45)
(or 1 if prevTime is too short)

Note: even the time of the first exposure is compensated. This allows you to take an exposure, enter that time (with some suitable correction if the image was too light or too dark) and start the script without having to mentally compensate for changing sky brightness.

As usual for scripts, the input options are recorded when you press "Start" and ignored thereafter. Thus you must stop and restart the script to run it with different settings.

Note: this script uses the same time compensation used by the original SPIcam eveflat and mornflat scripts (but with limits to avoid crashes).

Pointing Data

The Telescope:Pointing Data script takes set of pointing error measurements of pointing reference stars across the sky. It logs the results to a data file which can be used to fit a pointing model.

Modes

The script runs in one of two modes, controlled by the Attended Mode checkbutton:

  • Attended Mode: if a star cannot be measured then pause on that star. To retry measuring the star, fix the problem (e.g. by adjusting focus, exposure time or offset) and press Continue. To give up on the star and go on to the next, press the Skip Curr Star button and Continue.
  • Unattended Mode: if a star cannot be measured, continue on to the next star, but pause at the very end if any stars could not be measured. To retry all missing stars you can switch to Attended Mode, push the Retry All button, and press Continue.

Note:

  • You can toggle the mode at any time.
  • Once the script halts you can no longer add data to the current pointing data file. However, you can combine two files.

Controls

You may change any parameter except Az/Alt Grid while the script is running; the new value will be used as soon as possible. For parameters you type (such as exposure time), you must type <tab<> or <enter> or click on a different field to save the new value; unfortunately there is no visual feedback indicating if a value has been saved. If you want to change several values at the same time, you may wish to pause the script while you make the changes.

  • Az/Alt Grid: select the grid of az/alt points. The script slews to a pointing reference star near each point in turn.
  • Min Mag: minimum magnitude (maximum brightness) of pointing reference star.
  • Max Mag: maximum magnitude (minimum brightness) of pointing reference star.
  • Rot Type: rotation type (rotation angle is always 0).
  • Settling Time: wait time after each slew to a new pointing reference star (sec) to give the axes additional time to settle. Normally this should be 0 (if the axis controllers and TCC tune block are properly set), but if guider images show signs that the axes have not settled, try increasing it.
  • Num Exp: the number of exposures to take of each pointing reference star. After each exposure the pointing is corrected (by updating the Calibration offset). The pointing error of the final exposure is logged to the pointing data file. 1 should usually suffice, but it is worth experimenting with 2 to see if it increases the accuracy of the pointing model.
  • Exp Time: exposure time (sec).
  • Bin Factor: bin factor
  • Centroid Radius: centroid radius, in arcsec. It controls how many pixels are used to measure a star after it has been found (it does not affect star finding). It should be large enough to include the star and some sky around it.
  • Pause on Error: controls the mode of operation.
  • Skip Current Star: add the current star to Stars to Skip. This is useful if running in attended mode and you give up on the current star.
  • Retry All Stars: add all stars from Missing Stars (except those in Stars to Skip) to Stars to Retry. This is useful if running in unattended mode and you want to retry all missing stars.
  • Missing Stars: a read-only list of star numbers (grid index starting from 1) that could not be measured.
  • Stars to Skip: a list of star numbers to not try to measure. You may edit this field while the script is paused, but not while it is running. You can add the current star while running by pressing Skip Current Star. This field is cleared when you change grids.
  • Stars to Retry: a list of star numbers to retry. You may edit this field while the script is paused, but not while it is running. If you are running in attended mode then any missed star is automatically added to this list, unless it appears in Stars to Skip. This field is cleared when you change grids.

Note:

  • Star numbers are grid indices, starting at 1. If your grid has 80 stars then the first star in the grid is star number 1 and the last is star number 80.
  • If a star number appears in both Stars to Skip and Stars to Retry then it is skipped.
  • You can pause the script at any time to edit the "Stars to Skip" and "Stars to Retry" controls.

Operation

Select an az/alt grid, adjust any other settings as desired, then push Start. For each point in the az/alt grid the script will find and slew to a nearby pointing reference star, measure the star, write the pointing error to a data file whose path is displayed, and correct the pointing error.

The graph shows the grid of az/alt points. While a star near a grid point is being measured, that grid point is shown as a large blue star. Once the star has been measured, the grid point is a small green star, or a red X if the star could not be measured. Note that the graph does not show the positions of the pointing reference stars (to avoid clutter) nor the measured error (because TPOINT does this so much more better).

The data file can be read by TPOINT and used to fit a pointing model. You will also want access to the the current pointing model (to get the terms we use, and to see how much pointing has changed). You can get that from tcc35m-1-p in tccdata/telmod.dat.

Adding Az/Alt Grids

A few grids of az/alt points are built in. TUI looks for additional grids in TUIAdditions/Grids/*.dat. The Az/Alt Grid menu is rebuilt each time you click on it, so you can add, delete or modify grid files while TUI is running.

You may generate additional grids using the MakeGrid application, or generate files by hand. The format of grid files is one line per point: az alt (decimal degrees, no comma separating them). Lines starting with # or ! and blank lines are ignored. Leading and trailing whitespace is also ignored. For example:

                        # azimuth   altitude
                        #  (deg)      (deg)
                            91.02     51.43
                           126.52     15.08
                        ...

Nod

The TSpec:Nod script takes a set of TripleSpec exposures alternating between two points A and B in the pattern A1 B1 B2 A2.

  • Point A is the telescope position when you start the script
  • Point B is (+85, +1) unbinned pixels away from A in (x, y).

The script always moves the telescope back to point A at the end, even if the script fails or you cancel it.

Controls

  • #Exp: the number of exposures to take at each point (typically 1)
  • Cycles: the number of A1 B1 B2 A2 cycles

Thus if #Exp = 3 and Cyles = 5 the script will take 60 exposures: 3 exposures at each point, 4 points in a cycle, 5 cycles.