The PGPLOT library routine PGIMAG is used to plot the image. The WCS library of Mark Calabretta is used to compute and plot the optional celestial coordinate grid (or tick-marks).
read parameters;
load the image;
find all null-valued pixels and set them to the minimum non-null image value;
if (--withzclip) {
calculate the effective minimum and maximum image values effMin and effMax
by histogram clipping;
} else {
effMin = minval(image);
effMax = maxval(image);
}
set up PGPLOT;
# Avoid irritating phenomenon in which background and foreground colours swap
# for ps/cps output, except within the image itself:
if (pgplot device is 'PS' or 'CPS') {
if (labelcolour==0 || labelcolour==1) {
labelcolour = 1 - labelcolour;
}
if (usercolours==0 || usercolours==1) {
usercolours = 1 - usercolours;
}
}
#...........................................................
# Plot the image:
calculate x and y pixel limits from --trimborder and --xfraclo etc;
call pgimag;
if (--withframe) {
draw frame;
write info at the side of the plot;
draw colour wedge;
if (--gridstyle eq 'none') {
annotate frame with X and Y ticks;
} else {
annotate frame (using wcs keywords) with RA and DEC ticks;
}
}
if (--gridstyle ne 'none') {
draw RA/DEC grid;
}
if (withSrcList) {
#...........................................................
# Plot the sources:
filter the source list using --expression;
calculate source radii;
if (--ncutsortstyle ne 'none') {
sort the source list in order of the value of --ncutsortexpression;
}
truncate the sorted list at --ncut;
calculate the source labels;
foreach (remaining source) {
calculate the image position of the source;
plot the source circle;
add the label;
}
if (--withframe) {
write some stuff to the base and side of the plot;
}
}