! midas procedure snr.prg ! author: E. Pompei ! Created: 2003 - La Silla ! Purpose: does a quick and dirty ! estimate of the S/N, ! assuming Poisson noise ! and a 1D spectra. ! input files in .bdf format write/out "***********************************" write/out "* MIDAS PROCEDURE QUICKRED *" write/out "***********************************" define/local low/r/1/1 0. define/local up/r/1/1 0. define/local argh/i/1/1 0 again: low = 0. up = 0. argh = 0 set/gra xaxis=auto set/gra yaxis=auto set/gra pmode=1 inquire/keyword basso/r/1/1 "Please type the lower lambda (angstrom)" inquire/keyword alto/r/1/1 "Please type the upper lambda (angstrom)" low = {basso} up = {alto} set/gra xaxis={low},{up} set/gra yaxis=auto plot {p3} write/out "Click on line-free part of the spectra;" write/out "and press middle mouse button to get out" get/gcurs tmp stat/table tmp :value write/out "Your S/N (assuming Poisson noise) is:" comp sqrt({OUTPUTR(3)}) inquire/keyword deci/c/1/1 "Do you wish to try again? Y/N" if deci .EQ. "Y" then goto again endif