Today, you will
After a night of work, you may have 10, or 100, or 1000 target images. Each one needs to be cleaned. It would take a long time to do all this manually...
sub 1107a.001 dark15.fts div 1107a.001 flatv.fts flat sub 1107a.002 dark15.fts div 1107a.002 flatv.fts flat sub 1107a.003 dark15.fts div 1107a.003 flatv.fts flat ... sub 1107a.060 dark15.fts div 1107a.060 flatv.fts flat
Fortunately, there are ways to perform repeated operations automatically. One can
The shell is the program which interprets the commands you type; it expands wildcard characters, spawns processes to execute the programs you specify, keeps track of jobs running in the background, and so forth. There are several shells for Unix-like systems; the one you are using on iceberg is called the Bourne shell.
Very simple way to repeat commands in the Bourne shell: try the examples!
for i in 1 2 3 do echo $i done
for i in * do echo "next file is $i" done
You can save a set of shell commands in a file for later use. For example, if you create a file called testme.sh which contains these lines:
#!/bin/sh # execute a simple loop for i in 1 2 3 4 5 do echo "current value of i is $i" done exit 0you can execute them all simply by typing
sh testme.sh
Shell scripts can be pretty complicated. Read the tutorials listed above to learn more about them.
So, suppose you have a set of images you need to clean. You can use a little shell loop to apply the same commands to each image in the set (but don't do this yet!):
mn flatv.fts for i in 1107a.0?? do sub $i dark15.fts div $i flatv.fts flat done
I like to add a little note to the FITS header of an image as I process it, so that I know whether the image is still raw, or dark-subtracted, or fully reduced. The XVista command comment allows you to add a comment to the bottom of a FITS header. Try this:
buffers 1107a.001 comment 1107a.001 "added a comment" buffers 1107a.001
You can get a little more fancy, too:
buffers 1107a.001 comment 1107a.001 "added a comment on `date` " buffers 1107a.001
So, I recommend using a little loop like this:
mn flatv.fts for i in 1107a.0?? do sub $i dark15.fts comment $i "subtracted dark frame dark15.fts on `date` " div $i flatv.fts flat comment $i "divided by flatfield frame flatv.fts on `date` " done
Copyright © Michael Richmond. This work is licensed under a Creative Commons License.