0

I'm using a program named 'SExtractor' which takes astronomical images in imput and subtracts the skyglow giving as output the same image corrected. More specifically the output it's composed by four files per run: the original image, the corrected one, the subtraction and a text file with scientific parameters. The images I'm talking about are .fits files, very common in astronomy, and can be open with professional softwares like DS9.

Returning to the question, (sorry if I make it here but the software developer's guide it's still incomplete and I have found nothing more about this program on the web) I need to analyze about 1000 files and as you can imagine it will be a tedious work to select them manually! To run this program I just need to go to the terminal and write sextractor image.fit where image.fit is the image I want to analyze. My images are all in the same directory as image_001.fit, image_002.fit etc and I'd like to loop sextractor to analyze them automatically.

I tried typing sextractor image_001.fit, image_002.fit, image_003.fit and so on, but it gives me the error too many imput files. I get the same error if I type sextractor *.fit. It works fine in any case with just two images but, as the guide says, in this case I get a sort of combination of the two files and this is not what I'm looking for because I need to analyze each image singularly!

I wonder if there is a way to analyze all the files automatically. I tried a for-loop in C (the only language I know something about) but I don't know how to perform it with a series of files which differs for a number (image_001, image_002, etc). I also tried to make a text file with the list of all the images but if I type sextractor list.txt the program doesn't run because it says it wants .fits files. I don't know how to do this!

Sorry for the long question, I hope I've been clear enough, write me for any doubts. Thank you for the attenction!

  • 1
    Do you care about the order in which images are processed ? Like can you do sextractor image_001 then sextractor image_010 ? – Sergiy Kolodyazhnyy Aug 23 '18 at 18:41
  • I don't mind the order, I just need to distinguish them by the name, so I can reorder them in a second time. The most important thing it's to have a series of output files for each image. – Vincenzo Aug 24 '18 at 18:03
5

You could try it in bash:

 for i in *.fit; do sextractor "$i"; done
| improve this answer | |
  • This does not necessarily guarantee the order image_001 to image_100 though. I think the processing needs the images to be processed in the correct order. – Bernard Wei Aug 23 '18 at 18:01
  • Hi, I launched it on a small groups of six images and it apparently worked,but when I opened the folder I saw only one group of output files: the last one. So I think it overwrites the ouput files giving as result only the last one...I should have all of them to work. – Vincenzo Aug 24 '18 at 18:01
  • @BernardWei See OP's response under thr question. Order doesn't matter – Sergiy Kolodyazhnyy Aug 24 '18 at 19:18
  • @Vincenzo What is the format in which output files are produced, what filenames are created ? Does it number the files if you have two input files alone ( not in loop ) ? – Sergiy Kolodyazhnyy Aug 24 '18 at 19:20
  • The output it's composed by three .fits and one .text file. They are named origin.fits, pros.fits, subtract.fits and tab.text. Sadly my program doesn't number the output nor adds the input name, and I think that's why it overwrites the files in the loop. If I have two input files not in loop I get a kind of combination of them with just one series of output files. – Vincenzo Aug 25 '18 at 20:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.