I have gathered hundrets of fits files over four observation nights under poor conditions with haze and clouds.
I want to filter away lights with "too bright" background (ADU > 500 in my case).
It's tedious to do this manually, so I wanted to script it. However, I cant seem to find a way of moving a file to another folder.
Or even renaming a file, that's another question. I can rename an image and save it, but then I end up with the same image with two different names, since I cant find a way to delete a file.
However, the script below eases the work, it gives me a list of files that I then can move manually.
Code: Select all
' root folder nad list of files to examine
folder = "C:\Users\Bruger\Rudi Dropbox\Main\astro\2019\0227\"
fitsFiles = FindFiles(folder, "cone*.fit")
' max image background ADU accepted
maxBackADU = 500
' get the number of files to examine
N = Count(fitsFiles)
for i = 1 to N
' open image and get background ADU
Image.Open(folder + fitsFiles{i})
bckADU = Image.Background
' is the maximum backgound ADU exceeded?
if maxBackADU < bckADU then
s = fitsFiles{i}
s = s + ", background value = "
s = s + Str(Image.Background)
print s
' todo... move file to a folder for bad images
endif
Image.Close()
next i