EranOfek / AstroPack

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

wrong application of proper motion in `MatchedSources.addExtMagColor` #415

Closed EastEriq closed 7 months ago

EastEriq commented 7 months ago

I have e.g. the MatchedSources object MS1 in the attached file. If I call MS1.addExtMagColor i get wrong matches, as apparent from

plot(MS1.SrcData.ExtRA,MS1.SrcData.ExtDec,'ro',MS1.Data.RA,MS1.Data.Dec,'b.')

image It turns out that this because of proper motion, which apparently here is applied wrongly (in the first place, I wouldn't expect it to be big and to affect all sources in a field, but what do I know). Indeed the match is correct if I call MS1.addExtMagColor('ApplyPM',false) instead.

matchedsources.mat.gz

EranOfek commented 7 months ago

can you please send me the name of one file on which you execute it so I can try to recreate the problem.

On Sun, Mar 10, 2024 at 10:52 AM EastEriq @.***> wrote:

I have e.g. the MatchedSources object MS1 in the attached file. If I call MS1.addExtMagColor i get wrong matches, as apparent from

plot(MS1.SrcData.ExtRA,MS1.SrcData.ExtDec,'ro',MS1.Data.RA,MS1.Data.Dec,'b.')

image.png (view on web) https://github.com/EranOfek/AstroPack/assets/16066531/27750276-5678-4db8-9116-85bc6bfd5973 It turns out that this because of proper motion, which apparently here is applied wrongly (in the first place, I wouldn't expect it to be big and to affect all sources in a field, but what do I know). Indeed the match is correct if I call MS1.addExtMagColor('ApplyPM',false) instead.

matchedsources.mat.gz https://github.com/EranOfek/AstroPack/files/14549442/matchedsources.mat.gz

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

EastEriq commented 7 months ago

A file is already attached to the issue

EastEriq commented 7 months ago

Hm, probably this happens because in this object MS1.JD=1. If I set

MS1.JD=unique(MS1.Data.JD(~isnan(MS1.Data.JD)))
MS1.addExtMagColor
plot(MS1.SrcData.ExtRA,MS1.SrcData.ExtDec,'ro',MS1.Data.RA,MS1.Data.Dec,'b.')

then the result is consistent: image I remark that I'm concerned with JD already since #409.

EastEriq commented 7 months ago

To say it differently, I don't understand if it is deliberate that MatchedSources.unifiedCatalogsIntoMatched(AstroCatalogs) sets MS.JD=1:N instead of taking, by default, AC.JD.

EranOfek commented 7 months ago

The problem is that the JD property (MS1.JD) does not contain JD, but only an image index. Then, the proper motion was calculated to the year -4712 BC. I added a warning in cases the year<0. To fix it just populate the JD. [dev1 035308ac]

EranOfek commented 7 months ago

Check if it is possible to populate the JD while the MatchedSources is created.