line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Astro::Catalog::IO::UKIRTBS; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Astro::Catalog::IO::UKIRTBS - Old format used by UKIRT Bright Star catalogues |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
$cat = Astro::Catalog::IO::UKIRTBS->_read_catalog( \@lines ); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 DESCRIPTION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
This class provides a read method for catalogs written in a format |
14
|
|
|
|
|
|
|
used by the old C web interface to the SAO and Bright Star |
15
|
|
|
|
|
|
|
catalogues. It is probable that this format has a real name and is a |
16
|
|
|
|
|
|
|
historical format rather than a UKIRT-specific format but the history |
17
|
|
|
|
|
|
|
of C and the associated catalogue files is not known to the |
18
|
|
|
|
|
|
|
author of this module. |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=cut |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
1
|
|
1371774
|
use 5.006; |
|
1
|
|
|
|
|
12
|
|
|
1
|
|
|
|
|
65
|
|
23
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
103
|
|
24
|
1
|
|
|
1
|
|
70
|
use warnings::register; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
397
|
|
25
|
1
|
|
|
1
|
|
8
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
230
|
|
26
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
61
|
|
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
1
|
|
933
|
use Astro::Catalog; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
use Astro::Catalog::Star; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
use base qw/ Astro::Catalog::IO::ASCII /; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
use vars qw/ $VERSION /; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
$VERSION = '4.31'; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=over 4 |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=item B<_read_catalog> |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Parses the catalogue lines and returns a new C |
42
|
|
|
|
|
|
|
object containing the catalog entries. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
$cat = Astro::Catalog::IO::JCMT->_read_catalog( \@lines ); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
No options are supported. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=cut |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub _read_catalog { |
51
|
|
|
|
|
|
|
my $class = shift; |
52
|
|
|
|
|
|
|
my $lines = shift; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
croak "Must supply catalogue contents as a reference to an array" |
55
|
|
|
|
|
|
|
unless ref($lines) eq 'ARRAY'; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
# Go through each line and parse it |
58
|
|
|
|
|
|
|
my @stars; |
59
|
|
|
|
|
|
|
for my $l ( @$lines ) { |
60
|
|
|
|
|
|
|
# benchmarks suggest that substr is faster than an unpack |
61
|
|
|
|
|
|
|
my $bs = substr($l,0,8); |
62
|
|
|
|
|
|
|
my $ra = substr($l,9,12); |
63
|
|
|
|
|
|
|
my $dec = substr($l,21,12); |
64
|
|
|
|
|
|
|
my $rap = substr($l,34,4); |
65
|
|
|
|
|
|
|
my $decp = substr($l,40,4); |
66
|
|
|
|
|
|
|
my $mag = substr($l,46,4); |
67
|
|
|
|
|
|
|
my $type = substr($l,50); |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
# Tidy the result |
70
|
|
|
|
|
|
|
chomp($type); |
71
|
|
|
|
|
|
|
$bs =~ s/^\s+//; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
# Create coordinate object |
74
|
|
|
|
|
|
|
my $c = new Astro::Coords( ra => $ra, |
75
|
|
|
|
|
|
|
dec => $dec, |
76
|
|
|
|
|
|
|
type => 'B1950', |
77
|
|
|
|
|
|
|
name => $bs, |
78
|
|
|
|
|
|
|
units => 'r', |
79
|
|
|
|
|
|
|
); |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
my $s = new Astro::Catalog::Star( coords => $c, |
82
|
|
|
|
|
|
|
id => $bs, |
83
|
|
|
|
|
|
|
spectype => $type, |
84
|
|
|
|
|
|
|
fluxes => new Astro::Fluxes( |
85
|
|
|
|
|
|
|
new Astro::Flux( $mag, 'mag', 'V') ), |
86
|
|
|
|
|
|
|
); |
87
|
|
|
|
|
|
|
push(@stars, $s); |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
# Create the catalog object |
91
|
|
|
|
|
|
|
return new Astro::Catalog( Stars => \@stars, |
92
|
|
|
|
|
|
|
Origin => 'UKIRT BS Catalog', |
93
|
|
|
|
|
|
|
); |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=back |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 FORMAT |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
The catalog format uses fixed formatting (first column is column 1): |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Columns |
104
|
|
|
|
|
|
|
1-7 star id |
105
|
|
|
|
|
|
|
10-20 Right Ascension (presumed B1950). Radians |
106
|
|
|
|
|
|
|
21-32 Declination (presumed B1950). Radians |
107
|
|
|
|
|
|
|
33-38 "rap" (unknown) |
108
|
|
|
|
|
|
|
39-44 "decp" (unknown) |
109
|
|
|
|
|
|
|
45-49 V Magnitude |
110
|
|
|
|
|
|
|
50- Spectral type |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 COPYRIGHT |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Copyright (C) 2004 Particle Physics and Astronomy Research Council. |
115
|
|
|
|
|
|
|
All Rights Reserved. |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it under |
118
|
|
|
|
|
|
|
the terms of the GNU General Public License as published by the Free Software |
119
|
|
|
|
|
|
|
Foundation; either version 2 of the License, or (at your option) any later |
120
|
|
|
|
|
|
|
version. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,but WITHOUT ANY |
123
|
|
|
|
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
124
|
|
|
|
|
|
|
PARTICULAR PURPOSE. See the GNU General Public License for more details. |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along with |
127
|
|
|
|
|
|
|
this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
128
|
|
|
|
|
|
|
Place,Suite 330, Boston, MA 02111-1307, USA |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 AUTHORS |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Tim Jenness Etjenness@cpan.orgE |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=cut |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
1; |