line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Astro::Catalog::IO::Astrom; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Astro::Catalog::IO::Astrom - Starlink Astrom catalogue I/O for |
6
|
|
|
|
|
|
|
Astro::Catalog. |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 SYNOPSIS |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
\@lines = Astro::Catalog::IO::Astrom->_write_catalog( $catalog ); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 DESCRIPTION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
This class provides a write method for catalogues to be used as |
15
|
|
|
|
|
|
|
import to Starlink Astrom. The method is not public and should, |
16
|
|
|
|
|
|
|
in general, only be called from the C C |
17
|
|
|
|
|
|
|
method. |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=cut |
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
1
|
|
3282141
|
use 5.006; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
100
|
|
22
|
1
|
|
|
1
|
|
15
|
use warnings; |
|
1
|
|
|
|
|
12
|
|
|
1
|
|
|
|
|
97
|
|
23
|
1
|
|
|
1
|
|
388
|
use warnings::register; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
383
|
|
24
|
1
|
|
|
1
|
|
6
|
use Carp; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
198
|
|
25
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
51
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# Bring in the Astro:: modules. |
28
|
1
|
|
|
1
|
|
1426
|
use Astro::Catalog; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
use Astro::Catalog::Star; |
30
|
|
|
|
|
|
|
use Astro::Coords; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
use base qw/ Astro::Catalog::IO::ASCII /; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
use vars qw/ $VERSION $DEBUG /; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
$VERSION = '4.31'; |
37
|
|
|
|
|
|
|
$DEBUG = 0; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=begin __PRIVATE_METHODS__ |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 PRIVATE METHODS |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
These methods are usually called automatically from the C |
44
|
|
|
|
|
|
|
constructor. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=over 4 |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=item B<_read_catalog> |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Not currently implemented for Astro::Catalog::IO::Astrom. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub _read_catalog { |
55
|
|
|
|
|
|
|
croak "Not yet implemented."; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=item B<_write_catalog> |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Writes the catalogue object to a file in a format that Starlink ASTROM |
61
|
|
|
|
|
|
|
can understand. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
\@lines = Astro::Catalog::IO::Astrom->_write_catalog( $catalog ); |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
where $catalog is an C object. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=cut |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub _write_catalog { |
70
|
|
|
|
|
|
|
croak ( 'Usage: _write_catalog( $catalog ) ') unless scalar( @_ ) >= 1; |
71
|
|
|
|
|
|
|
my $class = shift; |
72
|
|
|
|
|
|
|
my $catalog = shift; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
# Get the number of stars, since if we have fewer than N we cannot |
75
|
|
|
|
|
|
|
# do a fit without the field centre. |
76
|
|
|
|
|
|
|
my $nstars = $catalog->sizeof(); |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
if ( ! defined( $catalog->get_coords ) ) { |
79
|
|
|
|
|
|
|
croak "Need catalogue field centre to do astrometry correction"; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
# Set up some variables for output. |
83
|
|
|
|
|
|
|
my @output; |
84
|
|
|
|
|
|
|
my $output_line; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
# Write the approximate field centre. |
87
|
|
|
|
|
|
|
my $ra_cen = $catalog->get_coords->ra( format => 's' ); |
88
|
|
|
|
|
|
|
my $dec_cen = $catalog->get_coords->dec( format => 's' ); |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
# Strip out colons or dms/hms and replace them with spaces. |
91
|
|
|
|
|
|
|
$ra_cen =~ s/[:dhms]/ /g; |
92
|
|
|
|
|
|
|
$dec_cen =~ s/[:dhms]/ /g; |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
# Get the epoch of observation. This can be obtained from the |
95
|
|
|
|
|
|
|
# first star, so just pop it off, read the epoch, and pop it |
96
|
|
|
|
|
|
|
# back on. |
97
|
|
|
|
|
|
|
my $epoch_star = $catalog->popstar; |
98
|
|
|
|
|
|
|
my $wcs = $epoch_star->wcs; |
99
|
|
|
|
|
|
|
$catalog->pushstar( $epoch_star ); |
100
|
|
|
|
|
|
|
my $epoch; |
101
|
|
|
|
|
|
|
if( defined( $wcs ) ) { |
102
|
|
|
|
|
|
|
$epoch = $wcs->GetC("Epoch"); |
103
|
|
|
|
|
|
|
if( ! defined( $epoch ) ) { |
104
|
|
|
|
|
|
|
$epoch = "2000.0"; |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
} else { |
107
|
|
|
|
|
|
|
$epoch = "2000.0"; |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
push @output, "~ GENE 0.0"; |
111
|
|
|
|
|
|
|
push @output, "~ $ra_cen $dec_cen J2000 $epoch"; |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
# For each star, write the RA, Dec, epoch, X and Y coordinates. |
114
|
|
|
|
|
|
|
foreach my $star ( $catalog->stars ) { |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
next if ( ! defined( $star->ra ) || |
117
|
|
|
|
|
|
|
! defined( $star->dec ) || |
118
|
|
|
|
|
|
|
! defined( $star->x ) || |
119
|
|
|
|
|
|
|
! defined( $star->y ) ); |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
my $coords = $star->coords; |
122
|
|
|
|
|
|
|
my $ra = $coords->ra( format => 's' ); |
123
|
|
|
|
|
|
|
my $dec = $coords->dec( format => 's' ); |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
# Strip out colons or dms/hms and replace them with spaces. |
126
|
|
|
|
|
|
|
$ra =~ s/[:dhms]/ /g; |
127
|
|
|
|
|
|
|
$dec =~ s/[:dhms]/ /g; |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
# Get the star's epoch. |
130
|
|
|
|
|
|
|
my $star_epoch; |
131
|
|
|
|
|
|
|
if( defined( $star->wcs ) ) { |
132
|
|
|
|
|
|
|
$star_epoch = $star->wcs->GetC("Epoch"); |
133
|
|
|
|
|
|
|
if( ! defined( $star_epoch ) ) { |
134
|
|
|
|
|
|
|
$star_epoch = "2000.0"; |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
} else { |
137
|
|
|
|
|
|
|
$star_epoch = "2000.0"; |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
$output_line = "$ra $dec J2000 $star_epoch"; |
141
|
|
|
|
|
|
|
push @output, $output_line; |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
my $x = $star->x; |
144
|
|
|
|
|
|
|
my $y = $star->y; |
145
|
|
|
|
|
|
|
$output_line = "$x $y"; |
146
|
|
|
|
|
|
|
push @output, $output_line; |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
} |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
push @output, "END"; |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
return \@output; |
153
|
|
|
|
|
|
|
} |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=back |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=head1 REVISION |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
$Id: Astrom.pm,v 1.9 2006/03/11 00:01:41 cavanagh Exp $ |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head1 SEE ALSO |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
L, L |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
Starlink User Note 5 (http://www.starlink.ac.uk/star/docs/sun5.htx/sun5.html) |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=head1 COYPRIGHT |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
Copyright (C) 2005 Particle Physics and Astronomy Research Council. |
170
|
|
|
|
|
|
|
All Rights Reserved. |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
173
|
|
|
|
|
|
|
under the terms of the GNU Public License. |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=head1 AUTHORS |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
Brad Cavanagh Eb.cavanagh@jach.hawaii.eduE |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=cut |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
1; |