Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93787565
centre.pl
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Dec 1, 12:25
Size
892 B
Mime Type
text/x-perl
Expires
Tue, Dec 3, 12:25 (2 d)
Engine
blob
Format
Raw Data
Handle
22704721
Attached To
R1448 Lenstool-HPC
centre.pl
View Options
#!/usr/bin/perl
# Take catalog and convert the coordinates from absolute to relative
$PI = 3.141592653589793238462643;
$\ = "\n";
open(IN, $ARGV[0]);
if( $ARGV[1] )
{
open($out, '>', $ARGV[1] );
}
else
{
$out = *STDOUT;
}
LINE: while(<IN>)
{
chop;
if( /#REFERENCE/ )
{
($null,$iref,$ra,$dec) = split;
printf $out "#REFERENCE 3 $ra $dec\n" if( $iref == 0);
printf $out "#REFERENCE 0 $ra $dec\n" if( $iref == 3);
next LINE;
}
@fld = split;
if( $iref == 0 )
{
if( $fld[1] < $ra + 180 ) {$fld[1] = $fld[1] - $ra;}
else {$fld[1] = $fld[1] - 360 - $ra; }
$fld[2] -= $dec;
$fld[2] *= 3600.;
$fld[1] *= -3600.*cos($dec*$PI/180.);
}
elsif( $iref == 3 )
{
$fld[1] /= -3600.*cos($dec*$PI/180.);
$fld[1] += $ra;
$fld[2] = $fld[2]/3600. + $dec
}
$fld[1] = sprintf( "%.7f", $fld[1]);
$fld[2] = sprintf( "%.7f", $fld[2]);
printf $out "%s\n", join(" ",@fld);
}
Event Timeline
Log In to Comment