NAME: astsolve PURPOSE: Solve for astrometric transformation from image to sky coordinates. DESCRIPTION: CATEGORY: Astrometry CALLING SEQUENCE: astsolve,x,y,xi,eta,terms,renormfac,bad,cxi,ceta INPUTS: x - Image x-coordinate (should be "normalized" to range from -1 to 1) y - Image y-coordinate (should be "normalized" to range from -1 to 1) xi - Standard tanget plane coordinate (should be in arcsec) eta - Standard tanget plane coordinate (should be in arcsec) terms - Which fitting terms to use (see ASTTERMS.PRO) renormfac - Re-normalization factor for converting from normalized x,y to the original x,y values. bad - array of flags that mark bad data on input (modified). OPTIONAL INPUT PARAMETERS: KEYWORD INPUT PARAMETERS: EDIT - Flag, if set allows interactive bad point editing. MAXPASS - Maximum number of passes allowed when weeding out bad points during the fit. (default=1000) NOAUTOCLEAN - Flag, if set suppresses all attempts to weed out bad points. XFLIP - Flag, if set flips x axis plot when editing bad points. YFLIP - Flag, if set flips y axis plot when editing bad points. FORCETERMS - String array, if provided, is a list of terms (from "terms" input variable) that will be forced to a constant value rather than being fitted. FORCEVAL - This can either be an array of values or a scalar string. If it is an array it must be a Nx2 array where N matches the length of FORCETERMS and is used as the forced values in the same order as FORCETERMS. Row 0 of this array holds the forced xi term values and row 1 holds the eta terms. If it is a string, this is taken to be the name of a file in the current directory that contains the fit coefficients. This file is the same format as that used for storing normal fitting coefficients (see rdastfc.pro for details). However, this file uses the first field to identify the name of the filter for the coefficients rather than the filename as is normal for this type of file. The default value of this keyword is 'forcecoeff.dat'. FORCEFILTER - String value of the name of the filter. This is relevant only when using a file for the coefficients. If the file contains information for a single filter then that filter name is the default value. However, if there are two or more filters in the file then this keyword must be supplied. SILENT - Flag, if set suppresses all (non-error) printed output messages. Does not affect PROGRESSINFO OUTPUTS: cxi - coefficients of xi fit. ceta - coefficients of eta fit. bad - array of flags that mark bad data on output. KEYWORD OUTPUT PARAMETERS: WORSTRESID - Worst residual in "good" data in either axis (arcsec) XISCAT - Scatter of xi fit (arcsec). ETASCAT - Scatter of eta fit (arcsec). CXISIG - Uncertainty of the xi fit coefficients. CETASIG - Uncertainty of the eta fit coefficients. XICOVAR - covariance matrix of the xi fit coefficients. ETACOVAR - covariance matrix of the eta fit coefficients. PROGRESSINFO - string array with the printed information COMMON BLOCKS: SIDE EFFECTS: RESTRICTIONS: PROCEDURE: MODIFICATION HISTORY: 98/03/13, Written by Marc W. Buie, Lowell Observatory 98/11/23, MWB, added renormfac and fixed documentation 2000/09/14, MWB, added WORSTRESID keyword 2001/08/27, MWB, changed to auto-scale errors with /edit 2003/06/24, MWB, changed call to MARKDATA to use new features. 2003/10/27, MWB, fixed subtle bug during bad point cleanup. The test was done on O-C against the std deviation of a robust mean. The test needs to remove the mean of the surviving sample. 2006/02/03, MWB, added XISCAT and ETASCAT output keywords. 2009/07/14, MWB, added CXISIG, CETASIG, XICOVAR, ETACOVAR output keywords. 2009/12/02, MWB, calling seqeunce CHANGED! xiterms and etaterms are now consolidated into a single input argument. 2009/12/23, MWB, Major enhancement to add the ability to force some or all of the terms. This mode is supported by the new keywords, FORCETERMS, FORCEVAL, and FORCEFILTER. 2015/04/10, MWB, Added PROGRESSINFO output keyword 2019/12/04, MWB, added ERROR output keyword