EranOfek / AstroPack

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

read in MovingSource.m fails when the AstCrop is empty #503

Closed saraylet closed 2 weeks ago

saraylet commented 1 month ago

Using the input file: LAST.01.03.04_20230615.174941.304_clear_195+36_001_001_001_sci_merged_Asteroids_1.mat

Running the lines of code:

Fullfile = '/Data1/LASTdata/LASTeroids/LAST.01.03/LAST.01.03.04/LAST.01.03.04_20230615.174941.304_clear_195+36_001_001_001_sci_merged_Asteroids_1.mat';
[PathCount,FileCount,ExtCount] = fileparts(Fullfile); 
MP = MovingSource.read(append(FileCount,ExtCount), 'Path', PathCount, 'PopKA', true);

Results in the following error:

Error using MovingSource.read (line 467)
Unknown content format in file /Data1/LASTdata/LASTeroids/LAST.01.03/LAST.01.03.04/LAST.01.03.04_20230615.174941.304_clear_195+36_001_001_001_sci_merged_Asteroids_1.mat

467                         error('Unknown content format in file %s', FileName);

This error occurs in the file MovingSource.m in the read function (between lines 431 and 469) and is likely due to the fact that the variable Tmp is NOT empty but contains ONLY one EMPTY AstCrop.


      if isempty(Tmp)
          % skip
      else

          if any(strcmp(fieldnames(Tmp), 'AstCrop'))
              Tmp = Tmp.AstCrop;
          end

          if isa(Tmp, 'MovingSource')

          ...

          else
              error('Unknown content format in file %s', FileName);
          end
      end
EranOfek commented 1 month ago

just put the read command inside a try catch block

saraylet commented 1 month ago

When I call it in my own code, I now have it in a try-catch.

Sarah A. Spitzer, Ph.D. (She/Her/Hers)

Zuckerman Scholars Fellow

Weizmann Institute of Science

Department of Particle Physics and Astrophysics

Former Research Fellow

University of Michigan

Solar and Heliospheric Research Group

Department of Climate and Space Sciences & Engineering

!!!!! Please DO NOT SEND confidential, export controlled, or otherwise restricted data or files to this email address. Please contact me to set up a secure file transfer as needed. !!!!!

On Thu, Oct 10, 2024 at 5:59 PM Eran Ofek @.***> wrote:

just put the read command inside a try catch block

— Reply to this email directly, view it on GitHub https://github.com/EranOfek/AstroPack/issues/503#issuecomment-2405369182, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACC7VOMGA2GYU4SPSGGAK4TZ22I5BAVCNFSM6AAAAABPW6PGVCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMBVGM3DSMJYGI . You are receiving this because you authored the thread.Message ID: @.***>

EranOfek commented 2 weeks ago

fixed. [dev1 04d53f772]