procedure xcem () string dummy begin int ntemp, i, j, itt, itemp, itmax, iap int ii, jj, itnum[6] real zz, rr, z[6], r[6], zmax, rmax real c, cz string s1, s11 bool done ntemp = 6 c = 299792.458 done = no while (done == no) { print("enter command: ") if (scan(s1) != EOF) { s11 = substr(s1, 1, 1) if (s11 == "x" || s11 == "e") { print(" ") list = "mmultimake_c.tmp" rmax = 0. itmax = 0 zmax = 0. for (i=1; i<=ntemp; i+=1) { if (fscan(list, itt, itemp, iap, zz, rr) != EOF) { z[itemp] = zz r[itemp] = rr if (itemp != 6) { itnum[itemp] = itemp } else { itnum[itemp] = 5 } print(itt, z[itemp], r[itemp]) if (r[itemp] > rmax && itemp != 6) { rmax = r[itemp] itmax = itemp zmax = z[itemp] } } } print(" ") list = "" if (s11 == "x") { j = 1 if (itmax > 0) j = itmax cz = c * zmax if (stridx("a", s1) != 0) { print("enter aperture: ") if (scan(ii) != EOF) { iap = ii } else { print("defaulting to current aperture ", iap) } } if (stridx("t", s1) != 0) { print("enter template: ") if (scan(jj) != EOF) { j = jj if (j < 1 || j > ntemp) { print("warning: template ", j, \ "out of bounds") j = 5 print("defaulting to template ", j) } } else { j = 5 print("defaulting to template ", j) } cz = c * z[j] } if (stridx("z", s1) != 0) { print("enter guess redshift z: ") if (scan(zz) != EOF) { cz = c * zz } else { cz = 0. print("defaulting to cz = ", cz) } } print("cz = ", int(cz), " km/s") s2 = "templates.0000" + itnum[j] if (stridx("n", s1) != 0) { print("xcsao cleancalm specnum=", iap, \ "template=", s2, " czguess=", int(cz), \ "save_vel=no") xcsao("cleancalm", specnum=iap, \ template=s2, czguess=int(cz), save_vel=no) } else { print("xcsao cleancalm specnum=", iap, \ "template=", s2, " czguess=", int(cz), \ "save_vel=yes") xcsao("cleancalm", specnum=iap, \ template=s2, czguess=int(cz), save_vel=yes) } print("done xcsao") print(" ") # (s11 == "x") } else if (s11 == "e") { if (stridx("a", s1) != 0) { print("enter aperture: ") if (scan(ii) != EOF) { iap = ii } else { print("defaulting to current aperture ", iap) } } print("emsao cleancalm specnum=", iap) emsao("cleancalm", specnum=iap) print("done emsao") print(" ") } } else if (s1 == "q") { done = yes } else { print("unknown command") print("try again") print(" ") } # (s1 begins with "x" or "e") } else { done = yes } } # (read from std. input) print("done xcem") print(" ") end