| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Astro::Correlate; | 
| 2 |  |  |  |  |  |  |  | 
| 3 |  |  |  |  |  |  | =head1 NAME | 
| 4 |  |  |  |  |  |  |  | 
| 5 |  |  |  |  |  |  | Astro::Correlate - Class for cross-correlating astronomical catalogues. | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | use Astro::Correlate; | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | my $corr = new Astro::Correlate( catalog1 => $cat1, | 
| 12 |  |  |  |  |  |  | catalog2 => $cat2, | 
| 13 |  |  |  |  |  |  | method => 'FINDOFF' ); | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | $result = $corr->correlate; | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | Class for cross-correlating astronomical catalogues. | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  | =cut | 
| 22 |  |  |  |  |  |  |  | 
| 23 | 1 |  |  | 1 |  | 3485 | use 5.006; | 
|  | 1 |  |  |  |  | 5 |  | 
|  | 1 |  |  |  |  | 55 |  | 
| 24 | 1 |  |  | 1 |  | 6 | use strict; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 41 |  | 
| 25 | 1 |  |  | 1 |  | 16 | use warnings; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 58 |  | 
| 26 | 1 |  |  | 1 |  | 6 | use warnings::register; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 178 |  | 
| 27 | 1 |  |  | 1 |  | 6 | use Carp; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 86 |  | 
| 28 | 1 |  |  | 1 |  | 1466 | use File::Temp qw/ tempdir /; | 
|  | 1 |  |  |  |  | 31228 |  | 
|  | 1 |  |  |  |  | 1241 |  | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | our $VERSION = '1.0'; | 
| 31 |  |  |  |  |  |  |  | 
| 32 |  |  |  |  |  |  | =head1 METHODS | 
| 33 |  |  |  |  |  |  |  | 
| 34 |  |  |  |  |  |  | =head2 CONSTRUCTOR | 
| 35 |  |  |  |  |  |  |  | 
| 36 |  |  |  |  |  |  | =over 4 | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | =item B | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | Create a new instance of an C object. | 
| 41 |  |  |  |  |  |  |  | 
| 42 |  |  |  |  |  |  | $corr = new Astro::Correlate( catalog1 => $cat1, | 
| 43 |  |  |  |  |  |  | catalog2 => $cat2 ); | 
| 44 |  |  |  |  |  |  |  | 
| 45 |  |  |  |  |  |  | The two mandatory named arguments must be defined and must be | 
| 46 |  |  |  |  |  |  | C objects. Both catalogs must be comparable -- | 
| 47 |  |  |  |  |  |  | the C objects in those catalogs must have | 
| 48 |  |  |  |  |  |  | x/y or RA/Dec defined, or be able to calculate one from the other | 
| 49 |  |  |  |  |  |  | using a C FrameSet. | 
| 50 |  |  |  |  |  |  |  | 
| 51 |  |  |  |  |  |  | =cut | 
| 52 |  |  |  |  |  |  |  | 
| 53 |  |  |  |  |  |  | sub new { | 
| 54 | 0 |  |  | 0 | 1 |  | my $proto = shift; | 
| 55 | 0 |  | 0 |  |  |  | my $class = ref( $proto ) || $proto; | 
| 56 |  |  |  |  |  |  |  | 
| 57 | 0 |  |  |  |  |  | my %args = @_; | 
| 58 |  |  |  |  |  |  |  | 
| 59 | 0 | 0 | 0 |  |  |  | if( ! defined( $args{'catalog1'} ) || | 
|  |  |  | 0 |  |  |  |  | 
|  |  |  | 0 |  |  |  |  | 
| 60 |  |  |  |  |  |  | ! UNIVERSAL::isa( $args{'catalog1'}, "Astro::Catalog" ) || | 
| 61 |  |  |  |  |  |  | ! defined( $args{'catalog2'} ) || | 
| 62 |  |  |  |  |  |  | ! UNIVERSAL::isa( $args{'catalog2'}, "Astro::Catalog" ) ) { | 
| 63 | 0 |  |  |  |  |  | croak "Must supply two Astro::Catalog objects to Astro::Correlate constructor.\n"; | 
| 64 |  |  |  |  |  |  | } | 
| 65 |  |  |  |  |  |  |  | 
| 66 |  |  |  |  |  |  | # Create the object. | 
| 67 | 0 |  |  |  |  |  | my $corr = {}; | 
| 68 | 0 |  |  |  |  |  | bless( $corr, $class ); | 
| 69 |  |  |  |  |  |  |  | 
| 70 |  |  |  |  |  |  | # Configure the object. | 
| 71 | 0 |  |  |  |  |  | $corr->_configure( \%args ); | 
| 72 |  |  |  |  |  |  |  | 
| 73 |  |  |  |  |  |  | # Set up default options. | 
| 74 | 0 | 0 |  |  |  |  | $corr->keeptemps( 0 ) if ( ! defined( $corr->keeptemps ) ); | 
| 75 | 0 | 0 |  |  |  |  | $corr->messages( 0 ) if ( ! defined( $corr->messages ) ); | 
| 76 | 0 | 0 |  |  |  |  | $corr->timeout( 60 ) if ( ! defined( $corr->timeout ) ); | 
| 77 | 0 | 0 |  |  |  |  | $corr->temp( tempdir( CLEANUP => ( ! $corr->keeptemps ) ) ) if ( ! defined( $corr->temp ) ); | 
| 78 |  |  |  |  |  |  |  | 
| 79 |  |  |  |  |  |  | # And return the object. | 
| 80 | 0 |  |  |  |  |  | return $corr; | 
| 81 |  |  |  |  |  |  | } | 
| 82 |  |  |  |  |  |  |  | 
| 83 |  |  |  |  |  |  | =back | 
| 84 |  |  |  |  |  |  |  | 
| 85 |  |  |  |  |  |  | =head2 Accessor Methods | 
| 86 |  |  |  |  |  |  |  | 
| 87 |  |  |  |  |  |  | =over 4 | 
| 88 |  |  |  |  |  |  |  | 
| 89 |  |  |  |  |  |  | =item B | 
| 90 |  |  |  |  |  |  |  | 
| 91 |  |  |  |  |  |  | Return or set the first catalogue used for correlation. | 
| 92 |  |  |  |  |  |  |  | 
| 93 |  |  |  |  |  |  | my $catalog = $corr->catalog1; | 
| 94 |  |  |  |  |  |  | $corr->catalog1( $catalog ); | 
| 95 |  |  |  |  |  |  |  | 
| 96 |  |  |  |  |  |  | Returns an C object. | 
| 97 |  |  |  |  |  |  |  | 
| 98 |  |  |  |  |  |  | =cut | 
| 99 |  |  |  |  |  |  |  | 
| 100 |  |  |  |  |  |  | sub catalog1 { | 
| 101 | 0 |  |  | 0 | 1 |  | my $self = shift; | 
| 102 | 0 | 0 |  |  |  |  | if( @_ ) { | 
| 103 | 0 |  |  |  |  |  | my $cat = shift; | 
| 104 | 0 | 0 |  |  |  |  | if( UNIVERSAL::isa( $cat, "Astro::Catalog" ) ) { | 
| 105 | 0 |  |  |  |  |  | $self->{CATALOG1} = $cat; | 
| 106 |  |  |  |  |  |  | } | 
| 107 |  |  |  |  |  |  | } | 
| 108 | 0 |  |  |  |  |  | return $self->{CATALOG1}; | 
| 109 |  |  |  |  |  |  | } | 
| 110 |  |  |  |  |  |  |  | 
| 111 |  |  |  |  |  |  | =item B | 
| 112 |  |  |  |  |  |  |  | 
| 113 |  |  |  |  |  |  | Return or set the second catalogue used for correlation. | 
| 114 |  |  |  |  |  |  |  | 
| 115 |  |  |  |  |  |  | my $catalog = $corr->catalog2; | 
| 116 |  |  |  |  |  |  | $corr->catalog2( $catalog ); | 
| 117 |  |  |  |  |  |  |  | 
| 118 |  |  |  |  |  |  | Returns an C object. | 
| 119 |  |  |  |  |  |  |  | 
| 120 |  |  |  |  |  |  | =cut | 
| 121 |  |  |  |  |  |  |  | 
| 122 |  |  |  |  |  |  | sub catalog2 { | 
| 123 | 0 |  |  | 0 | 1 |  | my $self = shift; | 
| 124 | 0 | 0 |  |  |  |  | if( @_ ) { | 
| 125 | 0 |  |  |  |  |  | my $cat = shift; | 
| 126 | 0 | 0 |  |  |  |  | if( UNIVERSAL::isa( $cat, "Astro::Catalog" ) ) { | 
| 127 | 0 |  |  |  |  |  | $self->{CATALOG2} = $cat; | 
| 128 |  |  |  |  |  |  | } | 
| 129 |  |  |  |  |  |  | } | 
| 130 | 0 |  |  |  |  |  | return $self->{CATALOG2}; | 
| 131 |  |  |  |  |  |  | } | 
| 132 |  |  |  |  |  |  |  | 
| 133 |  |  |  |  |  |  | =item B | 
| 134 |  |  |  |  |  |  |  | 
| 135 |  |  |  |  |  |  | The magnitude type to use for the first catalogue. | 
| 136 |  |  |  |  |  |  |  | 
| 137 |  |  |  |  |  |  | my $magtype = $corr->cat1magtype; | 
| 138 |  |  |  |  |  |  | $corr->cat1magtype( 'mag_iso' ); | 
| 139 |  |  |  |  |  |  |  | 
| 140 |  |  |  |  |  |  | This is used for Astro::Catalog::Item objects that have Astro::Flux | 
| 141 |  |  |  |  |  |  | measurements that are not standard magnitudes, and for correlation | 
| 142 |  |  |  |  |  |  | methods that require a measure of object brightness for optimizations | 
| 143 |  |  |  |  |  |  | like the RITMatch method. If this is not defined, it will default to | 
| 144 |  |  |  |  |  |  | 'mag'. | 
| 145 |  |  |  |  |  |  |  | 
| 146 |  |  |  |  |  |  | =cut | 
| 147 |  |  |  |  |  |  |  | 
| 148 |  |  |  |  |  |  | sub cat1magtype { | 
| 149 | 0 |  |  | 0 | 1 |  | my $self = shift; | 
| 150 | 0 | 0 |  |  |  |  | if( @_ ) { | 
| 151 | 0 |  |  |  |  |  | my $magtype = shift; | 
| 152 | 0 |  |  |  |  |  | $self->{CAT1MAGTYPE} = $magtype; | 
| 153 |  |  |  |  |  |  | } | 
| 154 | 0 |  |  |  |  |  | return $self->{CAT1MAGTYPE}; | 
| 155 |  |  |  |  |  |  | } | 
| 156 |  |  |  |  |  |  |  | 
| 157 |  |  |  |  |  |  | =item B | 
| 158 |  |  |  |  |  |  |  | 
| 159 |  |  |  |  |  |  | The magnitude type to use for the second catalogue. | 
| 160 |  |  |  |  |  |  |  | 
| 161 |  |  |  |  |  |  | my $magtype = $corr->cat2magtype; | 
| 162 |  |  |  |  |  |  | $corr->cat2magtype( 'mag_iso' ); | 
| 163 |  |  |  |  |  |  |  | 
| 164 |  |  |  |  |  |  | As for cat1magtype(), but for the second catalogue. | 
| 165 |  |  |  |  |  |  |  | 
| 166 |  |  |  |  |  |  | =cut | 
| 167 |  |  |  |  |  |  |  | 
| 168 |  |  |  |  |  |  | sub cat2magtype { | 
| 169 | 0 |  |  | 0 | 1 |  | my $self = shift; | 
| 170 | 0 | 0 |  |  |  |  | if( @_ ) { | 
| 171 | 0 |  |  |  |  |  | my $magtype = shift; | 
| 172 | 0 |  |  |  |  |  | $self->{CAT2MAGTYPE} = $magtype; | 
| 173 |  |  |  |  |  |  | } | 
| 174 | 0 |  |  |  |  |  | return $self->{CAT2MAGTYPE}; | 
| 175 |  |  |  |  |  |  | } | 
| 176 |  |  |  |  |  |  |  | 
| 177 |  |  |  |  |  |  | =item B | 
| 178 |  |  |  |  |  |  |  | 
| 179 |  |  |  |  |  |  | Whether or not to keep temporary files after processing is completed. | 
| 180 |  |  |  |  |  |  |  | 
| 181 |  |  |  |  |  |  | my $keeptemps = $corr->keeptemps; | 
| 182 |  |  |  |  |  |  | $corr->keeptemps( 1 ); | 
| 183 |  |  |  |  |  |  |  | 
| 184 |  |  |  |  |  |  | Temporary files are created in a temporary directory that is reported | 
| 185 |  |  |  |  |  |  | during execution. The location of this temporary directory can be | 
| 186 |  |  |  |  |  |  | controlled using the C method. | 
| 187 |  |  |  |  |  |  |  | 
| 188 |  |  |  |  |  |  | This parameter defaults to false, so all temporary files are deleted | 
| 189 |  |  |  |  |  |  | after processing. | 
| 190 |  |  |  |  |  |  |  | 
| 191 |  |  |  |  |  |  | =cut | 
| 192 |  |  |  |  |  |  |  | 
| 193 |  |  |  |  |  |  | sub keeptemps { | 
| 194 | 0 |  |  | 0 | 1 |  | my $self = shift; | 
| 195 | 0 | 0 |  |  |  |  | if( @_ ) { | 
| 196 | 0 |  |  |  |  |  | my $keeptemps = shift; | 
| 197 | 0 |  |  |  |  |  | $self->{KEEPTEMPS} = $keeptemps; | 
| 198 |  |  |  |  |  |  | } | 
| 199 | 0 |  |  |  |  |  | return $self->{KEEPTEMPS}; | 
| 200 |  |  |  |  |  |  | } | 
| 201 |  |  |  |  |  |  |  | 
| 202 |  |  |  |  |  |  | =item B | 
| 203 |  |  |  |  |  |  |  | 
| 204 |  |  |  |  |  |  | Whether or not to display messages from the correlation task while | 
| 205 |  |  |  |  |  |  | processing. | 
| 206 |  |  |  |  |  |  |  | 
| 207 |  |  |  |  |  |  | my $messages = $corr->messages; | 
| 208 |  |  |  |  |  |  | $corr->messages( 1 ); | 
| 209 |  |  |  |  |  |  |  | 
| 210 |  |  |  |  |  |  | If set to true, then messages from the correlation task will be | 
| 211 |  |  |  |  |  |  | printed. | 
| 212 |  |  |  |  |  |  |  | 
| 213 |  |  |  |  |  |  | Defaults to false. | 
| 214 |  |  |  |  |  |  |  | 
| 215 |  |  |  |  |  |  | =cut | 
| 216 |  |  |  |  |  |  |  | 
| 217 |  |  |  |  |  |  | sub messages { | 
| 218 | 0 |  |  | 0 | 1 |  | my $self = shift; | 
| 219 | 0 | 0 |  |  |  |  | if( @_ ) { | 
| 220 | 0 |  |  |  |  |  | my $messages = shift; | 
| 221 | 0 |  |  |  |  |  | $self->{MESSAGES} = $messages; | 
| 222 |  |  |  |  |  |  | } | 
| 223 | 0 |  |  |  |  |  | return $self->{MESSAGES}; | 
| 224 |  |  |  |  |  |  | } | 
| 225 |  |  |  |  |  |  |  | 
| 226 |  |  |  |  |  |  | =item B | 
| 227 |  |  |  |  |  |  |  | 
| 228 |  |  |  |  |  |  | Retrieve or set the method to be used for correlation. | 
| 229 |  |  |  |  |  |  |  | 
| 230 |  |  |  |  |  |  | my $method = $corr->method; | 
| 231 |  |  |  |  |  |  | $corr->method( 'FINDOFF' ); | 
| 232 |  |  |  |  |  |  |  | 
| 233 |  |  |  |  |  |  | The method is case-sensitive. | 
| 234 |  |  |  |  |  |  |  | 
| 235 |  |  |  |  |  |  | =cut | 
| 236 |  |  |  |  |  |  |  | 
| 237 |  |  |  |  |  |  | sub method { | 
| 238 | 0 |  |  | 0 | 1 |  | my $self = shift; | 
| 239 | 0 | 0 |  |  |  |  | if( @_ ) { | 
| 240 | 0 |  |  |  |  |  | my $method = shift; | 
| 241 | 0 |  |  |  |  |  | $self->{METHOD} = $method; | 
| 242 |  |  |  |  |  |  | } | 
| 243 | 0 |  |  |  |  |  | return $self->{METHOD}; | 
| 244 |  |  |  |  |  |  | } | 
| 245 |  |  |  |  |  |  |  | 
| 246 |  |  |  |  |  |  | =item B | 
| 247 |  |  |  |  |  |  |  | 
| 248 |  |  |  |  |  |  | Retrieve or set the directory to be used for temporary files. | 
| 249 |  |  |  |  |  |  |  | 
| 250 |  |  |  |  |  |  | my $temp = $corr->temp; | 
| 251 |  |  |  |  |  |  | $corr->temp( '/tmp' ); | 
| 252 |  |  |  |  |  |  |  | 
| 253 |  |  |  |  |  |  | If undef (which is the default), a temporary directory will be | 
| 254 |  |  |  |  |  |  | created using C. | 
| 255 |  |  |  |  |  |  |  | 
| 256 |  |  |  |  |  |  | =cut | 
| 257 |  |  |  |  |  |  |  | 
| 258 |  |  |  |  |  |  | sub temp { | 
| 259 | 0 |  |  | 0 | 1 |  | my $self = shift; | 
| 260 | 0 | 0 |  |  |  |  | if( @_ ) { | 
| 261 | 0 |  |  |  |  |  | my $temp = shift; | 
| 262 | 0 |  |  |  |  |  | $self->{TEMP} = $temp; | 
| 263 |  |  |  |  |  |  | } | 
| 264 | 0 | 0 |  |  |  |  | if( ! defined( $self->{TEMP} ) ) { | 
| 265 | 0 | 0 |  |  |  |  | $self->{TEMP} = tempdir( CLEANUP => ( defined( $self->keeptemps ) | 
| 266 |  |  |  |  |  |  | ? ! $self->keeptemps | 
| 267 |  |  |  |  |  |  | : 1 ) ); | 
| 268 |  |  |  |  |  |  | } | 
| 269 | 0 |  |  |  |  |  | return $self->{TEMP}; | 
| 270 |  |  |  |  |  |  | } | 
| 271 |  |  |  |  |  |  |  | 
| 272 |  |  |  |  |  |  | =item B | 
| 273 |  |  |  |  |  |  |  | 
| 274 |  |  |  |  |  |  | Retrieve or set the timeout. | 
| 275 |  |  |  |  |  |  |  | 
| 276 |  |  |  |  |  |  | my $timeout = $corr->timeout; | 
| 277 |  |  |  |  |  |  | $corr->timeout( 120 ); | 
| 278 |  |  |  |  |  |  |  | 
| 279 |  |  |  |  |  |  | Time is in seconds and defaults to 60. | 
| 280 |  |  |  |  |  |  |  | 
| 281 |  |  |  |  |  |  | =cut | 
| 282 |  |  |  |  |  |  |  | 
| 283 |  |  |  |  |  |  | sub timeout { | 
| 284 | 0 |  |  | 0 | 1 |  | my $self = shift; | 
| 285 | 0 | 0 |  |  |  |  | if( @_ ) { | 
| 286 | 0 |  |  |  |  |  | my $timeout = shift; | 
| 287 | 0 |  |  |  |  |  | $self->{TIMEOUT} = $timeout; | 
| 288 |  |  |  |  |  |  | } | 
| 289 | 0 |  |  |  |  |  | return $self->{TIMEOUT}; | 
| 290 |  |  |  |  |  |  | } | 
| 291 |  |  |  |  |  |  |  | 
| 292 |  |  |  |  |  |  | =item B | 
| 293 |  |  |  |  |  |  |  | 
| 294 |  |  |  |  |  |  | Retrieve or set the verbosity level. | 
| 295 |  |  |  |  |  |  |  | 
| 296 |  |  |  |  |  |  | my $verbose = $corr->verbose; | 
| 297 |  |  |  |  |  |  | $corr->verbose( 1 ); | 
| 298 |  |  |  |  |  |  |  | 
| 299 |  |  |  |  |  |  | If set to true, then much output will be output to STD_ERR. Defaults to false. | 
| 300 |  |  |  |  |  |  |  | 
| 301 |  |  |  |  |  |  | =cut | 
| 302 |  |  |  |  |  |  |  | 
| 303 |  |  |  |  |  |  | sub verbose { | 
| 304 | 0 |  |  | 0 | 1 |  | my $self = shift; | 
| 305 | 0 | 0 |  |  |  |  | if( @_ ) { | 
| 306 | 0 |  |  |  |  |  | my $verbose = shift; | 
| 307 | 0 |  |  |  |  |  | $self->{VERBOSE} = $verbose; | 
| 308 |  |  |  |  |  |  | } | 
| 309 | 0 |  |  |  |  |  | return $self->{VERBOSE}; | 
| 310 |  |  |  |  |  |  | } | 
| 311 |  |  |  |  |  |  |  | 
| 312 |  |  |  |  |  |  | =back | 
| 313 |  |  |  |  |  |  |  | 
| 314 |  |  |  |  |  |  | =head2 General Methods | 
| 315 |  |  |  |  |  |  |  | 
| 316 |  |  |  |  |  |  | =over 4 | 
| 317 |  |  |  |  |  |  |  | 
| 318 |  |  |  |  |  |  | =item B | 
| 319 |  |  |  |  |  |  |  | 
| 320 |  |  |  |  |  |  | Cross-correlates two catalogues using the supplied method. | 
| 321 |  |  |  |  |  |  |  | 
| 322 |  |  |  |  |  |  | ( $corrcat1, $corrcat2 ) = $corr->correlate; | 
| 323 |  |  |  |  |  |  |  | 
| 324 |  |  |  |  |  |  | This method returns two catalogues, both containing stars that matched | 
| 325 |  |  |  |  |  |  | in the two catalogues passed to the constructor. The returned catalogues | 
| 326 |  |  |  |  |  |  | are C objects, and each matched C | 
| 327 |  |  |  |  |  |  | object has the same ID number in either catalogue. | 
| 328 |  |  |  |  |  |  |  | 
| 329 |  |  |  |  |  |  | =cut | 
| 330 |  |  |  |  |  |  |  | 
| 331 |  |  |  |  |  |  | sub correlate { | 
| 332 | 0 |  |  | 0 | 1 |  | my $self = shift; | 
| 333 |  |  |  |  |  |  |  | 
| 334 | 0 | 0 |  |  |  |  | if( ! defined( $self->method ) ) { | 
| 335 | 0 |  |  |  |  |  | croak "Must supply cross-correlation method"; | 
| 336 |  |  |  |  |  |  | } | 
| 337 |  |  |  |  |  |  |  | 
| 338 |  |  |  |  |  |  | # Find out what the cross-correlation class is called. | 
| 339 | 0 |  |  |  |  |  | my $corrclass = _load_corr_plugin( $self->method ); | 
| 340 | 0 | 0 |  |  |  |  | if( ! defined( $corrclass ) ) { | 
| 341 | 0 |  |  |  |  |  | croak "Could not load cross-correlation method class for " . $self->method . " method"; | 
| 342 |  |  |  |  |  |  | } | 
| 343 |  |  |  |  |  |  |  | 
| 344 |  |  |  |  |  |  | # Set up the correlated catalogues. | 
| 345 | 0 |  |  |  |  |  | my $corrcat1; | 
| 346 |  |  |  |  |  |  | my $corrcat2; | 
| 347 |  |  |  |  |  |  |  | 
| 348 |  |  |  |  |  |  | # And do the correlation. | 
| 349 | 0 |  |  |  |  |  | ( $corrcat1, $corrcat2 ) = $corrclass->correlate( catalog1 => $self->catalog1, | 
| 350 |  |  |  |  |  |  | catalog2 => $self->catalog2, | 
| 351 |  |  |  |  |  |  | cat1magtype => $self->cat1magtype, | 
| 352 |  |  |  |  |  |  | cat2magtype => $self->cat2magtype, | 
| 353 |  |  |  |  |  |  | keeptemps => $self->keeptemps, | 
| 354 |  |  |  |  |  |  | messages => $self->messages, | 
| 355 |  |  |  |  |  |  | temp => $self->temp, | 
| 356 |  |  |  |  |  |  | timeout => $self->timeout, | 
| 357 |  |  |  |  |  |  | verbose => $self->verbose ); | 
| 358 |  |  |  |  |  |  |  | 
| 359 |  |  |  |  |  |  | # Return the correlated catalogues; | 
| 360 | 0 |  |  |  |  |  | return( $corrcat1, $corrcat2 ); | 
| 361 |  |  |  |  |  |  | } | 
| 362 |  |  |  |  |  |  |  | 
| 363 |  |  |  |  |  |  | =back | 
| 364 |  |  |  |  |  |  |  | 
| 365 |  |  |  |  |  |  | =begin __PRIVATE_METHODS__ | 
| 366 |  |  |  |  |  |  |  | 
| 367 |  |  |  |  |  |  | =head2 Private Methods | 
| 368 |  |  |  |  |  |  |  | 
| 369 |  |  |  |  |  |  | The following methods are private to the module. | 
| 370 |  |  |  |  |  |  |  | 
| 371 |  |  |  |  |  |  | =over 4 | 
| 372 |  |  |  |  |  |  |  | 
| 373 |  |  |  |  |  |  | =item B<_configure> | 
| 374 |  |  |  |  |  |  |  | 
| 375 |  |  |  |  |  |  | Configures the object. | 
| 376 |  |  |  |  |  |  |  | 
| 377 |  |  |  |  |  |  | $auto->_configure( $args ); | 
| 378 |  |  |  |  |  |  |  | 
| 379 |  |  |  |  |  |  | Takes one argument, a hash reference. The hash contains key/value pairs | 
| 380 |  |  |  |  |  |  | that correspond to the various accessor methods of this module. | 
| 381 |  |  |  |  |  |  |  | 
| 382 |  |  |  |  |  |  | =cut | 
| 383 |  |  |  |  |  |  |  | 
| 384 |  |  |  |  |  |  | sub _configure { | 
| 385 | 0 |  |  | 0 |  |  | my $self = shift; | 
| 386 | 0 |  |  |  |  |  | my $args = shift; | 
| 387 |  |  |  |  |  |  |  | 
| 388 | 0 |  |  |  |  |  | foreach my $key ( keys %$args ) { | 
| 389 | 0 | 0 |  |  |  |  | if( $self->can( $key ) ) { | 
| 390 | 0 |  |  |  |  |  | $self->$key( $args->{$key} ); | 
| 391 |  |  |  |  |  |  | } | 
| 392 |  |  |  |  |  |  | } | 
| 393 |  |  |  |  |  |  | } | 
| 394 |  |  |  |  |  |  |  | 
| 395 |  |  |  |  |  |  | =item B<_load_corr_plugin> | 
| 396 |  |  |  |  |  |  |  | 
| 397 |  |  |  |  |  |  | Loads a correlation plugin module. | 
| 398 |  |  |  |  |  |  |  | 
| 399 |  |  |  |  |  |  | $class = _load_corr_plugin( $method ); | 
| 400 |  |  |  |  |  |  |  | 
| 401 |  |  |  |  |  |  | Returns the class name on successful load. If the class cannot be | 
| 402 |  |  |  |  |  |  | found or loaded, issues a warning and returns undef. | 
| 403 |  |  |  |  |  |  |  | 
| 404 |  |  |  |  |  |  | =cut | 
| 405 |  |  |  |  |  |  |  | 
| 406 |  |  |  |  |  |  | sub _load_corr_plugin { | 
| 407 | 0 |  |  | 0 |  |  | my $method = shift; | 
| 408 |  |  |  |  |  |  |  | 
| 409 |  |  |  |  |  |  | # Set the class name. | 
| 410 | 0 |  |  |  |  |  | my $class = "Astro::Correlate::Method::$method"; | 
| 411 |  |  |  |  |  |  |  | 
| 412 |  |  |  |  |  |  | # Eval the class to see if it loads, issuing a warning | 
| 413 |  |  |  |  |  |  | # if it fails. | 
| 414 | 0 |  |  |  |  |  | eval "use $class;"; | 
| 415 | 0 | 0 |  |  |  |  | if( $@ ) { | 
| 416 | 0 |  |  |  |  |  | warnings::warnif( "Error loading correlation plugin module $class: $@" ); | 
| 417 | 0 |  |  |  |  |  | return undef; | 
| 418 |  |  |  |  |  |  | } | 
| 419 |  |  |  |  |  |  |  | 
| 420 | 0 |  |  |  |  |  | return $class; | 
| 421 |  |  |  |  |  |  | } | 
| 422 |  |  |  |  |  |  |  | 
| 423 |  |  |  |  |  |  | =back | 
| 424 |  |  |  |  |  |  |  | 
| 425 |  |  |  |  |  |  | =end __PRIVATE_METHODS__ | 
| 426 |  |  |  |  |  |  |  | 
| 427 |  |  |  |  |  |  | =head1 REVISION | 
| 428 |  |  |  |  |  |  |  | 
| 429 |  |  |  |  |  |  | $Id$ | 
| 430 |  |  |  |  |  |  |  | 
| 431 |  |  |  |  |  |  | =head1 AUTHORS | 
| 432 |  |  |  |  |  |  |  | 
| 433 |  |  |  |  |  |  | Brad Cavanagh | 
| 434 |  |  |  |  |  |  |  | 
| 435 |  |  |  |  |  |  | =head1 COPYRIGHT | 
| 436 |  |  |  |  |  |  |  | 
| 437 |  |  |  |  |  |  | Copyright (C) 2005-2006 Particle Physics and Astronomy Research Council. | 
| 438 |  |  |  |  |  |  | All Rights Reserved. | 
| 439 |  |  |  |  |  |  |  | 
| 440 |  |  |  |  |  |  | This program is free software; you can redistribute it and/or modify it under | 
| 441 |  |  |  |  |  |  | the terms of the GNU General Public License as published by the Free Software | 
| 442 |  |  |  |  |  |  | Foundation; either version 2 of the License, or (at your option) any later | 
| 443 |  |  |  |  |  |  | version. | 
| 444 |  |  |  |  |  |  |  | 
| 445 |  |  |  |  |  |  | This program is distributed in the hope that it will be useful,but WITHOUT ANY | 
| 446 |  |  |  |  |  |  | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A | 
| 447 |  |  |  |  |  |  | PARTICULAR PURPOSE. See the GNU General Public License for more details. | 
| 448 |  |  |  |  |  |  |  | 
| 449 |  |  |  |  |  |  | You should have received a copy of the GNU General Public License along with | 
| 450 |  |  |  |  |  |  | this program; if not, write to the Free Software Foundation, Inc., 59 Temple | 
| 451 |  |  |  |  |  |  | Place,Suite 330, Boston, MA  02111-1307, USA | 
| 452 |  |  |  |  |  |  |  | 
| 453 |  |  |  |  |  |  | =cut | 
| 454 |  |  |  |  |  |  |  | 
| 455 |  |  |  |  |  |  | 1; |