line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Astro::GCN::Parse; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
GCN::Packet::Parse - module which parses valid GCN binary messages |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
$message = new Astro::GCN::Parse( Packet => $packet ); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 DESCRIPTION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
The module parses incoming GCN binary packet and parses it, it will |
14
|
|
|
|
|
|
|
correct parse TYPE_IM_ALIVE and all (most?) SWIFT related packets. |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=cut |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# L O A D M O D U L E S -------------------------------------------------- |
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
7115
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
21
|
1
|
|
|
1
|
|
4
|
use vars qw/ $VERSION $SELF /; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
49
|
|
22
|
|
|
|
|
|
|
|
23
|
1
|
|
|
1
|
|
867
|
use Net::Domain qw(hostname hostdomain); |
|
1
|
|
|
|
|
11049
|
|
|
1
|
|
|
|
|
78
|
|
24
|
1
|
|
|
1
|
|
11
|
use File::Spec; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
25
|
1
|
|
|
1
|
|
1439
|
use Time::localtime; |
|
1
|
|
|
|
|
6574
|
|
|
1
|
|
|
|
|
62
|
|
26
|
1
|
|
|
1
|
|
1247
|
use Data::Dumper; |
|
1
|
|
|
|
|
10717
|
|
|
1
|
|
|
|
|
70
|
|
27
|
1
|
|
|
1
|
|
9
|
use Carp; |
|
1
|
|
|
|
|
14
|
|
|
1
|
|
|
|
|
60
|
|
28
|
|
|
|
|
|
|
|
29
|
1
|
|
|
1
|
|
1041
|
use Astro::GCN::Constants qw(:packet_types); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
422
|
|
30
|
1
|
|
|
1
|
|
551
|
use Astro::GCN::Util; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7697
|
|
31
|
1
|
|
|
1
|
|
787
|
use Astro::GCN::Util::SWIFT; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
1487
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
'$Revision: 1.1.1.1 $ ' =~ /.*:\s(.*)\s\$/ && ($VERSION = $1); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# C O N S T R U C T O R ---------------------------------------------------- |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 REVISION |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
$Id: Parse.pm,v 1.1.1.1 2005/05/03 19:23:00 voevent Exp $ |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 METHODS |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head2 Constructor |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=over 4 |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=item B |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Create a new instance from a hash of options |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
$message = new Astro::GCN::Parse( Packet => $packet ); |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
returns a reference to an message object. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=cut |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub new { |
58
|
0
|
|
|
0
|
1
|
|
my $proto = shift; |
59
|
0
|
|
0
|
|
|
|
my $class = ref($proto) || $proto; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# bless the query hash into the class |
62
|
0
|
|
|
|
|
|
my $block = bless { BUFFER => undef, |
63
|
|
|
|
|
|
|
MESSAGE => [], |
64
|
|
|
|
|
|
|
TYPE => undef }, $class; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
# Configure the object |
67
|
0
|
|
|
|
|
|
$block->configure( @_ ); |
68
|
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
return $block; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
# A C C E S S O R M E T H O D S -------------------------------------------- |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=back |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head2 Accessor Methods |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=over 4 |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=item B |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Return the packet type |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
$pkt_type = $message->type(); |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=cut |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub type { |
92
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
93
|
0
|
|
|
|
|
|
return $self->{TYPE}; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=item B |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Return the packet serial number |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
$pkt_sernum = $message->serial_number(); |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=cut |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub serial_number { |
105
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
106
|
0
|
|
|
|
|
|
return $self->{MESSAGE}[1]; |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=item B |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Return the packet hop count which is incremented by each node |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
$pkt_hop_cnt = $message->hop_count(); |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=cut |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
sub hop_count { |
119
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
120
|
0
|
|
|
|
|
|
return $self->{MESSAGE}[2]; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=item B |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Return the time (seconds of day) when the packet was sent from the GCN. |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
$sod = $message->gcn_sod(); |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=cut |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
sub gcn_sod { |
132
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
133
|
0
|
|
|
|
|
|
return ( $self->{MESSAGE}[3] / 100.0 ); |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
# S W I F T R E L A T E D M E T H O D S --------------------------------- |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=item B |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Returns true if the packet originates from SWIFT, or undef if not |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
if ( defined $message->is_swift() ) { |
143
|
|
|
|
|
|
|
. |
144
|
|
|
|
|
|
|
. |
145
|
|
|
|
|
|
|
. |
146
|
|
|
|
|
|
|
} |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=cut |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
sub is_swift { |
151
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
152
|
|
|
|
|
|
|
|
153
|
0
|
0
|
0
|
|
|
|
if ( $self->type() >= 60 && $self->type <= 82 ) { |
154
|
0
|
|
|
|
|
|
return 1; |
155
|
|
|
|
|
|
|
} else { |
156
|
0
|
|
|
|
|
|
return undef; |
157
|
|
|
|
|
|
|
} |
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=item B |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
Return the trigger number (SWIFT packets only) |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
$trigger_num = $message->trigger_num(); |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=cut |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
sub trigger_num { |
169
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
170
|
|
|
|
|
|
|
|
171
|
0
|
0
|
|
|
|
|
return undef unless $self->is_swift(); |
172
|
|
|
|
|
|
|
|
173
|
0
|
|
|
|
|
|
my ( $trig_num, $obs_num ) = |
174
|
|
|
|
|
|
|
Astro::GCN::Util::SWIFT::convert_trig_obs_num( $self->{MESSAGE}[4] ); |
175
|
0
|
|
|
|
|
|
return $trig_num; |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
} |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=item B |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
Return the obs number (SWIFT packets only) |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
$obs_num = $message->obs_num(); |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=cut |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
sub obs_num { |
188
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
189
|
0
|
0
|
|
|
|
|
return undef unless $self->is_swift(); |
190
|
|
|
|
|
|
|
|
191
|
0
|
|
|
|
|
|
my ( $trig_num, $obs_num ) = |
192
|
|
|
|
|
|
|
Astro::GCN::Util::SWIFT::convert_trig_obs_num( $self->{MESSAGE}[4] ); |
193
|
0
|
|
|
|
|
|
return $obs_num; |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
} |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=item B |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
Return the truncated Julian Date of the observation. The precise |
200
|
|
|
|
|
|
|
defintion of this varies depending on the type of the original packet. |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
$julian_date = $message->tjd(); |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
For now this method will only return a value for SWIFT packets. |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=cut |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
sub tjd { |
210
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
211
|
0
|
0
|
|
|
|
|
return undef unless $self->is_swift(); |
212
|
0
|
0
|
0
|
|
|
|
if ( $self->type() >= 74 && $self->type <= 75 ) { |
213
|
0
|
|
|
|
|
|
return undef; |
214
|
|
|
|
|
|
|
} |
215
|
|
|
|
|
|
|
|
216
|
0
|
|
|
|
|
|
return $self->{MESSAGE}[5]; |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
} |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
=item B |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
Return the time (seconds of day) when the data originated at the |
223
|
|
|
|
|
|
|
instrument. The precise defintion of this varies depending on the |
224
|
|
|
|
|
|
|
type of the original packet. |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
$sod = $message->data_sod(); |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
For now this method will only return a value for SWIFT packets. |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
=cut |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
sub data_sod { |
233
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
234
|
|
|
|
|
|
|
|
235
|
0
|
0
|
|
|
|
|
return undef unless $self->is_swift(); |
236
|
0
|
0
|
0
|
|
|
|
if ( $self->type() >= 74 && $self->type <= 75 ) { |
237
|
0
|
|
|
|
|
|
return undef; |
238
|
|
|
|
|
|
|
} |
239
|
0
|
|
|
|
|
|
return ( $self->{MESSAGE}[6] / 100.0 ); |
240
|
|
|
|
|
|
|
} |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
=item B |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
Return the RA in "hh mm ss.ss" format. The precise defintion of this |
245
|
|
|
|
|
|
|
varies depending on the type of the original packet. |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
$ra = $message->ra(); |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
For now this method will only return a value for SWIFT packets. |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
=cut |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
sub ra { |
254
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
255
|
0
|
0
|
|
|
|
|
return undef unless $self->is_swift(); |
256
|
0
|
0
|
0
|
|
|
|
if ( $self->type() == 60 || $self->type == 62 || |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
257
|
|
|
|
|
|
|
( $self->type() >= 74 && $self->type <= 75 ) ) { |
258
|
0
|
|
|
|
|
|
return undef; |
259
|
|
|
|
|
|
|
} |
260
|
|
|
|
|
|
|
|
261
|
0
|
|
|
|
|
|
my $ra = Astro::GCN::Util::convert_ra_to_sextuplets( $self->{MESSAGE}[7] ); |
262
|
0
|
|
|
|
|
|
return $ra; |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
} |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
=item B |
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
Return the Declination in "+dd mm ss.ss" format. The precise defintion |
269
|
|
|
|
|
|
|
of this varies depending on the type of the original packet. |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
$dec = $message->dec(); |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
For now this method will only return a value for SWIFT packets. |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
=cut |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
sub dec { |
278
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
279
|
0
|
0
|
|
|
|
|
return undef unless $self->is_swift(); |
280
|
0
|
0
|
0
|
|
|
|
if ( $self->type() == 60 || $self->type == 62 || |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
281
|
|
|
|
|
|
|
( $self->type() >= 74 && $self->type <= 75 ) ) { |
282
|
0
|
|
|
|
|
|
return undef; |
283
|
|
|
|
|
|
|
} |
284
|
|
|
|
|
|
|
|
285
|
0
|
|
|
|
|
|
my $dec = Astro::GCN::Util::convert_dec_to_sextuplets( $self->{MESSAGE}[8] ); |
286
|
0
|
|
|
|
|
|
return $dec; |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
} |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
=item B |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
Return the error in RA & Declination in arc minutes. The precise |
293
|
|
|
|
|
|
|
defintion of the original values of RA & Declination will vary depending |
294
|
|
|
|
|
|
|
on the type of the original packet. |
295
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
$error = $message->burst_error(); |
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
For now this method will only return a value for the relevant SWIFT packets, |
299
|
|
|
|
|
|
|
these being types 61, 67, 81 and 84. |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
=cut |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
sub burst_error { |
304
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
305
|
0
|
0
|
|
|
|
|
return undef unless $self->is_swift(); |
306
|
0
|
0
|
0
|
|
|
|
unless ( $self->type() == 61 || $self->type == 67 || |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
307
|
|
|
|
|
|
|
$self->type() == 81 || $self->type == 84 ) { |
308
|
0
|
|
|
|
|
|
return undef; |
309
|
|
|
|
|
|
|
} |
310
|
|
|
|
|
|
|
|
311
|
0
|
|
|
|
|
|
my $error = |
312
|
|
|
|
|
|
|
Astro::GCN::Util::convert_burst_error_to_arcmin ( $self->{MESSAGE}[11] ); |
313
|
|
|
|
|
|
|
|
314
|
0
|
|
|
|
|
|
return $error; |
315
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
} |
317
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
=item B |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
Return the RA in degrees. The precise defintion of this |
322
|
|
|
|
|
|
|
varies depending on the type of the original packet. |
323
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
$ra = $message->ra_degrees(); |
325
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
For now this method will only return a value for SWIFT packets. |
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
=cut |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
sub ra_degrees { |
331
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
332
|
0
|
0
|
|
|
|
|
return undef unless $self->is_swift(); |
333
|
0
|
0
|
0
|
|
|
|
if ( $self->type() == 60 || $self->type == 62 || |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
334
|
|
|
|
|
|
|
( $self->type() >= 74 && $self->type <= 75 ) ) { |
335
|
0
|
|
|
|
|
|
return undef; |
336
|
|
|
|
|
|
|
} |
337
|
|
|
|
|
|
|
|
338
|
0
|
|
|
|
|
|
my $ra = Astro::GCN::Util::convert_ra_to_degrees( $self->{MESSAGE}[7] ); |
339
|
0
|
|
|
|
|
|
return $ra; |
340
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
} |
342
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
=item B |
344
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
Return the Declination in degrees. The precise defintion |
346
|
|
|
|
|
|
|
of this varies depending on the type of the original packet. |
347
|
|
|
|
|
|
|
|
348
|
|
|
|
|
|
|
$dec = $message->dec_degrees(); |
349
|
|
|
|
|
|
|
|
350
|
|
|
|
|
|
|
For now this method will only return a value for SWIFT packets. |
351
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
=cut |
353
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
sub dec_degrees { |
355
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
356
|
0
|
0
|
|
|
|
|
return undef unless $self->is_swift(); |
357
|
0
|
0
|
0
|
|
|
|
if ( $self->type() == 60 || $self->type == 62 || |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
358
|
|
|
|
|
|
|
( $self->type() >= 74 && $self->type <= 75 ) ) { |
359
|
0
|
|
|
|
|
|
return undef; |
360
|
|
|
|
|
|
|
} |
361
|
|
|
|
|
|
|
|
362
|
0
|
|
|
|
|
|
my $dec = Astro::GCN::Util::convert_dec_to_degrees( $self->{MESSAGE}[8] ); |
363
|
0
|
|
|
|
|
|
return $dec; |
364
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
} |
366
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
=item B |
368
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
Return the error in RA & Declination in degrees. The precise |
370
|
|
|
|
|
|
|
defintion of the original values of RA & Declination will vary depending |
371
|
|
|
|
|
|
|
on the type of the original packet. |
372
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
$error = $message->burst_error_degrees(); |
374
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
For now this method will only return a value for the relevant SWIFT packets, |
376
|
|
|
|
|
|
|
these being types 61, 67, 81 and 84. |
377
|
|
|
|
|
|
|
|
378
|
|
|
|
|
|
|
=cut |
379
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
sub burst_error_degrees { |
381
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
382
|
0
|
0
|
|
|
|
|
return undef unless $self->is_swift(); |
383
|
0
|
0
|
0
|
|
|
|
unless ( $self->type() == 61 || $self->type == 67 || |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
384
|
|
|
|
|
|
|
$self->type() == 81 || $self->type == 84 ) { |
385
|
0
|
|
|
|
|
|
return undef; |
386
|
|
|
|
|
|
|
} |
387
|
|
|
|
|
|
|
|
388
|
0
|
|
|
|
|
|
my $error = |
389
|
|
|
|
|
|
|
Astro::GCN::Util::convert_burst_error_to_degrees ( $self->{MESSAGE}[11] ); |
390
|
|
|
|
|
|
|
|
391
|
0
|
|
|
|
|
|
return $error; |
392
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
} |
394
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
=item B |
396
|
|
|
|
|
|
|
|
397
|
|
|
|
|
|
|
Return the type of solution for relevant BAT messages. |
398
|
|
|
|
|
|
|
|
399
|
|
|
|
|
|
|
$soln_status = $message->solution_status(); |
400
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
This method will only return a value for the relevant SWIFT packets, |
402
|
|
|
|
|
|
|
these being types 61, 62, 82 and 84. |
403
|
|
|
|
|
|
|
|
404
|
|
|
|
|
|
|
=cut |
405
|
|
|
|
|
|
|
|
406
|
|
|
|
|
|
|
sub solution_status { |
407
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
408
|
0
|
0
|
|
|
|
|
return undef unless $self->is_swift(); |
409
|
0
|
0
|
0
|
|
|
|
unless ( $self->type() == 61 || $self->type == 62 || |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
410
|
|
|
|
|
|
|
$self->type() == 82 || $self->type == 84 ) { |
411
|
0
|
|
|
|
|
|
return undef; |
412
|
|
|
|
|
|
|
} |
413
|
|
|
|
|
|
|
|
414
|
0
|
|
|
|
|
|
my %soln_status = |
415
|
|
|
|
|
|
|
Astro::GCN::Util::SWIFT::convert_soln_status ( $self->{MESSAGE}[18] ); |
416
|
|
|
|
|
|
|
|
417
|
0
|
|
|
|
|
|
return %soln_status; |
418
|
|
|
|
|
|
|
|
419
|
|
|
|
|
|
|
} |
420
|
|
|
|
|
|
|
|
421
|
|
|
|
|
|
|
=item B |
422
|
|
|
|
|
|
|
|
423
|
|
|
|
|
|
|
Return the height of the peak in the sky-image plane in counts |
424
|
|
|
|
|
|
|
|
425
|
|
|
|
|
|
|
$error = $message->burst_error(); |
426
|
|
|
|
|
|
|
|
427
|
|
|
|
|
|
|
This is valid for SWIFT BAT only (packet types 61 or 82) |
428
|
|
|
|
|
|
|
|
429
|
|
|
|
|
|
|
=cut |
430
|
|
|
|
|
|
|
|
431
|
|
|
|
|
|
|
sub bat_ipeak { |
432
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
433
|
0
|
0
|
|
|
|
|
return undef unless $self->is_swift(); |
434
|
0
|
0
|
0
|
|
|
|
unless ( $self->type() == 61 || $self->type == 82 ) { |
435
|
0
|
|
|
|
|
|
return undef; |
436
|
|
|
|
|
|
|
} |
437
|
|
|
|
|
|
|
|
438
|
0
|
|
|
|
|
|
return $self->{MESSAGE}[10]; |
439
|
|
|
|
|
|
|
|
440
|
|
|
|
|
|
|
} |
441
|
|
|
|
|
|
|
|
442
|
|
|
|
|
|
|
|
443
|
|
|
|
|
|
|
=item B |
444
|
|
|
|
|
|
|
|
445
|
|
|
|
|
|
|
Return the magnitude of the SWIFT UVOT pointing |
446
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
$error = $message->uvot_mag(); |
448
|
|
|
|
|
|
|
|
449
|
|
|
|
|
|
|
This is valid for SWIFT UVOT only (packet types 81) |
450
|
|
|
|
|
|
|
|
451
|
|
|
|
|
|
|
=cut |
452
|
|
|
|
|
|
|
|
453
|
|
|
|
|
|
|
sub uvot_mag { |
454
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
455
|
0
|
0
|
|
|
|
|
unless ( $self->type() == 81 ) { |
456
|
0
|
|
|
|
|
|
return undef; |
457
|
|
|
|
|
|
|
} |
458
|
|
|
|
|
|
|
|
459
|
0
|
|
|
|
|
|
return ( $self->{MESSAGE}[9] / 100.0 ); |
460
|
|
|
|
|
|
|
|
461
|
|
|
|
|
|
|
} |
462
|
|
|
|
|
|
|
|
463
|
|
|
|
|
|
|
# C O N F I G U R E ---------------------------------------------------------- |
464
|
|
|
|
|
|
|
|
465
|
|
|
|
|
|
|
=back |
466
|
|
|
|
|
|
|
|
467
|
|
|
|
|
|
|
=head2 General Methods |
468
|
|
|
|
|
|
|
|
469
|
|
|
|
|
|
|
=over 4 |
470
|
|
|
|
|
|
|
|
471
|
|
|
|
|
|
|
=item B |
472
|
|
|
|
|
|
|
|
473
|
|
|
|
|
|
|
Configures the object, takes an options hash as an argument |
474
|
|
|
|
|
|
|
|
475
|
|
|
|
|
|
|
$message->configure( %options ); |
476
|
|
|
|
|
|
|
|
477
|
|
|
|
|
|
|
Does nothing if the hash is not supplied. This is called directly from |
478
|
|
|
|
|
|
|
the constructor during object creation |
479
|
|
|
|
|
|
|
|
480
|
|
|
|
|
|
|
=cut |
481
|
|
|
|
|
|
|
|
482
|
|
|
|
|
|
|
sub configure { |
483
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
484
|
|
|
|
|
|
|
|
485
|
|
|
|
|
|
|
# CONFIGURE FROM ARGUEMENTS |
486
|
|
|
|
|
|
|
# ------------------------- |
487
|
|
|
|
|
|
|
|
488
|
|
|
|
|
|
|
# return unless we have arguments |
489
|
0
|
0
|
|
|
|
|
return undef unless @_; |
490
|
|
|
|
|
|
|
|
491
|
|
|
|
|
|
|
# grab the argument list |
492
|
0
|
|
|
|
|
|
my %args = @_; |
493
|
|
|
|
|
|
|
|
494
|
|
|
|
|
|
|
# Loop over the allowed keys and modify the default query options |
495
|
0
|
|
|
|
|
|
for my $key (qw / Packet / ) { |
496
|
0
|
|
|
|
|
|
my $method = lc($key); |
497
|
|
|
|
|
|
|
# normal configuration methods (if needed) |
498
|
0
|
0
|
|
|
|
|
$self->$method( $args{$key} ) if exists $args{$key}; |
499
|
|
|
|
|
|
|
} |
500
|
|
|
|
|
|
|
|
501
|
|
|
|
|
|
|
} |
502
|
|
|
|
|
|
|
|
503
|
|
|
|
|
|
|
# M E T H O D S ------------------------------------------------------------- |
504
|
|
|
|
|
|
|
|
505
|
|
|
|
|
|
|
=item B |
506
|
|
|
|
|
|
|
|
507
|
|
|
|
|
|
|
Read the binary packet and convert, |
508
|
|
|
|
|
|
|
|
509
|
|
|
|
|
|
|
$message->packet( $binary_packet ); |
510
|
|
|
|
|
|
|
|
511
|
|
|
|
|
|
|
takes the GCN native binary packet and converts to local format, then |
512
|
|
|
|
|
|
|
parses known packet types and makes the information available via the |
513
|
|
|
|
|
|
|
accessor methods. |
514
|
|
|
|
|
|
|
|
515
|
|
|
|
|
|
|
=cut |
516
|
|
|
|
|
|
|
|
517
|
|
|
|
|
|
|
sub packet { |
518
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
519
|
0
|
|
|
|
|
|
$self->{BUFFER} = shift; |
520
|
|
|
|
|
|
|
|
521
|
|
|
|
|
|
|
# parse the document using private methods. |
522
|
0
|
|
|
|
|
|
push @{$self->{MESSAGE}}, unpack( "N40", $self->{BUFFER} ); |
|
0
|
|
|
|
|
|
|
523
|
0
|
|
|
|
|
|
$self->{TYPE} = $self->{MESSAGE}[0]; |
524
|
|
|
|
|
|
|
|
525
|
|
|
|
|
|
|
} |
526
|
|
|
|
|
|
|
|
527
|
|
|
|
|
|
|
|
528
|
|
|
|
|
|
|
# T I M E A T T H E B A R -------------------------------------------- |
529
|
|
|
|
|
|
|
|
530
|
|
|
|
|
|
|
=back |
531
|
|
|
|
|
|
|
|
532
|
|
|
|
|
|
|
=head1 COPYRIGHT |
533
|
|
|
|
|
|
|
|
534
|
|
|
|
|
|
|
Copyright (C) 2005 University of Exeter. All Rights Reserved. |
535
|
|
|
|
|
|
|
|
536
|
|
|
|
|
|
|
This program was written as part of the eSTAR project and is free software; |
537
|
|
|
|
|
|
|
you can redistribute it and/or modify it under the terms of the GNU Public |
538
|
|
|
|
|
|
|
License. |
539
|
|
|
|
|
|
|
|
540
|
|
|
|
|
|
|
=head1 AUTHORS |
541
|
|
|
|
|
|
|
|
542
|
|
|
|
|
|
|
Alasdair Allan Eaa@astro.ex.ac.ukE, |
543
|
|
|
|
|
|
|
|
544
|
|
|
|
|
|
|
=cut |
545
|
|
|
|
|
|
|
|
546
|
|
|
|
|
|
|
# L A S T O R D E R S ------------------------------------------------------ |
547
|
|
|
|
|
|
|
|
548
|
|
|
|
|
|
|
1; |