procedure xcem2 () 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 #imcopy ("template[*,1]", "templates.0001", ver-) #imcopy ("template[*,2]", "templates.0002", ver-) #imcopy ("template[*,3]", "templates.0003", ver-) #imcopy ("template[*,4]", "templates.0004", ver-) #imcopy ("template[*,5]", "templates.0005", ver-) #imcopy ("template[*,6]", "templates.0006", ver-) 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 (1 to 6): ") 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=template ", \ "tempnum=", itnum[j], "czguess=", int(cz), \ "\n report_mode=2 save_vel- curmode+ xcor_plot+ nzpass=1 vel_init=guess") xcsao("cleancalm", specnum=iap, template="template", \ tempnum=itnum[j], czguess=int(cz), save_vel-, curmode+, \ report_mode=2, xcor_plot+, nzpass=1, vel_init="guess") } else { print("xcsao cleancalm specnum=", iap, "template=template ", \ "tempnum=", itnum[j], "czguess=", int(cz), \ "\n report_mode=2 save_vel- curmode+ xcor_plot+ nzpass=1 vel_init=guess") #print("xcsao cleancalm specnum=", iap, \ # "template=", s2, " czguess=", int(cz), \ # "save_vel=yes") xcsao("cleancalm", specnum=iap, template="template", \ tempnum=itnum[j], czguess=int(cz), save_vel-, curmode+, \ report_mode=2, xcor_plot+, nzpass=1, vel_init="guess") #xcsao("cleancalm", specnum=iap, template=s2, \ #czguess=int(cz), save_vel=yes, curmode+) } 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(" ") #imdel ("templates.000*", ver-, >& "dev$null") end