| fitsky | noao.digiphot.apphot | fitsky |
fitsky - determine the mode, sigma and skew of the sky pixels
fitsky image
FITSKY computes accurate sky values for a set of objects in the IRAF image image , whose coordinates are read from the text file coords or the image display cursor, and writes the computed sky values to the text file output .
The coordinates read from coords are assumed to be in coordinate system defined by wcsin . The options are "logical", "tv", "physical", and "world" and the transformation from the input coordinate system to the internal "logical" system is defined by the image coordinate system. The simplest default is the "logical" pixel system. Users working on with image sections but importing pixel coordinate lists generated from the parent image must use use the "tv" or "physical" input coordinate systems. Users importing coordinate lists in world coordinates, e.g. ra and dec, must use the "world" coordinate system and may need to convert their equatorial coordinate units from hours and degrees to degrees and degrees first.
The coordinates written to output are in the coordinate system defined by wcsout . The options are "logical", "tv", and "physical". The simplest default is the "logical" system. Users wishing to correlate the output coordinates of objects measured in image sections or mosaic mosaic pieces with coordinates in the parent image must use the "tv" or "physical" coordinate systems.
If cache is yes and the host machine physical memory and working set size are large enough, the input image pixels are cached in memory. If cacheing is enabled and FITSKY is run interactively the first measurement will appear to take a long time as the entire image must be read in before the measurement is actually made. All subsequent measurements will be very fast because FITSKY is accessing memory not disk. The point of cacheing is to speed up random image access by making the internal image i/o buffers the same size as the image itself. However if the input object lists are sorted in row order and sparse cacheing may actually worsen not improve the execution time. Also at present there is no point in enabling cacheing for images that are less than or equal to 524288 bytes, i.e. the size of the test image dev$ypix, as the default image i/o buffer is exactly that size. However if the size of dev$ypix is doubled by converting it to a real image with the chpixtype task then the effect of cacheing in interactive is can be quite noticeable if measurements of objects in the top and bottom halfs of the image are alternated.
FITSKY can be run either interactively or in batch mode by setting the parameter interactive . In interactive mode the user may either define the list of objects to be measured interactively with the image cursor or create an object list prior to running FITSKY. In either case the user may adjust the sky fitting parameters until a satisfactory measurement is achieved. coordinate list with that set of parameters. In batch mode positions are read from the text file coords or the image cursor parameter icommands can be redirected to a cursor command file.
The following cursor commands are currently available.
Interactive Keystroke Commands
? Print help
: Colon commands
v Verify the critical parameters
w Save the current parameters
d Plot radial profile of current star
i Interactively set parameters using current star
f Fit sky for current star
spbar Fit sky for current star, output results
m Move to next star in coordinate list
m Fit sky for next star in coordinate list, output results
l Fit sky for remaining stars in coordinate list, output results
e Print error messages
r Rewind the coordinate list
q Exit task
Colon commands
:show [data/sky] List the parameters
:m [n] Move to the next [nth] star in coordinate list
:n [n] Fit sky to next [nth] star in coordinate list, output results
Colon Parameter Editing Commands
# Image and file name parameters
:image [string] Image name
:coords [string] Coordinate file name
:output [string] Output file name
# Data dependent parameters
:scale [value] Image scale (units per pixel)
:fwhmpsf [value] Full width half maximum PSF (scale units)
:emission [y/n] Emission feature (y), absorption (n)
:sigma [value] Standard deviation of sky (counts)
:datamin [value] Minimum good pixel value (counts)
:datamax [value] Maximum good pixel value (counts)
# Noise parameters
:noise [string] Noise model (constant|poisson)
:gain [string] Gain image header keyword
:ccdread [string] Readout noise image header keyword
:epadu [value] Gain (electrons per adu)
:readnoise [value] Readout noise (electrons)
# Observations parameters
:exposure [string] Exposure time image header keyword
:airmass [string] Airmass image header keyword
:filter [string] Filter image header keyword
:obstime [string] Time of observation image header keyword
:itime [value] Exposure time (time units)
:xairmass [value] Airmass value (number)
:ifilter [string] Filter id string
:otime [string] Time of observation (time units)
# Sky fitting algorithm parameters
:salgorithm [string] Sky fitting algorithm
:skyvalue [value] User supplied sky value (counts)
:annulus [value] Inner radius of sky annulus (scale units)
:dannulus [value] Width of sky annulus (scale units)
:khist [value] Sky histogram extent (+/- sky sigma)
:smooth [y/n] Lucy smooth the sky histogram
:binsize [value] Resolution of sky histogram (sky sigma)
:smaxiter [value] Maximum number of iterations
:sloclip [value] Low side clipping factor (percent)
:shiclip [value] High side clipping factor (percent)
:snreject [value] Maximum number of rejection cycles
:sloreject [value] Low side pixel rejection limits (sky sigma)
:shireject [value] High side pixel rejection limits (sky sigma)
:rgrow [value] Region growing radius (scale units)
# Marking and plotting parameters
:mksky [y/n] Mark sky annuli on the display
:radplot [y/n] Plot radial profile of sky pixels
The following commands are available from within the interactive setup menu.
Interactive Fitsky Setup Menu
v Mark and verify the critical parameters (a,d,s)
s Mark and verify the standard deviation of the sky
l Mark and verify the minimum good data value
u Mark and verify the maximum good data value
a Mark and verify the inner radius of the sky annulus
d Mark and verify the width of the sky annulus
g Mark and verify the region growing radius
A brief description of the data dependent parameters and the sky fitting parameters can be found in the online manual pages for the DATAPARS and FITSKYPARS tasks.
In interactive mode the following quantities are printed on the standard output as each object is measured.
image xinit yinit msky stdev sskew nsky nsrej error
In both interactive and batch mode full output is written to the text file output . At the beginning of each file is a header listing the current values of the parameters when the first stellar record was written. These parameters can be subsequently altered. For each star measured the following record is written.
image xinit yinit id coords lid
msky stdev sskew nsky nsrej sier error
Image and coords are the name of the image and coordinate file respectively. Id and lid are the sequence numbers of stars in the output and coordinate files respectively. Sier and error are the error code and accompanying error message respectively. Xinit and yinit are the center coordinates of the sky annulus in pixels. Msky, stdev and sskew are the sky value, standard deviation and skew respectively. Nsky and nsrej are the number of sky pixels used and the number of sky pixels rejected respectively.
In interactive mode a radial profile of each measured object is plotted in the graphics window if radplots is "yes".
In interactive and batch mode a radial profile plot is written to plotfile if it is defined each time the result of an object measurement is written to output .
If all goes well during the sky fitting process then the error code sier will be 0. Non-zero values of sier flag the following error conditions.
0 # No error 201 # There are no sky pixels in the sky annulus 202 # Sky annulus is partially off the image 203 # The histogram of sky pixels has no width 204 # The histogram of sky pixels is flat or concave 205 # There are too few points for a good sky fit 206 # The sky fit is singular 207 # The sky fit did not converge 208 # The graphics stream is undefined 209 # The file of sky values does not exist 210 # The sky file is at EOF 211 # Cannot read the sky value correctly 212 # The best fit parameters are non-physical
1. Compute the sky values for a few stars in dev$ypix using the display and the image cursor. Setup the task parameters using the interactive setup menu defined by the i key command and a radial profile plot.
ap> display dev$ypix 1 fi+
... display the image
ap> fitsky dev$ypix
... type ? to print an optional help page
... move the image cursor to a star
... type i to enter the interactive setup menu
... enter maximum radius in pixels of the radial profile or hit
CR to accept the default
... set the inner and outer sky annuli, and sigma using the
graphics cursor and the stellar radial profile plot
... typing <CR> leaves everything at the default value
... type q to quit the setup menu
... type the v key to verify the parameters
... type the w key to save the parameters in the parameter files
... move the image cursor to the stars of interest and tap
the space bar
... a one line summary of the fitted parameters will appear on the
standard output for each star measured
... type q to quit and q again to confirm the quit
... the output will appear in ypix.sky.1
2. Compute the sky values for a few stars in dev$ypix using a contour plot and the graphics cursor. This option is only useful for those (now very few) users who have access to a graphics terminal but not to an image display server. Setup the task parameters using the interactive setup menu defined by the i key command as in example 1.
ap> show stdimcur
... record the default value of stdimcur
ap> set stdimcur = stdgraph
... define the image cursor to be the graphics cursor
ap> contour dev$ypix
... make a contour plot of dev$ypix
ap> contour dev$ypix >G ypix.plot1
... store the contour plot of dev$ypix in the file ypix.plot1
ap> fitsky dev$ypix display=stdgraph
... type ? to get an optional help page
... move graphics cursor to a star
... type i to enter the interactive setup menu
... enter maximum radius in pixels of the radial profile or CR
to accept the default value
... set the inner and outer sky annuli, and sigma using the
graphics cursor and the stellar radial profile plot
... typing <CR> leaves everything at the default value
... type q to quit the setup menu
... type the v key to verify the critical parameters
... type the w key to save the parameters in the parameter files
... retype :.read ypix.plot1 to reload the contour plot
... move the graphics cursor to the stars of interest and tap
the space bar
... a one line summary of the fitted parameters will appear on the
standard output for each star measured
... type q to quit and q again to verify
... full output will appear in the text file ypix.sky.2
ap> set stdimcur = <default>
... reset stdimcur to its previous value
3. Setup and run FITSKY interactively on a list of objects temporarily overriding the fwhmpsf, sigma, annulus, and dannulus parameters determined in examples 1 or 2.
ap> daofind dev$ypix fwhmpsf=2.6 sigma=25.0 verify-
... make a coordinate list
... the output will appear in the text file ypix.coo.1
ap> fitsky dev$ypix annulus=12.0 dannulus=5.0 coords=ypix.coo.1
... type ? for optional help
... move the graphics cursor to the stars and tap space bar
or
... select stars from the input coordinate list with m / :m #
and measure with spbar
... measure stars selected from the input coordinate list
with n / n #
... a one line summary of results will appear on the standard output
for each star measured
... type q to quit and q again to confirm the quit
... the output will appear in ypix.sky.3 ...
4. Display and measure some stars in an image section and write the output coordinates in the coordinate system of the parent image.
ap> display dev$ypix[150:450,150:450] 1
... display the image section
ap> fitsky dev$ypix[150:450,150:450] wcsout=tv
... move cursor to stars and type spbar
... type q to quit and q again to confirm quit
... output will appear in ypix.sky.4
ap> pdump ypix.sky.4 xi,yi yes | tvmark 1 STDIN col=204
5. Run FITSKY in batch mode using the coordinate file and the previously saved parameters. Verify the critical parameters.
ap> fitsky dev$ypix coords=ypix.coo.1 verify+ inter-
... output will appear in ypix.sky.5 ...
6. Repeat example 5 but assume that the input coordinate are ra and dec in degrees and degrees, turn off verification, and submit the task to to the background.
ap> display dev$ypix 1
ap> rimcursor wcs=world > radec.coo
... move to selected stars and type any key
... type ^Z to quit
ap> fitsky dev$ypix coords=radec.coo wcsin=world verify- inter- &
... output will appear in ypix.sky.6
ap> pdump ypix.sky.6 xi,yi yes | tvmark 1 STDIN col=204
... mark the stars on the display
7. Run FITSKY interactively without using the image display.
ap> show stdimcur
... record the default value of stdimcur
ap> set stdimcur = text
... set the image cursor to the standard input
ap> fitsky dev$ypix coords=ypix.coo.1
... type ? for optional help
... type :m 3 to set the initial coordinates to those of the
third star in the list
... type i to enter the interactive setup menu
... enter the maximum radius in pixels for the radial profile or
accept the default with a CR
... type v to enter the default menu
... set the inner and outer sky annuli, and sigma using the
graphics cursor and the stellar radial profile plot
... typing <CR> after the prompt leaves the parameter at its default
value
... type q to quit the setup menu
... type r to rewind the coordinate list
... type l to measure all the stars in the coordinate list
... a one line summary of the answers will appear on the standard
output for each star measured
... type q to quit followed by q to confirm the quit
... full output will appear in the text file ypix.sky.7
ap> set stdimcur = <default>
... reset the value of stdimcur
8. Use an image cursor command file to drive the FITSKY task. The cursor command file shown below sets the annulus and dannulus parameters, computes the sky values for 3 stars, updates the parameter files, and quits the task.
ap> type cmdfile
: annulus 12.0
: dannulus 5.0
442 410 101 \040
349 188 101 \040
225 131 101 \040
w
q
ap> fitsky dev$ypix icommands=cmdfile verify-
... full output will appear in ypix.sky.8
It is currently the responsibility of the user to make sure that the image displayed in the frame is the same as that specified by the image parameter.
Commands which draw to the image display are disabled by default. To enable graphics overlay on the image display, set the display parameter to "imdr", "imdg", "imdb", or "imdy" to get red, green, blue or yellow overlays and set the fitskypars mksky switch to"yes". It may be necessary to run gflush and to redisplay the image to get the overlays position correctly.
datapars, fitskypars, phot, polyphot, radprof