EranOfek / AstroPack

Astronomy & Astrophysics Software Pacakge
Other
19 stars 4 forks source link

Setting `AstroImage.Mask.MaskData` has WCS side consequences on creating subimages #224

Closed EastEriq closed 1 year ago

EastEriq commented 1 year ago

Continuing from the "not your fault" in #182. My test case:

ff='/raid/enrico/PTF/2ndTake/images/level1/proc/2012/01/07/f11/c0/p5/v1/PTF_201201075069_i_p_scie_t120955_u011063047_f11_p015199_c00.fits';
AI=AstroImage(ff);
%AI.MaskData.Data=zeros(size(AI.Image),'uint32');
AI=imProc.image.image2subimages(AI,2048);
ds9.system('xpaset -p ds9 tile');
for k=1:2
    ds9(AI(k),k,'zoom','to fit')
end

Leaving the third line commented, the sexagesimal FK5 coordinates of the lower left corner of the second subimage are [147.45,69.18] (correct and contiguous to the upper corner of subimage 1).

Uncommenting the third line, they become [147.59, 68.61].

Wrong WCS coordinates lead to subsequent astrometry failures, as complained in #176.

EastEriq commented 1 year ago

The same problem, trivially, is seen using AI.createMask instead of assigning explicitly a matrix.

EastEriq commented 1 year ago

Getting there? Without creating the mask:

>> AI(2).WCS.CRPIX

ans =

       909.84       905.03

Creating a mask:

>> AI(2).WCS.CRPIX

ans =

       909.84        -1132
EranOfek commented 1 year ago

so what was the problem?

On Sun, Aug 27, 2023 at 5:33 PM EastEriq @.***> wrote:

Closed #224 https://github.com/EranOfek/AstroPack/issues/224 as completed.

— Reply to this email directly, view it on GitHub https://github.com/EranOfek/AstroPack/issues/224#event-10201943533, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJUQ4JCQMVVLTNDIFS4L4DXXNLD5ANCNFSM6AAAAAA4AJMUIQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

EastEriq commented 1 year ago
body p { margin-bottom: 0cm; margin-top: 0pt; }

Il 27/08/23 19:00, EranOfek ha scritto:

  so what was the problem? 

that I lost nearly 4 hours to track your bug. See the commit
  referred to.

Message
    ID: ***@***.***>
  [

{ @.": "http://schema.org", @.": "EmailMessage", "potentialAction": { @.": "ViewAction", "target": "https://github.com/EranOfek/AstroPack/issues/224#issuecomment-1694702393", "url": "https://github.com/EranOfek/AstroPack/issues/224#issuecomment-1694702393", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { @.": "Organization", "name": "GitHub", "url": "https://github.com" } } ]