#287 PDL::Transform::map output FITS header is slightly wrong

closed-fixed
other (94)
8
2011-11-20
2011-10-25
Derek Lamb
No

use PDL::Transform;
$m51 = rfits('m51.fits');
$m51_match = $m51->match();
p all($m51 == $m51_match)
1
##that is correct

p pdl(0,0)->apply(t_fits($m51))
[-1.815 -1.91]
pdl(0,0)->apply(t_fits($m51_match))
[-1.8164 -1.9114]
##that is not correct

The call to match should be a very expensive no-op. It just calls the identity transform, scaling the output to be the same dimensions as the input, and uses the sampling method since $m51 is a Long. The data in the piddles is identical, which is good, but the FITS header of the $m51_match has different CRVALs and CRPIXs than the input, so precise image alignment between the two in scientific coordinates doesn't work.

Marking as low priority since the errors are very small, and this doesn't affect the actual data values.

Discussion

  • Chris Marshall

    Chris Marshall - 2011-11-12
    • priority: 3 --> 8
     
  • Craig DeForest

    Craig DeForest - 2011-11-20

    Working this now.

    The problem appears to be with the autoscaler, which (as advertised) *approximates* an exact match. I'll try to fix it up.

    Incidentally, the all-data-values-the-same result is correct for the m51 image - it is type long, which is an integer type -- so the match call (which really just calls map under the hood) defaults to sampling. Since the pixel center coordinates don't shift by more than CDELT/2, the resampled pixels just sample the original pixel locations. The more sophisticated interpolation schemes (even linear) wouldn't yield the same result.

     
  • Craig DeForest

    Craig DeForest - 2011-11-20

    Fixed in git -- thanks to Derek for finding this. It was a long-standing operation order error in the autoscaling code (an offset by 0.5 pixel to get from center to corner should have happened after scaling for a subsampled grid of pixels -- it was happening before, so the half-pixel offset was being scaled by the subsampling coefficient.)

     
  • Craig DeForest

    Craig DeForest - 2011-11-20
    • status: open --> closed-fixed
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks