I have a lot of codes that operate on both cdfp files and the MIDO tables in my image *.info files. Here I demonstrate and briefly describe some useful examples. I can use these as basic tools or templates fro building mido+cdfp+id.
Most of my ds9 codes allow the user to build ds9 region files (*.reg) that specify the positions of targets or images areas using circle, box and ellipse markers. To measure these markers I use the routine obj_id_build to make a temporary input file names id.objects from the regions file, then I use the routine mido to compute the image parameters for each ragion. Te paramater values are stored in the *.info file for the input FITS image.
Suppose I used the routine wcs_photom_zp to build a region file: wcs_photom_zp a.fits 17.0 3.0 0.5 11.5 red 4.0 and the name of the region file is: XY_Coordinates_1.image.reg I can get image parameters by: obj_id_build.sh a.fits XY_Coordinates_1.image.reg # makes id.objects mido.sh a.fits # stores image parameters to a.info file
First, I need a general way to get to the mido-computed parameters. I have subroutines to do this, but I also have a very general, easy-to-use script named midodata.sh. You can read more details in teh link just given, but a brief example from my NGC3379 studay is shown here:
% midodata.sh Rsco2040.fits
% ls mid*explain
midodata.1_explain midodata.2_explain midodata.XY_explain
% cat midodata.1_explain
# Contents of: midodata.1
Col01 = original marker number (integer i10)
Col02 = marker type (1x,a10)
Col03 = marker color (1x,a10)
Col04 = associated text string (1x,a30)
% cat midodata.1
1 circle green {250}
2 circle green {256}
3 circle green {18}
4 circle green {20}
5 circle green {1}
6 box green {0}
7 box green {0}
8 box green {0}
9 box green {0}
10 box green {0}
11 box green {0}
12 box green {0}
% cat midodata.2_explain
# Contents of: midodata.2
Col01 = X pixels (aperture X center)
Col02 = Y pixels (aperture Y center)
Col03 = X center, pixels (intensity weighted centroid)
Col04 = Y center, pixels (intensity weighted centroid)
Col05 = magnitude (assuming zp=30)
Col06 = Average value per pixel in aperture
Col07 = Average value per pixel in annulus
Col08 = number of pixels in aperture
Col09 = Peak pixel value (no bkg-sub, image ADU)
Col10 = marker code (1=circle,2=box,3=ellipse)
% cat midodata.2
964.60 1737.03 963.09 1737.33 19.632 211.266 198.460 1096.0 1806.91 1
804.84 1774.71 804.23 1774.98 20.005 205.557 199.534 1653.0 1900.65 1
880.82 190.62 880.11 191.92 -99.000 241.450 284.003 3217.0 13693.42 1
749.04 296.39 747.60 298.14 15.948 339.988 208.782 3184.0 45414.25 1
1556.32 241.35 1556.68 241.78 18.671 248.695 208.413 844.0 4659.72 1
1591.60 301.38 1591.19 300.86 24.324 207.048 206.925 1520.0 249.87 2
1539.85 455.78 1539.07 454.11 -99.000 207.233 207.538 4539.0 250.50 2
1806.46 474.14 1802.60 473.60 -99.000 206.723 206.987 7906.0 254.54 2
425.98 1805.62 424.35 1802.01 -99.000 195.658 198.007 10502.0 256.63 2
368.33 213.11 364.96 210.25 -99.000 206.765 206.870 14630.0 277.28 2
1226.64 1493.63 1223.13 1491.60 -99.000 203.221 204.174 7623.0 244.55 2
1595.97 1255.50 1605.39 1250.60 -99.000 206.903 211.479 18612.0 1916.79 2
% cat midodata.XY_explain
# Contents of: midodata.XY
Col01 = X center, pixels (intensity weighted centroid)
Col02 = Y center, pixels (intensity weighted centroid)
% cat midodata.XY
963.09 1737.33 250
804.23 1774.98 256
880.11 191.92 18
747.60 298.14 20
1556.68 241.78 1
1591.19 300.86 0
1539.07 454.11 0
1802.60 473.60 0
424.35 1802.01 0
364.96 210.25 0
1223.13 1491.60 0
1605.39 1250.60 0
A good example of getting data from a cdfp file is cdfp_filter.sh. Got many applications, like comparing two magnitudes to compute a zeropoint, we may want to smply pull a single quantity, like a standard magnitude. from a single line in a cdfp file. In a lot of my ds9 routines I plot regions that have names that correspond to the line number in a cdfp file. Hence, a tool that pulls a quantity in a given line number is very useful for lots of things:
A sample problem: compare two magnitudes:
% cat midodata.1*
1 circle red {1}
2 circle red {2}
3 circle red {3}
4 circle red {5}
5 circle red {9}
# Contents of: midodata.1
Col01 = original marker number (integer i10)
Col02 = marker type (1x,a10)
Col03 = marker color (1x,a10)
Col04 = associated text string (1x,a30)
% cat midodata.2*
594.92 268.68 593.30 269.14 15.511 2955.787 2049.344 689.0 7842.00 1
598.67 523.96 597.67 523.33 18.394 2112.304 2048.690 690.0 2487.00 1
416.90 560.55 417.93 561.04 18.042 2235.265 2147.282 690.0 2752.00 1
223.78 626.89 224.96 627.21 17.017 2335.446 2109.023 689.0 3620.00 1
141.31 579.95 141.76 581.82 18.220 2143.914 2069.161 689.0 2741.00 1
# Contents of: midodata.2
Col01 = X pixels (aperture X center)
Col02 = Y pixels (aperture Y center)
Col03 = X center, pixels (intensity weighted centroid)
Col04 = Y center, pixels (intensity weighted centroid)
Col05 = magnitude (assuming zp=30)
Col06 = Average value per pixel in aperture
Col07 = Average value per pixel in annulus
Col08 = number of pixels in aperture
Col09 = Peak pixel value (no bkg-sub, image ADU)
Col10 = marker code (1=circle,2=box,3=ellipse)
I want to compute the the zeropint using star=9:
MAG30 = 18.220
To get the value from line 9 of my file = usno_TARGETS.cdfp
% cdfp_getline.sh usno_TARGETS.cdfp V 9
16.0200
To collect data for ZP calcultaions:
% zp_collect_1 a.fits usno_TARGETS.cdfp V
% cat just_standard_mags
14.0900
16.8200
16.2400
15.4300
16.0200
Hence, after running zp_collect_1 we have several easy-to-read files
that can be used to derive zeropoint extimates:
midodata.2 ==
A lot of photometry for each mido target, but most
important we have the instrumental magnitude MagZP30
recall: MagZP30 = 30 - 2.5*alog10(f)
where f = integrated flux above sky
just_standard_mags ==
The standard system magnitudess from the cdfp catalog. The
type of magnitiude is determined by the name requested when
you ran zp_collect_1 (arg3)
just_names ==
The target names in the last ds9 display of your field. These
are usally line numbers referring to position in the cdfp file.
You can have text names or blanks, but they will not be recognized
by zp_collect_1 when pulling out standard magnitudes.
Hence, at this stage yoy are ready to run a pretty simple code for
collecting zp values and deriving a mean value. To date, that
simple OTW code is now called "zpmeancal.sh ".
Most of the above staeps are combined in the routine wcs_photom_zp.