[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Harry Potter Learns a Spell
Harry asked the great wizard Mike Sallman "How can I change my bias files
to dark?"
The wizard answered: "perl -p -i -e 's/bias/dark/g'
/whatever/directory/*.fits"
Moving to the right directory Harry fearlessly typed:
perl -p -i -e 's/bias/dark/g' *.fits
A small "pop" was heard, and Harry took out his DS9 wand and saw that the
change was successful.
Harry noticed that the options spell "pie" so he went to the fridge and cut
himself a piece.
Flushed with success, Harry moved to the flat file directory and typed:
perl -p -i -e "s/flat/object/g' *.fits
A dull thud was heard. DS9 could no longer read the .fits files.
Donning his global edit protection cloak, Harry typed:
perl -p -i -e "s/object/flat/g' *.fits
Wonder of wonders, everything was back to normal.
Now Harry tried:
perl -p -i -e "s/flat /object /g' *.fits
A pleasant pop revealed that the correct change had been made, and the
files were now all labeled 'object '
OK, I think it was Arthur Clarke who said "A sufficiently advanced
civilization is indistinguishable from magic." This looks like magic to me.
BTW, what is to keep flat in the above from matching up with noise and
changing some of the data bits? Does the above somehow know to just look
at the ascii text?
Tom Droege
At 06:29 PM 3/5/02 -0600, you wrote:
>Tom,
>
>Try this (if you have Perl installed):
>perl -p -i -e 's/bias/dark/g' /whatever/directory/*.fits
>
>This will replace all occurrences of bias in each .fits file in the
>directory.
>
>Mike
>
>Tom Droege wrote:
> >
> > Those of you that have actually worked on DS20 should be able to handle
> > this one.
> >
> > As you know, the dark files are incorrectly labeled "bias" in the fits
> > headers. How can I do a global edit on a directory of .fits files to
> > change the "bias" to "dark"? (If worst comes to worst, I will just go take
> > a new set of darks, but it seems like it will be useful to know how to do
> > this.)
> >