Data Reduction Pipeline
Special notes:
dithering
older notes
Pipeline status:
Pipeline 1.1 released. It is an (almost)
turnkey program which, starting with a set of raw data,
produces a co-added left/right pair for the target chosen. These
images have been "undistorted" and registered (x,y shift) before being
coadded. The input files for CALCTRANS (see below) are automatically
prepared so that once object pairs are found their calibrated
velocities can be obtained.
It is "almost" turnkey because before running:
you need to centroid a few spots in the reference masks you want to use;
you need to correct sky flats which have been classified as science
integrations owing to the way the data was taken;
you need to type in the names of the masks and associated data sets.
In addition, if no flats are included in the data set,
you need to give the name
of pixel-to-pixel correction masks, and bad pixel masks,
prepared elsewhere.
Typically, you should first run the program one command at a time,
cutting from the IRAF script and pasting the commands to the CL>
command line. In the process, missing file names can be pasted
into the script and one can get a feel for what is happening.
The script can subsequently be called as a task, performing the
reduction in one step.
Running the pipeline
- in .cshrc file
setenv PNSPIPE '/path/xxxxx/pnspipe'
setenv architecture `uname`
- Modifications required to your login.cl file:
- set stdimage=imt4096
- set pnspipe = "home$pnspipe/"
- task $pnspipe = pnspipe$pnspipe.cl
- set stdimcur = stdimage
- set imtype = "fits"
- set imextn = "fxf:fits,fit"
-
Obtain the tarfile of the current release from the
REPOSITORY directory and unpack it in the "iraf"
directory (this creates the "pnspipe" subdirectory)
-
At the iraf "cl" prompt type "pnspipe" to
load the scripts.
-
By default a call to most of the pipeline scripts
will be logged to a file called pnspipe$pns.log
Logging is done by a call like
logit("what a nice day")
which will log your name, the string, and the date. You can call
this script any time if you want to add a comment -
rude ones will be filtered out.
- Check that certain environment variables, set by the
file pipeline.cl, are still correct (in particular, the names of
the detectors need to be reset if these have changed)
29/10/2002 Pipeline 1.2 released.
Changes:
The undistort routine now uses a 31x31 sinc function
as the interpolation function - this greatly reduces the
patterning in the undistorted images. Unresolved objects
such as cosmic ray events result in severe ringing and these
must be removed first. The change was a suggestion by Koen.
24sep03update.tar (uploaded by AJR)
-
mods to alignspots.cl to set phot parameters,
this is now included in pnspipe.cl (see below)
-
bandpass.cl and bandpass1.cl - scripts to compute
calibrated filter profile over whole chip
-
new version of fpixels.cl in which
instead of rejecting flats with at least
one saturated pixel only flats whose
mean is above a certain value are rejected
-
reduce20020314.cl and reduceN3379.cl
- calctrans-notes.cl - testing choices of order
and fitting parameters
- cparse.cl (see below)
11/12/2003 Pipeline 1.3 archived 11/12/2003.
Changes:
Some important phot parameters now set in
pnspipe.cl itself:
centerpars.calgori="centroid"
centerpars.cbox=5
Jansen's utilities added:
cparse.cl - this will parse string given delimiter
rdlist.cl - returns line n from file f
tcolarit.cl - math operations on columns of data
numerous bug fixes
DATA directory now includes Filter-B-0 calibration
"prev" versions of calctrans etc, "micentroid",
and all "maskshifts" files
have been removed from pipeline and placed in this archive
11/12/2002 Pipeline 2.1 released
Main changes:
- 3/9/2003 Updates to wavelength solution (calctrans)
- effective wavelength of 5017 variable, new codes introduced
-
New routine shifty() which undistorts and applied x,y shift to
image in one step, avoiding the double interpolation which
otherwise arises when combining dithered, un-distorted images.
- showy(), similar but allowing rotation as well
as x,y shift: this requires a geomap table to be created
- The location of some useful files has been changed, most
files are now in the pnspipe$data area
- login.cl changed, please note the revised advice above
- Filter B-0 now calibrated
- undistort() now adds the name of the database
used to the header of the image being undistorted, in the field
"MASKDB".
- 11/2003 - major addition to the pipeline:
"xstartrails.cl" for optimal alignment and image combination,
astrometric solution, weights etc.
See details elsewhere on this page.
6/2/2004 Pipeline 2.2 released
Main changes:
- addPNSheader.cl - headers are updated when images are altered, so
far implemented in debias, fpixel, and ppcorrect steps
(e.g during debias, fpixels)
- xstartrails.cl
- debias 2.0 - uses over/underscan regions rather than a master bias
- fpixels 2.5 - includes OTHER group
Pipeline, Disks and Directories
Here is a printable checklist which you can use as an
aid when processing data: you can write fault descriptions
and other comments on them. Older checklists will help us reonstruct
the data reduction procedures used.
For the first pass you might find it handy to use a
pipeline 1.2 form
The pipeline script reduce.cl represents a complete
pipeline session and can be used as a template.
The data should be kept sorted by DATE during processing, so
that the correct calibration frames are used. Owing to the use of
"groups" files (see below) we do not need to divide the data into L and R
until the very last steps.
Many of the reduction steps are very time consuming, so intermediate
backups are a very good idea to avoid having to
to start from scratch - these could also be a back-up
archival sets.
The images, after conversion to REAL, are about 22 MB in size and it
is common to have more than 100 per arm per night, i.e. more than 2 GB.
This gives rise to the following strategy for directory naming
and corresponding processing
(the letter in the second column gives the designation in the
tape archive
if data are archived at the end of the corresponding step):
| {RAWDATA} | R | /rawdata/20020101/ | raw files from tape, delete after clean
|
| {CLEAN} | C | /clean/20020101/ | cleaned, ushort set (about 1 GB), archive
|
| {FLAT} | F | /flat/20020101/ | debiassed science data, bad pixels
fixed, pixel-flatted
|
| {FINAL} | FL | /final/20020101/ | cosmics removed,
using La-cos. Science images
are now ready to be shifted-and-added.
Directory should include images and masks.
By default sky flats are not included,
it is assumed that only a "standard" vignetting
correction will be applied. Standard stars
are present.
|
cd {CLEAN}
Data copying
Assuming the raw (16-bit integer) files are in dirA/, run
cleancopy(dirA)
- this will eliminate the extention [1], and replace "fit" by
the standard "fits" extention. In addition, the image size is
checked for the correct dimensions, in order to
eliminate stray images from other programs.
Finally, the bright line is trimmed off,
which changes the image size to [xxsize,yysize] which
are environment variables set in pnspipe.cl (set to [2130,2500]).
The under- and overscan regions are retained.
Now run
groups()
- this will create lists of files of various types,
automatically distinguishing Left and Right. It will
warn you if the number of files categorised is not consistent
with the total number of files.
At this point, inspect the lists targetL and
targetR in which mis-classified arcs and sky-flats
will be obvious. Use regroup() (follow the prompts)
to reclassify these and after this is done run groups()
again to get the lists correct. It is recommended that you
not run groups() in any subsequent steps
in the reduction unless you really know what you are doing:
since the lists at this stage are your best description of the
available data types.
Troublesome images, such as those from a focus run
which are classified as Science images, can be reclassified
to "OTHER" using regroup.
Bias creation (1)
As an optional step,
marktraps(yes,yes)
will examine the first bias frame in the lists
biasL and biasR for "traps", which are
areas (usually a column or part of a column) with a systematic
offset as a result of a charge-transfer problem
(this is best seen in the biases). If successful
it will create the masks trapsL.pl and trapsR.pl.
The masks will be used later by fpixels and that routine allows
you to nominate already-existing masks (e.g. in a different directory).
Marktraps will delete any existing "traps" masks which it finds
in the working directory.
If you plan to use pre-existing bad pixel masks (they exist
for EEV12 and EEV13) you do
NOT need to run marktraps()
Archive
This is a good point to archive the trimmed, ushort data,
with master biases and possibly "traps" masks, as a CLEAN data set.
Some of the following scripts can be executed
in one go (see below) but are listed here
for completeness and for "service-access".
cd {FLAT} and copy over the files from the corresponding {CLEAN}
directory
(more efficient, if you have saved the {CLEAN} data, is to simply
rename the directory to {FLAT} and continue)
Bias subtraction
run debias()
This fits a 2D function (order 2 (linear) in X and order 5 in Y) to
the over/underscan regions cols 1-28,2101-2128 and subtracts it
from each of the science, flats, skys, "other" images (but not the biases themselves
which are only of interest for evaluating noise patterns). As this step is irreversible
the headers are checked to see if debias has already run and will
not allow a repeat. Note that in other steps addPNSheader will report
the pre-existence of a header if asked to write it, and will not update it, but
will allow the script to run.
Fix bad pixels
run fpixels(flag,maskL,maskR,trapsL,trapsR)
to make a bad pixelmask and/or use it to correct the
images by interpolation.
If fpixels is provided the name of an existing mask, via the
parameters maskL and/or maskR, it will use that mask. If not, it will
attempt to create one using the available flats (sky flats or other).
If it cannot find an existing mask
nor create one then it will terminate.
If fpixels is provided the name of an ascii file listing
bad sections, via the parameters listL and listR, it will incorporate
these into the mask.
If fpixels is provided the name of a pixel trap file, perhaps made earlier
with marktraps, via the parameters trapsL and trapsR, it will incorporate
these into the mask.
The result of all this, if successful, will be a file "maskL.pl" or
"maskR.pl". fpixels reports that masks have been created, even
though they may only have been renamed.
If the correct flag is set to "yes", fpixels
will go ahead and
correct images using the IRAF routine FIXPIX.
All images in the categories FLAT, SCIENCE and SKY are corrected.
It is suggested that you run first
with flag=no if you want to see what the mask looks like.
Some existing mask, traps and bad sections files for EEV12 and EEV13
can be found in the data directory, e.g.
maskL="pnspipe$data/maskL.pl" (etc) - but to be sure these
can be used make sure that no offsets have arisen between
runs. See an important note below.
Example: the following call will create masks from the traps and bad sections
files, and correct the images, leaving new mask files in the
working directory:
fpixels(yes,"","","trapsL.pl","trapsR.pl","badL","badR")
The final output of the task consists of two new all-inclusive
bad pixel files files
"maskL.pl" and "maskR.pl" which are the masks actually used in
the FIXPIX call within fpixels.
Notes: The creation of bad pixel masks based on flats
uses all unsaturated flats, dividing them by their
median and then looking pixel-by-pixel for deviations greater
than 10%. For non-trivial signal levels such deviations
are very aberrant and indicate a bad pixel.
A mask is then produced, which is the intersection
of all the individual masks. This discriminates against cosmic ray events
and against the effect of low-signal masks. No algorithm is
used for "connecting" parts of bad columns and rows, this
does not seem to be necessary.
If flag=no, the masks are created but bad pixel correction is
not performed.
ARC frames are deliberately not corrected, as this might
do more harm than good...
Important note:
Between the July 2001 (mask1R) and the October 2002 runs the bad pixel
mask for the Right arm shifted by 3 pixels so always check this before
assuming you can reuse an existing mask or list of bad pixels.
In such a case you can shift the mask (in this example
shift(mask1R,mask2R,-3,0)
but
note that the routine which actually
fixes pixels, IRAF task FIXPIX, works with physical
coordinates so you would need to run
wcsreset mask2R physical in order for the
shifted mask to work.
fpixels(), which calls FIXPIX, does this internally, but
it is not a bad idea
to do it by hand as well (and necessary if you use FIXPIX manually).
NOTE ADDED BY ND: in the left arm data (EEV12) there are some isolated
bad pixels which are detected by fpixels. There are also
some rows which appear to have higher gain and which therefore
appear to the eye as "bad rows": they are however light-sensitive
and they are dealt with by ppcorrect, as they should be.
Flat fielding (1)
the script ppcorrect(flag)
will look for normalised pixel response maps (PflatL,PflatR)
and if either does not exist
will try to create it.
If flag is yes it will go ahead and perform the
pixel-to-pixel correction of science and arc data
by dividing the data by the map.
ppcorrect creates the maps by
using ALL the flats and skys which are not saturated.
In principle you should check manually to make sure that
the files listed as flats and skys are correctly
categorised, as focus runs and masked flats often turn
up in these lists. In practice, ppcorrect often
returns a message such as "image r449410.fits has negative median"
when it encounters such images.
Each of the images is flattened by dividing by a median-filtered
image, and then combined with both weights (so that the noise
remains poissonian) and rejection (to eliminate the influence of cosmic
ray events),
these last additions by KK in 4/2002. The correction range is clipped
at 10% (see also the notes on fpixels).
Usually, this would also be the place to correct the data
for the instrumental function over the field (i.e. for the
so-called vignetting). However, the vignetting function for the
PN.S is necessarily arrived at indirectly: because
(1) the flat fields are
affected by the slowness of the shutter, and (2) the vignetting
may be wavelength dependent (in the cameras, especially).
We may be able to
derive an analytical
instrumental transission function V=V(x,y,wavel) from the
data we have from mask calibration images, including
arc lamp and tungsten, together with judicious use of
sky and dome flats, but this has not been done as of January 2003.
Therefore, the pipeline leaves the data uncorrected with
the appropriate corrections to be made to the final data, later.
NOTES:
-
Flats should be taken at each filter angle used (and preferably each night)
and it is helpful to have at least one long flat (T>120).
-
Use dome flats for pixel-to-pixel variations, and sky flats for large-scale variations.
Archive
At this point the {FLAT} directory might be archived.
To get from {CLEAN} to {FLAT} in one step call the megascript
flatten() which executes all the intermediate
steps except the copying of data to the new
directory.
cd {FINAL}
FINAL DATA
The FINAL stages involve
removal of cosmic ray events, un-distorting the images
and shifting and adding prior to PN searching. You may want
to organise the
images differently at this stage, e.g. sorted by target.
Note that it is good to have cosmic ray removal
at the start of this phase rather than at the
end of the previous phase since it is prone to error
and this allows better for a recovery.
Cosmic ray removal
We have decided to correct each image using lacos. Therefore
run rmcosmics(iimage,mmin,nniter,oobj,rreplace)
which simply calls lacos_im with the appropriate
parameters (no need to specify sections anymore as the bright
line has been windowed away).
Typical call: rmcosmics("scienceL",120,3,2.0,yes)
will process only those images with exposure time greater than 120,
and with 3 iterations, objl=2.0, deleting the original
images after cleaning.
Lacos is a very slow-running process: for three iterations
1.5h on a Linux and 3.0h on the fastest Solaris machine (Ptolemy).
For more information, see here.
One of the documented bugs in lacos concerns fits files. I believe
that this bug has now been circumvented by the call in rmcosmics
Still, it is noticed that our rmcosmics procedure does fall over sometimes,
whether due to a bug in the script of in lacos itself. Recovery
has been made fairly painless: if image r123456 was being processed then
files with affixes (eg r123456m) and other temporary files (eg la12534q etc) should
simply be deleted - if all is well the uncleaned image will still be there. Then
start (e.g.) rmcosmics("scienceL",120,3,2.0,yes) again - no need to change
the list. Files already cleaned will be recognised as such (affix "c") and skipped.
Image transformations
-
Since the plate scale is non-linear toward the edges of the field,
shifting images (due to dithering or different observing nights)
then combining them will smear out some of the PN images, inhibiting detections.
A transformation to a rectilinear reference frame should be made before combining.
(Note this is not always necessary, as shifts of <= 1"x1" do not result in
significant differential distortion.)
-
Assuming that this step is the last one before co-adding the
images and looking for pairs, it seems logical to incorporate
the image alignment here. To have data sets in which a positive
velocity results in a shift to the RIGHT in the RIGHT arm data,
one needs to rotate the LEFT images (and arcs) by 180 degrees.
-
As discussed, the plate scale of the transformed images
should be (nearly) the same as that of the original images. To achieve this
one could produce the "ideal" target mask just by taking
((L+R)/2) where L and R are the x,y
values of a bright image for each spot in the L (rotated coordinates)
and R images.
- To avoid errors, the transformation should be performed on both the
target image and the reference arc image, before finding the wavelength
solution (below).
-
For each filter and angle of incidence we should take a long
mask exposure with as many spectral lines as possible
in order to create a good mask template.
"Un-distorting" and Calibrating
The philosophy is as follows: masks are taken
at regular intervals during observing so that drift can be
corrected; in addition any image rotation can be removed and the
appropriate orientations obtained. Finally the curvatures in the
images can be removed, which facilitates image stacking.
This can all be done with a single wavelength in the mask images,
transforming the images so that these holes line up with a
(fictitious) perfect mask. This is "un-distorting". All the images
and their corresponding masks are undistorted by the same code
using the same database - so that all effects generated
by this step will be common to images and masks.
To allow for changes in the dispersion and perhaps
in the dispersion direction due to mechanical
shifts in the instrument - i.e. to properly
track wavelength-dependent distortions -
the spots corresponding to several wavelengths are centroided
in the undistorted masks. Since some of the lines will
be weak, a high-quality reference mask is used as the starting
point for the centroiding.
- Characterising a new reference mask
- use a permanent directory, indicating
the filter/angle e.g. pnspipe$data/FILTER-D-3/
- create high-quality mask images LEFTARC, RIGHTARC
- select the best wavelength to use as a "key"
and write the wavelength code in file wavelength.1.dat
- centroid the Nholes
(usually 178) corresponding to
the key wavelength to create the files
coords.left, coords.right -- perhaps using
an existing file as a starting point. To check for errors
it is advisable to have three columns: x,y,i=1--Nholes
where i is defined in the diagram below
- for three holes, those numbered 39, 84, and 141, enter x,y
into the files coords.3.left, coords.3.right
- now determine the (rougly constant) Xoffset between
the spots from the key wavelength and the other wavelengths
and, using the simple script BCD.cl generate
the files coords.N.left, coords.N.right which will
contain Nwavels*Nholes entries.
- recentroid these spots using (e.g.) phot
See for an example the images and analysis in
/mag1/users/pns/FILTER-B-6/
For notes on filter bandpasses, see
here.
Filter B-6:
LEFTARC comes from r484747+r484757 (1600 sec),
RIGHTARC comes from r484748+r484758 (1600 sec)
Images below sample left, right-arm spectrlets,
with spots at 5009, 5017.25, 5023, 5031, 5038 Å marked (149, 623, 959, 1467, 1850 km/s)
Now for a "normal" (80 sec) arc exposure:
Filter B-0:
LEFTARC comes from r484880+r484882 (580 sec),
RIGHTARC comes from r484881+r484883 (580 sec)
Spots marked at 5009, 5031, 5038, 5049, 5062 Å (149, 1467, 1850, 2513, 3304 km/s)
(note FWHM bandpass is 5017.5 - 5048.2 Å = 640 - 2480 km/s)
And a normal arc:
Filter A-0:
LEFTARC comes from ?? ,
RIGHTARC comes from ??
- Calibrating observing masks
-
First of all, check which wavelength has been used as the "key"
wavelength by looking at the directory of the relevant reference
mask, e.g.
type pnspipe$data/FILTER-A-0/wavelength.1.dat.
-
You now want to run alignspots(FF/,maskL), alignspots(FF/,maskR)
for the L/R mask
pair corresponding to a set of images - this will centroid the Nholes
corresponding to the key wavelength whose value you have just looked up.
Alignspots
will automatically decide whether the mask is L or R, but needs
some help in the initial orientation of the holes. As explained
under "Characterising a new reference mask" the location of three
spots must similarly be entered into the files r433333.3.right
(or left as the case may be. Often the same file can be recycled
for use with other masks, if the flexure is not too great. Also, the
reference mask files coords.3.left, coords.3.right
can often be used as a starting point, at least to identify the
right holes (39, 84 and 141). Once you have created (e.g.)
r433333.3.right run tvmark to make sure that the
positions in the file line up with the corresponding
position for the key wavelength. If you use the wrong line,
all will not be well in Toyland.
Only now can you run Alignspots.
During the
procedure a graphics window will appear showing the
fit and residuals, if these look ok type 'q' in the
window to move on --
similarly you will be prompted for confirmation
of PHOT parameters, just hit CR
-
This creates a
database with which the masks and the images associated with them can be
transformed images -> pnspipe$data/spots0.dat
("backward" for images and "forward" for co-ordinates).
The database has
with the same name as the mask file but with the
extention .db (e.g. r433333.db).
-
Other fit parameters than the default can in principle
be used in the task, they are logged if logging is switched on
- the mask is then transformed, resulting in (e.g.) r433333un
(left-arm images will have been rotated by 180o)
- the coordinates for all wavelengths (e.g. r433333.Nxy)
are transformed and recentroided - poor fits are thrown out
- the verified data are fused with the "ideal"
mask coordinates from the pnspipe$data directory
and output as r433333un.spotsR, which is
in "calctrans" format, with wavelength codes in line 1
and xi, yi x0,y0
in subsequent lines, and -99 as the
invalid data flag
- the transformed mask can in principle be discarded,
it can easily be generated again if required
|
numbered spots in L image
|
|
numbered spots in R image
|
- Undistort
-
You can now run undistort(database,image,list) to transform your
science images using the databases you have created. These images
will thus have had their curvature removed. By
default undistort uses sinc interpolation and the result
with a frame not cleared of cosmics is quite artistic.
The process still causes a noticeable change in the background
structure - perhaps experiment with different functions?>
-
To avoid transforming the data more than once (which would
introduce unnecessary numerical noise) we have written two
elaborations of Undistort . Shifty includes
an x,y shift and is useful for removing deliberate dither.
Input are the numbers x and y.
Showy
includes x,y shift and rotation,
the input being a table
of (x,y,x0,y0) data to which a transform is fitted.
- Align images
Following distortion removal the images may need to be aligned before stacking,
though according to theory the only
remaining effects should be accounted for by a
simple x,y shift or rotation. In addition weights for
adding the images should be determined. We have written a
nice front-end to the routines described earlier which
facilitates many of the required steps. It is called:
xstartrails.cl
- Input a reference image and an input image which has to be
aligned with it. xstartrails will check that they
are both L or both R.
- xstartrails will read data from the USNO
or USNO-B catalog and (with your interactive help
if learn=yes) fit the stellar positions to the
startrails in the images. It will ignore a designated
radius in the centre, and stars above a designated brightness.
If USNO-B was used a proper motion correction will be made.
- When you think the initial fit is close enough,
xstartrails will centre-up using IRAF xregister
(an artificial star trail is cross-correlated with the
real ones to achieve this).
- Given the centroids so found, xstartrails
will again call xregister to produce the pattern of
offsets between input image and reference, and if correct=yes
will go ahead and tranform the input image.
It does this by means of a call to showy.
The appropriate
database file (*.db) from the original undistort
step must be present, and named in the header of the
input file.
IN ADDITION:
- Using calls to the nin-interactive IRAF task
fitprofs, xstartrails will find the median value of FWHM of the
gaussian fit to a vertical slice through the all the star trails
in each image, and offer this as the "seeing".
-
Similarly it will use the "continuum" level of the
gaussian fit as a measure of the background in the image
(bias has been subtracted earlier of course)
-
Similarly it will use the fluxes provided the fitprofs fits to
calculate the transparency appropriate to the input image (relative to the reference image)
-
The output of xstartrails is a list of
aligned images (my.xims) , and weights (my.xweights),
to be fed to IRAF imcombine.
The first image in any such list is the reference image.
It will not allow you use different reference images
in the same named image or weight listing.
-
If rotation or stretch is required to co-align an input image with
the reference image, one has to check whether the effective
dispersion has not been altered too much by the alignment.
There is a simple form of quality control included
in showy (and hence in xstartrails): the
effect of the new transform is compared with the old, and
a warning is given if the new transform substantially
changes the effective dispersion. Explicitly, the x-separation
of two points is computed for both cases, and if there
is a change of more a certain percentage (in version 1.4 this was 1%) a warning is given.
A 1% change would result in a 0.5 pixel shift over our typical filter bandwidth
of about 50 Angstrom, so that objects separated by that amount in velocity
space would no longer be accurately co-located with their counterparts
in the reference image.
-
If you input a L/R pair, xstartrails
will not perform the image transformation
but will produce the coordinates table ("xstarfile")
which will enable the manual call to showy.
-
If you input a L/R pair, and
if requested (astrom=yes),
xstartrails will produce
an astrometric solution (my.xdb,sol="forward")
which can be used by IRAF cctran to convert x,y
to RA and Dec.
-
Run calctrans for the undistorted mask
corresponding to each master image in order to
create input files for pnsvel.
-
To convert the objects found in imageL and imageR
to true position + velocity, use pnsvel (see below)
with as inputs: measured positions, and the
appropriate calctrans coefficients files.
Notes
- Shifty is redundant but is maintained.
- Xstartrails does not yet include transparency and
background evaluation
- The text file pnspipe$xstartrails.cl lists some bugs and "todo" items
- The file pnspipe$field_stars_B was created using the USNO-B web interface
http://www.nofs.navy.mil/data/fchpix/ selecting
12x12 field, 0.1 < B2 < 18 (do NOT select zero for bright limit)
and with the following fields selected
RA/Dec, mean epoch, muRA, muDEC,B2. To select a given field
with a targetID code, use the code given in square brackets on the title
line of the "targets observed" page, e.g. [N205] for M110.
Image combining
-
Koen's notes on optimal stacking: with additions by Nigel 16/12/03
I finally managed to finish the study of optimal stacking of sequences of
images with different seeing. I made such images, with seeing from 0.8 to
3 arcsec, using hte IRAF artdata package and stacked them with different
weightings, then used Sextractor to check point source detection and
accuracy of the photometry for different weightings - none,
seeing -1,
seeing -2,
seeing -3 and even
seeing -4.
Conclusion is that weighting by seeing -1 and seeing -2 do best both regarding
number of sources detected, and the accuracy of the photometry. But the
difference was not as strong as I would have guessed a priori.
I would have expected theoretically that seeing -2 would be optimal,
since S/N of a background-limited point source is proportional to
seeing -1, and the way to optimize a combined measurement is to weight by
(S/N)2. So I propose we stick with that as the experiments do not
disprove this idea.
Of course if the background and transparency vary that needs to be
taken into account as
well.
S/N goes like (transparency) (seeing) -1 (background) -1/2
So the optimal weight for each image would then be proportional to
(transparency)2 (seeing) -2 (background) -1
I believe that the weighting factor must be calculated such that for the averaging
(or, equivalently, summing) of images of equal quality but
with differing exposure time the weights are the same. The only combination which includes
signal and background and which satisfies this seems to be (signal/background). Since background
is of order noise2 and thus has to be evaluated as a sum over the PSF, which is
proportional to seeing2, and since signal is directly proportional
to EXPosure time and transparency-1,
I propose that the weighting should be evaluated as:
W = (EXP)(transparency)(seeing)-2 (background) -1
and this is what is coded in xstartrails version 1.x. This is
different from the above only by a factor of order unity, and might
in fact be a matter of definition: here Background is measured;
so W is independent of EXP, all other factors being equal. There is also
an ASSUMPTION that background is independent of transparency, since the
causes of transparency (e.g. thin or intermittent cloud) may lead to
increase or decrease in measured background. If one does not
make this assumption then transparency drops out of the formula
as you would expect (it has the same effect as a shorter exposure).
-
At this stage we may want to obtain a median-subtracted
image and a noise map - the following parameters are much larger
than one obtains by scaling
from those we successfully used with the ISIS data (13,7) but numerical
experiments indicated that signal is attenuated with smaller
median boxes:
median("N5866combL","mN5866combL",81,47)
imarith("N5866combL","-","mN5866combL","N5866finalL")
PN finding
There are two general strategies:
ID'ing by eye with blinking,
or automated source-finding searches.
By eye can use Koen's "searchpne", which
has now been modified to account for new image transformations:
you can specify any rotation angle for each of the two images displayed in
searchpne. Can be zero, can be 180, or whatever, so no problem either way.
Might be more convenient to transform the images to the same orientation,
but for searchpne it is not required
Note KK 4/4/2002
searchpne sw...
has been updated. Latest update: Aug 2003 -KK
New features:
* hit ? and you get a list of commands, see also searchpne.txt
* m has been fixed
* independent contrast scaling of the two windows
* you can now rotate each window by an arbitrary amount (a key)
The program has been linked to the cfitsio library,
see searchpne.txt.
Automated searching may be possible using "starfind" or
something. A semi-automatic procedure, which requires setting a number
of cuts and thresholds interactively, has now been installed and can
be found in the $SEARCHPNE/ directory (see searchpne.txt). It relies on sextractor for
detection of sources and their photometry, and on a supermongo script
that selects those sources that have no continuum, and those pairs
that line up in y and whose velocity is within alloed range. Added Aug 2003 -KK
In any case what is crucial is some kind of objective test(s) of the legitimacy of image pairs -- are
they legitimate or are they noise?
Potential tests:
magnitude consistency
pair aligned in dispersion direction (testable by dy error in pnsvel)
magnitude cutoff limit for each image, as function of magnitude and radial position (due to galaxy light) --
perhaps generated simply by making a deliberately wrong shift+add image to see what characteristics of pure noise are
Note that searchpne uses its own centroiding algorithm,
weighting with a gaussian of dispersion 2.5 pixels.
So its output numbers should be treated for now as preliminary,
and input to an IRAF PHOT script (e.g.) to get robust centroids.
Centroiding and photometry methods still needed...
Wavelength solution
calctrans
3/9/03: Aaron's notes on optimising wavelength solution
here.
In summary:
- need 5 wavelength spots (5009, 5017, 5022, 5035, 5038)
- need higher-order terms (see here for list)
- in high-S/N mask, calctrans fit indicates rms accuracy of 0.12 pix = 0.09 Å ~ 6 km/s
- in normal mask, calctrans fit indicates rms accuracy of 0.18 pix = 0.14 Å ~ 9 km/s
- in normal mask, simulated data toward centre of wavelength range indicate accuracy is ~2 km/s (rms), ~7 km/s (max excursion)
- in normal mask, simulated data toward edge of wavelength range indicate accuracy is ~3 km/s (rms), ~8 km/s (max excursion)
- solution rapidly loses accuracy outside of fitted region (5009-5038 Å).
- external checks involving Galactic PNe are not helpful, probably because
they lie outside wavelength range of B-6° bandpass, but
there are also puzzling centroiding and flux issues
Much of the work has already been done by alignspots (see above) - spot files
from the "undistorted"
masks corresponding to your data set now have to be fed to calctrans to produce
the wavelength solution over the field. This is done by
fitting a Chebyshev series mapping the original
position of a spectral line at a mask hole to its dispersed spot:
(x0,y0,lambda) -> (x,y) .
The fit is done iteratively, rejecting outlying points until
it converges on some tolerable residual (Koen: what criterion is used?). The
wavelengths to be used are listed (in code) in the first line of the spots file
and are read in by calctrans and converted to full precision:
4943 4942.915
4945 4944.990
4955 4955.382
4956 4956.750
4957 4957.122
4965 4965.073
4972 4972.157
4974 4973.538
4990 4989.948
4995 4994.930
5005 5005.159
5009 5009.334
5011 5011.003
501725 5017.25 (was 5017.316)
5023 5022.870
5031 5031.350
5036 5035.989
5038 5037.751
5049 5048.813
5053 5052.930
5054 5054.178
5060 5060.079
5062 5062.036
5073 5073.076
5074 5074.190
NOTES: calctrans requires an exact match to the above codes,
so the fact that 4956 is not the nearest integer does not matter.
The above lines are all Ar or Ne, no allowance has been made for
He lamps (which are not available at the WHT).
Sample calctrans parameters are:
xspots = r433550un.spotsR : output of alignspots(FF/r433550)
xxmod = wavemodsx.dat : listing of which polynomial terms to use in fit to x-position: powers of (x0,y0,lambda) given in each row
yymod = wavemodsy.dat : same as above, for y-position
xxout = r433550un.xcoefR : output coefficients of wavelength solution for x-position
yyout = r433550un.ycoefR : same as above, for y-position
pgplotde= /xs : output device for vector plot of fit residuals
This is run separately for the Left and Right arm masks (the naming convention for the extentions
as illustrated above is VERY MUCH recommended and a check for consistency
should perhaps be built into calctrans). Each line of (e.g.) wavemodsx.dat has the form
m1 m2 m3
representing a term of the form xm1ym2wavelm3 (see notes below on
which terms to use).
Notes:
The arc line wavelengths come from
data taken with the RGO spectrograph in high resolution using similar lamps and/or from
this source.
The central wavelength of the blend at 5017Å depends on
the relative linestrengths, and we have taken the ratio measured by the
RGO spectrograph (5017.160(ArII 20):5017.629(ArII 10))to calculate the weighted mean wavelength - however it remains uncertian whether thisline should be
included especially if it is close to the edge of the filter passband.
pnsvel
Now the velocities of objects from the science images are found using the
wavelength solution, and image pairs from the L/R images.
pnsvel.cl does this using such parameters as:
lxwave = r433549un.xcoefL : output coefficients of calctrans for L image
lywave = r433549un.ycoefL : as above
rxwave = r433550un.xcoefR : as above, for R image
rywave = r433550un.ycoefR : as above
infile = data.png018.6-02.2 : listing of image pairs: (xL,yL,xR,yR) for each object
outfile = spec.png018.6-02.2.1 : output of object's wavelength
(we should add velocity); dy gives an indication of goodness of fit
NOTES:
- New versions of calctrans and pnsvel are installed in the pns account
(linux and sunos).
They seem to handle higher orders better.
Currently there is a hard-wired limit of 25 components that can be fitted
simultaneously. If you want more, edit the Makefile in pnspipe/sunos &/^
pnspipe/linux and replace max_mod=25 with a higher number, and recompile.
(25/1/2002) - internal scaling removed (7/8/02) so now the x coefficient
in x and y coefficient in y should both be around 1.0, and the x coefficient
in wavelength about 1.3. (KK)
-
Recommended fit orders for calctrans:
wavemodsx.dat
0 0 0
1 0 0
2 0 0
0 1 0
0 2 0
0 0 1
0 0 2
wavemodsy.dat
0 0 0
1 0 0
0 1 0
Using the masks r433549 and r433550
as sources of fake data, and taking care to
reject spurious velocities arising from (very) poorly fit lines,
ND (7/02) compared the nominal wavelengths with those returned
by pnsvel:
nominal: 5017.316 returned: 5017.31 sigma: 0.061 (3.7 km/s)
nominal: 5037.751 returned: 5037.74 sigma: 0.091 (5.5 km/s)
... this easy experiment should be performed after each fit.
If we only have two lines to fit, we obviously cannot use a third
order fit in wavelength as indicated above. In the previous experiment
ND checked the result with the wavel2 term removed:
nominal: 5017.316 returned: 5017.29 sigma: 0.065 (error in mean 1.6 km/s)
nominal: 5037.751 returned: 5037.69 sigma: 0.053 (error in mean 3.7 km/s)
which suggests that reasonable results can still be obtained - perhaps
the systematic error can even be (partly) corrected for.
-
Bookkeeping: if you have an ascii file with a table of numbers
(locations of found objects, magnitudes etc) you can call AppendVelocity
which will call pnsvel.cl and append the corrected position
and velocity of the sources to the table without overwriting any
of the existing columns. Optionally, if the astrometric solution exists (see below),you can
request the corrected position directly in RA and Dec.
To avoid any misunderstandings AppendVelocity does its work line-by-line and
your input table can contain as many comments as you wish (beginning with a hash).
PN fluxes
In the "reduction.cl" files which are available as a template, the images
are scaled and added in such a way that the counts correspond to T=1800s.
It is suggested that, to avoid confusion, object lists use this convention
during the reduction process.
To convert counts to fluxes, one needs to compare with the count rate from a standard
star (or galactic PNe). The fluxes from both the standard, and the observed PNe,
should be divided by the appropriate (smoothed) transmission function.
This is done using the undistorted co-ordinates. Transmission
functions, which may depend on the filter used, are available in
image form at pnspipe/data/vignetting. If a given PN has been
observed at (xL,yL) in FINAL-LEFT and at (xR,yR) in FINAL-RIGHT
with the BARR-A-0 configuration, then
then the fluxes aL,aR must be divided by VIG-LEFT-BARR-A-0[xL,yL] (etc etc).
Notes
on the preparation of the vignetting functions (in postscript).
PN astrometry
To a good approximation the corrected cartesian coordinates of any
object (PN or star) is simply the
average of the L/R (x,y) values,
since this is the way the transformations have been
set up.
The pipeline script xstartrails
uses this fact to generate an astrometric database (of type "*.xdb").
The x,y coordinates of the PNe are generated
by pnsvel.
To convert these to positions, use cctran (e.g.):
pn> unlearn cctran
pn> lpar cctran
input = The input coordinate files
output = The output coordinate files
database = "N7457.xdb" The input database file
solutions = "forward" The input plate solutions
(geometry = "geometric") Transformation type (linear,geometric)
(forward = yes) Transform x / y to ra / dec (yes) or vice versa (no) ?
(xref = INDEF) The X reference pixel
(yref = INDEF) The Y reference pixel
(xmag = INDEF) The X axis scale in arcsec per pixel
(ymag = INDEF) The Y axis scale in arcsec per pixel
(xrotation = INDEF) The X axis rotation angle in degrees
(yrotation = INDEF) The Y axis rotation angle in degrees
(lngref = INDEF) The ra / longitude reference coordinate in lngunits\t
(latref = INDEF) The dec / latitude reference coordinate in latunits
(lngunits = "") The input / output ra / longitude reference coordinate units
(latunits = "") The input / output dec / latitude reference coordinate units
(projection = "tan") The sky projection geometry
(xcolumn = 1) Input column containing the x / ra / longitude coordinate
(ycolumn = 2) Input column containing the y / dec / latitude coordinate
(lngformat = "") Output format of the ra / longitude / x coordinate
(latformat = "") Output format of the dec / latitude / y coordinate
(min_sigdigit = 7) Minimum precision of the output coordinates
(mode = "ql")
To double-check these steps compute some star positions
by hand using centerstars and add these to the
list of PNe positions L and R. pnsvel should return
a "velocity" for the stars which has a constant value
equal to the difference between the central wavelength of the filter
and the "key" wavelength used by calctrans, and
from the "position" determined
cctran should return the input RA and Dec
as listed (in this example) in "N7457.xcoo".
last modified by AJR, 15 December 2003