0

Suppose I have three fits images (file1.fits, file2.fits, and file3.fits).The middle one(file2.fits) is a bad image. When i run imheader it shows ![result]

file1.fits[1092,736][ushort]: bias

file2.fits[1092,736][ushort]: ASAS135406

file3.fits[1092,736][ushort]: flat

But when i run imstat it shows Result

ERROR: Pixel storage file is truncated (file2.fits)

It gave the result for the first image, but the execution stops as soon as it encounters a bad file. How to ignore the bad file and continue the execution

  • It sounds like you have two choices: 1) download the source code for imstat and modify it so that it continues,or 2) write a little shell script that calls imstat for one file at a time, in a loop. – paulsm4 Jun 11 '22 at 17:18
  • I have done it by putting the imstat command in try except block. Thankyou for your response. – Pritam Das Jun 16 '22 at 07:48
  • Q: If you use a try/catch block ... doesn't your app stop processing files at the first file that fails? Maybe the app itself doesn't crash anymore ... but don't you want it to look at the rest of the files, too? – paulsm4 Jun 16 '22 at 15:54
  • no sir it does not fails..as soon as i encounter the bad file in catch block, i move that file to another directory. – Pritam Das Jun 16 '22 at 19:36
  • If you pass a wildcard (`imheader *.fits`)... and if file 2 of 3 is "bad"... then it never gets to file 3, correct? – paulsm4 Jun 17 '22 at 01:24
  • if i do it in terminal then it stops at file 2, but if i do with try catch it shows a error that file 2 is bad then shows header for file3. – Pritam Das Jun 17 '22 at 04:50

0 Answers0