IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 26186


Ignore:
Timestamp:
Nov 18, 2009, 1:10:03 PM (16 years ago)
Author:
Paul Price
Message:

Fix division by zero.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippScripts/scripts/magic_tree.pl

    r26183 r26186  
    158158
    159159    # Relative coordinates of centre of the field
    160     my $x = $naxis1 - $crpix1;
    161     my $y = $naxis2 - $crpix2;
     160    my $x = $naxis1/2 - $crpix1;
     161    my $y = $naxis2/2 - $crpix2;
    162162
    163163    # Coordinates on tangent plane
     
    168168
    169169    # Coordinates on rotated celestial sphere
    170     my $phi = atan2($eta,$xi) + pi/2;
    171     my $denominator = sqrt($xi**2 + $eta**2);
    172     &my_die("denominator is zero!!", $magic_id, $PS_EXIT_PROG_ERROR) if $denominator == 0;
    173 
    174     my $theta = atan(180 / pi / $denominator);
     170    my ($phi, $theta);
     171    if ($xi == 0 and $eta == 0) {
     172        $phi = 0;
     173        $eta = 0;
     174    } else {
     175        $phi = atan2($eta,$xi) + pi/2;
     176        my $denominator = sqrt($xi**2 + $eta**2);
     177        &my_die("denominator is zero!!", $magic_id, $PS_EXIT_PROG_ERROR) if $denominator == 0;
     178        $theta = atan(180 / pi / $denominator);
     179    }
    175180
    176181    # Coordinates on celestial sphere
Note: See TracChangeset for help on using the changeset viewer.