EranOfek / AstroPack

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

Issue with MovingSource.selectGoodCand and MovingSource.nearestKnownAst when multiple known asteroid matches are found #507

Closed saraylet closed 2 weeks ago

saraylet commented 1 month ago

When reaching the file: LAST.01.05.01_20231107.004241.796_clear_WD0333_161_001_001_sci_merged_Asteroids_1.mat

using the following lines of code:

MP = MovingSource.read([], 'Path', Path, 'PopKA', true, 'IndDirStart', Count, 'MaxNdir', Count, 'AstFileTemp', AstFileTemp);
FC = MP.selectGoodCand();

The following error results from MovingSource.selectGoodCand when MovingSource.nearestKnownAst is called:


Unable to perform assignment because the left and right sides have a different number of elements.

Error in MovingSource/nearestKnownAst (line 791)
                    Dist(Iobj) = Obj(Iobj).KnownAst.Table.Dist;

Error in MovingSource/selectGoodCand (line 919)
            [Dist, Mag]   = Obj.nearestKnownAst();

This appears to be because index 5 (ie. when Iobj = 5) in MP (or in Obj) has 2 known asteroid candidates in the table:

K>> Iobj

Iobj =

     5

K>> Obj(Iobj).KnownAst.Table

ans =

  2×11 table

        JD          RA       Dec        R       Delta      SOT      STO       TSO       Mag         Desig        Dist 
    __________    ______    ______    ______    ______    _____    ______    ______    ______    ___________    ______

    2.4603e+06      52.2    18.694    2.3677    1.3861    169.5    4.3747    6.1235    16.658    "1999 WL11"    4.3731
    2.4603e+06    52.197    18.693    2.2764    1.2946    169.5    4.5494    5.9463    22.073    "2009 HJ23"    5.2474

K>> Obj(Iobj).KnownAst.Table.Dist

ans =

       4.3731
       5.2474
EranOfek commented 2 weeks ago

Bug fixed. Now, nearestKnonAst selects only the nearest. [dev1 3324024b7]