File Coverage

blib/lib/Astro/SolarParallax.pm
Criterion Covered Total %
statement 9 25 36.0
branch n/a
condition 0 3 0.0
subroutine 3 5 60.0
pod 2 2 100.0
total 14 35 40.0


line stmt bran cond sub pod time code
1             package Astro::SolarParallax;
2              
3             #use 5.008003;
4 1     1   23399 use strict;
  1         2  
  1         50  
5 1     1   7 use warnings;
  1         1  
  1         36  
6 1     1   12513 use Math::Trig;
  1         25874  
  1         317  
7              
8             our $VERSION = '0.04';
9              
10              
11             =head1 NAME
12              
13             Astro::SolarParallax - Find the Solar Parallax from Venus Transit
14              
15             =head1 SYNOPSIS
16              
17             use Astro::SolarParallax::Observer;
18             use Astro::SolarParallax;
19             use Geo::Coordinates;
20             my $obs1 = new Geo::Coordinates;
21             my $obs2 = new Geo::Coordinates;
22             $obs1->latitude(78.20); # Longyearbyen
23             $obs1->longitude(15.82);
24             $obs2->latitude(13.7307); # Bangkok
25             $obs2->longitude(100.521);
26             my $observer1 = Astro::SolarParallax::Observer->new($obs1);
27             my $observer2 = Astro::SolarParallax::Observer->new($obs2);
28             # Longyearbyen
29             $observer1->contacttime(1, "07:17:47");
30             $observer1->contacttime(4, "13:21:00");
31             # Bangkok
32             $observer2->contacttime(1, "07:13:07");
33             $observer2->contacttime(4, "13:20:36");
34             my $measurement = Astro::SolarParallax->new($observer1, $observer2);
35             print $measurement->AU(1,4);
36              
37              
38             =head1 DESCRIPTION
39              
40             This module is intended to be used to compute the solar parallax from planetary transits. Specifically, in the current implementation, it makes use of a method developed by F. Mignard, and is limited to the transit of Venus on 2004-06-08.
41              
42             It has a object oriented interface.
43              
44             =over
45              
46             =item C
47              
48             This is the constructor of this class, it takes as argument two observers, that is, two objects of the L class.
49              
50             =cut
51              
52             sub new {
53 0     0 1   my $that = shift;
54 0           my $obs1 = shift;
55 0           my $obs2 = shift;
56 0   0       my $class = ref($that) || $that;
57 0           my $self = {
58             OBS1 => $obs1,
59             OBS2 => $obs2,
60             };
61              
62 0           bless($self, $class);
63 0           return $self;
64             }
65              
66             =item C
67              
68             This method will return the distance to the sun in kilometers, based on the measurements done by the two observers given to the constructor. It takes as argument and array containing the number of the contact points, in ascending order.
69              
70             The constraints in the L apply.
71              
72             =cut
73              
74              
75             sub AU {
76 0     0 1   my $self = shift;
77 0           my @contacts = @_;
78 0           my $deltatref = ${$self}{'OBS2'}->deltatref(@contacts)
  0            
79 0           - ${$self}{'OBS1'}->deltatref(@contacts);
80 0           my $deltatobs = ${$self}{'OBS2'}->deltatobs(@contacts)
  0            
81 0           - ${$self}{'OBS1'}->deltatobs(@contacts);
82 0           return (149.60 * 1000000 * $deltatref->seconds / $deltatobs->seconds);
83             }
84              
85              
86             1;
87             __END__