Astro/Catalog/IO/SExtractor.pm

filter: Statementstmt 57.6% 234 / 406 Branchbran 26.6% 90 / 338 Conditioncond 33.3% 4 / 12 MC/DCmcdc 0.0% 0 / 7 Subroutinesub 100% 15 / 15 Podpod n/a totaltotal 44.0% 343 / 778 CC 176 SCAR 87.0
CC
176
Cov
43%
_read_catalog
7162.8
_write_catalog
20.4
BEGIN
1.0
CRAP 5996.1
↑ Summary Astro/Catalog/Query/SuperCOSMOS.pm »
1 package Astro::Catalog::IO::SExtractor;
2  
3 =head1 NAME
4  
5 Astro::Catalog::IO::SExtractor - SExtractor output catalog I/O for
6 Astro::Catalog
7  
8 =head1 SYNOPSIS
9  
10 $cat = Astro::Catalog::IO::SExtractor->_read_catalog(\@lines);
11  
12 =head1 DESCRIPTION
13  
14 This class provides read and write methods for catalogs written by
15 SExtractor, as long as they were written in ASCII_HEAD format. The
16 methods are not public and should, in general, only be called from the
17 C<Astro::Catalog> C<read_catalog> and C<write_catalog> methods.
18  
19 =cut
20  
21 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 2 ▶use warnings::register;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 2 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
25  
26 2 ▶use Astro::Catalog;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 2 ▶use Astro::Catalog::Item;
Subroutine BEGIN: called CC=1 SCAR=0.0
28 2 ▶use Astro::Catalog::Item::Morphology;
Subroutine BEGIN: called CC=1 SCAR=0.0
29 2 ▶use Astro::Coords;
Subroutine BEGIN: called CC=1 SCAR=0.0
30  
31 2 ▶use Number::Uncertainty;
Subroutine BEGIN: called CC=1 SCAR=0.0
32 2 ▶use Astro::Flux;
Subroutine BEGIN: called CC=1 SCAR=0.0
33 2 ▶use Astro::FluxColor;
Subroutine BEGIN: called CC=1 SCAR=0.0
34 2 ▶use Astro::Fluxes;
Subroutine BEGIN: called CC=1 SCAR=0.0
35  
36 2 ▶use base qw/Astro::Catalog::IO::ASCII/;
Subroutine BEGIN: called CC=1 SCAR=0.0
37  
38 2 our $VERSION = '4.38';
39 2 our $DEBUG = 0;
40  
41 =begin __PRIVATE_METHODS__
42  
43 =head1 PRIVATE METHODS
44  
45 These methods are usually called automatically from the C<Astro::Catalog>
46 constructor.
47  
48 =over 4
49  
50 =item B<_read_catalog>
51  
52 Parses the catalog lines and returns a new C<Astro::Catalog> object
53 containing the catalog entries.
54  
55 $cat = Astro::Catalog::IO::SExtractor->_read_catalog(\@lines);
56  
57 The catalog lines must include column definitions as written using
58 the 'ASCII_HEAD' catalog type from SExtractor. This implementation
59 currently only supports reading information from the following output
60 parameters:
61  
62 NUMBER id
63 X_IMAGE
64 Y_IMAGE
65 X_PIXEL
66 Y_PIXEL
67 ERRX2_IMAGE
68 ERRY2_IMAGE
69 XWIN_IMAGE
70 YWIN_IMAGE
71 ERRX2WIN_IMAGE
72 ERRY2WIN_IMAGE
73 ALPHA_J2000 coords
74 DELTA_J2000 coords
75 MAG_ISO
76 MAGERR_ISO
77 FLUX_ISO
78 FLUXERR_ISO
79 MAG_ISOCOR
80 MAGERR_ISOCOR
81 FLUX_ISOCOR
82 FLUXERR_ISOCOR
83 MAG_APER
84 MAGERR_APER
85 FLUX_APER
86 FLUXERR_APER
87 MAG_AUTO
88 MAGERR_AUTO
89 FLUX_AUTO
90 FLUXERR_AUTO
91 MAG_BEST
92 MAGERR_BEST
93 FLUX_BEST
94 FLUXERR_BEST
95 ELLIPTICITY morphology ellipticity
96 THETA_IMAGE morphology position_angle_pixel
97 ERRTHETA_IMAGE morphology position_angle_pixel
98 THETA_SKY morphology position_angle_world
99 ERRTHETA_SKY morphology position_angle_world
100 B_IMAGE morphology minor_axis_pixel
101 ERRB_IMAGE morphology minor_axis_pixel
102 A_IMAGE morphology major_axis_pixel
103 ERRA_IMAGE morphology major_axis_pixel
104 B_WORLD morphology minor_axis_world
105 ERRB_WORLD morphology minor_axis_world
106 A_WORLD morphology major_axis_world
107 ERRA_WORLD morphology major_axis_world
108 ISOAREA_IMAGE morphology area
109 FWHM_IMAGE morphology fwhm_pixel
110 FWHM_WORLD morphology fwhm_world
111 FLAGS quality
112  
113 The pixel coordinate values are special cases. As there are only two
114 available methods to hold this information in an
115 C<Astro::Catalog::Item> object, x() and y(), and six potential values
116 to use, we must make a choice as to which value gets the nod. We
117 preferentially use the NDF pixel coordinates (which are only available
118 in output from the Starlink version of EXTRACTOR), then the windowed
119 coordinates that were made available in SExtractor v2.4.3, then the
120 standard coordinates.
121  
122 For the flux and magnitude values, a separate C<Astro::Flux> object is
123 set up for each type with the flux type() equal to the SExtractor
124 keyword. For example, if the MAG_AUTO keyword exists in the catalog,
125 then the output C<Astro::Catalog::Item> objects will have an
126 C<Astro::Flux> object of the type 'MAG_AUTO' in it.
127  
128 There are optional named parameters. These are case-sensitive, and are:
129  
130 =item Filter - An Astro::WaveBand object denoting the waveband that
131 the catalog values were measured in.
132  
133 =item Quality - If set, then only objects that have an extraction flag
134 in the FLAGS column equal to this value will be used to generate the
135 output catalog. Otherwise, all objects will be used.
136  
137 =cut
138  
139 2 ▶sub _read_catalog {
Subroutine _read_catalog: called CC=159 SCAR=88.8
140 2 my $class = shift;
141 2 my $lines = shift;
142 2 my %args = @_;
143  
144 2 ▶ if (ref( $lines ) ne 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $lines ne "ARRAY") 0 2 2
145 0 croak "Must supply catalog contents as a reference to an array";
146 }
147  
148 2 ▶ if ((defined $args{'Filter'}) &&
Branch: 1 branch
BranchTrueFalseTotal
if (defined $args{"Filter"} and not UNIVERSAL::isa($args{"Filter"}, "Astro::WaveBand")) 0 2 2
Condition33%1/3
defined $args{"Filter"} and not UNIVERSAL::isa($args{"Filter"}, "Astro::WaveBand")
!ll&&!rl&&r
200
MC/DC0%0/2
defined $args{"Filter"} and not UNIVERSAL::isa($args{"Filter"}, "Astro::WaveBand")
defined $args{"Filter"} not UNIVERSAL::isa($args{"Filter"}, "Astro::WaveBand")
Truth table33%1/3
A and not(B)
A= defined $args{"Filter"}B= not UNIVERSAL::isa($args{"Filter"}, "Astro::WaveBand")
ABresult
0X0
100
111
149 ! UNIVERSAL::isa( $args{'Filter'}, "Astro::WaveBand")) {
150 0 croak "Filter as passed to SExtractor->_read_catalog must be an Astro::WaveBand object";
151 }
152  
153 2 my $filter;
154 2 ▶ if (defined $args{'Filter'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $args{'Filter'}) { } 0 2 2
155 0 $filter = $args{'Filter'}->natural;
156 }
157 else {
158 2 $filter = 'unknown';
159 }
160  
161 2 my $quality = $args{'Quality'};
162 2 ▶ unless (defined $quality) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $quality) 2 0 2
163 2 $quality = -1;
164 }
165  
166 2 my @lines = @$lines; # Dereference, make own copy.
167  
168 # Create an Astro::Catalog object;
169 2 my $catalog = new Astro::Catalog();
170  
171 # Set up columns.
172 2 my $id_column = -1;
173 2 my $x_column = -1;
174 2 my $x_pixel_column = -1;
175 2 my $xerr_column = -1;
176 2 my $xwin_column = -1;
177 2 my $xwinerr_column = -1;
178 2 my $y_column = -1;
179 2 my $y_pixel_column = -1;
180 2 my $yerr_column = -1;
181 2 my $ywin_column = -1;
182 2 my $ywinerr_column = -1;
183 2 my $ra_column = -1;
184 2 my $dec_column = -1;
185 2 my $mag_iso_column = -1;
186 2 my $magerr_iso_column = -1;
187 2 my $flux_iso_column = -1;
188 2 my $fluxerr_iso_column = -1;
189 2 my $flux_isocor_column = -1;
190 2 my $fluxerr_isocor_column = -1;
191 2 my $mag_isocor_column = -1;
192 2 my $magerr_isocor_column = -1;
193 2 my $flux_aper1_column = -1;
194 2 my $fluxerr_aper1_column = -1;
195 2 my $mag_aper1_column = -1;
196 2 my $magerr_aper1_column = -1;
197 2 my $flux_aper2_column = -1;
198 2 my $fluxerr_aper2_column = -1;
199 2 my $mag_aper2_column = -1;
200 2 my $magerr_aper2_column = -1;
201 2 my $flux_auto_column = -1;
202 2 my $fluxerr_auto_column = -1;
203 2 my $mag_auto_column = -1;
204 2 my $magerr_auto_column = -1;
205 2 my $flux_best_column = -1;
206 2 my $fluxerr_best_column = -1;
207 2 my $mag_best_column = -1;
208 2 my $magerr_best_column = -1;
209 2 my $ell_column = -1;
210 2 my $posang_pixel_column = -1;
211 2 my $posangerr_pixel_column = -1;
212 2 my $posang_world_column = -1;
213 2 my $posangerr_world_column = -1;
214 2 my $minor_pixel_column = -1;
215 2 my $minorerr_pixel_column = -1;
216 2 my $major_pixel_column = -1;
217 2 my $majorerr_pixel_column = -1;
218 2 my $minor_world_column = -1;
219 2 my $minorerr_world_column = -1;
220 2 my $major_world_column = -1;
221 2 my $majorerr_world_column = -1;
222 2 my $area_column = -1;
223 2 my $fwhm_pixel_column = -1;
224 2 my $fwhm_world_column = -1;
225 2 my $flag_column = -1;
226  
227 # Loop through the lines.
228 2 for (@lines) {
229 20 my $line = $_;
230  
231 # If we're on a column line that starts with a #, check to see
232 # if it's describing where the X, Y, RA, or Dec position is in
233 # the table, or the object number, or the flux, or the error in
234 # flux.
235 20 ▶ if ($line =~ /^#/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /^#/) 12 8 20
236 12 my @column = split /\s+/, $line;
237 12 ▶ if ($column[2] =~ /^NUMBER/) {
Branch: 50 branches
BranchTrueFalseTotal
if ($column[2] =~ /^NUMBER/) { } 2 10 12
elsif ($column[2] =~ /^X_IMAGE/) { } 2 8 10
elsif ($column[2] =~ /^Y_IMAGE/) { } 2 6 8
elsif ($column[2] =~ /^X_PIXEL/) { } 0 6 6
elsif ($column[2] =~ /^Y_PIXEL/) { } 0 6 6
elsif ($column[2] =~ /^ERRX2_IMAGE/) { } 0 6 6
elsif ($column[2] =~ /^ERRY2_IMAGE/) { } 0 6 6
elsif ($column[2] =~ /^XWIN_IMAGE/) { } 0 6 6
elsif ($column[2] =~ /^ERRX2WIN_IMAGE/) { } 0 6 6
elsif ($column[2] =~ /^YWIN_IMAGE/) { } 0 6 6
elsif ($column[2] =~ /^ERRY2WIN_IMAGE/) { } 0 6 6
elsif ($column[2] =~ /^ALPHA_J2000/) { } 2 4 6
elsif ($column[2] =~ /^DELTA_J2000/) { } 2 2 4
elsif ($column[2] =~ /^MAG_ISO$/) { } 0 2 2
elsif ($column[2] =~ /^MAGERR_ISO$/) { } 0 2 2
elsif ($column[2] =~ /^FLUX_ISO$/) { } 0 2 2
elsif ($column[2] =~ /^FLUXERR_ISO$/) { } 0 2 2
elsif ($column[2] =~ /^FLUX_ISOCOR/) { } 0 2 2
elsif ($column[2] =~ /^FLUXERR_ISOCOR/) { } 0 2 2
elsif ($column[2] =~ /^MAG_ISOCOR/) { } 1 1 2
elsif ($column[2] =~ /^MAGERR_ISOCOR/) { } 1 0 1
elsif ($column[2] =~ /^FLUX_APER/) { } 0 0 0
elsif ($column[2] =~ /^FLUXERR_APER/) { } 0 0 0
elsif ($column[2] =~ /^MAG_APER/) { } 0 0 0
elsif ($column[2] =~ /^MAGERR_APER/) { } 0 0 0
elsif ($column[2] =~ /^FLUX_AUTO/) { } 0 0 0
elsif ($column[2] =~ /^FLUXERR_AUTO/) { } 0 0 0
elsif ($column[2] =~ /^MAG_AUTO/) { } 0 0 0
elsif ($column[2] =~ /^MAGERR_AUTO/) { } 0 0 0
elsif ($column[2] =~ /^FLUX_BEST/) { } 0 0 0
elsif ($column[2] =~ /^FLUXERR_BEST/) { } 0 0 0
elsif ($column[2] =~ /^MAG_BEST/) { } 0 0 0
elsif ($column[2] =~ /^MAGERR_BEST/) { } 0 0 0
elsif ($column[2] =~ /^ELLIPTICITY/) { } 0 0 0
elsif ($column[2] =~ /^THETA_IMAGE/) { } 0 0 0
elsif ($column[2] =~ /^ERRTHETA_IMAGE/) { } 0 0 0
elsif ($column[2] =~ /^THETA_SKY/) { } 0 0 0
elsif ($column[2] =~ /^ERRTHETA_SKY/) { } 0 0 0
elsif ($column[2] =~ /^B_IMAGE/) { } 0 0 0
elsif ($column[2] =~ /^ERRB_IMAGE/) { } 0 0 0
elsif ($column[2] =~ /^A_IMAGE/) { } 0 0 0
elsif ($column[2] =~ /^ERRA_IMAGE/) { } 0 0 0
elsif ($column[2] =~ /^B_WORLD/) { } 0 0 0
elsif ($column[2] =~ /^ERRB_WORLD/) { } 0 0 0
elsif ($column[2] =~ /^A_WORLD/) { } 0 0 0
elsif ($column[2] =~ /^ERRA_WORLD/) { } 0 0 0
elsif ($column[2] =~ /^ISOAREA_IMAGE/) { } 0 0 0
elsif ($column[2] =~ /^FWHM_IMAGE/) { } 0 0 0
elsif ($column[2] =~ /^FWHM_WORLD/) { } 0 0 0
elsif ($column[2] =~ /^FLAGS/) { } 0 0 0
238 2 $id_column = $column[1] - 1;
239 2 ▶ print "ID column is $id_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 2 2
240 }
241 elsif ($column[2] =~ /^X_IMAGE/) {
242 2 $x_column = $column[1] - 1;
243 2 ▶ print "X_IMAGE column is $x_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 2 2
244 }
245 elsif ($column[2] =~ /^Y_IMAGE/) {
246 2 $y_column = $column[1] - 1;
247 2 ▶ print "Y_IMAGE column is $y_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 2 2
248 }
249 elsif ($column[2] =~ /^X_PIXEL/) {
250 0 $x_pixel_column = $column[1] - 1;
251 0 ▶ print "X_PIXEL column is $x_pixel_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
252 }
253 elsif ($column[2] =~ /^Y_PIXEL/) {
254 0 $y_pixel_column = $column[1] - 1;
255 0 ▶ print "Y_PIXEL column is $y_pixel_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
256 }
257 elsif ($column[2] =~ /^ERRX2_IMAGE/) {
258 0 $xerr_column = $column[1] - 1;
259 0 ▶ print "X ERROR column is $xerr_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
260 }
261 elsif ($column[2] =~ /^ERRY2_IMAGE/) {
262 0 $yerr_column = $column[1] - 1;
263 0 ▶ print "Y ERROR column is $yerr_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
264 }
265 elsif ($column[2] =~ /^XWIN_IMAGE/) {
266 0 $xwin_column = $column[1] - 1;
267 0 ▶ print "XWIN_IMAGE column is $xwin_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
268 }
269 elsif ($column[2] =~ /^ERRX2WIN_IMAGE/) {
270 0 $xwinerr_column = $column[1] - 1;
271 0 ▶ print "ERRX2WIN_IMAGE column is $xwinerr_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
272 }
273 elsif ($column[2] =~ /^YWIN_IMAGE/) {
274 0 $ywin_column = $column[1] - 1;
275 0 ▶ print "YWIN_IMAGE column is $ywin_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
276 }
277 elsif ($column[2] =~ /^ERRY2WIN_IMAGE/) {
278 0 $ywinerr_column = $column[1] - 1;
279 0 ▶ print "ERRY2WIN_IMAGE column is $ywinerr_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
280 }
281 elsif ($column[2] =~ /^ALPHA_J2000/) {
282 2 $ra_column = $column[1] - 1;
283 2 ▶ print "RA column is $ra_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 2 2
284 }
285 elsif ($column[2] =~ /^DELTA_J2000/) {
286 2 $dec_column = $column[1] - 1;
287 2 ▶ print "DEC column is $dec_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 2 2
288 }
289 elsif ($column[2] =~ /^MAG_ISO$/) {
290 0 $mag_iso_column = $column[1] - 1;
291 0 ▶ print "MAG_ISO column is $mag_iso_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
292 }
293 elsif ($column[2] =~ /^MAGERR_ISO$/) {
294 0 $magerr_iso_column = $column[1] - 1;
295 0 ▶ print "MAGERR_ISO column is $magerr_iso_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
296 }
297 elsif ($column[2] =~ /^FLUX_ISO$/) {
298 0 $flux_iso_column = $column[1] - 1;
299 0 ▶ print "FLUX_ISO column is $flux_iso_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
300 }
301 elsif ($column[2] =~ /^FLUXERR_ISO$/) {
302 0 $fluxerr_iso_column = $column[1] - 1;
303 0 ▶ print "FLUXERR_ISO column is $fluxerr_iso_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
304 }
305 elsif ($column[2] =~ /^FLUX_ISOCOR/) {
306 0 $flux_isocor_column = $column[1] - 1;
307 0 ▶ print "FLUX_ISOCOR column is $flux_isocor_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
308 }
309 elsif ($column[2] =~ /^FLUXERR_ISOCOR/) {
310 0 $fluxerr_isocor_column = $column[1] - 1;
311 0 ▶ print "FLUXERR_ISOCOR column is $fluxerr_isocor_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
312 }
313 elsif ($column[2] =~ /^MAG_ISOCOR/) {
314 1 $mag_isocor_column = $column[1] - 1;
315 1 ▶ print "MAG_ISOCOR column is $mag_isocor_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 1 1
316 }
317 elsif ($column[2] =~ /^MAGERR_ISOCOR/) {
318 1 $magerr_isocor_column = $column[1] - 1;
319 1 ▶ print "MAGERR_ISOCOR column is $magerr_isocor_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 1 1
320 }
321 elsif ($column[2] =~ /^FLUX_APER/) {
322 0 $flux_aper1_column = $column[1] - 1;
323 0 ▶ print "FLUX_APER column is $flux_aper1_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
324 }
325 elsif ($column[2] =~ /^FLUXERR_APER/) {
326 0 $fluxerr_aper1_column = $column[1] - 1;
327 0 ▶ print "FLUXERR_APER column is $fluxerr_aper1_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
328 }
329 elsif ($column[2] =~ /^MAG_APER/) {
330 0 $mag_aper1_column = $column[1] - 1;
331 0 ▶ print "MAG_APER column is $mag_aper1_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
332 }
333 elsif ($column[2] =~ /^MAGERR_APER/) {
334 0 $magerr_aper1_column = $column[1] - 1;
335 0 ▶ print "MAGERR_APER column is $magerr_aper1_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
336 }
337 elsif ($column[2] =~ /^FLUX_AUTO/) {
338 0 $flux_auto_column = $column[1] - 1;
339 0 ▶ print "FLUX_AUTO column is $flux_auto_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
340 }
341 elsif ($column[2] =~ /^FLUXERR_AUTO/) {
342 0 $fluxerr_auto_column = $column[1] - 1;
343 0 ▶ print "FLUXERR_AUTO column is $fluxerr_auto_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
344 }
345 elsif ($column[2] =~ /^MAG_AUTO/) {
346 0 $mag_auto_column = $column[1] - 1;
347 0 ▶ print "MAG_AUTO column is $mag_auto_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
348 }
349 elsif ($column[2] =~ /^MAGERR_AUTO/) {
350 0 $magerr_auto_column = $column[1] - 1;
351 0 ▶ print "MAGERR_AUTO column is $magerr_auto_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
352 }
353 elsif ($column[2] =~ /^FLUX_BEST/) {
354 0 $flux_best_column = $column[1] - 1;
355 0 ▶ print "FLUX_BEST column is $flux_best_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
356 }
357 elsif ($column[2] =~ /^FLUXERR_BEST/) {
358 0 $fluxerr_best_column = $column[1] - 1;
359 0 ▶ print "FLUXERR_BEST column is $fluxerr_best_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
360 }
361 elsif ($column[2] =~ /^MAG_BEST/) {
362 0 $mag_best_column = $column[1] - 1;
363 0 ▶ print "MAG_BEST column is $mag_best_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
364 }
365 elsif ($column[2] =~ /^MAGERR_BEST/) {
366 0 $magerr_best_column = $column[1] - 1;
367 0 ▶ print "MAGERR_BEST_COLUMN is $magerr_best_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
368 }
369 elsif ($column[2] =~ /^ELLIPTICITY/) {
370 0 $ell_column = $column[1] - 1;
371 0 ▶ print "ELLIPTICITY column is $ell_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
372 }
373 elsif ($column[2] =~ /^THETA_IMAGE/) {
374 0 $posang_pixel_column = $column[1] - 1;
375 0 ▶ print "THETA_IMAGE column is $posang_pixel_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
376 }
377 elsif ($column[2] =~ /^ERRTHETA_IMAGE/) {
378 0 $posangerr_pixel_column = $column[1] - 1;
379 0 ▶ print "ERRTHETA_IMAGE column is $posangerr_pixel_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
380 }
381 elsif ($column[2] =~ /^THETA_SKY/) {
382 0 $posang_world_column = $column[1] - 1;
383 0 ▶ print "THETA_SKY column is $posang_world_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
384 }
385 elsif ($column[2] =~ /^ERRTHETA_SKY/) {
386 0 $posangerr_world_column = $column[1] - 1;
387 0 ▶ print "ERRTHETA_SKY column is $posangerr_world_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
388 }
389 elsif ($column[2] =~ /^B_IMAGE/) {
390 0 $minor_pixel_column = $column[1] - 1;
391 0 ▶ print "B_IMAGE column is $minor_pixel_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
392 }
393 elsif ($column[2] =~ /^ERRB_IMAGE/) {
394 0 $minorerr_pixel_column = $column[1] - 1;
395 0 ▶ print "ERRB_IMAGE column is $minorerr_pixel_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
396 }
397 elsif ($column[2] =~ /^A_IMAGE/) {
398 0 $major_pixel_column = $column[1] - 1;
399 0 ▶ print "A_IMAGE column is $major_pixel_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
400 }
401 elsif ($column[2] =~ /^ERRA_IMAGE/) {
402 0 $majorerr_pixel_column = $column[1] - 1;
403 0 ▶ print "ERRA_IMAGE column is $majorerr_pixel_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
404 }
405 elsif ($column[2] =~ /^B_WORLD/) {
406 0 $minor_world_column = $column[1] - 1;
407 0 ▶ print "B_WORLD column is $minor_world_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
408 }
409 elsif ($column[2] =~ /^ERRB_WORLD/) {
410 0 $minorerr_world_column = $column[1] - 1;
411 0 ▶ print "ERRB_WORLD column is $minorerr_world_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
412 }
413 elsif ($column[2] =~ /^A_WORLD/) {
414 0 $major_world_column = $column[1] - 1;
415 0 ▶ print "A_WORLD column is $major_world_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
416 }
417 elsif ($column[2] =~ /^ERRA_WORLD/) {
418 0 $majorerr_world_column = $column[1] - 1;
419 0 ▶ print "ERRA_WORLD column is $majorerr_world_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
420 }
421 elsif ($column[2] =~ /^ISOAREA_IMAGE/) {
422 0 $area_column = $column[1] - 1;
423 0 ▶ print "AREA column is $area_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
424 }
425 elsif ($column[2] =~ /^FWHM_IMAGE/) {
426 0 $fwhm_pixel_column = $column[1] - 1;
427 0 ▶ print "FWHM_IMAGE column is $fwhm_pixel_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
428 }
429 elsif ($column[2] =~ /^FWHM_WORLD/) {
430 0 $fwhm_world_column = $column[1] - 1;
431 0 ▶ print "FWHM_WORLD column is $fwhm_world_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
432 }
433 elsif ($column[2] =~ /^FLAGS/) {
434 0 $flag_column = $column[1] - 1;
435 0 ▶ print "FLAGS column is $flag_column\n" if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Astro::Catalog::IO::SExtractor::DEBUG 0 0 0
436 }
437 12 next;
438 }
439  
440 # Remove leading whitespace and go to the next line if the
441 # current one is blank.
442 8 $line =~ s/^\s+//;
443 8 ▶ next if length($line) == 0;
Branch: 1 branch
BranchTrueFalseTotal
if length $line == 0 0 8 8
444  
445 # Form an array of the fields in the catalog.
446 8 my @fields = split /\s+/, $line;
447  
448 # Don't deal with this object if our requested quality is not -1
449 # and the quality of the object is not equal to the requested
450 # quality and we have a quality flag for this object.
451 8 ▶ if (($quality != -1) &&
Branch: 1 branch
BranchTrueFalseTotal
if ($quality != -1 and $flag_column != -1 and $fields[$flag_column] != $quality) 0 8 8
Condition33%2/6
$quality != -1 and $flag_column != -1 and $fields[$flag_column] != $quality
!ll&&!rl&&r
800
$quality != -1 and $flag_column != -1
!ll&&!rl&&r
800
MC/DC0%0/3
$quality != -1 and $flag_column != -1 and $fields[$flag_column] != $quality
$quality != -1 $flag_column != -1 $fields[$flag_column] != $quality
Truth table25%1/4
A and B and C
A= $quality != -1B= $flag_column != -1C= $fields[$flag_column] != $quality
ABCresult
0XX0
10X0
1100
1111
452 ($flag_column != -1) &&
453 ($fields[$flag_column] != $quality)) {
454 0 next;
455 }
456  
457 # Create a temporary Astro::Catalog::Item object.
458 8 my $star = new Astro::Catalog::Item();
459  
460 # Grab the coordinates, forming an Astro::Coords object., but only
461 # if the RA and Dec columns are defined.
462 8 ▶ if ($ra_column != -1 &&
Branch: 1 branch
BranchTrueFalseTotal
if ($ra_column != -1 and $dec_column != -1) 8 0 8
Condition33%1/3
$ra_column != -1 and $dec_column != -1
!ll&&!rl&&r
008
MC/DC0%0/2
$ra_column != -1 and $dec_column != -1
$ra_column != -1 $dec_column != -1
Truth table33%1/3
A and B
A= $ra_column != -1B= $dec_column != -1
ABresult
0X0
100
111
463 $dec_column != -1) {
464 8 ▶ my $coords = new Astro::Coords(
Branch: 1 branch
BranchTrueFalseTotal
$id_column != -1 ? : 8 0 8
465 type => 'J2000',
466 ra => $fields[$ra_column],
467 dec => $fields[$dec_column],
468 name => ($id_column != -1 ? $fields[$id_column] : undef),
469 units => 'degrees',
470 );
471 8 $star->coords($coords);
472 }
473  
474 8 ▶ if ($flag_column != -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($flag_column != -1) { } 0 8 8
475 0 $star->quality($fields[$flag_column]);
476 }
477 else {
478 8 $star->quality(0);
479 }
480  
481 8 ▶ if ($id_column != -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($id_column != -1) 8 0 8
482 8 $star->id($fields[$id_column]);
483 }
484  
485 # Set up the various flux and magnitude measurements.
486 8 ▶ if ($mag_iso_column != -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($mag_iso_column != -1) 0 8 8
487 0 my $num;
488 0 ▶ if ($magerr_iso_column != -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($magerr_iso_column != -1) { } 0 0 0
489 0 $num = new Number::Uncertainty(Value => $fields[$mag_iso_column],
490 Error => $fields[$magerr_iso_column]);
491 }
492 else {
493 0 $num = new Number::Uncertainty(Value => $fields[$mag_iso_column]);
494 }
495 0 my $mag_iso = new Astro::Flux($num, 'MAG_ISO', $filter);
496 0 $star->fluxes(new Astro::Fluxes($mag_iso));
497 }
498 8 ▶ if ($flux_iso_column != -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($flux_iso_column != -1) 0 8 8
499 0 my $num;
500 0 ▶ if ($fluxerr_iso_column != -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fluxerr_iso_column != -1) { } 0 0 0
501 0 $num = new Number::Uncertainty(Value => $fields[$flux_iso_column],
502 Error => $fields[$fluxerr_iso_column]);
503 }
504 else {
505 0 $num = new Number::Uncertainty(Value => $fields[$flux_iso_column]);
506 }
507 0 my $flux_iso = new Astro::Flux($num, 'FLUX_ISO', $filter);
508 0 $star->fluxes(new Astro::Fluxes($flux_iso));
509 }
510  
511 8 ▶ if ($mag_isocor_column != -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($mag_isocor_column != -1) 4 4 8
512 4 my $num;
513 4 ▶ if ($magerr_isocor_column != -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($magerr_isocor_column != -1) { } 4 0 4
514 4 $num = new Number::Uncertainty(Value => $fields[$mag_isocor_column],
515 Error => $fields[$magerr_isocor_column]);
516 }
517 else {
518 0 $num = new Number::Uncertainty(Value => $fields[$mag_isocor_column]);
519 }
520 4 my $mag_isocor = new Astro::Flux($num, 'MAG_ISOCOR', $filter);
521 4 $star->fluxes(new Astro::Fluxes($mag_isocor));
522 }
523 8 ▶ if ($flux_isocor_column != -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($flux_isocor_column != -1) 0 8 8
524 0 my $num;
525 0 ▶ if ($fluxerr_isocor_column != -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fluxerr_isocor_column != -1) { } 0 0 0
526 0 $num = new Number::Uncertainty(Value => $fields[$flux_isocor_column],
527 Error => $fields[$fluxerr_isocor_column]);
528 }
529 else {
530 0 $num = new Number::Uncertainty(Value => $fields[$flux_isocor_column]);
531 }
532 0 my $flux_isocor = new Astro::Flux($num, 'FLUX_ISOCOR', $filter);
533 0 $star->fluxes(new Astro::Fluxes($flux_isocor));
534 }
535  
536 8 ▶ if ($mag_aper1_column != -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($mag_aper1_column != -1) 0 8 8
537 0 my $num;
538 0 ▶ if ($magerr_aper1_column != -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($magerr_aper1_column != -1) { } 0 0 0
539 0 $num = new Number::Uncertainty(Value => $fields[$mag_aper1_column],
540 Error => $fields[$magerr_aper1_column]);
541 }
542 else {
543 0 $num = new Number::Uncertainty(Value => $fields[$mag_aper1_column]);
544 }
545 0 my $mag_aper1 = new Astro::Flux($num, 'MAG_APER1', $filter);
546 0 $star->fluxes(new Astro::Fluxes($mag_aper1));
547 }
548 8 ▶ if ($flux_aper1_column != -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($flux_aper1_column != -1) 0 8 8
549 0 my $num;
550 0 ▶ if ($fluxerr_aper1_column != -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fluxerr_aper1_column != -1) { } 0 0 0
551 0 $num = new Number::Uncertainty(Value => $fields[$flux_aper1_column],
552 Error => $fields[$fluxerr_aper1_column]);
553 }
554 else {
555 0 $num = new Number::Uncertainty(Value => $fields[$flux_aper1_column]);
556 }
557 0 my $flux_aper1 = new Astro::Flux($num, 'FLUX_APER1', $filter);
558 0 $star->fluxes(new Astro::Fluxes($flux_aper1));
559 }
560  
561 8 ▶ if ($mag_auto_column != -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($mag_auto_column != -1) 0 8 8
562 0 my $num;
563 0 ▶ if ($magerr_auto_column != -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($magerr_auto_column != -1) { } 0 0 0
564 0 $num = new Number::Uncertainty(Value => $fields[$mag_auto_column],
565 Error => $fields[$magerr_auto_column]);
566 }
567 else {
568 0 $num = new Number::Uncertainty(Value => $fields[$mag_auto_column]);
569 }
570 0 my $mag_auto = new Astro::Flux($num, 'MAG_AUTO', $filter);
571 0 $star->fluxes(new Astro::Fluxes($mag_auto));
572 }
573 8 ▶ if ($flux_auto_column != -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($flux_auto_column != -1) 0 8 8
574 0 my $num;
575 0 ▶ if ($fluxerr_auto_column != -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fluxerr_auto_column != -1) { } 0 0 0
576 0 $num = new Number::Uncertainty(Value => $fields[$flux_auto_column],
577 Error => $fields[$fluxerr_auto_column]);
578 }
579 else {
580 0 $num = new Number::Uncertainty(Value => $fields[$flux_auto_column]);
581 }
582 0 my $flux_auto = new Astro::Flux($num, 'FLUX_AUTO', $filter);
583 0 $star->fluxes(new Astro::Fluxes($flux_auto));
584 }
585  
586 8 ▶ if ($mag_best_column != -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($mag_best_column != -1) 0 8 8
587 0 my $num;
588 0 ▶ if ($magerr_best_column != -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($magerr_best_column != -1) { } 0 0 0
589 0 $num = new Number::Uncertainty(Value => $fields[$mag_best_column],
590 Error => $fields[$magerr_best_column]);
591 }
592 else {
593 0 $num = new Number::Uncertainty(Value => $fields[$mag_best_column]);
594 }
595 0 my $mag_best = new Astro::Flux($num, 'MAG_BEST', $filter);
596 0 $star->fluxes(new Astro::Fluxes($mag_best));
597 }
598 8 ▶ if ($flux_best_column != -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($flux_best_column != -1) 0 8 8
599 0 my $num;
600 0 ▶ if ($fluxerr_best_column != -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fluxerr_best_column != -1) { } 0 0 0
601 0 $num = new Number::Uncertainty(Value => $fields[$flux_best_column],
602 Error => $fields[$fluxerr_best_column]);
603 }
604 else {
605 0 $num = new Number::Uncertainty(Value => $fields[$flux_best_column]);
606 }
607 0 my $flux_best = new Astro::Flux($num, 'FLUX_BEST', $filter);
608 0 $star->fluxes(new Astro::Fluxes($flux_best));
609 }
610  
611 # Set the x and y coordinates. Preferentially use the NDF pixel
612 # coordinates, then the windowed coordinates, then the standard
613 # coordinates.
614 8 ▶ if ($x_pixel_column != -1) {
Branch: 3 branches
BranchTrueFalseTotal
if ($x_pixel_column != -1) { } 0 8 8
elsif ($xwin_column != -1) { } 0 8 8
elsif ($x_column != -1) { } 8 0 8
615 0 $star->x($fields[$x_pixel_column]);
616 }
617 elsif ($xwin_column != -1) {
618 0 $star->x($fields[$xwin_column]);
619 }
620 elsif ($x_column != -1) {
621 8 $star->x($fields[$x_column]);
622 }
623 8 ▶ if ($y_pixel_column != -1) {
Branch: 3 branches
BranchTrueFalseTotal
if ($y_pixel_column != -1) { } 0 8 8
elsif ($ywin_column != -1) { } 0 8 8
elsif ($x_column != -1) { } 8 0 8
624 0 $star->y($fields[$y_pixel_column]);
625 }
626 elsif ($ywin_column != -1) {
627 0 $star->y($fields[$ywin_column]);
628 }
629 elsif ($x_column != -1) {
630 8 $star->y($fields[$y_column]);
631 }
632  
633 # Set up the star's morphology.
634 8 my $ellipticity;
635 my $position_angle_pixel;
636 8 my $position_angle_world;
637 8 my $major_axis_pixel;
638 8 my $minor_axis_pixel;
639 8 my $major_axis_world;
640 8 my $minor_axis_world;
641 8 my $fwhm_pixel;
642 8 my $fwhm_world;
643 8 my $area;
644 8 ▶ if ($ell_column != -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ell_column != -1) 0 8 8
645 0 $ellipticity = new Number::Uncertainty(Value => $fields[$ell_column]);
646 }
647 8 ▶ if ($posang_pixel_column != -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($posang_pixel_column != -1) 0 8 8
648 0 ▶ if($posangerr_pixel_column != -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($posangerr_pixel_column != -1) { } 0 0 0
649 0 $position_angle_pixel = new Number::Uncertainty(Value => $fields[$posang_pixel_column],
650 Error => $fields[$posangerr_pixel_column]);
651 }
652 else {
653 0 $position_angle_pixel = new Number::Uncertainty(Value => $fields[$posang_pixel_column]);
654 }
655 }
656 8 ▶ if ($posang_world_column != -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($posang_world_column != -1) 0 8 8
657 0 ▶ if($posangerr_world_column != -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($posangerr_world_column != -1) { } 0 0 0
658 0 $position_angle_world = new Number::Uncertainty(Value => $fields[$posang_world_column],
659 Error => $fields[$posangerr_world_column]);
660 }
661 else {
662 0 $position_angle_world = new Number::Uncertainty(Value => $fields[$posang_world_column]);
663 }
664 }
665 8 ▶ if ($major_pixel_column != -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($major_pixel_column != -1) 0 8 8
666 0 ▶ if($majorerr_pixel_column != -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($majorerr_pixel_column != -1) { } 0 0 0
667 0 $major_axis_pixel = new Number::Uncertainty(Value => $fields[$major_pixel_column],
668 Error => $fields[$majorerr_pixel_column]);
669 }
670 else {
671 0 $major_axis_pixel = new Number::Uncertainty(Value => $fields[$major_pixel_column]);
672 }
673 }
674 8 ▶ if ($major_world_column != -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($major_world_column != -1) 0 8 8
675 0 ▶ if($majorerr_world_column != -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($majorerr_world_column != -1) { } 0 0 0
676 0 $major_axis_world = new Number::Uncertainty(Value => $fields[$major_world_column],
677 Error => $fields[$majorerr_world_column]);
678 }
679 else {
680 0 $major_axis_world = new Number::Uncertainty(Value => $fields[$major_world_column]);
681 }
682 }
683 8 ▶ if ($minor_pixel_column != -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($minor_pixel_column != -1) 0 8 8
684 0 ▶ if($minorerr_pixel_column != -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($minorerr_pixel_column != -1) { } 0 0 0
685 0 $minor_axis_pixel = new Number::Uncertainty(Value => $fields[$minor_pixel_column],
686 Error => $fields[$minorerr_pixel_column]);
687 }
688 else {
689 0 $minor_axis_pixel = new Number::Uncertainty(Value => $fields[$minor_pixel_column]);
690 }
691 }
692 8 ▶ if ($minor_world_column != -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($minor_world_column != -1) 0 8 8
693 0 ▶ if($minorerr_world_column != -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($minorerr_world_column != -1) { } 0 0 0
694 0 $minor_axis_world = new Number::Uncertainty(Value => $fields[$minor_world_column],
695 Error => $fields[$minorerr_world_column]);
696 }
697 else {
698 0 $minor_axis_world = new Number::Uncertainty(Value => $fields[$minor_world_column]);
699 }
700 }
701 8 ▶ if ($area_column != -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($area_column != -1) 0 8 8
702 0 $area = new Number::Uncertainty(Value => $fields[$area_column]);
703 }
704 8 ▶ if ($fwhm_pixel_column != -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fwhm_pixel_column != -1) 0 8 8
705 0 $fwhm_pixel = new Number::Uncertainty(Value => $fields[$fwhm_pixel_column]);
706 }
707 8 ▶ if ($fwhm_world_column != -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fwhm_world_column != -1) 0 8 8
708 0 $fwhm_world = new Number::Uncertainty(Value => $fields[$fwhm_world_column]);
709 }
710 8 my $morphology = new Astro::Catalog::Item::Morphology(
711 ellipticity => $ellipticity,
712 position_angle_pixel => $position_angle_pixel,
713 position_angle_world => $position_angle_world,
714 major_axis_pixel => $major_axis_pixel,
715 minor_axis_pixel => $minor_axis_pixel,
716 major_axis_world => $major_axis_world,
717 minor_axis_world => $minor_axis_world,
718 area => $area,
719 fwhm_pixel => $fwhm_pixel,
720 fwhm_world => $fwhm_world,
721 );
722 8 $star->morphology($morphology);
723  
724 # Push the star onto the catalog.
725 8 $catalog->pushstar($star);
726 }
727  
728 2 $catalog->origin('IO::SExtractor');
729 2 return $catalog;
730 }
731  
732 =item B<_write_catalog>
733  
734 Create an output catalog in the SExtractor ASCII_HEAD format and
735 return the lines in an array.
736  
737 $ref = Astro::Catalog::IO::SExtractor->_write_catalog($catalog);
738  
739 Argument is an C<Astro::Catalog> object.
740  
741 This method currently only returns the ID, X, Y, RA and Dec values in
742 the returned strings, in that order.
743  
744 =cut
745  
746 1 ▶sub _write_catalog {
Subroutine _write_catalog: called CC=18 SCAR=30.2
747 1 ▶ croak('Usage: _write_catalog($catalog, [%opts])') unless scalar(@_) >= 1;
Branch: 1 branch
BranchTrueFalseTotal
unless scalar @_ >= 1 0 1 1
748 1 my $class = shift;
749 1 my $catalog = shift;
750  
751 1 my @output;
752  
753 # First, the header. What we write to the header depends on what
754 # values we have for our objects, so check for ID, X, Y, RA, and Dec
755 # values.
756 1 my $write_id = 0;
757 1 my $write_x = 0;
758 1 my $write_y = 0;
759 1 my $write_ra = 0;
760 1 my $write_dec = 0;
761  
762 1 my @stars = $catalog->stars();
763  
764 1 ▶ if (defined $stars[0]->id) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $stars[0]->id) 1 0 1
765 1 $write_id = 1;
766 }
767 1 ▶ if (defined $stars[0]->x) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $stars[0]->x) 1 0 1
768 1 $write_x = 1;
769 }
770 1 ▶ if (defined $stars[0]->y) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $stars[0]->y) 1 0 1
771 1 $write_y = 1;
772 }
773 1 ▶ if (defined $stars[0]->coords->ra) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $stars[0]->coords->ra) 1 0 1
774 1 $write_ra = 1;
775 }
776 1 ▶ if (defined $stars[0]->coords->dec) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $stars[0]->coords->dec) 1 0 1
777 1 $write_dec = 1;
778 }
779  
780 # Now for the header.
781 1 my $pos = 1;
782 1 ▶ if ($write_id) {
Branch: 1 branch
BranchTrueFalseTotal
if ($write_id) 1 0 1
783 1 push @output, "# $pos NUMBER Running object number";
784 1 $pos ++;
785 }
786 1 ▶ if ($write_x) {
Branch: 1 branch
BranchTrueFalseTotal
if ($write_x) 1 0 1
787 1 push @output, "# $pos X_IMAGE Object position along x [pixel]";
788 1 $pos ++;
789 }
790 1 ▶ if ($write_y) {
Branch: 1 branch
BranchTrueFalseTotal
if ($write_y) 1 0 1
791 1 push @output, "# $pos Y_IMAGE Object position along y [pixel]";
792 1 $pos ++;
793 }
794 1 ▶ if ($write_ra) {
Branch: 1 branch
BranchTrueFalseTotal
if ($write_ra) 1 0 1
795 1 push @output, "# $pos ALPHA_J2000 Right ascension of barycenter (J2000) [deg]";
796 1 $pos ++;
797 }
798 1 ▶ if ($write_dec) {
Branch: 1 branch
BranchTrueFalseTotal
if ($write_dec) 1 0 1
799 1 push @output, "# $pos DELTA_J2000 Declination of barycenter (J2000) [deg]";
800 1 $pos ++;
801 }
802  
803 # Now go through the objects.
804 1 foreach my $star (@stars) {
805 4 my $output_string = "";
806  
807 4 ▶ if ($write_id) {
Branch: 1 branch
BranchTrueFalseTotal
if ($write_id) 4 0 4
808 4 $output_string .= $star->id . " ";
809 }
810 4 ▶ if ($write_x) {
Branch: 1 branch
BranchTrueFalseTotal
if ($write_x) 4 0 4
811 4 $output_string .= $star->x . " ";
812 }
813 4 ▶ if ($write_y) {
Branch: 1 branch
BranchTrueFalseTotal
if ($write_y) 4 0 4
814 4 $output_string .= $star->y . " ";
815 }
816 4 ▶ if ($write_ra) {
Branch: 1 branch
BranchTrueFalseTotal
if ($write_ra) 4 0 4
817 4 $output_string .= $star->coords->ra->degrees . " ";
818 }
819 4 ▶ if ($write_dec) {
Branch: 1 branch
BranchTrueFalseTotal
if ($write_dec) 4 0 4
820 4 $output_string .= $star->coords->dec->degrees . " ";
821 }
822  
823 4 push @output, $output_string;
824 }
825  
826 1 return \@output;
827 }
828  
829 2 1;
830  
831 __END__
↑ Summary Astro/Catalog/Query/SuperCOSMOS.pm »