From 40e5a5811c6ffce9b0974e93cdd927cbcf60c157 Mon Sep 17 00:00:00 2001 From: Joe Hunkeler Date: Tue, 11 Aug 2015 16:51:37 -0400 Subject: Repatch (from linux) of OSX IRAF --- noao/onedspec/Revisions | 5321 +++++++++++++++++++++ noao/onedspec/aidpars.par | 25 + noao/onedspec/autoidentify.par | 38 + noao/onedspec/bplot.cl | 54 + noao/onedspec/calibrate.par | 13 + noao/onedspec/continuum.par | 25 + noao/onedspec/deredden.par | 10 + noao/onedspec/dispcor.par | 19 + noao/onedspec/dispcor/dcio.x | 1155 +++++ noao/onedspec/dispcor/dctable.h | 11 + noao/onedspec/dispcor/dctable.x | 145 + noao/onedspec/dispcor/dispcor.h | 16 + noao/onedspec/dispcor/dispcor.x | 233 + noao/onedspec/dispcor/mkpkg | 28 + noao/onedspec/dispcor/ranges.x | 239 + noao/onedspec/dispcor/refaverage.x | 84 + noao/onedspec/dispcor/reffollow.x | 114 + noao/onedspec/dispcor/refgspec.x | 268 ++ noao/onedspec/dispcor/refinterp.x | 127 + noao/onedspec/dispcor/refmatch.x | 43 + noao/onedspec/dispcor/refmsgs.x | 108 + noao/onedspec/dispcor/refnearest.x | 104 + noao/onedspec/dispcor/refnoextn.x | 29 + noao/onedspec/dispcor/refprecede.x | 114 + noao/onedspec/dispcor/refspectra.com | 15 + noao/onedspec/dispcor/refspectra.h | 30 + noao/onedspec/dispcor/refspectra.x | 186 + noao/onedspec/dispcor/reftable.x | 109 + noao/onedspec/dispcor/t_dispcor.x | 1336 ++++++ noao/onedspec/dispcor/t_disptrans.x | 413 ++ noao/onedspec/dispcor1.par | 5 + noao/onedspec/disptrans.par | 12 + noao/onedspec/doc/aidpars.hlp | 563 +++ noao/onedspec/doc/autoidentify.hlp | 370 ++ noao/onedspec/doc/bplot.hlp | 201 + noao/onedspec/doc/calibrate.hlp | 195 + noao/onedspec/doc/continuum.hlp | 263 + noao/onedspec/doc/deredden.hlp | 201 + noao/onedspec/doc/dispcor.hlp | 497 ++ noao/onedspec/doc/disptrans.hlp | 193 + noao/onedspec/doc/dopcor.hlp | 184 + noao/onedspec/doc/fitprofs.hlp | 403 ++ noao/onedspec/doc/identify.hlp | 810 ++++ noao/onedspec/doc/lcalib.hlp | 125 + noao/onedspec/doc/mkspec.hlp | 86 + noao/onedspec/doc/names.hlp | 67 + noao/onedspec/doc/ndprep.hlp | 115 + noao/onedspec/doc/odcombine.hlp | 480 ++ noao/onedspec/doc/onedspec.hlp | 293 ++ noao/onedspec/doc/refspectra.hlp | 413 ++ noao/onedspec/doc/reidentify.hlp | 516 ++ noao/onedspec/doc/rspectext.hlp | 138 + noao/onedspec/doc/sapertures.hlp | 217 + noao/onedspec/doc/sarith.hlp | 571 +++ noao/onedspec/doc/sbands.hlp | 209 + noao/onedspec/doc/scombine.hlp | 765 +++ noao/onedspec/doc/scoords.hlp | 83 + noao/onedspec/doc/scopy.hlp | 541 +++ noao/onedspec/doc/sensfunc.hlp | 447 ++ noao/onedspec/doc/sfit.hlp | 262 + noao/onedspec/doc/sflip.hlp | 114 + noao/onedspec/doc/sinterp.hlp | 146 + noao/onedspec/doc/skytweak.hlp | 311 ++ noao/onedspec/doc/skytweak.key | 35 + noao/onedspec/doc/slist.hlp | 142 + noao/onedspec/doc/specplot.hlp | 387 ++ noao/onedspec/doc/specshift.hlp | 67 + noao/onedspec/doc/specwcs.hlp | 586 +++ noao/onedspec/doc/splot.hlp | 1118 +++++ noao/onedspec/doc/standard.hlp | 551 +++ noao/onedspec/doc/sys/1and2dspec.hlp | 66 + noao/onedspec/doc/sys/Headers.hlp | 189 + noao/onedspec/doc/sys/Onedspec.hlp | 2219 +++++++++ noao/onedspec/doc/sys/Review.hlp | 512 ++ noao/onedspec/doc/sys/TODO | 28 + noao/onedspec/doc/sys/coincor.ms | 46 + noao/onedspec/doc/sys/identify.ms | 347 ++ noao/onedspec/doc/sys/onedproto.ms | 1673 +++++++ noao/onedspec/doc/sys/onedv210.ms | 680 +++ noao/onedspec/doc/sys/revisions.v3.ms | 382 ++ noao/onedspec/doc/sys/revisions.v31.ms | 329 ++ noao/onedspec/doc/sys/revisions.v31.ms.bak | 307 ++ noao/onedspec/doc/sys/rvidentify.ms | 304 ++ noao/onedspec/doc/sys/sensfunc.ms | 83 + noao/onedspec/doc/sys/specwcs.ms | 612 +++ noao/onedspec/doc/telluric.hlp | 350 ++ noao/onedspec/doc/telluric.key | 35 + noao/onedspec/doc/wspectext.hlp | 96 + noao/onedspec/dopcor.par | 10 + noao/onedspec/ecidentify.par | 26 + noao/onedspec/ecidentify/eccenter.x | 34 + noao/onedspec/ecidentify/eccolon.x | 243 + noao/onedspec/ecidentify/ecdb.x | 268 ++ noao/onedspec/ecidentify/ecdelete.x | 28 + noao/onedspec/ecidentify/ecdofit.x | 128 + noao/onedspec/ecidentify/ecdoshift.x | 44 + noao/onedspec/ecidentify/ecffit/ecfcolon.x | 102 + noao/onedspec/ecidentify/ecffit/ecfeval.x | 68 + noao/onedspec/ecidentify/ecffit/ecffit.com | 23 + noao/onedspec/ecidentify/ecffit/ecffit.h | 20 + noao/onedspec/ecidentify/ecffit/ecffit.key | 53 + noao/onedspec/ecidentify/ecffit/ecffit.x | 193 + noao/onedspec/ecidentify/ecffit/ecfgdata.x | 37 + noao/onedspec/ecidentify/ecffit/ecfget.x | 84 + noao/onedspec/ecidentify/ecffit/ecfgraph.x | 50 + noao/onedspec/ecidentify/ecffit/ecfnearest.x | 85 + noao/onedspec/ecidentify/ecffit/ecfreject.x | 53 + noao/onedspec/ecidentify/ecffit/ecfrms.x | 26 + noao/onedspec/ecidentify/ecffit/ecfset.x | 92 + noao/onedspec/ecidentify/ecffit/ecfshift.x | 55 + noao/onedspec/ecidentify/ecffit/ecfsolve.x | 196 + noao/onedspec/ecidentify/ecffit/ecftitle.x | 48 + noao/onedspec/ecidentify/ecffit/mkpkg | 21 + noao/onedspec/ecidentify/ecfitdata.x | 146 + noao/onedspec/ecidentify/ecgdata.x | 74 + noao/onedspec/ecidentify/ecgetim.x | 17 + noao/onedspec/ecidentify/ecgline.x | 20 + noao/onedspec/ecidentify/ecgraph.x | 155 + noao/onedspec/ecidentify/ecidentify.h | 94 + noao/onedspec/ecidentify/ecidentify.key | 76 + noao/onedspec/ecidentify/ecidentify.x | 535 +++ noao/onedspec/ecidentify/ecinit.x | 64 + noao/onedspec/ecidentify/ecline.x | 22 + noao/onedspec/ecidentify/eclinelist.x | 281 ++ noao/onedspec/ecidentify/eclog.x | 77 + noao/onedspec/ecidentify/ecmark.x | 71 + noao/onedspec/ecidentify/ecnearest.x | 26 + noao/onedspec/ecidentify/ecnewfeature.x | 91 + noao/onedspec/ecidentify/ecnext.x | 23 + noao/onedspec/ecidentify/ecpeak.x | 24 + noao/onedspec/ecidentify/ecprevious.x | 23 + noao/onedspec/ecidentify/ecrms.x | 28 + noao/onedspec/ecidentify/ecshift.x | 77 + noao/onedspec/ecidentify/ecshow.x | 78 + noao/onedspec/ecidentify/mkpkg | 39 + noao/onedspec/ecidentify/t_eciden.x | 68 + noao/onedspec/ecidentify/t_ecreid.x | 181 + noao/onedspec/ecreidentify.par | 11 + noao/onedspec/fitprofs.par | 29 + noao/onedspec/fortran/mkpkg | 10 + noao/onedspec/fortran/nlcfit.f | 400 ++ noao/onedspec/fortran/polft1.f | 205 + noao/onedspec/fortran/trans.f | 21 + noao/onedspec/gcurval.dat | 1 + noao/onedspec/getairm.x | 54 + noao/onedspec/getcalib.x | 415 ++ noao/onedspec/getextn.x | 209 + noao/onedspec/hireswcal.cl | 68 + noao/onedspec/identify.par | 33 + noao/onedspec/identify/autoid/aidautoid.x | 314 ++ noao/onedspec/identify/autoid/aidget.x | 21 + noao/onedspec/identify/autoid/aidgraph.x | 240 + noao/onedspec/identify/autoid/aidinit.x | 93 + noao/onedspec/identify/autoid/aidlog.x | 57 + noao/onedspec/identify/autoid/aidset.x | 162 + noao/onedspec/identify/autoid/aidshift.x | 67 + noao/onedspec/identify/autoid/autoid.h | 90 + noao/onedspec/identify/autoid/autoid.x | 1600 +++++++ noao/onedspec/identify/autoid/mkpkg | 17 + noao/onedspec/identify/idcenter.x | 37 + noao/onedspec/identify/idcolon.x | 284 ++ noao/onedspec/identify/iddb.x | 515 ++ noao/onedspec/identify/iddelete.x | 26 + noao/onedspec/identify/iddofit.x | 108 + noao/onedspec/identify/iddoshift.x | 41 + noao/onedspec/identify/identify.h | 90 + noao/onedspec/identify/identify.key | 90 + noao/onedspec/identify/idfitdata.x | 177 + noao/onedspec/identify/idgdata.x | 67 + noao/onedspec/identify/idgraph.x | 111 + noao/onedspec/identify/ididentify.x | 631 +++ noao/onedspec/identify/idinit.x | 368 ++ noao/onedspec/identify/idlabel.x | 30 + noao/onedspec/identify/idlinelist.x | 385 ++ noao/onedspec/identify/idlog.x | 72 + noao/onedspec/identify/idmap.x | 375 ++ noao/onedspec/identify/idmark.x | 98 + noao/onedspec/identify/idnearest.x | 29 + noao/onedspec/identify/idnewfeature.x | 87 + noao/onedspec/identify/idnoextn.x | 11 + noao/onedspec/identify/idpeak.x | 95 + noao/onedspec/identify/idrms.x | 28 + noao/onedspec/identify/idshift.x | 106 + noao/onedspec/identify/idshow.x | 79 + noao/onedspec/identify/mkpkg | 48 + noao/onedspec/identify/peaks.gx | 578 +++ noao/onedspec/identify/peaks.x | 578 +++ noao/onedspec/identify/reidentify.x | 482 ++ noao/onedspec/identify/t_autoid.x | 252 + noao/onedspec/identify/t_identify.x | 89 + noao/onedspec/identify/t_reidentify.x | 1083 +++++ noao/onedspec/irsiids/addsets.par | 8 + noao/onedspec/irsiids/batchred.cl | 168 + noao/onedspec/irsiids/batchred.par | 38 + noao/onedspec/irsiids/bplot.cl | 35 + noao/onedspec/irsiids/bswitch.par | 15 + noao/onedspec/irsiids/coefs.par | 3 + noao/onedspec/irsiids/coincor.par | 9 + noao/onedspec/irsiids/coincor.x | 123 + noao/onedspec/irsiids/conversion.x | 213 + noao/onedspec/irsiids/doc/addsets.hlp | 66 + noao/onedspec/irsiids/doc/batchred.hlp | 145 + noao/onedspec/irsiids/doc/bswitch.hlp | 228 + noao/onedspec/irsiids/doc/coefs.hlp | 57 + noao/onedspec/irsiids/doc/coincor.hlp | 101 + noao/onedspec/irsiids/doc/extinct.hlp | 49 + noao/onedspec/irsiids/doc/flatdiv.hlp | 94 + noao/onedspec/irsiids/doc/flatfit.hlp | 188 + noao/onedspec/irsiids/doc/powercor.hlp | 62 + noao/onedspec/irsiids/doc/process.hlp | 20 + noao/onedspec/irsiids/doc/slist1d.hlp | 59 + noao/onedspec/irsiids/doc/subsets.hlp | 49 + noao/onedspec/irsiids/doc/sums.hlp | 44 + noao/onedspec/irsiids/doc/widstape.hlp | 90 + noao/onedspec/irsiids/extinct.cl | 22 + noao/onedspec/irsiids/extinct.par | 11 + noao/onedspec/irsiids/flatdiv.par | 12 + noao/onedspec/irsiids/flatfit.par | 24 + noao/onedspec/irsiids/getnimage.x | 133 + noao/onedspec/irsiids/idsmtn.h | 101 + noao/onedspec/irsiids/irsiids.hd | 18 + noao/onedspec/irsiids/mkpkg | 22 + noao/onedspec/irsiids/powercor.cl | 4 + noao/onedspec/irsiids/powercor.par | 7 + noao/onedspec/irsiids/slist1d.par | 3 + noao/onedspec/irsiids/subsets.par | 6 + noao/onedspec/irsiids/sums.par | 8 + noao/onedspec/irsiids/t_addsets.x | 195 + noao/onedspec/irsiids/t_bswitch.x | 924 ++++ noao/onedspec/irsiids/t_coefs.x | 88 + noao/onedspec/irsiids/t_coincor.x | 102 + noao/onedspec/irsiids/t_flatdiv.x | 276 ++ noao/onedspec/irsiids/t_flatfit.x | 740 +++ noao/onedspec/irsiids/t_slist1d.x | 163 + noao/onedspec/irsiids/t_subsets.x | 121 + noao/onedspec/irsiids/t_sums.x | 239 + noao/onedspec/irsiids/t_widstape.x | 343 ++ noao/onedspec/irsiids/widstape.par | 8 + noao/onedspec/lcalib.par | 10 + noao/onedspec/mkpkg | 72 + noao/onedspec/mkspec.par | 11 + noao/onedspec/names.par | 7 + noao/onedspec/ndprep.cl | 65 + noao/onedspec/odcombine.par | 54 + noao/onedspec/odcombine/mkpkg | 18 + noao/onedspec/odcombine/odcombine.par | 54 + noao/onedspec/odcombine/src/generic/icaclip.x | 2206 +++++++++ noao/onedspec/odcombine/src/generic/icaverage.x | 406 ++ noao/onedspec/odcombine/src/generic/iccclip.x | 1790 +++++++ noao/onedspec/odcombine/src/generic/icgdata.x | 1207 +++++ noao/onedspec/odcombine/src/generic/icgrow.x | 263 + noao/onedspec/odcombine/src/generic/icmedian.x | 692 +++ noao/onedspec/odcombine/src/generic/icmm.x | 644 +++ noao/onedspec/odcombine/src/generic/icomb.x | 1917 ++++++++ noao/onedspec/odcombine/src/generic/icpclip.x | 878 ++++ noao/onedspec/odcombine/src/generic/icsclip.x | 1922 ++++++++ noao/onedspec/odcombine/src/generic/icsigma.x | 434 ++ noao/onedspec/odcombine/src/generic/icsort.x | 1096 +++++ noao/onedspec/odcombine/src/generic/icstat.x | 892 ++++ noao/onedspec/odcombine/src/generic/mkpkg | 25 + noao/onedspec/odcombine/src/generic/xtimmap.x | 1080 +++++ noao/onedspec/odcombine/src/icaclip.gx | 575 +++ noao/onedspec/odcombine/src/icaverage.gx | 114 + noao/onedspec/odcombine/src/iccclip.gx | 471 ++ noao/onedspec/odcombine/src/icemask.x | 114 + noao/onedspec/odcombine/src/icgdata.gx | 307 ++ noao/onedspec/odcombine/src/icgrow.gx | 135 + noao/onedspec/odcombine/src/icgscale.x | 88 + noao/onedspec/odcombine/src/ichdr.x | 55 + noao/onedspec/odcombine/src/icimstack.x | 186 + noao/onedspec/odcombine/src/iclog.x | 422 ++ noao/onedspec/odcombine/src/icmask.com | 8 + noao/onedspec/odcombine/src/icmask.h | 9 + noao/onedspec/odcombine/src/icmask.x | 499 ++ noao/onedspec/odcombine/src/icmedian.gx | 231 + noao/onedspec/odcombine/src/icmm.gx | 189 + noao/onedspec/odcombine/src/icomb.gx | 674 +++ noao/onedspec/odcombine/src/icombine.com | 45 + noao/onedspec/odcombine/src/icombine.h | 53 + noao/onedspec/odcombine/src/icombine.x | 476 ++ noao/onedspec/odcombine/src/icpclip.gx | 233 + noao/onedspec/odcombine/src/icpmmap.x | 34 + noao/onedspec/odcombine/src/icrmasks.x | 41 + noao/onedspec/odcombine/src/icscale.x | 351 ++ noao/onedspec/odcombine/src/icsclip.gx | 504 ++ noao/onedspec/odcombine/src/icsection.x | 94 + noao/onedspec/odcombine/src/icsetout.x | 322 ++ noao/onedspec/odcombine/src/icsigma.gx | 122 + noao/onedspec/odcombine/src/icsort.gx | 386 ++ noao/onedspec/odcombine/src/icstat.gx | 238 + noao/onedspec/odcombine/src/mkpkg | 62 + noao/onedspec/odcombine/src/tymax.x | 27 + noao/onedspec/odcombine/src/xtimmap.com | 8 + noao/onedspec/odcombine/src/xtimmap.gx | 552 +++ noao/onedspec/odcombine/src/xtprocid.x | 38 + noao/onedspec/odcombine/srcwt/generic/icaclip.x | 2206 +++++++++ noao/onedspec/odcombine/srcwt/generic/icaverage.x | 522 ++ noao/onedspec/odcombine/srcwt/generic/iccclip.x | 1790 +++++++ noao/onedspec/odcombine/srcwt/generic/icgdata.x | 1558 ++++++ noao/onedspec/odcombine/srcwt/generic/icgrow.x | 263 + noao/onedspec/odcombine/srcwt/generic/icmedian.x | 692 +++ noao/onedspec/odcombine/srcwt/generic/icmm.x | 644 +++ noao/onedspec/odcombine/srcwt/generic/icomb.x | 2054 ++++++++ noao/onedspec/odcombine/srcwt/generic/icpclip.x | 878 ++++ noao/onedspec/odcombine/srcwt/generic/icsclip.x | 1922 ++++++++ noao/onedspec/odcombine/srcwt/generic/icsigma.x | 562 +++ noao/onedspec/odcombine/srcwt/generic/icsort.x | 1096 +++++ noao/onedspec/odcombine/srcwt/generic/icstat.x | 892 ++++ noao/onedspec/odcombine/srcwt/generic/mkpkg | 25 + noao/onedspec/odcombine/srcwt/generic/xtimmap.x | 1079 +++++ noao/onedspec/odcombine/srcwt/icaclip.gx | 575 +++ noao/onedspec/odcombine/srcwt/icaverage.gx | 143 + noao/onedspec/odcombine/srcwt/iccclip.gx | 471 ++ noao/onedspec/odcombine/srcwt/icemask.x | 128 + noao/onedspec/odcombine/srcwt/icgdata.gx | 397 ++ noao/onedspec/odcombine/srcwt/icgdata.gxBAK | 307 ++ noao/onedspec/odcombine/srcwt/icgrow.gx | 135 + noao/onedspec/odcombine/srcwt/icgscale.x | 92 + noao/onedspec/odcombine/srcwt/ichdr.x | 55 + noao/onedspec/odcombine/srcwt/icimstack.x | 186 + noao/onedspec/odcombine/srcwt/iclog.x | 422 ++ noao/onedspec/odcombine/srcwt/icmask.com | 8 + noao/onedspec/odcombine/srcwt/icmask.h | 9 + noao/onedspec/odcombine/srcwt/icmask.x | 499 ++ noao/onedspec/odcombine/srcwt/icmedian.gx | 231 + noao/onedspec/odcombine/srcwt/icmm.gx | 189 + noao/onedspec/odcombine/srcwt/icomb.gx | 711 +++ noao/onedspec/odcombine/srcwt/icombine.com | 46 + noao/onedspec/odcombine/srcwt/icombine.h | 56 + noao/onedspec/odcombine/srcwt/icombine.x | 488 ++ noao/onedspec/odcombine/srcwt/icpclip.gx | 233 + noao/onedspec/odcombine/srcwt/icpmmap.x | 34 + noao/onedspec/odcombine/srcwt/icrmasks.x | 41 + noao/onedspec/odcombine/srcwt/icscale.x | 391 ++ noao/onedspec/odcombine/srcwt/icsclip.gx | 504 ++ noao/onedspec/odcombine/srcwt/icsection.x | 94 + noao/onedspec/odcombine/srcwt/icsetout.x | 322 ++ noao/onedspec/odcombine/srcwt/icsigma.gx | 154 + noao/onedspec/odcombine/srcwt/icsort.gx | 386 ++ noao/onedspec/odcombine/srcwt/icstat.gx | 238 + noao/onedspec/odcombine/srcwt/mkpkg | 62 + noao/onedspec/odcombine/srcwt/tymax.x | 27 + noao/onedspec/odcombine/srcwt/xtimmap.com | 8 + noao/onedspec/odcombine/srcwt/xtimmap.gx | 552 +++ noao/onedspec/odcombine/srcwt/xtprocid.x | 38 + noao/onedspec/odcombine/t_odcombine.x | 1071 +++++ noao/onedspec/odcombine/x_odcombine.x | 1 + noao/onedspec/odropenp.x | 92 + noao/onedspec/onedspec.cl | 57 + noao/onedspec/onedspec.hd | 58 + noao/onedspec/onedspec.men | 51 + noao/onedspec/onedspec.par | 10 + noao/onedspec/refspectra.par | 16 + noao/onedspec/reidentify.par | 36 + noao/onedspec/rspectext.cl | 115 + noao/onedspec/rstext.par | 4 + noao/onedspec/sapertures.par | 16 + noao/onedspec/sarith.par | 22 + noao/onedspec/sbands.par | 8 + noao/onedspec/scombine/README | 17 + noao/onedspec/scombine/generic/icaclip.x | 555 +++ noao/onedspec/scombine/generic/icaverage.x | 84 + noao/onedspec/scombine/generic/iccclip.x | 453 ++ noao/onedspec/scombine/generic/icgrow.x | 76 + noao/onedspec/scombine/generic/icmedian.x | 139 + noao/onedspec/scombine/generic/icmm.x | 152 + noao/onedspec/scombine/generic/icpclip.x | 224 + noao/onedspec/scombine/generic/icsclip.x | 486 ++ noao/onedspec/scombine/generic/icsort.x | 275 ++ noao/onedspec/scombine/generic/mkpkg | 16 + noao/onedspec/scombine/icgdata.x | 199 + noao/onedspec/scombine/iclog.x | 301 ++ noao/onedspec/scombine/icombine.com | 36 + noao/onedspec/scombine/icombine.h | 74 + noao/onedspec/scombine/icombine.x | 174 + noao/onedspec/scombine/icscale.x | 463 ++ noao/onedspec/scombine/icstat.x | 160 + noao/onedspec/scombine/icsum.x | 48 + noao/onedspec/scombine/iscombine.key | 23 + noao/onedspec/scombine/iscombine.par | 18 + noao/onedspec/scombine/mkpkg | 35 + noao/onedspec/scombine/scombine.par | 37 + noao/onedspec/scombine/t_scombine.x | 630 +++ noao/onedspec/scombine/x_scombine.x | 1 + noao/onedspec/scoords.par | 5 + noao/onedspec/scopy.cl | 30 + noao/onedspec/scopy.par | 17 + noao/onedspec/sensfunc.par | 17 + noao/onedspec/sensfunc/mkpkg | 38 + noao/onedspec/sensfunc/sensfunc.h | 64 + noao/onedspec/sensfunc/sensfunc.key | 81 + noao/onedspec/sensfunc/sfadd.x | 105 + noao/onedspec/sensfunc/sfapertures.x | 27 + noao/onedspec/sensfunc/sfcgraph.x | 104 + noao/onedspec/sensfunc/sfcolon.x | 193 + noao/onedspec/sensfunc/sfcolors.x | 28 + noao/onedspec/sensfunc/sfcomposite.x | 147 + noao/onedspec/sensfunc/sfdata.x | 59 + noao/onedspec/sensfunc/sfdelete.x | 127 + noao/onedspec/sensfunc/sfeout.x | 114 + noao/onedspec/sensfunc/sfextinct.x | 226 + noao/onedspec/sensfunc/sffit.x | 78 + noao/onedspec/sensfunc/sfginit.x | 89 + noao/onedspec/sensfunc/sfgraph.x | 289 ++ noao/onedspec/sensfunc/sfimage.x | 234 + noao/onedspec/sensfunc/sfmarks.x | 46 + noao/onedspec/sensfunc/sfmove.x | 166 + noao/onedspec/sensfunc/sfnearest.x | 69 + noao/onedspec/sensfunc/sfoutput.x | 114 + noao/onedspec/sensfunc/sfreset.x | 62 + noao/onedspec/sensfunc/sfrms.x | 43 + noao/onedspec/sensfunc/sfsensfunc.x | 255 + noao/onedspec/sensfunc/sfshift.x | 81 + noao/onedspec/sensfunc/sfstats.x | 152 + noao/onedspec/sensfunc/sfstds.x | 266 + noao/onedspec/sensfunc/sftitle.x | 23 + noao/onedspec/sensfunc/sfundelete.x | 141 + noao/onedspec/sensfunc/sfvstats.x | 104 + noao/onedspec/sensfunc/sfweights.x | 51 + noao/onedspec/sensfunc/t_sensfunc.x | 99 + noao/onedspec/setdisp.par | 6 + noao/onedspec/sfit.par | 25 + noao/onedspec/sflip.par | 6 + noao/onedspec/sinterp.par | 14 + noao/onedspec/skytweak.par | 19 + noao/onedspec/slist.par | 3 + noao/onedspec/smw/README | 6 + noao/onedspec/smw/funits.x | 445 ++ noao/onedspec/smw/mkpkg | 48 + noao/onedspec/smw/shdr.x | 1269 +++++ noao/onedspec/smw/smwclose.x | 46 + noao/onedspec/smw/smwct.x | 19 + noao/onedspec/smw/smwctfree.x | 19 + noao/onedspec/smw/smwctran.gx | 166 + noao/onedspec/smw/smwctran.x | 312 ++ noao/onedspec/smw/smwdaxis.x | 109 + noao/onedspec/smw/smwequispec.x | 86 + noao/onedspec/smw/smwesms.x | 96 + noao/onedspec/smw/smwgapid.x | 30 + noao/onedspec/smw/smwgwattrs.x | 134 + noao/onedspec/smw/smwmerge.x | 102 + noao/onedspec/smw/smwmultispec.x | 30 + noao/onedspec/smw/smwmw.x | 38 + noao/onedspec/smw/smwnd.x | 19 + noao/onedspec/smw/smwndes.x | 82 + noao/onedspec/smw/smwnewcopy.x | 58 + noao/onedspec/smw/smwoldms.x | 101 + noao/onedspec/smw/smwonedspec.x | 109 + noao/onedspec/smw/smwopen.x | 70 + noao/onedspec/smw/smwopenim.x | 69 + noao/onedspec/smw/smwsapid.x | 40 + noao/onedspec/smw/smwsaveim.x | 251 + noao/onedspec/smw/smwsaxes.x | 247 + noao/onedspec/smw/smwsctran.x | 96 + noao/onedspec/smw/smwsmw.x | 21 + noao/onedspec/smw/smwswattrs.x | 162 + noao/onedspec/smw/units.x | 529 ++ noao/onedspec/specplot.h | 49 + noao/onedspec/specplot.key | 134 + noao/onedspec/specplot.par | 28 + noao/onedspec/specshift.par | 4 + noao/onedspec/splot.par | 52 + noao/onedspec/splot/anshdr.x | 84 + noao/onedspec/splot/autoexp.x | 79 + noao/onedspec/splot/avgsnr.x | 72 + noao/onedspec/splot/conflam.x | 28 + noao/onedspec/splot/confnu.x | 28 + noao/onedspec/splot/deblend.x | 627 +++ noao/onedspec/splot/eqwidth.x | 109 + noao/onedspec/splot/eqwidthcp.x | 240 + noao/onedspec/splot/fixx.x | 27 + noao/onedspec/splot/flatten.x | 110 + noao/onedspec/splot/fudgept.x | 38 + noao/onedspec/splot/fudgex.x | 46 + noao/onedspec/splot/getimage.x | 159 + noao/onedspec/splot/gfit.x | 391 ++ noao/onedspec/splot/mkpkg | 38 + noao/onedspec/splot/mktitle.x | 41 + noao/onedspec/splot/plotstd.x | 70 + noao/onedspec/splot/replot.x | 27 + noao/onedspec/splot/smooth.x | 54 + noao/onedspec/splot/spdeblend.x | 819 ++++ noao/onedspec/splot/splabel.x | 112 + noao/onedspec/splot/splot.key | 116 + noao/onedspec/splot/splot.log | 8 + noao/onedspec/splot/splot.x | 605 +++ noao/onedspec/splot/splotcolon.x | 263 + noao/onedspec/splot/splotfun.x | 127 + noao/onedspec/splot/stshelp.key | 7 + noao/onedspec/splot/stshelp.x | 34 + noao/onedspec/splot/sumflux.x | 165 + noao/onedspec/splot/usercoord.x | 94 + noao/onedspec/splot/voigt.x | 71 + noao/onedspec/splot/wrspect.x | 397 ++ noao/onedspec/standard.key | 11 + noao/onedspec/standard.par | 21 + noao/onedspec/t_calibrate.x | 437 ++ noao/onedspec/t_deredden.x | 361 ++ noao/onedspec/t_dopcor.x | 293 ++ noao/onedspec/t_fitprofs.x | 1151 +++++ noao/onedspec/t_lcalib.x | 98 + noao/onedspec/t_mkspec.x | 120 + noao/onedspec/t_names.x | 45 + noao/onedspec/t_rstext.x | 91 + noao/onedspec/t_sapertures.x | 428 ++ noao/onedspec/t_sarith.x | 1423 ++++++ noao/onedspec/t_sbands.x | 585 +++ noao/onedspec/t_scoords.x | 179 + noao/onedspec/t_sfit.x | 986 ++++ noao/onedspec/t_sflip.x | 145 + noao/onedspec/t_sinterp.x | 232 + noao/onedspec/t_slist.x | 105 + noao/onedspec/t_specplot.x | 2030 ++++++++ noao/onedspec/t_specshift.x | 222 + noao/onedspec/t_standard.x | 835 ++++ noao/onedspec/t_tweak.x | 1352 ++++++ noao/onedspec/telluric.par | 21 + noao/onedspec/wspectext.cl | 47 + noao/onedspec/x_onedspec.x | 43 + 519 files changed, 131524 insertions(+) create mode 100644 noao/onedspec/Revisions create mode 100644 noao/onedspec/aidpars.par create mode 100644 noao/onedspec/autoidentify.par create mode 100644 noao/onedspec/bplot.cl create mode 100644 noao/onedspec/calibrate.par create mode 100644 noao/onedspec/continuum.par create mode 100644 noao/onedspec/deredden.par create mode 100644 noao/onedspec/dispcor.par create mode 100644 noao/onedspec/dispcor/dcio.x create mode 100644 noao/onedspec/dispcor/dctable.h create mode 100644 noao/onedspec/dispcor/dctable.x create mode 100644 noao/onedspec/dispcor/dispcor.h create mode 100644 noao/onedspec/dispcor/dispcor.x create mode 100644 noao/onedspec/dispcor/mkpkg create mode 100644 noao/onedspec/dispcor/ranges.x create mode 100644 noao/onedspec/dispcor/refaverage.x create mode 100644 noao/onedspec/dispcor/reffollow.x create mode 100644 noao/onedspec/dispcor/refgspec.x create mode 100644 noao/onedspec/dispcor/refinterp.x create mode 100644 noao/onedspec/dispcor/refmatch.x create mode 100644 noao/onedspec/dispcor/refmsgs.x create mode 100644 noao/onedspec/dispcor/refnearest.x create mode 100644 noao/onedspec/dispcor/refnoextn.x create mode 100644 noao/onedspec/dispcor/refprecede.x create mode 100644 noao/onedspec/dispcor/refspectra.com create mode 100644 noao/onedspec/dispcor/refspectra.h create mode 100644 noao/onedspec/dispcor/refspectra.x create mode 100644 noao/onedspec/dispcor/reftable.x create mode 100644 noao/onedspec/dispcor/t_dispcor.x create mode 100644 noao/onedspec/dispcor/t_disptrans.x create mode 100644 noao/onedspec/dispcor1.par create mode 100644 noao/onedspec/disptrans.par create mode 100644 noao/onedspec/doc/aidpars.hlp create mode 100644 noao/onedspec/doc/autoidentify.hlp create mode 100644 noao/onedspec/doc/bplot.hlp create mode 100644 noao/onedspec/doc/calibrate.hlp create mode 100644 noao/onedspec/doc/continuum.hlp create mode 100644 noao/onedspec/doc/deredden.hlp create mode 100644 noao/onedspec/doc/dispcor.hlp create mode 100644 noao/onedspec/doc/disptrans.hlp create mode 100644 noao/onedspec/doc/dopcor.hlp create mode 100644 noao/onedspec/doc/fitprofs.hlp create mode 100644 noao/onedspec/doc/identify.hlp create mode 100644 noao/onedspec/doc/lcalib.hlp create mode 100644 noao/onedspec/doc/mkspec.hlp create mode 100644 noao/onedspec/doc/names.hlp create mode 100644 noao/onedspec/doc/ndprep.hlp create mode 100644 noao/onedspec/doc/odcombine.hlp create mode 100644 noao/onedspec/doc/onedspec.hlp create mode 100644 noao/onedspec/doc/refspectra.hlp create mode 100644 noao/onedspec/doc/reidentify.hlp create mode 100644 noao/onedspec/doc/rspectext.hlp create mode 100644 noao/onedspec/doc/sapertures.hlp create mode 100644 noao/onedspec/doc/sarith.hlp create mode 100644 noao/onedspec/doc/sbands.hlp create mode 100644 noao/onedspec/doc/scombine.hlp create mode 100644 noao/onedspec/doc/scoords.hlp create mode 100644 noao/onedspec/doc/scopy.hlp create mode 100644 noao/onedspec/doc/sensfunc.hlp create mode 100644 noao/onedspec/doc/sfit.hlp create mode 100644 noao/onedspec/doc/sflip.hlp create mode 100644 noao/onedspec/doc/sinterp.hlp create mode 100644 noao/onedspec/doc/skytweak.hlp create mode 100644 noao/onedspec/doc/skytweak.key create mode 100644 noao/onedspec/doc/slist.hlp create mode 100644 noao/onedspec/doc/specplot.hlp create mode 100644 noao/onedspec/doc/specshift.hlp create mode 100644 noao/onedspec/doc/specwcs.hlp create mode 100644 noao/onedspec/doc/splot.hlp create mode 100644 noao/onedspec/doc/standard.hlp create mode 100644 noao/onedspec/doc/sys/1and2dspec.hlp create mode 100644 noao/onedspec/doc/sys/Headers.hlp create mode 100644 noao/onedspec/doc/sys/Onedspec.hlp create mode 100644 noao/onedspec/doc/sys/Review.hlp create mode 100644 noao/onedspec/doc/sys/TODO create mode 100644 noao/onedspec/doc/sys/coincor.ms create mode 100644 noao/onedspec/doc/sys/identify.ms create mode 100644 noao/onedspec/doc/sys/onedproto.ms create mode 100644 noao/onedspec/doc/sys/onedv210.ms create mode 100644 noao/onedspec/doc/sys/revisions.v3.ms create mode 100644 noao/onedspec/doc/sys/revisions.v31.ms create mode 100644 noao/onedspec/doc/sys/revisions.v31.ms.bak create mode 100644 noao/onedspec/doc/sys/rvidentify.ms create mode 100644 noao/onedspec/doc/sys/sensfunc.ms create mode 100644 noao/onedspec/doc/sys/specwcs.ms create mode 100644 noao/onedspec/doc/telluric.hlp create mode 100644 noao/onedspec/doc/telluric.key create mode 100644 noao/onedspec/doc/wspectext.hlp create mode 100644 noao/onedspec/dopcor.par create mode 100644 noao/onedspec/ecidentify.par create mode 100644 noao/onedspec/ecidentify/eccenter.x create mode 100644 noao/onedspec/ecidentify/eccolon.x create mode 100644 noao/onedspec/ecidentify/ecdb.x create mode 100644 noao/onedspec/ecidentify/ecdelete.x create mode 100644 noao/onedspec/ecidentify/ecdofit.x create mode 100644 noao/onedspec/ecidentify/ecdoshift.x create mode 100644 noao/onedspec/ecidentify/ecffit/ecfcolon.x create mode 100644 noao/onedspec/ecidentify/ecffit/ecfeval.x create mode 100644 noao/onedspec/ecidentify/ecffit/ecffit.com create mode 100644 noao/onedspec/ecidentify/ecffit/ecffit.h create mode 100644 noao/onedspec/ecidentify/ecffit/ecffit.key create mode 100644 noao/onedspec/ecidentify/ecffit/ecffit.x create mode 100644 noao/onedspec/ecidentify/ecffit/ecfgdata.x create mode 100644 noao/onedspec/ecidentify/ecffit/ecfget.x create mode 100644 noao/onedspec/ecidentify/ecffit/ecfgraph.x create mode 100644 noao/onedspec/ecidentify/ecffit/ecfnearest.x create mode 100644 noao/onedspec/ecidentify/ecffit/ecfreject.x create mode 100644 noao/onedspec/ecidentify/ecffit/ecfrms.x create mode 100644 noao/onedspec/ecidentify/ecffit/ecfset.x create mode 100644 noao/onedspec/ecidentify/ecffit/ecfshift.x create mode 100644 noao/onedspec/ecidentify/ecffit/ecfsolve.x create mode 100644 noao/onedspec/ecidentify/ecffit/ecftitle.x create mode 100644 noao/onedspec/ecidentify/ecffit/mkpkg create mode 100644 noao/onedspec/ecidentify/ecfitdata.x create mode 100644 noao/onedspec/ecidentify/ecgdata.x create mode 100644 noao/onedspec/ecidentify/ecgetim.x create mode 100644 noao/onedspec/ecidentify/ecgline.x create mode 100644 noao/onedspec/ecidentify/ecgraph.x create mode 100644 noao/onedspec/ecidentify/ecidentify.h create mode 100644 noao/onedspec/ecidentify/ecidentify.key create mode 100644 noao/onedspec/ecidentify/ecidentify.x create mode 100644 noao/onedspec/ecidentify/ecinit.x create mode 100644 noao/onedspec/ecidentify/ecline.x create mode 100644 noao/onedspec/ecidentify/eclinelist.x create mode 100644 noao/onedspec/ecidentify/eclog.x create mode 100644 noao/onedspec/ecidentify/ecmark.x create mode 100644 noao/onedspec/ecidentify/ecnearest.x create mode 100644 noao/onedspec/ecidentify/ecnewfeature.x create mode 100644 noao/onedspec/ecidentify/ecnext.x create mode 100644 noao/onedspec/ecidentify/ecpeak.x create mode 100644 noao/onedspec/ecidentify/ecprevious.x create mode 100644 noao/onedspec/ecidentify/ecrms.x create mode 100644 noao/onedspec/ecidentify/ecshift.x create mode 100644 noao/onedspec/ecidentify/ecshow.x create mode 100644 noao/onedspec/ecidentify/mkpkg create mode 100644 noao/onedspec/ecidentify/t_eciden.x create mode 100644 noao/onedspec/ecidentify/t_ecreid.x create mode 100644 noao/onedspec/ecreidentify.par create mode 100644 noao/onedspec/fitprofs.par create mode 100644 noao/onedspec/fortran/mkpkg create mode 100644 noao/onedspec/fortran/nlcfit.f create mode 100644 noao/onedspec/fortran/polft1.f create mode 100644 noao/onedspec/fortran/trans.f create mode 100644 noao/onedspec/gcurval.dat create mode 100644 noao/onedspec/getairm.x create mode 100644 noao/onedspec/getcalib.x create mode 100644 noao/onedspec/getextn.x create mode 100644 noao/onedspec/hireswcal.cl create mode 100644 noao/onedspec/identify.par create mode 100644 noao/onedspec/identify/autoid/aidautoid.x create mode 100644 noao/onedspec/identify/autoid/aidget.x create mode 100644 noao/onedspec/identify/autoid/aidgraph.x create mode 100644 noao/onedspec/identify/autoid/aidinit.x create mode 100644 noao/onedspec/identify/autoid/aidlog.x create mode 100644 noao/onedspec/identify/autoid/aidset.x create mode 100644 noao/onedspec/identify/autoid/aidshift.x create mode 100644 noao/onedspec/identify/autoid/autoid.h create mode 100644 noao/onedspec/identify/autoid/autoid.x create mode 100644 noao/onedspec/identify/autoid/mkpkg create mode 100644 noao/onedspec/identify/idcenter.x create mode 100644 noao/onedspec/identify/idcolon.x create mode 100644 noao/onedspec/identify/iddb.x create mode 100644 noao/onedspec/identify/iddelete.x create mode 100644 noao/onedspec/identify/iddofit.x create mode 100644 noao/onedspec/identify/iddoshift.x create mode 100644 noao/onedspec/identify/identify.h create mode 100644 noao/onedspec/identify/identify.key create mode 100644 noao/onedspec/identify/idfitdata.x create mode 100644 noao/onedspec/identify/idgdata.x create mode 100644 noao/onedspec/identify/idgraph.x create mode 100644 noao/onedspec/identify/ididentify.x create mode 100644 noao/onedspec/identify/idinit.x create mode 100644 noao/onedspec/identify/idlabel.x create mode 100644 noao/onedspec/identify/idlinelist.x create mode 100644 noao/onedspec/identify/idlog.x create mode 100644 noao/onedspec/identify/idmap.x create mode 100644 noao/onedspec/identify/idmark.x create mode 100644 noao/onedspec/identify/idnearest.x create mode 100644 noao/onedspec/identify/idnewfeature.x create mode 100644 noao/onedspec/identify/idnoextn.x create mode 100644 noao/onedspec/identify/idpeak.x create mode 100644 noao/onedspec/identify/idrms.x create mode 100644 noao/onedspec/identify/idshift.x create mode 100644 noao/onedspec/identify/idshow.x create mode 100644 noao/onedspec/identify/mkpkg create mode 100644 noao/onedspec/identify/peaks.gx create mode 100644 noao/onedspec/identify/peaks.x create mode 100644 noao/onedspec/identify/reidentify.x create mode 100644 noao/onedspec/identify/t_autoid.x create mode 100644 noao/onedspec/identify/t_identify.x create mode 100644 noao/onedspec/identify/t_reidentify.x create mode 100644 noao/onedspec/irsiids/addsets.par create mode 100644 noao/onedspec/irsiids/batchred.cl create mode 100644 noao/onedspec/irsiids/batchred.par create mode 100644 noao/onedspec/irsiids/bplot.cl create mode 100644 noao/onedspec/irsiids/bswitch.par create mode 100644 noao/onedspec/irsiids/coefs.par create mode 100644 noao/onedspec/irsiids/coincor.par create mode 100644 noao/onedspec/irsiids/coincor.x create mode 100644 noao/onedspec/irsiids/conversion.x create mode 100644 noao/onedspec/irsiids/doc/addsets.hlp create mode 100644 noao/onedspec/irsiids/doc/batchred.hlp create mode 100644 noao/onedspec/irsiids/doc/bswitch.hlp create mode 100644 noao/onedspec/irsiids/doc/coefs.hlp create mode 100644 noao/onedspec/irsiids/doc/coincor.hlp create mode 100644 noao/onedspec/irsiids/doc/extinct.hlp create mode 100644 noao/onedspec/irsiids/doc/flatdiv.hlp create mode 100644 noao/onedspec/irsiids/doc/flatfit.hlp create mode 100644 noao/onedspec/irsiids/doc/powercor.hlp create mode 100644 noao/onedspec/irsiids/doc/process.hlp create mode 100644 noao/onedspec/irsiids/doc/slist1d.hlp create mode 100644 noao/onedspec/irsiids/doc/subsets.hlp create mode 100644 noao/onedspec/irsiids/doc/sums.hlp create mode 100644 noao/onedspec/irsiids/doc/widstape.hlp create mode 100644 noao/onedspec/irsiids/extinct.cl create mode 100644 noao/onedspec/irsiids/extinct.par create mode 100644 noao/onedspec/irsiids/flatdiv.par create mode 100644 noao/onedspec/irsiids/flatfit.par create mode 100644 noao/onedspec/irsiids/getnimage.x create mode 100644 noao/onedspec/irsiids/idsmtn.h create mode 100644 noao/onedspec/irsiids/irsiids.hd create mode 100644 noao/onedspec/irsiids/mkpkg create mode 100644 noao/onedspec/irsiids/powercor.cl create mode 100644 noao/onedspec/irsiids/powercor.par create mode 100644 noao/onedspec/irsiids/slist1d.par create mode 100644 noao/onedspec/irsiids/subsets.par create mode 100644 noao/onedspec/irsiids/sums.par create mode 100644 noao/onedspec/irsiids/t_addsets.x create mode 100644 noao/onedspec/irsiids/t_bswitch.x create mode 100644 noao/onedspec/irsiids/t_coefs.x create mode 100644 noao/onedspec/irsiids/t_coincor.x create mode 100644 noao/onedspec/irsiids/t_flatdiv.x create mode 100644 noao/onedspec/irsiids/t_flatfit.x create mode 100644 noao/onedspec/irsiids/t_slist1d.x create mode 100644 noao/onedspec/irsiids/t_subsets.x create mode 100644 noao/onedspec/irsiids/t_sums.x create mode 100644 noao/onedspec/irsiids/t_widstape.x create mode 100644 noao/onedspec/irsiids/widstape.par create mode 100644 noao/onedspec/lcalib.par create mode 100644 noao/onedspec/mkpkg create mode 100644 noao/onedspec/mkspec.par create mode 100644 noao/onedspec/names.par create mode 100644 noao/onedspec/ndprep.cl create mode 100644 noao/onedspec/odcombine.par create mode 100644 noao/onedspec/odcombine/mkpkg create mode 100644 noao/onedspec/odcombine/odcombine.par create mode 100644 noao/onedspec/odcombine/src/generic/icaclip.x create mode 100644 noao/onedspec/odcombine/src/generic/icaverage.x create mode 100644 noao/onedspec/odcombine/src/generic/iccclip.x create mode 100644 noao/onedspec/odcombine/src/generic/icgdata.x create mode 100644 noao/onedspec/odcombine/src/generic/icgrow.x create mode 100644 noao/onedspec/odcombine/src/generic/icmedian.x create mode 100644 noao/onedspec/odcombine/src/generic/icmm.x create mode 100644 noao/onedspec/odcombine/src/generic/icomb.x create mode 100644 noao/onedspec/odcombine/src/generic/icpclip.x create mode 100644 noao/onedspec/odcombine/src/generic/icsclip.x create mode 100644 noao/onedspec/odcombine/src/generic/icsigma.x create mode 100644 noao/onedspec/odcombine/src/generic/icsort.x create mode 100644 noao/onedspec/odcombine/src/generic/icstat.x create mode 100644 noao/onedspec/odcombine/src/generic/mkpkg create mode 100644 noao/onedspec/odcombine/src/generic/xtimmap.x create mode 100644 noao/onedspec/odcombine/src/icaclip.gx create mode 100644 noao/onedspec/odcombine/src/icaverage.gx create mode 100644 noao/onedspec/odcombine/src/iccclip.gx create mode 100644 noao/onedspec/odcombine/src/icemask.x create mode 100644 noao/onedspec/odcombine/src/icgdata.gx create mode 100644 noao/onedspec/odcombine/src/icgrow.gx create mode 100644 noao/onedspec/odcombine/src/icgscale.x create mode 100644 noao/onedspec/odcombine/src/ichdr.x create mode 100644 noao/onedspec/odcombine/src/icimstack.x create mode 100644 noao/onedspec/odcombine/src/iclog.x create mode 100644 noao/onedspec/odcombine/src/icmask.com create mode 100644 noao/onedspec/odcombine/src/icmask.h create mode 100644 noao/onedspec/odcombine/src/icmask.x create mode 100644 noao/onedspec/odcombine/src/icmedian.gx create mode 100644 noao/onedspec/odcombine/src/icmm.gx create mode 100644 noao/onedspec/odcombine/src/icomb.gx create mode 100644 noao/onedspec/odcombine/src/icombine.com create mode 100644 noao/onedspec/odcombine/src/icombine.h create mode 100644 noao/onedspec/odcombine/src/icombine.x create mode 100644 noao/onedspec/odcombine/src/icpclip.gx create mode 100644 noao/onedspec/odcombine/src/icpmmap.x create mode 100644 noao/onedspec/odcombine/src/icrmasks.x create mode 100644 noao/onedspec/odcombine/src/icscale.x create mode 100644 noao/onedspec/odcombine/src/icsclip.gx create mode 100644 noao/onedspec/odcombine/src/icsection.x create mode 100644 noao/onedspec/odcombine/src/icsetout.x create mode 100644 noao/onedspec/odcombine/src/icsigma.gx create mode 100644 noao/onedspec/odcombine/src/icsort.gx create mode 100644 noao/onedspec/odcombine/src/icstat.gx create mode 100644 noao/onedspec/odcombine/src/mkpkg create mode 100644 noao/onedspec/odcombine/src/tymax.x create mode 100644 noao/onedspec/odcombine/src/xtimmap.com create mode 100644 noao/onedspec/odcombine/src/xtimmap.gx create mode 100644 noao/onedspec/odcombine/src/xtprocid.x create mode 100644 noao/onedspec/odcombine/srcwt/generic/icaclip.x create mode 100644 noao/onedspec/odcombine/srcwt/generic/icaverage.x create mode 100644 noao/onedspec/odcombine/srcwt/generic/iccclip.x create mode 100644 noao/onedspec/odcombine/srcwt/generic/icgdata.x create mode 100644 noao/onedspec/odcombine/srcwt/generic/icgrow.x create mode 100644 noao/onedspec/odcombine/srcwt/generic/icmedian.x create mode 100644 noao/onedspec/odcombine/srcwt/generic/icmm.x create mode 100644 noao/onedspec/odcombine/srcwt/generic/icomb.x create mode 100644 noao/onedspec/odcombine/srcwt/generic/icpclip.x create mode 100644 noao/onedspec/odcombine/srcwt/generic/icsclip.x create mode 100644 noao/onedspec/odcombine/srcwt/generic/icsigma.x create mode 100644 noao/onedspec/odcombine/srcwt/generic/icsort.x create mode 100644 noao/onedspec/odcombine/srcwt/generic/icstat.x create mode 100644 noao/onedspec/odcombine/srcwt/generic/mkpkg create mode 100644 noao/onedspec/odcombine/srcwt/generic/xtimmap.x create mode 100644 noao/onedspec/odcombine/srcwt/icaclip.gx create mode 100644 noao/onedspec/odcombine/srcwt/icaverage.gx create mode 100644 noao/onedspec/odcombine/srcwt/iccclip.gx create mode 100644 noao/onedspec/odcombine/srcwt/icemask.x create mode 100644 noao/onedspec/odcombine/srcwt/icgdata.gx create mode 100644 noao/onedspec/odcombine/srcwt/icgdata.gxBAK create mode 100644 noao/onedspec/odcombine/srcwt/icgrow.gx create mode 100644 noao/onedspec/odcombine/srcwt/icgscale.x create mode 100644 noao/onedspec/odcombine/srcwt/ichdr.x create mode 100644 noao/onedspec/odcombine/srcwt/icimstack.x create mode 100644 noao/onedspec/odcombine/srcwt/iclog.x create mode 100644 noao/onedspec/odcombine/srcwt/icmask.com create mode 100644 noao/onedspec/odcombine/srcwt/icmask.h create mode 100644 noao/onedspec/odcombine/srcwt/icmask.x create mode 100644 noao/onedspec/odcombine/srcwt/icmedian.gx create mode 100644 noao/onedspec/odcombine/srcwt/icmm.gx create mode 100644 noao/onedspec/odcombine/srcwt/icomb.gx create mode 100644 noao/onedspec/odcombine/srcwt/icombine.com create mode 100644 noao/onedspec/odcombine/srcwt/icombine.h create mode 100644 noao/onedspec/odcombine/srcwt/icombine.x create mode 100644 noao/onedspec/odcombine/srcwt/icpclip.gx create mode 100644 noao/onedspec/odcombine/srcwt/icpmmap.x create mode 100644 noao/onedspec/odcombine/srcwt/icrmasks.x create mode 100644 noao/onedspec/odcombine/srcwt/icscale.x create mode 100644 noao/onedspec/odcombine/srcwt/icsclip.gx create mode 100644 noao/onedspec/odcombine/srcwt/icsection.x create mode 100644 noao/onedspec/odcombine/srcwt/icsetout.x create mode 100644 noao/onedspec/odcombine/srcwt/icsigma.gx create mode 100644 noao/onedspec/odcombine/srcwt/icsort.gx create mode 100644 noao/onedspec/odcombine/srcwt/icstat.gx create mode 100644 noao/onedspec/odcombine/srcwt/mkpkg create mode 100644 noao/onedspec/odcombine/srcwt/tymax.x create mode 100644 noao/onedspec/odcombine/srcwt/xtimmap.com create mode 100644 noao/onedspec/odcombine/srcwt/xtimmap.gx create mode 100644 noao/onedspec/odcombine/srcwt/xtprocid.x create mode 100644 noao/onedspec/odcombine/t_odcombine.x create mode 100644 noao/onedspec/odcombine/x_odcombine.x create mode 100644 noao/onedspec/odropenp.x create mode 100644 noao/onedspec/onedspec.cl create mode 100644 noao/onedspec/onedspec.hd create mode 100644 noao/onedspec/onedspec.men create mode 100644 noao/onedspec/onedspec.par create mode 100644 noao/onedspec/refspectra.par create mode 100644 noao/onedspec/reidentify.par create mode 100644 noao/onedspec/rspectext.cl create mode 100644 noao/onedspec/rstext.par create mode 100644 noao/onedspec/sapertures.par create mode 100644 noao/onedspec/sarith.par create mode 100644 noao/onedspec/sbands.par create mode 100644 noao/onedspec/scombine/README create mode 100644 noao/onedspec/scombine/generic/icaclip.x create mode 100644 noao/onedspec/scombine/generic/icaverage.x create mode 100644 noao/onedspec/scombine/generic/iccclip.x create mode 100644 noao/onedspec/scombine/generic/icgrow.x create mode 100644 noao/onedspec/scombine/generic/icmedian.x create mode 100644 noao/onedspec/scombine/generic/icmm.x create mode 100644 noao/onedspec/scombine/generic/icpclip.x create mode 100644 noao/onedspec/scombine/generic/icsclip.x create mode 100644 noao/onedspec/scombine/generic/icsort.x create mode 100644 noao/onedspec/scombine/generic/mkpkg create mode 100644 noao/onedspec/scombine/icgdata.x create mode 100644 noao/onedspec/scombine/iclog.x create mode 100644 noao/onedspec/scombine/icombine.com create mode 100644 noao/onedspec/scombine/icombine.h create mode 100644 noao/onedspec/scombine/icombine.x create mode 100644 noao/onedspec/scombine/icscale.x create mode 100644 noao/onedspec/scombine/icstat.x create mode 100644 noao/onedspec/scombine/icsum.x create mode 100644 noao/onedspec/scombine/iscombine.key create mode 100644 noao/onedspec/scombine/iscombine.par create mode 100644 noao/onedspec/scombine/mkpkg create mode 100644 noao/onedspec/scombine/scombine.par create mode 100644 noao/onedspec/scombine/t_scombine.x create mode 100644 noao/onedspec/scombine/x_scombine.x create mode 100644 noao/onedspec/scoords.par create mode 100644 noao/onedspec/scopy.cl create mode 100644 noao/onedspec/scopy.par create mode 100644 noao/onedspec/sensfunc.par create mode 100644 noao/onedspec/sensfunc/mkpkg create mode 100644 noao/onedspec/sensfunc/sensfunc.h create mode 100644 noao/onedspec/sensfunc/sensfunc.key create mode 100644 noao/onedspec/sensfunc/sfadd.x create mode 100644 noao/onedspec/sensfunc/sfapertures.x create mode 100644 noao/onedspec/sensfunc/sfcgraph.x create mode 100644 noao/onedspec/sensfunc/sfcolon.x create mode 100644 noao/onedspec/sensfunc/sfcolors.x create mode 100644 noao/onedspec/sensfunc/sfcomposite.x create mode 100644 noao/onedspec/sensfunc/sfdata.x create mode 100644 noao/onedspec/sensfunc/sfdelete.x create mode 100644 noao/onedspec/sensfunc/sfeout.x create mode 100644 noao/onedspec/sensfunc/sfextinct.x create mode 100644 noao/onedspec/sensfunc/sffit.x create mode 100644 noao/onedspec/sensfunc/sfginit.x create mode 100644 noao/onedspec/sensfunc/sfgraph.x create mode 100644 noao/onedspec/sensfunc/sfimage.x create mode 100644 noao/onedspec/sensfunc/sfmarks.x create mode 100644 noao/onedspec/sensfunc/sfmove.x create mode 100644 noao/onedspec/sensfunc/sfnearest.x create mode 100644 noao/onedspec/sensfunc/sfoutput.x create mode 100644 noao/onedspec/sensfunc/sfreset.x create mode 100644 noao/onedspec/sensfunc/sfrms.x create mode 100644 noao/onedspec/sensfunc/sfsensfunc.x create mode 100644 noao/onedspec/sensfunc/sfshift.x create mode 100644 noao/onedspec/sensfunc/sfstats.x create mode 100644 noao/onedspec/sensfunc/sfstds.x create mode 100644 noao/onedspec/sensfunc/sftitle.x create mode 100644 noao/onedspec/sensfunc/sfundelete.x create mode 100644 noao/onedspec/sensfunc/sfvstats.x create mode 100644 noao/onedspec/sensfunc/sfweights.x create mode 100644 noao/onedspec/sensfunc/t_sensfunc.x create mode 100644 noao/onedspec/setdisp.par create mode 100644 noao/onedspec/sfit.par create mode 100644 noao/onedspec/sflip.par create mode 100644 noao/onedspec/sinterp.par create mode 100644 noao/onedspec/skytweak.par create mode 100644 noao/onedspec/slist.par create mode 100644 noao/onedspec/smw/README create mode 100644 noao/onedspec/smw/funits.x create mode 100644 noao/onedspec/smw/mkpkg create mode 100644 noao/onedspec/smw/shdr.x create mode 100644 noao/onedspec/smw/smwclose.x create mode 100644 noao/onedspec/smw/smwct.x create mode 100644 noao/onedspec/smw/smwctfree.x create mode 100644 noao/onedspec/smw/smwctran.gx create mode 100644 noao/onedspec/smw/smwctran.x create mode 100644 noao/onedspec/smw/smwdaxis.x create mode 100644 noao/onedspec/smw/smwequispec.x create mode 100644 noao/onedspec/smw/smwesms.x create mode 100644 noao/onedspec/smw/smwgapid.x create mode 100644 noao/onedspec/smw/smwgwattrs.x create mode 100644 noao/onedspec/smw/smwmerge.x create mode 100644 noao/onedspec/smw/smwmultispec.x create mode 100644 noao/onedspec/smw/smwmw.x create mode 100644 noao/onedspec/smw/smwnd.x create mode 100644 noao/onedspec/smw/smwndes.x create mode 100644 noao/onedspec/smw/smwnewcopy.x create mode 100644 noao/onedspec/smw/smwoldms.x create mode 100644 noao/onedspec/smw/smwonedspec.x create mode 100644 noao/onedspec/smw/smwopen.x create mode 100644 noao/onedspec/smw/smwopenim.x create mode 100644 noao/onedspec/smw/smwsapid.x create mode 100644 noao/onedspec/smw/smwsaveim.x create mode 100644 noao/onedspec/smw/smwsaxes.x create mode 100644 noao/onedspec/smw/smwsctran.x create mode 100644 noao/onedspec/smw/smwsmw.x create mode 100644 noao/onedspec/smw/smwswattrs.x create mode 100644 noao/onedspec/smw/units.x create mode 100644 noao/onedspec/specplot.h create mode 100644 noao/onedspec/specplot.key create mode 100644 noao/onedspec/specplot.par create mode 100644 noao/onedspec/specshift.par create mode 100644 noao/onedspec/splot.par create mode 100644 noao/onedspec/splot/anshdr.x create mode 100644 noao/onedspec/splot/autoexp.x create mode 100644 noao/onedspec/splot/avgsnr.x create mode 100644 noao/onedspec/splot/conflam.x create mode 100644 noao/onedspec/splot/confnu.x create mode 100644 noao/onedspec/splot/deblend.x create mode 100644 noao/onedspec/splot/eqwidth.x create mode 100644 noao/onedspec/splot/eqwidthcp.x create mode 100644 noao/onedspec/splot/fixx.x create mode 100644 noao/onedspec/splot/flatten.x create mode 100644 noao/onedspec/splot/fudgept.x create mode 100644 noao/onedspec/splot/fudgex.x create mode 100644 noao/onedspec/splot/getimage.x create mode 100644 noao/onedspec/splot/gfit.x create mode 100644 noao/onedspec/splot/mkpkg create mode 100644 noao/onedspec/splot/mktitle.x create mode 100644 noao/onedspec/splot/plotstd.x create mode 100644 noao/onedspec/splot/replot.x create mode 100644 noao/onedspec/splot/smooth.x create mode 100644 noao/onedspec/splot/spdeblend.x create mode 100644 noao/onedspec/splot/splabel.x create mode 100644 noao/onedspec/splot/splot.key create mode 100644 noao/onedspec/splot/splot.log create mode 100644 noao/onedspec/splot/splot.x create mode 100644 noao/onedspec/splot/splotcolon.x create mode 100644 noao/onedspec/splot/splotfun.x create mode 100644 noao/onedspec/splot/stshelp.key create mode 100644 noao/onedspec/splot/stshelp.x create mode 100644 noao/onedspec/splot/sumflux.x create mode 100644 noao/onedspec/splot/usercoord.x create mode 100644 noao/onedspec/splot/voigt.x create mode 100644 noao/onedspec/splot/wrspect.x create mode 100644 noao/onedspec/standard.key create mode 100644 noao/onedspec/standard.par create mode 100644 noao/onedspec/t_calibrate.x create mode 100644 noao/onedspec/t_deredden.x create mode 100644 noao/onedspec/t_dopcor.x create mode 100644 noao/onedspec/t_fitprofs.x create mode 100644 noao/onedspec/t_lcalib.x create mode 100644 noao/onedspec/t_mkspec.x create mode 100644 noao/onedspec/t_names.x create mode 100644 noao/onedspec/t_rstext.x create mode 100644 noao/onedspec/t_sapertures.x create mode 100644 noao/onedspec/t_sarith.x create mode 100644 noao/onedspec/t_sbands.x create mode 100644 noao/onedspec/t_scoords.x create mode 100644 noao/onedspec/t_sfit.x create mode 100644 noao/onedspec/t_sflip.x create mode 100644 noao/onedspec/t_sinterp.x create mode 100644 noao/onedspec/t_slist.x create mode 100644 noao/onedspec/t_specplot.x create mode 100644 noao/onedspec/t_specshift.x create mode 100644 noao/onedspec/t_standard.x create mode 100644 noao/onedspec/t_tweak.x create mode 100644 noao/onedspec/telluric.par create mode 100644 noao/onedspec/wspectext.cl create mode 100644 noao/onedspec/x_onedspec.x (limited to 'noao/onedspec') diff --git a/noao/onedspec/Revisions b/noao/onedspec/Revisions new file mode 100644 index 00000000..6da71399 --- /dev/null +++ b/noao/onedspec/Revisions @@ -0,0 +1,5321 @@ +.help revisions Jun88 noao.onedspec +.nf + +splot/eqwidthcp.x + The 'sg' and 'lg' pointers were allocated as TY_REAL and re-allocated + as TY_INT (5/4/13) + +splot/anshdr.x + Added a F_FLUSHNL flag to the logfile descriptors to flush the + data as it is written (5/12/12, MJF) + +splot/spdeblend.x + Added overplotting of individual components. (12/5/11, Valdes) + +==== +2.16 +==== + +hireswcal.cl + A script I wrote for Simon Schuler to apply the wavelength calibrations + that he got for hires spectra from Geoff Marcy. This is put here for + safe keeping. (11/16/11, Valdes) + +t_deredden.x + There was a small error in coding the formulae of Cardelli, et al. + (6/28/11, Valdes) + +splot/spdeblend.x + An integer allocated array was being freed as a real array causing + an error with deblending on 64-bit systems. (6/6/11, Valdes) + +======= +2.15.1a +======= + +====== +2.15.1 +====== + +scombine/icgdata.x + This code uses the SX array to pass in mask values. The code, taken from + an old version of imcombine, treats the mask array as integers. All the + dereferencing of this mask array were changed to reals. + +scombine/t_scombine.x + The SX pointer (allocated as real) was being used in a Memi, causing + a segfault on some 64-bit systems (4/3/11/, MJF) + +specplot.h + Fixed improper use of P2R in macro. (3/31/11, MJF) + +continuum.par +odcombine.par +sfit.par +splot.par + The prompt strings which said the "grow" parameter is in pixels were + changed to remove this. The grow parameter is in user coordinate units. + (6/28/10, Valdes) + +======= +V2.14.1 +======= + +t_specplot.x +specplot.par +doc/specplot.hlp + Added a new "transform" parameter to allow scaling the spectrum pixel + values. Currently on "log" is implemented. (1/5/09, Valdes) + +doc/splot.hlp + The description of the 'e' key incorrectly said a core flux is + output. (8/22/08, Valdes) + +dispcor.par + Changed "Conserve flux" to "Conserve total flux" per user request. + (6/13/08) + +rspectext.cl + Added "addonly" values to all hedit commands. (4/1/08, Valdes) + +odcombine/t_odcombine.x + Fixed some procedure calls being closed with a ']' instead of a ')' + (2/17/08, MJF) + +ecidentify/eclinelist.x + A check is made that the second closest match has a match distance + more that 25% greater than the nearest match. (12/10/07, Valdes) + +t_dopcor.x + For clarity when the velocity applied is in km/s this is used in the + log and in DOPCORn keywords. (12/10/07, Valdes) + +===== +V2.14 +===== + +doc/standard.hlp + Clarified the equations and formating. There was an inconsistency + between the Vega flux and magnitude given in the text. Either value + could be changed but the old version of this task was based on the + specified Vega flux so the magnitude was changes (0.048-0.0336) + to make the description consistent. (4/3/07, Valdes) + +splot/wrspect.x + For log sampled data (dc-flag=1) that also has a ltv offset the + new WCS for the output was wrong. (12/4/06, Valdes) + +smw/shdr.x + The shdr_rebin procedure was rebinning the target spectrum to its natural + units while the reference spectrum might be in different units. The + correct thing to do is rebin in the reference units. (10/27/06, Valdes) + + +======= +V2.12.3 +======= + +splot/splot.x + Needed to initialize the aperture so that the aperture selection + behavior is consistent when calling splot more than once. (5/16/06, Valdes) + +doc/specplot.hlp + Added a quick example illustrating using batch mode plotting. + (5/2/05, Valdes) + +t_specplot.x + To support cursor file input without including the x, y, wcs fields + the call to sp_nearest was modified to avoid floating exceptions. + (5/2/05, Valdes) + +t_sarith.x + Error handling was improved for onedspec output. When no pixels + were selected by using w1/w2 the warning was reported but then + a segmentation error would occur when trying to close the output + image. (3/8/05, Valdes) + +t_tweak.x +doc/telluric.hlp + The normalization used is now printed. (1/12/05, Valdes) + +t_dopcor.x +doc/dopcor.hlp + A keyword is added to log the operation. (10/29/04, Valdes) + +t_deredden.x + Adjusted the error reporting to print the warning before closing and + deleting the output image. (9/27/04, Valdes) + +ecidentify/ecfitdata.x + The EC_FITPT routine used the wrong pointer for the physical to logical + coordinate conversion. (9/10/04, Valdes) + +odcombine/ + +doc/odcombine.hlp + +x_onedspec.x +onedspec.cl +onedspec.men +onedspec.hd +mkpkg + Added a new task ODCOMBINE which is layered more directly on the + source for IMCOMBINE. This version supports bad pixel masks as well + as most of the new features of IMCOMBINE. (6/21/04, Valdes) + +scombine/x_scombine.x + +scombine/mkpkg +onedspec.cl +mkpkg + Packaged SCOMBINE as its own executable noaobin$x_scombine.e. + (6/21/04, Valdes) + +t_standard.x + In case someone puts the query parameter "star_name" on the command + line and the calibration cannot be found the task will not only try + twice before aborting rather than go into an infinite loop. + (5/21/04, Valdes) + +dispcor/t_dispcor.x +dispcor/dispcor.x +dispcor.par +doc/dispcor.hlp + Added the new parameter "blank" to control the output values when there + are no input values; i.e. the out of bounds values. (5/18/04, Valdes) + +dispcor/t_discpor.x + For 2D spectra the "global" option was not working. (5/14/04, Valdes) + +scombine/t_scombine.x + A check for the input format was added. If the input is 2D spectra + then a format error is printed. (5/14/04, Valdes) + +identify/autoid/autoid.x + Changed "AID_NT(aid) = min (2 * AID_NR(aid), AID_NTF(aid))" to + "AID_NT(aid) = AID_NTF(aid)". While this may have speed consequences + it avoids preselecting target lines. (4/23/04, Cooke, Valdes) + +doc/scombine.hlp + Made corrections suggested by Francois Schweizer on 2/25/04. + (3/10/04, valdes with input from schweizer) + +t_sarith.x + When the task was modified 8/3/02 to add something to the WCS the + wrong pointer was used resulting in a segmentation violation when + using the "merge" option. (3/9/04, Valdes) + +======= +V2.12.2 +======= + +identify/autoid/aidlog.x + Added a test to avoid an arithmetic error if the dispersion + turns out to be zero. (1/29/04, Valdes) + +identify/autoid/aidautoid.x +identify/autoid/autoid.x + Two new debugging characters, "nm", were added. + (1/29/04, Valdes) + +aidpars.par + Default values were changed: + cddir: "unknown" -> "sign" + ntarget: 30 -> 100 + ndmax: 20 -> 500 + fmatch: 0.3 -> 0.2 + (1/29/04, Valdes) + +identify/autoid/autoid.x + The parameters that can be specified by header keywords can now be + either the keyword or the keyword prefixed by '!'. This was done + because there are a number of other IRAF tasks that use the '!' prefix + and users may be confused and use this syntax. (1/29/04, Valdes) + +identify/autoid/autoid.x +aidpars.par + The number of highest vote potential dispersions checked was + previously limited to a maximum of three times the number of target lines. + Now the number may be as large as specified by the "ndmax" parameter. + The default parameter value was greatly increased to 500. + (1/29/04, Valdes) + +identify/autoid/aidautoid.x +doc/aidpars.hlp + The algorithm was modified to iterate on the pattern parameter + "npattern". After exhausting the search with the initial + number of lines per pattern the value is reduced successively by + one down to the minimum of 3. This makes the algorithm take longer + but the search is more exhaustive. Use of larger patterns initially + allows finding fewer and more likely candidates first to speed + a solution. (1/29/04, Valdes) + +aidpars.par +identify/autoid/autoid.x +doc/aidpars.hlp + The "rms" parameter is now specified in units of the "fwidth" + parameter rather than in pixels. This is because if fwidth is + made larger to deal with broad lines (i.e. a wide slit) then the + expected uncertainties in pixel centroids will be larger. The + default value was changed from 0.3 pixels to 0.1 of fwidth. + (1/29/04, Valdes) + +identify/autoid/autoid.x +doc/aidpars.hlp +identify/id_peaks.x + The selection of target lines was changed from using id_peaks to a + new routine id_upeaks. In the former routine the ntarget strongest + peaks are selected regardless of position in the spectrum. But this + can result in no lines being used in some parts of the spectrum if + the spectrum is dominated by strong lines in just one part of the + spectrum. The id_upeaks routine finds lines over the whole spectrum + by dividing the spectrum into regions and then alternatively selecting + the brightest line in each region until the desired number of lines + is obtained. In this case the number of regions if hardwired at 5. + (1/29/04, Valdes) + +aidpars.par +identify/autoid/autoid.h +doc/aidpars.hlp +identify/autoid/aidinit.x +identify/autoid/aidset.x +identify/autoid/autoid.x + Added two new parameters to aidpars. The first is "maxnl" which + defines the maximum non-linearity to accept after a dispersion function + fit. Previously the maximum was hardwired in the code to be 0.5% + which was too small for many applications. The default is set at + 2%. The second new parameter is "crquad" which defines a quadratic + correction to the pixel positions of detected lines in order to + "linearize" the pattern of line spacings which are matched against + the coordinate list. This was found to not be as important as the + "maxnl" limitation in handling non-linear dispersion and has a default + value of zero. (1/29/04) + +sensfunc/sfstds.x + Added a check for names with a kernel section. Specifically, names + that end in ']'. (12/18/03, Valdes) + +smw/shdr.x + Now if CUNITn is specified in velocity (m/s or km/s) and if + CTYPEn is VELO (or VELOCITY) then internally the velocity zero point + reference of 21 centimenters will be automatically added. + (8/19/03, Valdes) + +smw/shdr.x + Experience has shown that data with no units that users want to + import is mostly in Angstroms. So rather than use the old FITS + standard that units are meters it will now assume Angstroms. + (8/15/03, Valdes) + +smw/smwaxes.x + A check is made if the physical axis is ra or dec in which case the + image is considered not to be dispersion corrected. (8/5/03, Valdes) + +smw/smwsctran.x + If there is an error the physical coordinate system is used instead of + the world coordinate system. This is meant to allow coupled WCS + (particularly celestial WCS) to be used without an error. + (8/5/03, Valdes) + +t_dopcor.x + Moved the erract before the imunmap/imdelete to produce the correct + error message. (7/8/03, Valdes) + +dispcor/t_disptrans.x + When the subroutine dispcor was modified with an extra arguement this + task was not modified. The extra argument was added. (6/4/03, Valdes) + +identify/idinit.x + The restore function was not resetting the shift value at the right + time. This had the effect of causing the user shift to be wrong + in the REIDENTIFY output when refit=no. (5/27/03, Valdes) + +t_tweak.x + The statistics computation is now relative to neighboring points. + This change was developed working with the Coude-Feed spectral atlas + pipeline. (4/3/03, Valdes) + +t_tweak.x + WHen an error, such as calibration values too low, occurs in twk_fit it + would exit without closing the graphics. Now the graphics is opened with + AW_DEFER and the error action is to first close the graphics before + returning to the calling routine with the error. (2/28/03, Valdes) + +t_tweak.x (Bug 520) + The erract was after error cleanup which could cause the incorrect + error to be reported. Since the error action is to WARN it makes sense + to immediate report the error and then do the clean up. (2/24/03, Valdes) + +dispcor/refspectra.x +dispcor/refgspec.x +dispcor/refspectra.com + The "select" parameter is now included in the common so that + refgspec does not try to look for the sort and group keyword if + it is not needed. (9/5/02, Valdes) + +t_sarith.x + When a new MWCS pointer is created the attribute "sformat" has to + be added. (8/3/02, Valdes) + +t_fitprofs.x + Incorrectly used pargi instead of pargb. (8/2/02, Valdes) + +splot/getimage.x + Gt_setr was being called with an integer argument. (8/2/02, Valdes) + + +splot/eqwidthcp.x + 1. A pargd was used with the real variable cont. + 2. Variable pi never used. + (8/2/02, Valdes) + +scombine/icscale.x + Needed to dereference the error string in icgscale. + (8/2/02, Valdes) + +t_dispcor.x + String argument was incorrectly given as NULL. + (8/2/02, Valdes) + +t_dispcor.x +dispcor/dcio.x +sensfunc/sfoutput.x + The axis variable is not used and was deleted. (8/2/02, Valdes) + +======= +V2.12.1 +======= + +scombine/t_scombine.x +doc/scombine.hlp + The rejection option is ignored when "combine=sum". The documentation + did not make this clear and the output log would show whatever was + set for the rejection parameter. The help was clarified and the + code changed to show a rejection of none. (7/5/02, Valdes) + +irsiids/libpkg.a + Removed a stray libpkg.a link (6/5/02, MJF) + +identify/idcenter.x +ecidentify/eccenter.x + The handling of INDEF values between reals and doubles was not done + correctly. (5/28/02, Valdes) + +===== +V2.12 +===== + +t_slist.x +irsiids/t_slist1d.x + The SMW pointer was being closed without resetting the pointer in + the SHDR structure. (5/30/02, Valdes) + +identify/iddofit.x +identify/idinit.x + When deleting features during the fitting the memory allocated for + the labels was not being updated correctly. Also in freeing the + feature memory there was no need to free labels beyond the number + of features. (4/30/02, Valdes) + +splot/wrspect.x + Removed possibility of an infinite loop and make error checking + a little more obvious. (2/28/02, Valdes, 3/21/02, Valdes)) + +dispcor/dcio.x + Removed the special test for dispersion corrected data with no DCLOG + keyword which prevents re-calibration. (2/4/02, Valdes) + +doc/bplot.hlp + Fixed a typo in the help page. (1/5/02, MJF) + +mkpkg + Added missing dependency to getcalib.x (12/13/01, MJF) + +sensfunc/mkpkg + Removed unneeded dependencies for sfimage.x (12/13/01, MJF) + +irsiids/t_flatfit.x +irsiids/t_subsets.x +irsiids/t_sums.x +t_mkspec.x +t_sinterp.x +irsiids/t_bswitch.x + imgl1r() called with extra arg. (9/20/01, Valdes) + +dispcor/t_dispcor.x + dc_gec() missing arg. (9/20/01, Valdes) + +identify/autoid/aidautoid.x + aid_eval() called with extra arg. (9/20/01, Valdes) + +identify/idinit.x + id_gid() define as a function but should be a subroutine. + (9/20/01, Valdes) + +identify/idshift.x + id_getid() called as subroutine. (9/20/01, Valdes) + +ecidentify/ecffit/ecfshift.x + ecf_pshift() was incorrect. (9/20/01, Valdes) + +identify/iddofit.x + When removing lines deleted during fitting the labels were not being + correctly maintained. (8/2/01, Valdes) + +splot/eqwidth.x + Instead of refusing to compute errors when there is a negative value + (anywhere in the spectrum and not just in the region) the routine + simply sets the pixel value in evaluating the sigma. + (5/16/01, Valdes) + +doc/deredden.hlp + Added information about the range of validity of the extinction + function. (4/9/01, Valdes) + +t_fitprof.x + The input image was being unmmaped before the output image which + can cause problems. (3/9/01, Valdes) + +splot/getimage.x + The nline parameter was not being set to the current line which could + cause the ')' and '(' to misbehave. (2/15/01, Valdes) + +doc/sarith.hlp + The help said incorrectly that flux conservation was used. + (1/17/01, Valdes) + +smw/smwsaveim.x +smw/smwequispec.x + The APNUM keywords change to AP when the aperture number is greater + than 999. (11/8/00, Valdes) + +identify/iddb.x + The user units string is now recorded. This is to allow velocity + units to include the reference point. (5/4/00, Valdes) + +splot/eqwidthcp.x + When x becomes large enough the parabola fitting routine has a + divide by zero. The parabola fitting routine was converted to work in + double, to check the x values for degeneracy, and to avoid the squares + of large numbers. The calling routine was also modified to work in + double. (2/15/00, Valdes) + +smw/smwonedspec.x +smw/smwoldms.x + Put an error check on imdelf. The list expansion should have expanded + to only the header keywords present but for some undiagnosed reason + sometimes the list expansion returned a non-existant keyword which + wouod cause an error. (2/2/00) + +dispcor/dispcor.x + The input linei argument should really be the aperture number needed + to go back to pixel coordinates. The change was to use this value only + to flag if the WCS is 1D (for long slit data) and otherwise to do + what the procedure did before. (2/1/00, Valdes) + +dispcor/t_dispcor.x + During changes for 2D dispcor the arguments for a routine changed and + this was not reflected in the dc_global routines resulting in a + segmentation violation when the global option is selected. + (1/27/00, Valdes) + +dispcor/dcio.o + Touched but not changes. (1/27/00, Valdes) + +getcalib.x +t_standard.x +standard.par +lcalib.par +splot.par +doc/standard.hlp +doc/lcalib.hlp +doc/splot.hlp + 1. The calibration files may now be blackbody curves scaled to a + specified magnitude. + 2. STANDARD displays the data and bandpasses in the units of the + data rather than Angstroms. The changes were made to allow + output in other untis but for now this has been disabled. + (1/24/00, Valdes) + +t_sarith.x + The WCS was set wrong when copying/extracting a region of a + log-linear spectrum. (12/14/99, Valdes) + +======= +V2.11.3 +======= + +t_fitprof.x + Fixed double/int mismatch in a min call. (11/22/99, Valdes) + +smw/mkpkg +ecidentify/ecffit/mkpkg +sensfunc/mkpkg +splot/mkpkg +mkpkg + Added missing dependencies. (10/11/99, Valdes) + +t_fitprofs.x +doc/fitprofs.hlp + The background region specification was extended to allow a third + argument as a scaling factor. (9/22/99, Valdes) + +doc/specwcs.hlp + Fixed typo defining the variable n. (9/13/99, Valdes) + +t_tweak.x + 1. Changed wavelength evaluations to double precision. + 2. The normalization step for the rms calculation was removed for + the case of sky subtraction. + (9/8/99, Valdes) + +dispcor/t_dispcor.x +dispcor/dcio.x +dispcor/dispcor.x +doc/dispcor.hlp + Now allows NDSPEC format spectra. (9/7/99, Valdes) + +t_fitprofs.x +doc/fitprofs.hlp + 1. The background region specification was extended to allow taking + the average or median or a region. + 2. The image identification label was incorrect. + 3. If verbose=no there was an attempt to close a non-existent structure. + (6/26/99, Valdes) + +t_fitprofs.x + Fixed bug which only allowed the last component to be saved to an + image. (8/25/99, Valdes) + +======= +V2.11.2 +======= + +smw/units.x +smw/funits.x + Stripped trailing whitespace from units label. (8/5/99, Valdes) + +identify/t_reidentify.x + File date changed but no changes made to the file. (7/22/99, Valdes) + +rspectext.cl + Added explicit add and del parameters to all the HEDIT calls. + (7/15/99, Valdes) + +t_sarith.x + The option to have a single second operand to work on a set of + first operands was not working. (5/28/99, Valdes) + +splot/splot.key +doc/splot.hlp + Added a reference to :.help and :/help. (5/12/99, Valdes) + +doc/sys/1and2dspec.hlp +doc/sys/Onedspec.hlp +doc/sys/Review.hlp +doc/fitprofs.hlp +doc/reidentify.hlp +doc/sensfunc.hlp +doc/aidpars.hlp +doc/autoidentify.hlp +doc/skytweak.hlp +doc/telluric.hlp +irsiids/doc/powercor.hlp +irsiids/doc/widstape.hlp + Fixed minor formating problems. (4/22/99, Valdes) + +identify/idlinelist.x + The call to id_peak was using physical pixels while the subroutine + expects logical pixels. A conversion from physical to logical was + added before calling id_peak. (3/8/99, Valdes) + +scombine/t_scombine.x + Changed UT(shin) = imgetr (im, Memc[gain -> snoise]). + (1/29/99, Valdes) + +identify/idgraph.x + Removed violation of GTOOLS data structure. (12/18/98, Valdes) + +identify/t_reidentify.x + 1. When interactive=yes and ans is not NO when starting on a new + image in ri_image, the curfit descriptor was initialized to the + defaults rather than to reference solution. This was because + of a missing ic_copy. + 2. When the reference and image names are the same the task will now + skip the reidentify, + (12/3/98, Valdes) + +shdr.x + Needed to check if data is defined for associated types before trying + to set flux units. (11/27/98, Valdes) + +shdr.x + Improved the recognition of CTYPE values. Most notably WAVELENGTH + is converted to "waveleng" by MWCS in making the label attribute. + (11/25/98, Valdes) + +doc/splot.hlp + Fixed help that said the output of a long slit or ND image would be + a 1D image. (11/18/98, Valdes) + +dispcor/dispcor.x +dispcor/refspectra.x + The weights when weighting multiple dispersion solutions were only + being recorded in the WCS attributes to 3 significant digits. This + could cause the weights to become unnormalized and cause small + shifts. Now whenever the weights are converted to strings the + format is %.8g. (11/17/98, Valdes) + +t_fitprofs.x + When the input peak value was INDEF the task would fail with a + floating overflow value if scale < 1. This was caused by not checking + for INDEF before dividing by the scale. (11/5/98, Valdes) + +smw/smwnewcopy.x + The structure copy was wrong. (10/28/98, Valdes) + +sensfunc/sfimage.x +t_calibraate.x + The flux calibration gets the wrong sign if dw<0. (9/25/98, Valdes) + +smw/shdr.x + Default units of Angstroms was added if DC-FLAG is dispersion corrected. + (9/24/98, Valdes) + +dispcor/dcio.x + The weights are now adjusted to produce weighted average rather than + weighted sum. (8/25/98, Valdes) + +splot/wrspect.x + The filling in of data outside of NP1/NP2 was done incorrectly. + Normally NP1/NP2 cover the entire image line but in echelle data + it is common for NP2 to be less than the full line. In this case + the result of saving an image was loss of the last valid point. + (7/14/98, Valdes) + +identify/idinit.x + When restoring a solution without a dispersion function the shift + failed to be restored. This causes a problem with REIDENTIFY when + working on long slit data with a significant systematic tilt and + measuring the spatial distortion. (6/1/98, Valdes) + +t_tweak.x +telluric.par +doc/telluric.hlp + If the calibration is < 0 it is detected but there was an error in + the error clean up giving a "memory corruption" error. This error + was fixed and a new threshold parameter was added to allow the task + to continue if the calibration data has low values. + (4/21/98, Valdes) + +t_sarith.x + When rebinning non-linear spectra the dispersion type was not be reset + to linear resulting in an incorrect spectral WCS. See buglog 400. + (4/17/98, Valdes) + +doc/scopy.hlp + Added a note about using epar to set nsum to examples in section III + as suggested by Ivan King on 4/3/98. (4/8/98, Valdes) + +scombine/t_scombine.x + If the input spectra are not dispersion corrected and first=no the + task was incorrectly setting the dispersion correction flag. + (3/3/98, Valdes) + +splot/deblend.x + The dorefit code was not handling the case of a mixture of profile types. + (2/12/98, Valdes) + +t_tweak.x + The extra argument in a twk_colon call was removed. + (2/5/98, Valdes) + +dispcor/t_dispcor.x + Added some errchk declarations. + (1/26/98, Valdes) + +identify/idlinelist.x +doc/autoidentify.hlp +doc/identify.hlp +doc/reidentify.hlp + When a coordinate list is read it will be sorted and identical + entries will be eliminated. Thus, line lists no longer need to + be sorted. (1/12/98, Valdes) + +======= +V2.11.1 +======= + +doc/splot.hlp + Added another paragraph and a correction to the flux calculation + done by 'e'. (12/22/97, Valdes) + +splot/gfit.x + The test for computing errors when negative data is detected was + incorrect and would given an error message even when errors were + not desired. (10/23/97, Valdes) + +dispcor/dispcor.x +smw/shdr.x + Changed the maximum distance that the endpoints can be from pixel + edges before using the pixel values directly instead of integrating + the interpolator from 0.001 to 0.00001. (10/7/97, Valdes) + +doc/calibrate.hlp + Added brief discussion about pixels falling outside the wavelength + range of the sensitivity function. (9/23/97, Valdes) + +=========== +V2.11export +=========== + +identify/iddb.x +ecidentify/ecdb.x + Increased the number of digits recorded in the database for the fit + and user values to 9. (8/22/97, Valdes) + +swm/shdr.x + Added an arbitrary reference for the velocity CTYPE value. + (8/20/97, Valdes) + +smw/smwsaxes.x + The earlier fix for transposed data was incorrect. The origin terms + do not need to be changed but the order of the CD matrix terms + was incorrect. (8/15/97, Valdes) + +dispcor/refnoextn.x + Added fit and fits to the possible extensions. (8/14/97, Valdes) + +smw/smwsaxes.x + When the LTERM is adjusted to correct for a transpose only the matrix + terms were being corrected. The origin terms also needed to be + corrected. (8/6/97, Valdes) + +scombine/t_scombine.x + Previously an end input pixel had to completely overlap an output pixel + otherwise it was flagged as missing data. This was changed to use + the end pixels if they overlapped at all. This change was done to + allow small dispersion shifts to not affect the end point combining. + (8/6/97, Valdes) + +smw/shdr.x + No change. (8/6/97, Valdes) + +identify/t_reidentify.x +doc/reidentify.hlp +reidentify.par +imred/*/reidentify.par +twodspec/longslit/reidentify.par + The shift parameter was restored to it's previous usage. The automatic + pattern matching algorithm is not selected by setting the shift to INDEF + and using the new parameter crsearch. (7/21/97, Valdes) + +identify/idshift.x +identify/t_reidentify.x + The symbol table of reference solutions was being modified by the shift + calculation causing the loop over solutions to be wrong. Now + ri_image marks and frees the symbol table between calls and loops + through the symbol table solutions in a way that is not affected by + new entries in the symbol table. Also idshift marks and frees the + symbol table. Note that marking and freeing is not enough because + the loop using sthead/stnext will not work. (7/19/97, Valdes) + +identify/autoid/aidshift.x +identify/ididentify.x +identify/idreidentify.x +identify/doc/reidentify.x +identify/reidentify.par + 1. aid_shift was not using crsearch/cdsearch as expected. + 2. The call to id_shift in the interactive routines had an incorrect + argument value. + 3. The help page for REIDENTIFY was clarified about what the shift + parameter means. + 4. The parameter prompt for shift in REIDENTIFY was corrected. + parameter means. + (7/17/97, Valdes) + +identify/t_reidentify.x + The nlost parameter now applies when not tracing. (7/17/97, Valdes) + +t_sarith.x + The power option did not work because the apow routine takes only + integer powers. Replace the apow routine with an explicit calculation. + (7/15/97, Valdes) + +========= +V2.11Beta +========= + +identify/t_reidentify.x + The number of features was being used to calculate how many features + might be lost before it was set. (6/3/97, Valdes) + +doc/disptrans.hlp +doc/onedspec.hlp +doc/splot.hlp + Added new unit abbreviations. (5/27/97, Valdes) + +splot/splot.x +splot/splotcolon.x +splot/splabel.x + +splot/splot.key +doc/splot.hlp + Added colon commands for labeling. (5/16/97, Valdes) + +t_tweak.x + 1. The ? help file was specified as .hlp instead of .key. + 2 Add a divide by zero check. + (5/14/97, Valdes) + +t_scoords.x + +scoords.par + +doc/scoords.hlp + +x_onedspec.x +mkpkg +onedspec.cl +onedspec.hd +onedspec.men + Added a new task that sets a pixel array spectral coordinate system + in 1D spectra. (5/9/97, Valdes) + +doc/sapertures.hlp +doc/sinterp.hlp +doc/sflip.hlp +doc/disptrans.hlp +doc/skytweak.hlp +doc/telluric.hlp +doc/sfit.hlp +doc/continuum.hlp +doc/fitprofs.hlp +irsiids/doc/slist1d.hlp + Changed revision versions. (4/22/97, Valdes) + +t_tweak.x + +skytweak.par + +telluric.par + +doc/skytweak.hlp + +doc/telluric.hlp + +x_onedspec.x +onedspec.cl +onedspec.men +onedspec.hd + Added tasks for tweaking calibration spectra and applying a sky + subtraction or telluric correction. (3/28/97, Valdes) + +t_sarith.x + The wrong INDEF type was used. (3/17/97, Valdes) + +smw/shdr.x + The shdr_linear needed to transform the requested input range to + the image WCS units. (3/13/97, Valdes) + +t_calibrate.x +t_standard.x + Changed to allow input spectra in various units. (3/12/97, Valdes) + +autoidentify.par +identify.par +ecidentify.par +identify/t_autoid.x +identify/t_identify.x +identify/identify.h +identify/idinit.x +identify/idgdata.x +identify/iddofit.x +identify/idmap.x +identify/iddb.x +identify/idlinelist.x +identify/idfitdata.x +ecidentify/ecinit.x +ecidentify/ecgdata.x +ecidentify/t_eciden.x +ecidentify/eclinelist.x +ecidentify/ecidentify.h +ecidentify/ecdb.x +ecidentify/ecfitdata.x +dispcor/t_dispcor.x +dispcor/dcio.x +dispcor/dispcor.h +doc/autoidentify.hlp +doc/identify.hlp +imred/echelle/doc/ecidentify.hlp +imred/irs/identify.par +imred/iids/identify.par +imred/kpnocoude/identify.par +noao/lib/linelists/* + Changes to allow IDENTIFY/ECIDENTIFY to work in user or line list + specified units and to have DISPCOR pass on the units. (3/11/97, Valdes) + +splot/usercoords.x + This routine had a couple of places where it calls smw_c?tran? and + then takes log sampling in EQUISPEC/NDSPEC explicitly into account. + Since this is now done by the lower level routines the log conversions + were removed. (3/3/97, Valdes) + +dispcor/dcio.x +doc/dispcor.hlp + The coordinate transformation between logical and world was changed + to always produce linear wavelength. It use to be that for + equispec and ndspec formats with dc-flag=1 this would produce + log wavelengths. This prevented resampling from log back to + linear. [The date on dcio.x was touched but no actual change was + made.] (3/3/97, Valdes) + +smw/shdr.x + The SHDR routines that convert between world and logical were updated + for the changes in smw_c?tran?. Previously, these routines explicitly + applied the log transformation for log sample spectra. For this + reason most ONEDSPEC tasks operated correctly. However, DISPCOR + does not use SHDR_LW/SHDR_WL so it failed. Now the log conversions + are done in smw_c?tran? and not in the SHDR routines. + (3/3/97, Valdes) + +smw/smwsctran.x +smw/smwctran.gx + +noao/lib/smw.h + The coordinate transformations in ONEDSPEC tasks assume that dispersion + coordinates are always in linear dispersion whether or not the + spectra are stored in log sampling (DC-FLAG=1). However, this + was not true for EQUISPEC/NDSPEC format. Now calls to the smw_c?tran? + routines will return linear dispersion for all supported ONEDSPEC + WCS types. This was needed to fix the problem with DISPCOR and + log sampled input spectra. + +smw/smwsaveim.x + Deleted unused procedure name in errchk. No functional change. + (3/3/97, Valdes) + +scombine/t_scombine.x + Moved the call to smw_openim to "clean up" the WCS from after the + image size is changed to before because otherwise an error would + occur trying to access aperture information for any new lines added. + I no longer recall the purpose of this "clean up" step. + (2/19/97, Valdes) + +splot/sumflux.x + The conversion to "angstrom" units used the wpc instead of abs(wpc). + (2/6/97, Valdes) + +identify/idpeak.x +identify/ididentify.x +identify/idshift.x +identify/reidentify.x +identify/autoid/autoid.x + Added a new procedure, id_peaks, that replaces calls to find_peaks. + The new procedure calls find_peaks and then converts the pixels to + physical coordinates. (1/30/97, Valdes) + +t_calibrate.x + The calculation of dw for the flux correction used the index i + instead of k. This means that dw was constant which is incorrect + for spectra with non-linear dispersion. (1/22/97, Valdes) + +doc/splot.hlp +splot/autoexp.x + The intensity range produced by the 'a', ',', '.', and 'z' keys + could be wrong if the dispersion function was sufficiently non-linear. + This now fixed and if the positions for the 'a' key are the same + it autoscales; i.e. 'a' 'a' is a short cut to autoscale. + (1/10/97, Valdes) + +splot/splot.x + The whitespace was being removed from the units parameter so that + any units string that requires whitespace (such as "km/s 4000 ang") + would fail to be recognized. (12/3/96, Valdes) + +scombine/t_scombine.x +scombine/icscale.x + The feature of getting scaling, zero, and weight values from the image + headers did not work because the header values were not cached. + (11/11/96, Valdes) + +t_sarith.x +doc/sarith.hlp + The noise spectrum type is now only copied unmodified. This is + a quick kludge until the noise is properly handled. + (9/11/96, Valdes) + +smw/shdr.x + Added a spectrum type field to the spectrum structure and a specific + procedure to decode the spectrum type. + (9/11/96, Valdes) + +splot/gfit.x +splot/spdeblend.x + Allow error estimates with negative pixels if invgain=0 otherwise + print a warning. (7/23/96, Valdes) + +doc/standard.hlp + Added comments about proper use of extinction files. + (6/26/96, Valdes) + +doc/dispcor.hlp + Update the help file to indicate that the input limits are in + non-log units even with logarithmic sampling is selected. + (6/14/96, Valdes) + +t_standard.x + Make minor change to beginning of std_flux to avoid optimizer error + on Solaris with V4.0 compiler. (6/10/96, Valdes) + +t_sarith.x + Altered order of opening the output so that any error in reading + the input data is caught first. (5/14/96, Valdes) + +smw/shdr.x + Separated call for imgs3r in order to error check for failure to + get the pixel data (such as occurs with a long pathname to the pixel + file). (5/14/96, Valdes) + +rspectext.cl + Removed use of CL variable "list". (5/6/96, Valdes) + +noao$lib/smw.h + Changed SMW_NSPLIT from 200 to 500. (4/18/96, Valdes) + +smw/smwmerge.x + 1. When the output format is multispec the code did not open a + single MWCS but simply opened another split MWCS. + 2. A pointer rather than the string was incorrectly passed to + smw_swattrs. + (4/18/96, Valdes) + +smw/shdr.x + If the units are not defined by an attribute a check is made for + a CUNITn keyword. (4/17/96, Valdes) + +identify/autoid/autoid.x + 1. Removed useless call to id_log. + 2. Fixed realloc bug. + 3. Fixed bug allowing lines to be found multiple times. + (4/12/96, Valdes) + +identify/autoid/aidshift.x + Added missing argument in call to aid_init. (4/11/96, Valdes) + +identify/idlinelist.x + Minor efficiency change that avoids extract calls to id_fitpt. + (4/11/96, Valdes) + +identify/t_autoid.x + Minor bug fix so that log header is printed. (4/5/96, Valdes) + +t_rstext.x +rspectext.cl +doc/rspectext.hlp + The task now automatically senses the presence of a header. + (3/7/96, Valdes) + +identify/identify.h +identify/peaks.gx +identify/autoid/autoid.x + 1. The ID_FTYPE entry in the structure was being clobbered by a typo + in the include file which also mapped ID_LABEL to the same location. + 2. The peak finding routines were modified so that values of INDEF + for the threshold and contrast would disable these tests. This + is needed when absorption peak data is negated to find the + absorption peaks which are all negative. + 3. The autoid.x uses of find_peaks were modified to set the contrast + and threshold to INDEF instead of zero. + (2/24/96, Valdes) + +splot/getimage.x + There was a bug in initializing the image section limits such that + when an image section of the form [n,*] is used and there is not + display limits (xmin and xmax are INDEF) then the plotted spectrum + will cover the range of the first axis rather than the second. + (2/22/96, Valdes) + +identify/autoid/* + +identify/t_autoid.x + +identify/t_identify.x +identify/t_reidentify.x +identify/idcolon.x +identify/iddb.x +identify/iddoshift.x +identify/idfitdata.x +identify/idgdata.x +identify/ididentify.x +identify/idinit.x +identify/idlinelist.x +identify/idlog.x +identify/idmap.x +identify/idshift.x +identify/idshow.x +identify/peaks.gx +identify/peaks.x +identify/reidentify.x +identify/identify.h +identify/identify.key +identify/mkpkg +doc/aidpars.hlp + +doc/autoidentify.hlp + +doc/identify.hlp +doc/reidentify.hlp +x_onedspec.x +aidpars.par + +autoidentify.par +identify.par +reidentify.par +onedspec.cl +onedspec.par +onedspec.men +onedspec.hd + Added an automatic line identification algorithm. This algorithm + is part of the new task AUTOIDENTIFY and modified versions of + IDENITFY and REIDENTIFY. A new pset task AIDPARS contains the + algorithm parameters. (2/1/96, Valdes) + +onedspec.hd +onedspec.men + Added linelists$README and onedstds$README as the help topics + "linelists" and "onedstds". (1/26/96, Valdes) + +smw/shdr.x + When extracting a wavelength range (without rebinning) and with the + range flipped there was an error in not checking for the existence + of the associated spectra causing a segmentation violation. + (1/22/96, Valdes) + +specplot.x + The scale and offset parameters may now be a constant value, an + @file containing the values, or a keyword name. (1/13/96, Valdes) + +smw/smwopen.x + The arrays for the aperture, beam, and limits in equispec format were + not being initialized to reasonable values which could cause an + error when doing an ES to MS conversion. Replaced + mallocs with callocs. (1/9/96, Valdes) + +smw/smwesms.x + Fixed a typo: smwopn -> smw_open. (1/9/96, Valdes) + +smw/smwsaxes.x + Uncalibrated long slit (2D) spectra which have been rotated are now + allowed. The rotated WCS is reset to pixels. If the dispersion + calibration flag is set and the spectra have been rotated then + an error is reported. (1/4/96, Valdes) + +t_sarith.x +doc/sarith.hlp +doc/scopy.hlp + Preiously both w1 and w2 had to be specified to select a wavelength + region to be copied or operated upon. Now if only one is specified + the second will default to the appropriate starting or ending + pixel. (12/20/95, Valdes) + +t_sbands.x + 1. Converted to work in double precision except the spectrum data + obtained by shdr_open is only in real. + 2. Increased the index and eqwidth precision printed from + %7.4g to %9.6g. + (12/5/95, Valdes) + +identify/idgraph.x + If the graph x window is outside of the data the x window is now + autoscaled. This occurs when a user sets window limits in pixel space + and then does a fit to wavelength. The new graph was then plotted in + the windowed pixel space and no data would be seen. (12/5/95, Valdes) + +t_calibrate.x + The airmass value computed by get_airm was being ignored causing + a floating exception (bug log 321). This was fixed. (12/4/95, Valdes). + +scombine/generic/icpclip.x + Fixed a bug where a variable was improperly used for two different + purposes causing the algorithm to fail (bug 316). (10/19/95, Valdes) + +identify/peaks.x + There was an index bug in is_local_max. (9/26/95, Valdes) + +t_slist.x + Fixed another case of closing the mwcs pointer without invalidating + it in the shdr pointer. (9/26/95, Valdes) + +t_fitprofs.x + Added a check and appropriate error message for a missing positions + file. (9/22/95, Valdes) + +doc/splot.hlp + Added explicit equations for the quantities measured by the 'e' + key in SPLOT. (9/22/95, Valdes) + +identify/ididentify.x +idenitfy/identify.key +doc/identify.hlp + A new key, 'e', has been added to add features from a line list without + doing any fits. This is like the 'l' but without the automatic + fitting before and after adding new features. (9/5/95, Valdes) + +identify/t_reidentify.x +doc/reidentify.hlp + If there are no reference features the "addfeatures" option will add + new features before doing a fit or shift. (9/5/95, Valdes) + +splot/getimage.x + The change of 5/1/95 allows parsing an image section to determine + the dispersion line. However this ignored any range along the + dispersion. This change completely parses any image section and + sets the display range in pixels or wavelength to that of the + image section along the dispersion. (8/28/95, Valdes) + +identify/t_reidentify.x +identify/iddb.x + 1. If the reference image does not exist REIDENTIFY would catch the + error but then attempt to close an unopened database leading to + a seg vio error rather than the warning. A check was added for + the database being open. + 2. Added a new database procedure that scans a database and saves + the records. This allows REIDENTIFY to use a reference database + even when the reference image doesn't exist. + (8/23/95, Valdes) + +smw/smwdaxis.x +smw/shdr.x + In the absence of DISPAXIS the software will recognize the FITS + CTYPE keyword with values of LAMBDA, FREQ, VELO*, WAVELENGTH + in the units defined in the original FITS paper. (8/20/95, Valdes) + +t_sfit.x + The logic for checking whether all lines and all bands has been done + is not as straightforward as indicated in the entry of 4/29/94. + The checking on bands has been eliminated though a record of + the bands dones is written to the header. (8/15/95, Valdes) + +smw/smwsaveim.x +scombine/t_scombine.x + When a new image is opened NEW_COPY it inherits IM_NPHYSDIM and IM_NDIM. + A routine can change IM_NDIM but not IM_NPHYSDIM. The routine to + save an equispec WCS needs to preserve the IM_NPHYSDIM when updating + an exisiting 2D image which may have been specified as a 1D section. + In order to tell the routine that a new lower dimensional image + is desired with a NEW_COPY header the higher level routine can set + the temporary keyword SMW_NDIM and the routine setting up the WCS + will use this in prference to the IM_NPHYSDIM. (8/14/95, Valdes) + +identify/idlinelist.x + The way memory was being allocated for labels was such that not + all memory would be deallocated at the end. (8/3/95, Valdes) + +identify/iddb.x + When "adding" features the NALLOC value was not properly updated + resulting in free uninitialized pointers leading to a segvio. + (8/3/95, Valdes) + +smw/smwdaxis.x + If the image header dispersion axis is unreasonable a warning is + printed and the "dispaxis" parameter is used instead. (8/2/95, Valdes) + +sbands.x + Changed the index and eq width format from 7.2f to 7.4g. + (7/28/95, Valdes) + +splot/voigt.x + +t_fitprofs.x +splot/splot.x +splot/anshdr.x +splot/eqwidthcp.x +splot/gfit.x +splot/deblend.x +splot/spdeblend.x +splot/splot.key +splot/mkpkg +doc/fitprofs.hlp +doc/splot.hlp +fitprofs.par +splot.par + Added lorentzian and voigt profile fitting and deblending. This changed + the FITPROFS parameters and the input line lists for FITPROFS and + SPLOT though the old line lists will still work. A new parameter was + also added to SPLOT and FITPROFS to set the number of Monte-Carlo + samples used in the error estimates. + (7/28/95, Valdes) + +splot/splot.x + Changed when the shdr structure is closed to avoid an error. + (8/24/95, Valdes) + +t_sapertures.x +doc/sapertures.hlp + Modified to allow aperture ID table to be from an image header + in the same way as done in the APEXTRACT package. + (7/24/95, Valdes) + +t_specplot.x +specplot.key +doc/specplot.hlp + Added a new key 'f' to toggle between logical pixels and world + coordinates. (7/21/95, Valdes) + +dispcor/dcio.x +dispcor/dispcor.h + The application of a shift now also works with non-linear dispersions + in the input image. This is a feature used in the DOFIBERS script + to align sky lines. (7/19/95, Valdes) + +splot/wrspect.x + The BANDID keyword was being written with garbage characters + because a pargstr was used instead of pargi. (7/14/95, Valdes) + +dispcor/dcio.x + When there is only a shift in the database (a feature added 4/21/94) + and the image has more than one aperture the weight parameter was being + clobbered causing incorrect results. (7/13/95, Valdes) + +t_sapertures.x + Fixed the "dtype" parameter behavior which was not correct. + (6/30/95, Valdes) + +smw/smwonedspec.x +smw/smwsaxes.x + 1. For the simplest spectra a heuristic to determine DC-FLAG was + added such that if the wavelength of the first pixel and the + increment per pixel are both unequal to 1 then the spectrum is + assumed to be dispersion calibrated. + 2. The label and units are not overridden if either is present. + If neither is present but the spectrum is considered to be + dispersion corrected then it defaults to Wavlength(angstroms). + (6/30/95, Valdes) + +ididentify.x +reidentify.x + When a line center fails to be found with the 'm' key a message is + printed pointing to the threshold parameter. (6/30/95, Valdes) + +t_sbands.x + The allocation scheme was incorrect causing a segmentation violation + after the first 10 bands. (6/30/95, Valdes) + +======= +V2.10.4 +======= + +t_sarith.x + The "units_display" WCS attribute is copied if set. (5/13/95, Valdes) + +splot/splot.x +splot/getimage.x +t_specplot.x + 1. The task "units" parameter value is mapped to "display" if null. + 2. The units are set with shdr_units. + (5/13/95, Valdes) + +smw/shdr.x + 1. The spectrum structure is loaded in the image MWCS units ("units"). + 2. The special unit string "display" changes units to the "units_display" + attribute in shdr_units. + 3. The special unit string "default" changes units to the image MWCS + units in shdr_units. + (5/13/95, Valdes) + +doc/sfit.hlp + Added a description of the "sample" range syntax. (5/12/95, Valdes) + +splot/splot.x +splot/getimage.x +doc/splot.hlp + Because it can be desirable to use image sections on the input but + this will cause problems if the user attempts to update the image + SPLOT was modified to parse the image section for the specified image + line, column, or band and then map the full image. (5/1/95, Valdes) + +t_sbands.x +doc/t_sbands.x + Increase the length and changed to g format for the flux so that + flux calibrated data will print. (4/12/95, Valdes) + +doc/wspectext.hlp + Fixed typo in example. (4/12/95, Valdes) + +t_sarith.x + Image extensions are no only stripped for onedspec format output + images rather than in all image names. This is necessary to allow + STF images with explicit extensions not matching the imtype value + to be specified. (3/31/95, Valdes) + +scombine/icscale.x +doc/scombine.hlp + The behavior of the weights when using both multiplicative and zero + point scaling was incorrect; the zero levels have to account for + the scaling. (3/27/95, Valdes) + +splot/flatten.x + Removed use of faulty fp_equal test for equality with zero. This would + cause continuum normalization to fail for fluxed data. (2/23/95, Valdes) + +sensfunc/sfshift.x + Deleted points and stars are now ignored in the grey shift calculation. + (2/22/95, Valdes) + +t_sinterp.x + Updated the image header keywords to give a complete and standard + linear WCS. (2/21/95, Valdes) + +splot/gfit.x + If the marked region does not span the profile peak then an pointer + indexing error occurs when estimating the initial sigma. Modified + to estimate the sigma differently in this case. (2/17/95, Valdes) + +t_fitprofs.x +splot/spdeblend.x +splot/gfit.x + 1. The indexing was incorrect in the Monte-Carlo error estimation. + 2. Change the number of Monte-Carlo samples from 100 to 50. + (2/16/95, Valdes) + +smw/shdr.x + If an associated spectrum doesn't exist free any previous spectrum. + (2/13/95, Valdes) + +getcalib.x + Added missing length argument to strcpy which caused an unaligned + access error on the Alpha. (1/27/95, Valdes) + +t_dopcor.x + Fixed typo bug which prevents more than 8 spectra in multispec format + to work. This affects primarily echelle data. (1/18/95, Valdes) + +smw/swmctran.x + The equispec coordinate transformations now include mapping apertures + and lines. (1/16/95, Valdes) + +smw/smwopenim.x + Changed unknown coordinate system from a fatal error to a warning. + (1/14/95, Valdes) + +t_standard.x + Fixed bug in closing sh structure. (1/3/95, Valdes) + +t_standard.x +t_calibrate.x +standard.par +calibrate.par +doc/standard.hlp +doc/calibrate.hlp + If the exposure time and airmass cannot be determined from the header + they are queried and updated in the images. New query parameters + were added. (1/2/95, Valdes) + +dispcor/refmsgs.x +dispcor/refgspec.x +dispcor/reftable.x +dispcor/refspectra.h +dispcor/refinterp.x +dispcor/reffollow.x +dispcor/refnearest.x +dispcor/refprecede.x + Added error information if no reference spectrum is found to aid in + diagnosing the problem. (12/30/94, Valdes) + +dispcor/t_dispcor.x +dispcor/dcio.x + 1. Improved the error messages again to more clearly pinpoint problems + with the dispersion database. + 2. The image extensions are now stripped in REFSPEC keywords. + (12/30/94, Valdes) + +identify/identify.x +identify/reidentify.x +identify/iddofit.x +identify/identify.key + 1. Added 'v' to change fitting weights. (12/29/94, Valdes) + +identify/t_reidentify.x +doc/reidentify.hlp + The step parameter for multispec/equispec data is now ignored and + all apertures are reidentified expect for a value of zero indicates + don't reidentify anything but the reference aperture. (11/15/94, Valdes) + +onedspec.men +doc/mkspec.hlp + Highlighted the fact that the MKSPEC task is obsolete. (11/12/94, Valdes) + +doc/identify.hlp +identify/identify.key +identify/idcolon.x + The help described one of the options for :label to be "coords" when + it is actually "coord". Rather than modify the code I modified the + help. The colon procedure was modified only in that when it + reports the current value of the label parameter it shows coord + and not coords. (11/8/94, Valdes) + +doc/onedspec.hlp +doc/specwcs.hlp + Added description of dispaxis and nsum package parameters to the package + description. (11/1/94, Valdes) + +scombine/t_scombine.x + There was a problem with using SCOMBINE with 2D/3D spectra in that + it assumed the number of spectra is the second image dimension. + Changed this to the approriate number of spectra for all spectral + formats. (10/27/94, Valdes) + +dispcor/dctable.x + If ignoreaps=yes and there are apertures defined with an aperture table + or reference image then the defaults for the wavelength scale if + an undefined aperture is encountered will be that of the first defined + aperture unless an explicit value has been given with the task parameters. + This is needed to make the IMRED reductions scripts run as desired. + (10/12/94, Valdes) + +smw/smwonedspec.x +smw/smwoldms.x + Added a missing call to close the image header keyword template list + which caused memory to not be freed. (10/4/94, Valdes) + +identify/t_reidentify.x + Now checks for a zero step and only operates on the specified reference + line. (9/15/94, Valdes) + +t_sfit.x +doc/sfit.hlp +doc/continuum.hlp + Extended SFIT and CONTINUUM to work on NDSPEC spectra. (9/13/94, Valdes) + +splot/splot.x + 1. The 'p' and 'u' now restore the "world" system before setting the + dispersion. Previously if the user switched to "pixel" (with '$') + then a units conversion error would occur if the user tried to + set the dispersion. + 2. The 'v' key now toggles even if no input units are specified. + (8/17/94, Valdes) + +splot/wrspect.x + Fixed a bug in which the output units when saving a spectrum were + incorrectly set to be the current display units rather than the MWCS + units. + (8/17/94, Valdes) + +splot/wrspect.x + Fixed a typo in a pointer assignment in the case of overwriting + an existing 2D image which caused a segmentation violation. + (8/17/94, Valdes) + +doc/splot.hlp +doc/fitprofs.hlp + Fixed various typos and added suggestions as pointed out by Dave Bell. + (8/17/94, Valdes) + +splot/gfit.x +splot/spdeblend.x +t_fitprofs.x + Added a check for both sigma0 and invgain being zero. + (8/17/94, Valdes) + +t_fitprofs.x + Failed to treat the scaling of the sigmas properly to avoid overflow + problems. + (8/17/94, Valdes) + +onedspec.cl +onedspec.hd +onedspec.men +x_onedspec.x +dispcor/mkpkg +dispcor/t_disptrans.x + +disptrans.par + +doc/disptrans.hlp + + Added a new task to convert the WCS dispersion relation between units + and to apply a vacuum/air conversion. (8/8/94, Valdes) + +t_slist.x + Removed the restriction against N-dim spectra so that this could + be used with BPLOT to expand a list of apertures. (7/29/94, Valdes) + +splot/spdeblend.x +splot/gfit.x + 1. The sigmas needed to be scaled to unit mean to avoid possible + overflow problems during the fitting. + 2. There was an incorrect calling sequence in gfit for the new + model parameters. + (7/26/94, Valdes) + +noao/lib/units.h +smw/units.x +splot/splot.key +specplot.key +doc/onedspec.hlp +doc/splot.hlp + Added nanometers as a unit. (7/21/94, Valdes) + +noao/lib/smw.h +smw/shdr.x +splot/wrspect.x +splot/splot.x + 1. Added a reddening correction flag to the basic spectrum data structure. + 2. When writing out a spectrum with WRSPECT also update the calibration + parameters. + 3. Restructured WRSPECT to be more general for use with SPECTOOL and + put an SPLOT specific routine to handle the parameter queries. + (7/20/94, Valdes) + +t_sflip.x + +sflip.par + +doc/sflip.hlp + +x_onedspec.x +mkpkg +onedspec.cl +onedspec.men +onedspec.hd + Added a new task for flipping spectra. (7/18/94, Valdes) + +splot/wrspect.x +splot/splot.x +smw/smwswattrs.x + Fixed a rather tricky bug with replacing a spectrum in the current + image with SPLOT. (7/13/94, Valdes) + +splot/spdeblend.x + +splot/deblend.x +splot/gfit.x +splot/sumflux.x +splot/eqwidth.x +splot/splot.x +splot.par +t_fitprofs.x +fitprofs.par +doc/splot.hlp +doc/fitprofs.hlp + 1. Separated the SPLOT specific delending routine from the mathematical + deblending routines called by the various gaussian fitting routines. + 2. Replaced deblending code with a version that uses a sigma array + and subsampling of the pixels. This version also allows contraining + the relative line strengths but this feature is not used by + SPLOT of FITPROFS. + 3. Added constant noise and inverse gain parameters to SPLOT and FITPROFS. + 4. If a sigma0 and inverse gain are specified the deblending estimates + errors in the fit parameters using Monte-Carlo simulation. The + errors are recorded in the log and :show output. This was + added to both SPLOT and FITPROFS. + 5. If a sigma0 and inverse gain are specified the centroid, flux, and + equivalent width estimates (from 'e' key) include error estimates. + The errors are recorded in the log and :show output. + (7/12/94, Valdes) + +dispcor/t_dispcor.x +dispcor/dcio.x + 1. Added a check for the existence of both IDENTIFY and ECIDENTIFY + database files for the same image. + 2. The recent errcode check addition (5/20) was incorrect in that + it would not proceed to look for an ECIDENTIFY file if no + IDENTIFY file was found; i.e. echelle data would fail. The + appropriate checking of errors is now done. + (7/11/94, Valdes) + +t_dopcor.x + The verbose output was enhanced to show the old redshift in the case + of adding to warn a user. This only applies to multispec images + which store the redshift separately. (7/7/94, Valdes) + +t_sbands.x + Instead of passing a file name to the routine which reads the bandpass + descriptions a file descriptor is not passed. This allows the + calling procedure to use either a file or a string file. + (6/30/94, Valdes) + +doc/sbands.hlp +doc/splot.hlp + Typo fixes. (6/30/94, Valdes) + +doc/dopcor.hlp + Made a slight change to description of isvelocity to make as clear as + possible that velocities are relativistic and not c*z velocities. + (6/30/94, Valdes) + +t_rstext.x + +rstext.par + +rspectext.cl +x_onedspec.e +onedspec.cl +mkpkg + Added a compiled task to reformat the input RSPECTEXT file into the + formats needed by RTEXTIMAGE and DISPCOR and modified RSPECTEXT + to use it. This improves the speed of this script task enormously for + large input text files since the CL facilities can be slow. + (6/20/94, Valdes) + +splot/wrspect.x + Failed to initialize a pointer to NULL. This became a seg vio after the + changes for the BANDID info. (6/15/94, Valdes) + +scombine/generic/iccclip.x +scombine/generic/icsclip.x + Found and fixed another typo bug. (6/7/94, Valdes/Zhang) + +scombine/generic/icaclip.x +scombine/generic/iccclip.x +scombine/generic/icpclip.x +scombine/generic/icsclip.x +scombine/generic/icgrow.x +scombine/generic/icmedian.x + The restoration of deleted pixels to satisfy the nkeep parameter + was being done inside the iteration loop causing the possiblity + of a non-terminating loop; i.e. pixels are rejected, they are + restored, and the number left then does not statisfy the termination + condition. The restoration step was moved following the iterative + rejection. + + There was a bug in how the restored points were added back when + mclip=no and there are multiple residuals with the same value. + + Also updated icgrow and icmedian. All these files are the same + as the generic files from IMCOMBINE reduced to only the real datatype. + (6/13/94, Valdes) + +t_sbands.x + When scanning the bandpass file, if there was an filter file then + the scanning of the filter file caused the remaining scan of the + bandpass line to be terminated. This was fixed by using getline + instead of fscan in the scanning the bandpass file. (6/3/94, Valdes) + +doc/sbands.hlp + Fixed a discrepancy in the bandpass file description between the + description section and the examples. (6/2/94, Valdes) + +splot/splot.x +splot/splotcolon.x +splot/splot.key +splot.par +doc/splot.hlp + Added an overplot options to permanently toggle overplotting. + (5/31/94, Valdes) + +scombine/icscale.x + The sigma scaling flag, doscale1, would not be set in the case of + a mean offset of zero though the scale factors could be different. + (5/25/94, Valdes/Zhang) + +scombine/generic/icsclip.gx + There was a missing line: l = Memi[mp1]. (5/25/94, Valdes/Zhang) + +scombine/generic/icaclip.x +scombine/generic/iccclip.x +scombine/generic/icpclip.x +scombine/generic/icsclip.x + The reordering step when a central median is used during rejection + but the final combining is average was incorrect if the number + of rejected low pixels was greater than the number of pixel + number of pixels not rejected. (5/25/94, Valdes) + +dispcor/dcio.x +dispcor/t_dispcor.x + All warning messages were being converted to a single warning which + was not appropriate in all cases. Added an errcode check. + (5/20/94, Valdes) + +============================ +V2.10.3beta internal release +============================ + +noao/lib/smw.h +smw/shdr.x +t_fitprofs.x +t_sarith.x +splot/wrspect.x + The spectrum data structure was modified so that it can contain + all the associated spectra such as the spectrum, raw spectrum, + sky, continuum, and sigma. Also the STYPE field was changed + to an array of string pointers SID to contain the specturm + type strings for all the associated spectra. Except for the + SID changes (in FITPROFS, SARITH, and SPLOT) the structure + changes are invisible to any spectral task. (5/4/94, Valdes) + +scombine/icscale.x +scombine/t_scombine.x + There is now a warning error if the scale, zero, or weight type + is unknown. (5/2/94, Valdes) + +t_sfit.x +sfit.par +continuum.par +doc/sfit.hlp +doc/continuum.hlp + 1. The sample regions are now set to the task parameter after each + fit. Previously this was only done for the first spectrum and + after that it was set to "*". + 2. A straightforward replication of the line selection mechanism + to allow band selection was added. + (4/29/94, Valdes) + +identify/t_reidentify.x + The refit=no options would not work if there was not dispersion + function even though it makes sense to do so. It was case of + the if clauses not being defined correctly. (4/28/94, Valdes) + +dispcor/dcio.x + A possibly very useful and common case is when IDENITFY/REIDENTIFY + are used on previously dispersion corrected data to get only a + shift with no dispersion function. DISPCOR was modified to + allow this case. (4/21/94, Valdes) + +scombine/iclog.x + Changed the mean, median, mode, and zero formats from 6g to 7.5g to + insure 5 significant digits regardless of signs and decimal points. + (4/13/94, Valdes) + +noao/lib/smw.h +smw/shdr.x + The standard spectrum data structure now includes a pointer for a + continuum spectrum. Currently it is unused. (4/12/94, Valdes) + +scombine/icscale.x + When the combine object is "sum" the task attempts to compute the + total exposure time. Since a missing exposure time is represented + as INDEF this caused an arithmetic error. The task was modified to + not compute or output a total exposure time if any of the spectra + have an undefined exposure time. (4/11/94, Valdes) + +identify/idmark.x + Changed the mark and mark label color to be the tick label color + currently in effect. Eventually the user should have more control + over the color but this cannot be done without changing GTOOLS or + IDENTIFY more than is appropriate at the moment. (4/11/94, Valdes) + +doc/identify.hlp + Fixed a typo in the description of the Legendre polynomial formula. + (4/11/94, Valdes) + +smw/shdr.x + The case of DC-FLAG=-1 was not being handled by shdr_lw and shdr_wl. + (4/9/93, Valdes) + +smw/shdr.x + The flux units were not being copied when the spectrum header is + copied. (3/31/94, Valdes) + +t_sarith.x + The string used to read in the aperture, band, and beam lists was + SZ_FNAME which is too short for possible input lines. Changed + the lengths to SZ_LINE. (3/31/94, Valdes) + +splot.par + Changed the mode of line and band to be query so that if SPLOT is run + from epar line and band queries will still be made. (3/21/94, Valdes) + +scombine/generic/icaclip.x +scombine/generic/iccclip.x +scombine/generic/icsclip.x + The image sigma was incorrectly computed when an offset scaling is used. + (3/8/94, Valdes) + +smw/shdr.x + The call to shdr_units can specify "default" to restore the original + units. (3/7/94, Valdes) + +smw/shdr.x +splot/wrspect.x +t_sarith.x +t_fitprofs. + Fixed problems when NP1 > 1 due to a IMSHIFT operation that moves + the first physical pixel higher logical coordinates (or the + first logical pixel in the image corresponds to a negative + physical pixel coordinate). (3/5/94, Valdes) + +t_deredden.x + Fixed bug causing memory corruption. (3/2/94, Valdes) + +scombine/icscale.x +scombine/iclog.x + 1. The exposure time was not being summed when summing spectra. + 2. The exposure time is now printed whenever the exposure time is used + even if the times are all equal. + (2/24/94, Valdes) + +t_deredden.x +doc/deredden.hlp + Overriding a previous correction will apply to the original data + rather than being incremental. (2/23/94, Valdes) + +smw/shdr.x +noao$lib/smw.h + Added structure fields for the flux units and shdr_open sets the + field if possible. The flux units are determined first by any + BUNIT keyword, then if the flux calibration flag is set by + the magnitude of the data. (2/22/94, Valdes) + +smw/funits.x + +noao$lib/funits.h + + Added a flux units package. (2/21/94, Valdes) + +smw/shdr.x + Added a routine to change the units. (2/19/94, Valdes) + +splot/usercoord.x + The routine was not correct for input log-linear spectra (dc-flag=1). + (2/19/94, Valdes) + +dispcor/dispcor.x + Fixed typo (out[1] -> out[i]) which was causing the non-flux conserving + mode to fail. (2/18/94, Valdes) + +splot.par +specplot.par +doc/splot.hlp +doc/specplot.hlp + 1. SPLOT will write out the current display units to the WCS attribute + "units_display". + 2. The default "units" task parameter now has the null string value + to allow selecting the units given by "units_display" or the WCS + units in that order. (2/18/94, Valdes) + +smw/smwsaveim.x +smw/smwesms.x +smw/smwmerge.x +smw/smwndes.x +smw/shdr.x + 1. A new WCS attribute "units_display" has been defined. It is now + stored in the image and transfered when copying WCS if it is defined. + 2. When a spectrum is opened with shdr_open the user units are set + to that specified by "units_display" if present. Otherwise + the units of the WCS are used. + (2/18/94, Valdes) + +noao$lib/smw.h +shdr.x + Added a field to the standard spectrum data structure to contain an + error array. This array is filled in by shdr_open if a new flag + value is used. Since there are no current tasks which use the + new value this feature is unused in current tasks. (2/7/94, Valdes) + +noao$lib/smw.h +t_fitprofs.x +t_sarith.x +splot/wrspect.x +smw/smwsaveim.x + Added a field to the standard spectrum data structure to contain the + type of spectrum; i.e. spectrum, background, sigma. This type is + stored in the BANDIDn keywords for multispec format data extracted by + APEXTRACT. This information, if present, is now updated on outputing a + new spectrum. This is particularly important for SCOPY when the bands + are adjusted. (2/4/94, Valdes) + +dispcor/t_dispcor.x + Deleted unused variable, junk, which somehow snuck in. (2/7/94, Valdes) + +t_specplot.x +specplot.key +doc/specplot.hlp + Extended the :units command to allow specifying individual spectra. + This is intended to allow multiple spectra to be plotted on a velocity + scale with different zero points. (2/4/94, Valdes) + +smw/shdr.x +smw/smwmw.x + Added checks for the aperture number to be outside of the range of + spectra in N-dimensional spectra. (1/8/94, Valdes) + +splot/splot.x +splot/splotcolon.x +splot/splot.key +doc/splot.hlp +splot.par + A new options, "flip", has been added to select plotting the spectra + in decreasing wavelength. (12/8/93, Valdes) + +dispcor/dispcor.x +doc/dispcor.hlp + When flux=no DISPCOR now computes an average across the output pixel + rather than interpolating to the pixel center. This allows + flux density conservation. (12/6/93, Valdes) + +identify/idinit.x + Changed aclrr to aclri. (12/1/93, Valdes) + +doc/identify.hlp + Added a description of the function coefficients. (12/1/93, Valdes) + +t_calibrate.x + Added a warning if the exposure time is not found. (11/19/93, Valdes) + +sensfunc/sfoutput.x + Instead of using the dispersion range from a single standard star + the code now uses the maximum range and minimum dispersion. + (11/15/93, Valdes) + +t_sbands.x + +sbands.par + +doc/sbands.hlp + +x_onedspec.x +onedspec.cl +onedspec.men +onedspec.hd +mkpkg + Added a new task to do bandpass spectrophotometry. (11/1/93, Valdes) + +rspectext.cl +wspectext.cl +doc/rspectext.hlp +doc/wspectext.hlp +onedspec.cl +onedspec.men +onedspec.hd + Added two script tasks to convert between 1D image spectra and + ascii text spectra. (10/22/93, Valdes) + +splot/splot.x +splot/getimage.x +splot/splotfun.x +doc/splot.hlp + If a wavelength scale is set with 'p' or 'u' then all subsequent + spectra which are not dispersion calibrated will use that wavelength + scale. (9/2/93, Valdes) + +t_sapertures.x + The negative beam number warning is only issued if verbose = yes. + (9/1/93, Valdes) + +dispcor/t_dispcor.x +smw/smwesms.x + The aperture IDs were not being properly propagated. (9/1/93, Valdes) + +t_fitprofs.x +fitprofs.par +doc/fitprofs.hlp + 1. Fixed bug with close MWCS + 2. Add a bands parameter for 3D images. + (8/31/93, Valdes) + +t_deredden.x + There was an error in freeing the sh pointer causing a segmentation + violation after the spectra are successfully dereddened. (8/13/93, Valdes) + +splot/splot.x +doc/splot.hlp + The '(' and ')' keys will now cycle in bands if there is only one line. + (8/10/93, Valdes) + +t_sapertures.x + Modified to ignore attempts to set a negative beam number. + (8/9/93, Valdes) + +splot/wrspect.x + Added check against an error opening an output image in shdr_open. + (8/4/93, Valdes) + +splot/fudgex.x + Added check against a divide by zero if the cursor is not moved. + (8/4/93, Valdes) + +splot/splotcolon.x + The call to ans_hdr in the COMMENT case was missing the key argument. + (8/3/93, Valdes) + +smw/smwonedspec.x + For spectra which are dispersion corrected (DC-FLAG set) but have no + units the code was setting the "label" rather than "units" to + "angstroms". (8/3/93, Valdes) + +============ +V2.10.3 beta +============ + +splot.par +splot/smooth.x +doc/splot.hlp + 1. The parameter file parameter prompt for the smoothing box size was + modified to request an odd number. + 2. If an even number is given, a warning is printed. + 3. The help for the parameter boxsize indicates the the value must + be odd. + (6/28/93, Valdes) + +scombine/icscale.x + The result of reading an @file for the zero or weight parameter was + being placed in the scales array. This has been fixed. This + affected only one IRAFX users. (6/28/93, Valdes) + +specplot.key + Added missing :redshift and :velocity commands in the summary. Also + sorted and cleaned up the multicolumn lists. (6/15/93, Valdes) + +t_dopcor.x +dopcor.par +doc/dopcor.hlp + An new parameter has been added to allow combining sequential + corrections in "multispec" format spectra. (6/15/93, Valdes) + +usercoord.x +wrspect.x +t_dopcor.x + When smw_swattrs is called it is possible that the smw pointer will be + changes (promoting an equispec format to multispec). If this happens + and the pointer is part of an open shdr structure then the routine + must invalidate the mwcs stuff and possibly open or update the shdr + structure. (6/14/93, Valdes) + +bplot.cl +doc/bplot.hlp + The query parameters from SPLOT were added as hidden parameters in + BPLOT to allow such things as writing output spectra without generating + queries. (6/8/93, Valdes) + +identify/ididentify.x + Added newlines when printing to the status line. This is needed when + redirecting the output to a file in the IMRED scripts. (6/4/93, Valdes) + +identify/iddelete.x + The label pointers needed to be updated when deleting a feature. + (6/4/93, Valdes) + +t_specplot.x + Modified the log output format to include the aperture number. + (5/25/93, Valdes) + +t_sarith.x +t_fitprofs.x +wrspect.x + The conversion from logical to physical coordinates was incorrect in + that it truncated the physical coordinates. This could cause a subtle + error in the coordinate system. (5/20/93, Valdes) + +identify/idmap.x + The user specified vector axis is interpreted as a logical axis rather + than a physical axis. This is only significant for transposed images. + (5/14/93, Valdes) + +smw/smwsaxes.x +smw/smwsaveim.x + Transposed NDSPEC images are now allowed. (5/11/93, Valdes) + +getcalib.x + Added a search for alternate standard names in a file names.men + if that file is present. (5/4/93, Valdes) + +splot/splot.x +splot/anshdr.x +splot/avgsnr.x + Added logging of the 'm' key output. (5/4/93, Valdes) + +splot/splot.x +splot/splotfun.x + 1. fun_do was not initializing the pointers passed to getimage. + This proves to be a problem if an error occurs in getting the + second image data, such as due to a mistype, so that the + next time the routine is called an invalid pointer is found + and a segmentation error occurs. + 2. Added a time delay on an error message in fun_do followed by the + function mode prompt. + (3/2/93, Valdes) + +sensfunc/sfstds.x + 1. Eliminated input stars/apertures that have no data. + 2. Eliminated input flux points outside the range of the + star/aperture wavelength range. + 3. Improved the iterative fitting to drop back to a polynomial + function if the lowest order spline does not fit. + (2/12/93, Valdes) + +identify/idgraph.x + Because these procedures used the SX array as temporary storage it + caused the initialize option to fail. (2/3/92, Valdes) + +onedspec.men + Removed reference to dispaxis. (1/21/93, Valdes) + +scombine/generic/icaclip.x +scombine/generic/iccclip.x +scombine/generic/icpclip.x +scombine/generic/icsclip.x + When using mclip=yes and when more pixels are rejected than allowed by + the nkeep parameter there was a subtle bug in how the pixels are added + back which can result in a segmentation violation. + if (nh == n2) ==> if (nh == n[i]) + (1/20/93, Valdes) + +sensfunc/sensfunc.h +sensfunc/sfgraph.x +sensfunc/sfginit.x +sensfunc/sfimage.x +sensfunc/sfcgraph.x +sensfunc/sfextinct.x +sensfunc/sfcolors.x +sensfunc/sfcolon.x +sensfunc/sfmove.x +sensfunc/sfundelete.x +sensfunc/sfdelete.x +sensfunc/sfadd.x +sensfunc/mkpkg +sensfunc/sensfunc.key +sensfunc.par +doc/sensfunc.hlp + Added color support. (12/17/92, Valdes) + +splot/gfit.x +splot/eqwidthcp.x +splot/deblend.x +splot/splot.x +identify/idmark.x + Added color support. (12/8/92, Valdes) + +splot/sumflux.x + 1. There was no check of whether esum was INDEF (a possible value) before + multiplying by wpc. A check was added. + 2. Because of a change to fp_equalr which occured on (10/18) the + equivalent widths of flux calibrated data would be INDEF. To + compensate the test is made on scaled data. + (12/7/92, Valdes) + +units.h + The conversion factors for millimeter and centimeter were off by a + factor of 10. (12/4/92, Valdes) + +dispcor/dcio.x + The wrong axis was selected in computing the logical NW. (11/24/92, Valdes) + +splot/splot.x +splot/usercoord.x +splot/splot.key +splot/mkpkg +doc/splot.hlp +splot.par + Changed the 'u' and 'p' keys to include additional ways to adjust the + dispersion scale. In particular a doppler and zeropoint adjustment can + be made using the cursor and entering a coordinate. Note that these + two adjustments apply to all coordinate systems and units and do not + require assuming a linear dispersion. In effect these are interactive, + cursor marking versions of DOPCOR (without the flux correction) and + SPECSHIFT. The coordinates are specified in the current displayed + units. The code that does the adjustment is now well integrated with + the MWCS rather than fudging the W0 and WP entries. The output of a + new spectrum with 'i' will properly handle the adjusted coordinate + system. (11/20/92, Valdes) + +bplot.cl +irsiids/bplot.cl +doc/bplot.hlp +gcurval -> gcurval.dat + Changed the name of the default cursor file to avoid stripping. + (11/20/92, Valdes) + +splot/wrspect.x + Fixed typo affecting 3D images: PNDIM(out) --> PNDIM(sh2). + (11/19/92, Valdes) + +splot/wrspect.x + A spectrum was being written using the W0, WPC of the current units + rather than Angstroms as it should be. A call to un_ctran to convert + to the MWCS units was added. (11/17/92, Valdes) + +t_specplot.x +specplot.h +doc/specplot.hlp +specplot.key + Added a color parameter for specifying the color of each spectrum + on color graphics terminals. (10/30/92, Valdes) + +t_sarith.x +t_fitprofs.x +splot/wrspect.x + 1. The doppler correction was still not properly handled. Instead of + dividing by (1 - z) it should multiple by (1 + z) in order to + be symmetric with the WCS driver. + 2. To avoid roundoff with multispec format W0 and W1 (which are real) + are not used when recalculating the w1, dw attribute values. Instead + shdr_lw is called to get the double precision values. + (10/16/92, Valdes) + +dispcor/t_dispcor.x +dispcor/dcio.x +doc/dispcor.hlp + DISPCOR will now allow multiple uses of IDENTIFY dispersion solutions + in a simple way with but with continuing protection against accidental + multiple uses of the same dispersion solutions. When a spectrum is + first dispersion corrected using one or more reference spectra keywords + the dispersion flag is set and the reference spectra keywords are moved to + DCLOGn keywords. If DISPCOR is called again without setting new + reference spectra keywords then the spectra are resampled (rebinned) + using the current coordinate system. If new reference spectra are set + then DISPCOR will apply these new dispersion functions. Thus the user + now explicitly enables multiple dispersion functions by adding + reference spectra keywords and DISPCOR eliminates accidental multiple + uses of the same dispersion function by renaming the reference + spectra. The renamed keywords also provide a history. + + Some additional log and verbose output was added to better inform the + user about what is done. + (10/15/92, Valdes) + +t_specshift.x + +specshift.par + +doc/specshift.hlp + +x_onedspec.x +mkpkg +onedspec.cl +onedspec.men +onedspec.hd +imred$argus/argus.cl +imred$ctioslit/ctioslit.cl +imred$echelle/echelle.cl +imred$hydra/hydra.cl +imred$iids/iids.cl +imred$irs/irs.cl +imred$kpnocoude/kpnocoude.cl +imred$kpnoslit/kpnoslit.cl +imred$specred/specred.cl +imred$argus/argus.men +imred$ctioslit/ctioslit.men +imred$echelle/echelle.men +imred$hydra/hydra.men +imred$iids/iids.men +imred$irs/irs.men +imred$kpnocoude/kpnocoude.men +imred$kpnoslit/kpnoslit.men +imred$specred/specred.men + The new task SPECSHIFT applies a coordinate system shift to selected + spectra. For linear coordinate systems this is done by changing + the wavelength of the first physical pixel. For nonlinear systems + the existing shift coefficient is adjusted. + (10/14/92, Valdes) + +dispcor/dcio.x + Added step to update the linear part of the nonlinear WCS. + This is mostly cosmetic. + (10/14/92, Valdes) + +dispcor/idmap.x + Changed the way the image is opened to avoid updating the WCS. + (10/14/92, Valdes) + +*doc/onedspec.hlp +smw.x + 1. Spectra in a single image which all have the same linear dispersion + are now stored with linear axis types. This gives a simpler header + structure than the multispec axis type for this common case. This + modification applies to 1, 2, and 3 dimensional images. + 2. Extensions were added to allow importing spectra which use + a different WCS driver than multispec or linear. + (10/13/92, Valdes) + +doc/onedspec.hlp + First an error in a font switch causing part of the text to all be in + standout. (10/9/92, Valdes) + +scombine/t_scombine.x +scombine/icombine.h +scombine/icombine.com +scombine/icombine.x +scombine/icscale.x +scombine/iclog.x +scombine/generic/iccclip.x +scombine/generic/icsclip.x +scombine/generic/icpclip.x +scombine/generic/icaclip.x +scombine/generic/icgrow.x +scombine.par +doc/scombine.hlp + The weighting was changed from using the square root of the exposure time + or spectrum statistics to using the values directly. This corresponds + to variance weighting. Other options for specifying the scaling and + weighting factors were added; namely from a file or from a different + image header keyword. The \fInkeep\fR parameter was added to allow + controling the maximum number of pixels to be rejected by the clipping + algorithms. The \fIsnoise\fR parameter was added to include a sensitivity + or scale noise component to the noise model. + (10/2/92, Valdes) + +splot/usercoords.x + This routine no longer puts a default value in the wavelength parameters. + This will allow using SPLOT to noninteractively set wavelengths. + (9/17/92, Valdes) + +identify/idfitdata.x +identify/idmark.x +identify/idgdata.x +identify/idcenter.x + IDENITFY/REIDENTIFY use the standard SHDR interface which eliminates + data with negative physical coordinates. This occurs because NP1 is + then computed to be positive. The case where this can occur is using + IMSHIFT with a positive shift though explicit use of NP1 could also do + it. However, the above routines use the MWCS logical-physical and + physical-logical conversions without accounting for NP1. This results + in incorrect results. The routines were fixed to apply NP1. (9/16/92, + Valdes) + +splot/splot.x +splot/getimage.x + Modified getimage to also allow specification of the aperture. This + is needed in order for the scrolling through lines, the '(' and ')' + keys, to work correctly by indicating that the aperture number is + to be ignored. (9/8/92, Valdes) + +dispcor/dcio.x + The computation of the aperture center was not prepared to deal with + INDEF aperture limits. (9/3/92, Valdes) + +smw.x + There was a type mismatch when setting aplow and aphigh to INDEF. + Changed to set them to INDEFD. This bug caused the APLOW and APHIGH + keywords to appear in the image header unexpectedly with IDENTIFY + on the VaxStation port. (8/31/92, Valdes) + +ecidentify/ecgetim.x +identify/idnoextn.x + The algorithm for stripping the image extension could get confused + with the name such as ec025.john.ec --> ec025n.ec. The routines + were modified to use xt_imroot which does a better job. (8/31/92, Valdes) + +t_sarith.x +smw.x + Added provision to save multispec title in MSTITLE keyword when + separating out multispec spectra or converting to simple 1D format and + to restore the title when combining 1D spectra into a multispec + spectrum. (8/24/92, Valdes) + +sensfunc/sfsvstats.x + A real variable was used where a double should have been giving round + off errors in the computation of the standard deviation. (8/13/92, Valdes) + +t_sfit.x + Output images are of type real regardless of the input type. + (8/11/92, Valdes) + +scombine/icscale.x + The zero level offsets were being incorrectly scaled twice. + (8/10/92, Valdes) + +dispcor/refgspec.x + Arguments incompatible with intrinsic function: + sortval = mod (sortval + 24. - timewrap, 24.) + Changed second 24. to 24.0D0. (8/10/92, Valdes) + +splot/fixx.x + Arguments incompatible with intrinsic function: + z1 = max (0.5, min (double (SN(sh)+.499), shdr_wl(sh, z1))) + z2 = max (0.5, min (double (SN(sh)+.499), shdr_wl(sh, z2))) + The 0.5 should be double. (8/10/92, Valdes) + +shdr.x + Arguments incompatible with intrinsic function: on lines 268-269, + 319-320, need to real the image limits. (8/10/92, Valdes) + +units.x +onedspec.hlp + The velocity label was changed to "cz velocity" to show that it + is c*z and not a true velocity. (7/30/92, Valdes) + +dispcor/t_dispcor.x + Changed WCSDIM to be 3 in the case of a 3D image. (7/27/92, Valdes) + +splot/splot.x + Getttng a new image always forces the data to be read even if the + same image is given. (7/20/92, Valdes) + +smw.x + Altered the way in which old APNUM keywords are deleted to avoid + a problem with the limit on the number of keywords that can be + mapped with imofnl in the imio$db package. (7/17/92, Valdes) + +splot/replot.x + Replaced gascale with gt_ascale to do the autoscaling only within + the GTOOLS window. (7/16/92, Valdes) + +t_sapertures.x +sapertures.par +doc/sapertures.hlp + Modified this task to allow resetting the WCS to pixels and changing + any of the WCS fields. (7/2/92, Valdes) + +splot/wrspect.x + Harmless typo fix mwopen -> mw_open. (7/1/92, Valdes) + +t_sarith.x + Modified to properly handle 3D images. (7/1/92, Valdes) + +t_sarith.x + Onedspec output format now splits out the bands as well. + (7/1/92, Valdes) + +======= +V2.10.2 +======= + +t_dopcor.x +doc/dopcor.hlp + 1. The conversion from velocity to z was incorrect. + 2. Checks were added for reasonable velocities and redshifts. + 3. A negative sign for a header parameter changes the sense of + a redshift if the parameter is a redshift. + +======= +V2.10.1 +======= + +t_deredden.x + The declaration for decode_ranges was incorrect. Changed from bool to int. + (7/21/92, Valdes) + +shdr.x + 1. An earlier fix left the aaxis parameter undefined for longslit images. + This meant that references to IM_LEN(im,aaxis) yield the dimension + of the image rather than the axis length. + 2. Discovered that image sections don't automatically reset the lengths + of the higher dimensions to 1 as assumed in several tasks. SHDR now + resets these. (7/20/92, Valdes) + +======= +V2.10.0 +======= + +irsiids/batchred.cl + The parameter "recformat" in STANDARD and CALIBRATE and "apertures" in + CALIBRATE are no longer present. The BATCHRED task was modified to not + add these parameters to the PROCESS script. (7/6/92, Valdes) + +shdr.x + The resampling in shdr_linear and shdr_rebin is now an average rather + than a sum. (6/23/92, Valdes) + +splot/wrspect.x + New output spectra are created type real. (6/22/92, Valdes) + +scombine/icscale.x +scombine/t_scombine.x + The exposure time is only required now if scaling or weighting by + the exposure time. (6/22/92, Valdes) + +mwcs$wfmspec.x + The inverse coordinate transform could fail in some cases. An extra + check was added to avoid this. (6/17/92, Valdes) + +smw.x + Added special case to convert a 2D image which has a second dimension + length of 1 to a 1D image. Note this is different than a 1D section + of a 2D image. (6/17/92, Valdes) + +shdr.x + Added additional check for a 2D image with the dispersion axis + along a dimension of length 1; for example [800,1] with dispaxis=2. + This will also give an warning and then choose the appropriate + axis. (6/17/92, Valdes) + +t_sarith.x +t_fitprofs.x +splot/wrspect.x + The doppler correction was not properly handled when creating a new + output spectrum. (6/17/92, Valdes) + +shdr.x + The change to catch an inappropriate dispersion axis for TWODSPEC + images was not complete. I'm not fully sure anymore what should be + done but I made the checking better. (6/3/92, Valdes) + +t_sinterp.x + Change the roundoff when computing the number of pixels to nearest + integer. (6/3/92, Valdes) + +scombine/t_scombine: + There was a bug in which the j loop index was redefined in the loop + when checkin the MINMAX rejection limits. (6/1/92, Valdes) + +t_sarith.hlp + Needed to allocate the coeff pointer in sa_1d. Attempting to copy + a long slit spectrum to onedspec format caused a segmentation violation. + (5/27/92, Valdes) + +doc/scopy.hlp +doc/sarith.hlp + The examples incorrectly showed nsum to be a task parameter. + (5/21/92, Valdes) + +bplot.cl + The error when a nonexistent image was specified was not properly + handled. (5/18/92, Valdes) + +splot/splot.key + Clarified 'o' key description. (5/14/92, Valdes) + +smw.x +scombine/t_scombine.x + 1. Added additional commands to delete keywords which should not be + present. + 2. When mapping the output image a copy of the input image header is + made. This header may contain WCS keywords which are invalid. + A call is now made to smw_openim() which has the effect of cleaning + up the header. + (5/14/92, Valdes) + +===== +V2.10 +===== + +doc/*.hlp +doc/sys/onedv210.ms + + Make documentation changes to allow all revisions to be obtained with + "help onedspec.* sec=rev". The package revisions summary was prepared + and installed. (5/6/92, Valdes) + +splot/splot.x +splot/splotcolon.x +splot/splot.key +splot.par +doc/splot.hlp + 1. Added the option "wreset" to have the graph limits automatically + restored to the initial values for each new spectrum. + 2. Added colon commands to change the options interactively. + (5/6/92, Valdes) + +shdr.x + A 1D image section of a 2D (not multispec) image which is not along + the specified dispersion axis will now print a warning and use the + specified axis rather than aborting. (5/6/92, Valdes) + +smw.x +shdr.x + Added checks in the case of log-linear dispersion (DC-FLAG=1) that + the coordinates make sense. Otherwise a linear dispersion is used. + This comes up when DC-FLAG is set to 1 but the other coordinate + information is incorrect or missing resulting in pixel coordinates. + Without this check there would be an attempt to take the dex of + a pixel coordinate causing a floating overflow error. + (5/5/92, Valdes) + +identify/t_reidentify.x + Added call to strip whitespace from the reference image name + accidentally entered by the user. Extra whitespace caused a + mysterious behavior in finding a database entry which was hard + to track down. + (5/1/92, Valdes) + +identify/idinit.x + Added check to not unmap the database if it was never openned. + This would cause a segmentation error if a database was never + accessed. + (5/1/92, Valdes) + +identify/iddb.x +identify/t_reidentify.x +identify/identify.h + The database interaction was poorly done resulting in repeatedly + opening and reading the database file. If there are many entries this + becomes very slow. The DTTEXT routines were modified to add a remap + routine allowing a database file to remain open but automatically + closing and opening a new database if the database name changes. It + also allows changing access modes by closing and opening the file but + leaving the rest of the data structure alone. This avoids the need to + rescan the file each time the access mode changes and allows existence + checks for entries (from the original scan) while still in APPEND mode + without having to switch file access modes. The identify structure was + extended to include the database pointer so that id_dbread and + id_dbwrite could use the remap routine without closing the database + between calls. Thus, repeated calls to id_dbread and id_dbwrite for + the same image are much more efficient and the database is only scanned + once in the first read. There is still a slight inefficiency in that + switching between reading and writing requires reopening the file. For + the purposes of simple checking for existing entries without needing to + read the entry and change modes a new routine id_dbcheck was added. + Finally, the logic in REIDENTIFY was modified so that repeated mode + switches between reading and writing are avoided. The id_dbcheck + routine is used when override checking is enabled. REIDENTIFY + is now much faster when dealing with large numbers of spectra in + images (long slit with a fine step size or multifiber spectra with + many fibers). (4/30/92, Valdes) + +smw.x + An axis map is set for 1D multispec images. (4/27/92, Valdes) + +shdr.x + Shdr_system was changing the wrong pointers causing later calls to + shdr_open to produce an invalid coordinate system. (2/18/92, Valdes) + +scombine/t_scombine.x +scombine/iclog.x +scombine/icscale.x +scombine/icombine.x +scombine.par +doc/scombine.hlp + 1. The gain and read noise must be read when the image is open and + are stored in the RA and DEC spectrum structure parameters. + 2. NCOMBINE is not used on input. + 3. The exposure time is taken from the spectrum structure and the + keyword name is no longer a parameter. + (2/12/92, Valdes) + +scombine/icscale.x + Changed action for negative scaling, etc. to a warning. + (2/10/92, Valdes) + +calibrate.par +sensfunc.par +standard.par +onedspec.par +doc/calibrate.hlp +doc/sensfunc.hlp +doc/standard.hlp +doc/package.hlp + 1. Redirected observatory parameter to package parameter + 2. Added observatory package parameter + (2/6/92, Valdes) + +ecidentify/ecdofit.x +ecidentify/ecffit/ecfcolon.x + 1. The rejected points were not being reset between fits resulting in + misleading RMS values. + 2. Expanded the :show in fit mode. + (2/6/92, Valdes) + +t_standard.x +standard.key + 1. The abbreviation of N or Y for NO or YES is now allowed. + 2. The key file was moved from noaolib$scr to onedspec$ + (2/6/92, Valdes) + +t_calibrate.x +t_standard.x +irsiids/t_bswitch.x + Converted from obsimcheck to obsimopen. (2/4/92, Valdes) + +identify/* +doc/identify.hlp + Added feature labels. (1/30/92, Valdes) + +refspectra.par +doc/refspectra.hlp +dispcor/ref* + 1. Added group parameter + 2. Sort parameter is now used as a double + 3. If group or sort keywords are specified but not found it is a fatal + error. + (1/29/92, Valdes) + +t_sfit.x +sfit.par +continuum.par +eccontinuum.par +doc/sfit.hlp +doc/continuum.hlp + Added the new "markrej" parameter used in ICFIT to control whether + rejected points are marked. (1/21/92, Valdes) + +getcalib.x + The standard star parameter query will now print the file "standards.men" + in the calibration directory if the user supplied name does not match an + available file. (1/20/92, Valdes) + +irsiids/t_widstape.x + Modified the widstape task to support the new mag tape name syntax. + (1/7/92, Davis) + +identify/t_reidentify.x + If there is no dispersion function then no shift will now be computed. + (11/18/91, Valdes) + +ecidentify/ecffit/ecffit.x + Removed the progress print statements because they mess up the screen + clear on XTERM. Someday it might be desirable to put them back again. + (11/11/91, Valdes) + +doc/bswitch.hlp + Fixed minor typo where the keyword BEAM-NUM was refered to as BEAM. + (6/19/91, Valdes) + +t_combine.x + 1. The final coord scale must have WPC > 0. Needed to add an abs(WPC) + in case an input spectrum had negative WPC. (5/3/91, Valdes) + +getnimage.x +t_bswitch.x + Moved procedure add_spec from getnimage.x to t_bswitch.x (4/25/91, Valdes) + +t_calibrate.x + MWCS modifications. Aperture selection option removed. (4/24/91, Valdes) + +splot/getimage.x +splot/splotfun.x +splot/splot.x +splot/replot.x +splot/autoexp.x + Modified to use separate coordinate array. (3/29/91, Valdes) + +iwewcs.x +gmwcs.x +wfinit.x +wfmspec.x +mwopenim1.x +mkpkg +idsm_keywrds.x +load_hdr.x + Initial WCS modifications (3/28/91, Valdes) + +==== +V3.1 +==== + +t_calibrate.x + Moved calibration messages outside of loop over bands. + (3/26/91, Valdes) + +ecidentify/ecidentify.x +ecidentify.par + Added autowrite parameter which is similar to that of IDENTIFY. + (3/21/91, Valdes) + +ecidentify/ecffit/ecfsolve.x + The residual vector was not correctly set by ecf_solve. (3/18/91, Valdes) + +t_scopy.x + 1. If no beam number is found for ONEDSPEC images it defaults to 1. + 2. The image titles are converted to APID for ONEDSPEC images + going to MULTISPEC if the title differs from the main MULTISPEC + title. + 3. Added checking for repeated aperture numbers in ONEDSPEC to + MULTISPEC. + (3/13/91, Valdes) + +identify/t_reidentify.x +reidentify.par + Interactive parameter is now four valued to allow better control + of reidentification queries such as in the IMRED scripts. + +dispcor/ecio.x +dispcor/ecdispcor.x + 1. Fixed datatype error when reading the low and high values from the + APNUM keywords. + 2. Added REFSHFT capability for use with the FOE package. + 3. Added support for third dimension produced by APEXTRACT. + (1/31/91, Valdes) + +t_scopy.x + Fixed bugs in renumber option. It was renumbering before checking the + aperture list rather than after. + (1/31/91, Valdes) + +ecdispcor.par + The parameter override needed to be changed to the parameter rebin. + (1/16/91, Valdes) + +identify/iddb.x + REIDENTIFY checked if an entry in the database was absent by checking for + an error return from id_dbread. The error return was made without + first closing the database file. When reidentifying a large number + of images/apertures the task would run out of file descriptors. + The fix was to put a database close statement before the error + call. (1/7/91, Valdes) + +splot/getimage.x +load_hdr.x + 1. Added error checking for aperture out of bounds in multispec format. + 2. Added automatic limit on band specification in multispec format. + 3. Added missing nband=0 for case of 1D image section. + (1/7/91, Valdes) + +identify/idlinelist.x + The 'l' did not find lines because the first pass to finding MAXFEATURES + did not discriminate against finding the same line with different + user coordinates. This locked out weaker features during the finding. + Then when the features were added to the feature least the MINSEP + parameter eliminated the duplicates resulting in fewer than MAXFEATURES + features. (12/19/90, Valdes) + +splot/stshelp.key +splot/getimage.x +splot/anshdr.x +splot/mktitle.x +splot/mkpkg +splot/splotfun.x +splot/splot.x +splot/splot.key +splot.par + 1. Added support for bands in 3D images. This involved adding a + band task parameter and a '%' key. + 2. The 'o' overplot key is now a toggle for the next graph. It + does not query for the image. The user follows 'o' with 'g', + '#', or '%'. + (12/19/90, Valdes) + +splot/deblend.x +splot/gfit.x + +splot/stsfit.x +splot/stsfit.key + +splot/splot.x +splot/mkpkg +noao$lib/scr/splot.key - +splot/splot.key + + 1. The background was not subtracted in the initial amplitude estimate. + 2. The tau parameter in the call the hfti was too large. Changed + from .001 to 1E-10. + 3. Added new gaussian fitting function, key 'G'. + 4. Changed line help to use a file rather than coding the print + statements. + 5. Moved key file to source directory. + (12/19/90, Valdes) + +t_scopy.x + 1. Added a renumber option. + 2. For an input list of 1D images without onedspec extensions one can + uses a null aperture list to pack them into a single multispec + image. + (12/13/90, Valdes) + +splot/deblend.x + 1. Fixed bug that was scaling twice in computing the initial peak values. + This was also fixed in NEWIMRED. + 2. Last deblending prompt was not erased. Replaced with exiting + deblending message. + (12/4/90, Valdes) + +t_sfit.x + Fixed logfile prefix string from STFONTINUUM to SFIT. + (11/20/90, Valdes and Seaman) + +t_bswitch.x +t_calibrate.x +t_standard.x +sensfunc/sfimage.x +bswitch.par +calibrate.par +standard.par +sensfunc.par +doc/bswitch.hlp +doc/calibrate.hlp +doc/standard.hlp +doc/sensfunc.hlp + Converted to using observatory database. (11/19/90, Valdes) + +t_fitprofs.x +onedspec.hd +doc/fitprofs.hlp + + 1. Modified to write output model even if there is a fitting error to + avoid output images with not pixel file. + 2. The image title was not dereferenced when generating the log title + string with onedspec format. + 3. Added help page. + (11/2/90, Valdes) + +identify/iddoshift.x + Added image label shift info. + (10/29/90, Valdes) + +indentify/t_reidentify.x + 1. The entrance into the interactive mode was not initializing such things + as the feature type and width. It now initializes using parameters from + IDENTIFY if needed. + 2. When not in verbose mode but when entering the interactive IDENTIFY + it did not print the revised statistics line. This has been fixed. + (10/22/90, Valdes) + +ecidentify.par +noao$imred/echelle/doc/ecidentify.hlp +ecidentify/ ecidentify/ecffit +noao$lib/scr/ecidentify.key --> ecidentify/ecidentify.key +noao$lib/scr/ecffit.key --> ecidentify/ecffit/ecffit.key + 1. Moved key files to source directory. + 2. Made changes allowing iterative rejection in the echelle dispersion + tasks. This adds three parameters to the ECIDENTIFY parameter + file, the database files (backwards compatible), and colon + commands in fitting mode. The feature lists printed and in the + database now include an additional column to indicated rejected + lines. (10/15/90, Valdes) + +splot/splot.x + Changed the temporary spool file to be in tmp$. (10/3/90, Valdes) + +doc/dispcor.hlp + Added notes warning that flux conservation will change the units of the + flux. (10/3/90, Valdes) + +splot/splot.x +doc/splot.hlp +noao$lib/scr/splot.key + Added :log and :nolog commands to toggle logging of measurements. + (10/3/90, Valdes) + +load_hdr.x + Header keyword datatype conversion errors are now a warning. + (10/3/90, Valdes) + +identify/idcolon.x + Unrecognized or ambiguous colon commands are now noted. (10/2/90, Valdes) + +dispcor.par (also in imred.iids and imred.irs) +dispcor/dispcor.x +dispcor/dcio.x +dispcor/ranges.x +doc/dispcor.hlp + 1. is_in_range not considers INDEF to be equivalent to MAX_INT. This + has the effect that if no range is specified, "", then INDEF is in + the range while is some specific range which is not open ended will + not include INDEF in the list. + 2. Added new verbose parameter and modified program to print messages + when spectra are skipped. + 3. Ignoreaps now only applies to the global wavelength determination. + (10/2/90, Valdes) + +ecidentify/ecffit/ecfgraph.x + Put a check to avoid trying to plot points outside the defined window. + Plotting very deviant points outside the rescaled window causes a + gio floating overflow error. This fix is a workaround before the + real bug gets fixed. (9/20/90, Valdes) + +identify/idgdata.x +identify/idmap.x + Make changes to allow working with 3D multispec images. + (9/14/90, Valdes) + +calibrate.x +sensfunc/sfgimage.x + Make simple changes to allow working with 3D multispec images. + (9/12/90, Valdes) + +splot/splot.x +splot/fudgex.x +doc/splot.hlp + 1. Changed the 'x' key to use only the x cursor values and connect the + nearest pixels. (8/31/90, Valdes) + 2. Added a new option, xydraw, to select drawing between x-y points + instead of using nearest pixel values. (9/5/90, Valdes) + +bplot.cl +doc/bplot.hlp + BPLOT revised to use new SLIST. This is a much simpler and better + script. It selects on aperture numbers. + (8/24/90, Valdes) + +t_slist.x +doc/slist.hlp + SLIST now has a format parameter. In multispec mode more approriate + output is obtained. The multispec mode allows selection by aperture. + The short header listing is good for making lists for scripts to scan. + (8/24/90, Valdes) + +================================ +V3 of ONEDSPEC installed 8/23/90 +================================ + +fortran/polft1.f + Fixed bug in which reference was made to a part of some work arrays + not used by the program. This caused an arithmetic error on the MIPS. + (7/20/90, Valdes) + +onedspec.cl +onedspec.men +onedspec.cl +bplot.cl +doc/msdispcor.hlp + +doc/bplot.hlp + 1. Added MSDISPCOR to the package. + 2. Replaced the old BPLOT with the code from MSBPLOT. This program + also uses change to SPLOT which selects by aperture number. + +load_hdr.x +splot/splot.x +splot/mktitle.x +splot/deblend.x +splot/eqwidth.x +splot/eqwidthcp.x +splot/anshdr.x + +splot/anssave.x - +splot/mkpkg +doc/splot.hlp +noao$lib/scr/splot.key +t_standard.x + 1. Added mapping of APID keyword, if present, to the iids structure + LABEL field. + 2. SPLOT, STANDARD modified to use LABEL field instead of IM_TITLE. + 3. SPLOT modified to use different line type during overplotting. + 4. Removed maximum number limit for deblending. + 5. SPLOT now uses aperture number if the image is multispec/echelle. + 6. Added a new key, "#", to get new aperture without query about + image. + +t_specplot.x +load_hdr.x +idsm_keywrds.x +dispcor/dcio.x +dispcor/dispcor.x +dispcor/msdispcor.x +dispcor/ecdispcor.x +sensfunc/sfoutput.x + Added CD1_1 as allowed substitute for WPC and CDELT1 + +onedspec.hd + The revisions help is now a sys option. + +t_scopy.x + +t_sapertures.x + +scopy.par + +sapertures.par + +doc/scopy.hlp + +doc/sapertures.hlp + +mkpkg +x_onedspec.x +t_msselect.x - + 1. New task SCOPY added to handle copying and extraction apertures + between different formats + 2. New task SAPERTURES added to modify APNUM and APID info using + a text file. + 3. Removed MSSELECT/ECSELECT as they are replaced by SCOPY. + +onedspec.cl +onedspec.hd +onedspec.men +x_onedspec.x +t_sfit.x + +sfit.par + +continuum.par +t_ecctm.x - +continuum.cl - +mkpkg +doc/sfit.hlp +doc/continuum.hlp + 1. New task SFIT added. This is a modification of Rob Seamans ECCONTINUUM + task. + 2. A new output option was added to output the data with any rejected + points replaced by fitting values. This replacement also may be used + with the difference and ratio output types. + 3. ECCONTINUUM is just a different name for SFIT. + 4. CONTINUUM is just a different name for SFIT. The script version + based on FIT1D has been removed. + +onedspec.par + Incremented version number to V3. + +t_specplot.x +specplot.par +specplot.key + +doc/specplot.hlp +noao$lib/scr/specplot.key - + 1. Added apertures and logfile parameters. + 2. Moved key file to source directory + 3. Added to save sp_vshow parameters in logfile. + 4. Added option to undelete last deleted spectrum. + 5. Extended to also plot anything in third dimension. + 6. Added sysid parameter. + 7. Added ability to set line type to histogram + +dispcor/dispcor.x + 1. Added aperture position information to APNUM keyword. + +msdispcor.par + +dispcor/msdispcor.x +dispcor/msio.x +dispcor/msdispcor.com +dispcor/mkpkg + 1. Added logfile. This is particularly for logging reference + shift interpolation information. + 2. Added support for 3D format + 3. Added aperture position info for spatial interpolation. The positions + are read for the object from the APNUM keyword, propagated as + needed, and read from the database for the dispersion functions. + 3a. A reference shift spectrum may be specified. + 4. Communicate aperture number through ms_seteval call and then do a + lookup for all other parameters. + 5. Propagate independent beam number. + 6. The number of apertures in the reference spectrum need not be + the same as the object spectrum though all object spectra must + have a reference dispersion function. + 7. Everything is now done by aperture number. This allows line + numbers to change, particularly between the dispersion reference + image and the data image. + 8. Dependence of msdispcor.x on msdispcor.com removed. + 9. Fixed rounding problem in wavelengths. + +dispcor/ecdispcor.x +dispcor/ecio.x +dispcor/ecdispcor.com +dispcor/mkpkg + 1. Everything is done by aperture number using a call to ec_seteval. + This removes dependence on ecdispcor.com + 2. Aperture limit info is propagated + +identify/identify.x --> identify/t_identify.x +identify/identify.h +identify/linelist.x + *.x +identify/iddoshift.x +identify/iddb.x +identify.par +mkpkg + 1. Added an autowrite parameter to IDENTIFY. + 2. Simplified linelist package by passing id pointer. This affects + calling sequence of a number of procedures. + 3. Zero weight points are ignored and the number of valid features + used in the shift is printed. + 4. New id structure made some minor changes in main task. + 5. Dependence on center1d.h removed by including emmission/absorption + definitions in identify.h and new field in id structure. + +identify/iddb.x +identify/identify.h +identify/idgdata.x +identify/ididentify.x +identify/idinit.x +identify/identify.key + +identify/idmap.x + +identify/idnoextn.x + +identify/idgetim.x - +idreplot.x - +mkpkg + Added support for multispec format. + 1. The database name string includes aperture number. + 2. Image remains open for efficient movement through 2D image. + 3. A number of new fields are part of the id structure including + the image pointer, spectrum format, image axis, line number, + aperture info, and structure for saving copies of id structure. + 4. Added j, k, o keys to scroll through apertures. + 5. Changes are saved internally for multiple apertures until done + with the image. + +identify/idreidentify.x --> identify/t_reidentify.x +reidentify.par +reidentify.x - + 1. REIDENTIFY completely rewritten for efficiency, support for + multiaperture data, and for additional features and algorithms. + 2. The same number or order of apertures is not required. + 3. REIDENTIFY parameters changed to include interactive, track, + override, addfeatures, coordlist, match, maxfeatures, minsep, + graphics, cursor, and answer. + +------------------------------------------------------------------------------ + +load_hdr.x +splot/getimage.x + 1. Fixed bug that was setting NP1 to 1 instead of zero. + 2. Now load_hdr adjusts W0 to first good pixel. + 3. SPLOT no longer adjust W0 to first good pixel since it is done + by load_hdr. + (7/11/90, Valdes) + +onedspec$ecidentify/ecidentify.x +onedspec$ecidentify/t_ecreid.x +onedspec$ecidentify/ecdofit.x +onedspec$ecidentify/ecffit/ecffit.x +onedspec$ecidentify/ecffit/ecfsolve.x + 1. Added a fixed order fitting option so that ECREIDENTIFY will refit + with order fixed. This is mostly just passing a parameter down + to ecf_solve. (6/12/90, Valdes) + +onedspec$dispcor/msio.x + If an aperture identify entry was missing from the database the task + would quit with not error message. This is fixed now though the + new version to be installed soon will not have this approach to + mapping the dispersion solutions anyway. (6/4/90, Valdes) + +onedspec$doc/splot.hlp + Included query parameters since a user was asking about them. + (6/1/90, Valdes) + +==== +V2.9 +==== + +onedspec$t_sums.x +onedspec$sums.par + If an image already exists a new query parameter will be used to get + a new image name. (3/29/90, Valdes) + +onedspec$batchred.cl + Turned on extinction correction in calibrate for the case the spectra + are not already extinction calibrated. (3/29/90, Valdes) + +onedspec$ecidentify/ecdofit.x + When INDEF valued lines were used and features were deleted during + fitting the resorting of the feature list would get messed up. + This is a very rare condition which has now been fixed. + (3/16/90, Valdes) + +onedspec$identify/idgdata.x +onedspec$dispcor/dcio.x +onedspec$dispcor/ecdispcor.x +onedspec$dispcor/dispcor.x +onedspec$dispcor/msdispcor.x +onedspec$dispcor/disptable.r +onedspec$sensfunc/sfoutput.x +onedspec$load_hdr.x +onedspec$idsm_keywrds.x +onedspec$t_specplot.x + Added CDn_n to the set of keywords which may be used for the dispersion. + (2/8/90, Valdes) + +onedspec$splot/eqwidths.x +onedspec$splot/sumflux.x + The equivalent width is now computed using the ratio of the spectrum + to the continuum. The previous approximation is printed in the log + file for comparison. + (3/5/90, Valdes) + +onedspec$splot/splot.x +onedspec$splot/mktitle.x + 1. For :show added test for existence of spool file and an appropriate + message if it does not exist. + 2. Increase length of plotted title to SZ_LINE from 32. + (3/2/90, Valdes) + +onedspec$identify/iddofit.x + When INDEF valued lines were used and features were deleted during + fitting the resorting of the feature list would get messed up. + This is a very rare condition which has now been fixed. + (1/17/90, Valdes) + +onedspec$dispcor/ecdispcor.x + The sum option was actually the same as the average option! + (1/15/90, Valdes) + +199c199 +< call calloc (spec, nw, TY_REAL) +--- +> call malloc (spec, nw, TY_REAL) +208a209 +> call aclrr (Memr[spec], nw) +212c213,218 +< case SUM, AVERAGE: +--- +> case SUM: +> do j = 1, nw +> if (Memr[spec+j-1] != 0.) +> Memr[outdata+j-1] = Memr[outdata+j-1] + +> Memr[spec+j-1] +> case AVERAGE: + +onedspec$load_hdr.x + Add limit checks for NP1 and NP2. (11/8/89, Valdes) + +onedspec$sensfunc/sfstds.x + The data for apertures which are in the aperture list when the ignoreaps + flag is set was not being read unless the aperture list included + aperture 1. This has been fixed. (11/8/89, Valdes) + +onedspec$load_hdr.x +onedspec$t_specplot.x +onedspec$splot/splot.x +onedspec$splot/mktitle.x + 1. The new APID titles for multispec format spectra is now mapped into + the unused LABEL element of the IDS structure. For other formats + or if the keyword is missing then the image title is substituted. + 2. SPLOT now labels with the LABEL string rather the the image + title to allow individual titles for multispec spectra. + 3. SPECPLOT uses the APID titles if present. + (10/27/89, Valdes) + +onedspec$identify/iddofit.x + The order of evaluation in complex if statements is not necessarily + left to right as I'd thought. This caused a bus error on the + Convex. The particular change is as follows: + + old: + if (rejpts != NULL && Memi[rejpts+k-1] == YES) + WTS(id,j) = 0. + else + WTS(id,j) = Memd[wts+k-1] + new: + WTS(id,j) = Memd[wts+k-1] + if (rejpts != NULL) + if (Memi[rejpts+k-1] == YES) + WTS(id,j) = 0. + +onedspec$load_hdr.x + Modified header access to use imaccf to check if header parameter exists + rather than rely on an error return. On a Sun3x the error checking + results in an exception. (9/28/89, Valdes) + +onedspec$t_calibrate.x + The data outside of calibration range message was changed to print how many + pixels are outside of the calibration range is printed once. + (8/8/89, Valdes) + +==== +V2.8 +==== + +onedspec$idsmtn.h +onedspec$t_subsets.x +onedspec$t_standard.x +onedspec$t_slist.x +onedspec$t_shedit.x +onedspec$t_flatdiv.x +onedspec$t_calibrate.x +onedspec$t_bswitch.x +onedspec$t_addsets.x +onedspec$load_hdr.x +onedspec$idsm_keywrds.x +onedspec$sensfunc/sfimage.x +onedspec$splot/mktitle.x +onedspec$shparams.par + The exposure time is used as a real rather than an integer (7/11/89, Valdes) + +onedspec$t_specplot.x + The wavelengths were off by one pixel because CRPIX was uninitialized + and so defaulting to zero instead of 1. (6/6/89, Valdes) + +onedspec$sensfunc/sfstds.x + Previously added check for INDEF exposure time extended to also check + for zero exposure time. (6/1/89, Valdes) + +onedspec$dispcor/msio.x + Because of a recent change in IDENTIFY in which 2D images with a + second dimension of 1 are treated as 1D images a related change + was required to allow multispec format spectra to be dispersion + corrected if there is only one spectrum. (5/15/89, Valdes) + +onedspec$load_hdr.x + Airmass values less than 1 are mapped in INDEF to force an airmass + computation. (5/8/89, Valdes) + +onedspec$splot/getimage.x + If the spectrum has only 1 line (even if it is two dimensional) there + is no query for the line number. Also the line number given by the + user for 2D images is limited to the range of image lines to avoid + an out of bounds error. (5/6/89, Valdes) + +onedspec$dispcor/dispcor.x +onedspec$dispcor/dcio.x +onedspec$doc/dispcor.hlp + 1. The output spectrum will be of real datatype if the input spectrum + is short datatype. + 2. The last dispersion function defined for a 2D image is used for + all lines of a 2D image. + (5/6/89, Valdes) + +onedspec$doc/dispcor.hlp + Fixed mistake in description of the ignoreaps parameter. (5/6/89, Valdes) + +onedspec$identify/identify.h +onedspec$identify/*.x + 1. Added weights to the IDENTIFY data structure. + 2. Modified files to use the weights parameter. + 3. The weights are currently used to flag iteratively rejected points + during fitting of the dispersion function. + 4. Reidentify now prints the RMS of only those lines used in the fit + and shows the number of points fit. + 5. The database files now include a column for the weights. + (5/5/89, Valdes) + +onedspec$t_standard.x +onedspec$standard.par + 1. A warning message is printed if the exposure time is not found. + 2. Removed ennumerated value in parameter file. + (4/10/89, Valdes) + +onedspec$sensfunc/sfstds.x + 1. Standard values with negative counts are ignored thus avoiding + arithmetic problems. + 2. Warning message is printed if the exposure time in not defined and + a value of 1 is used. (4/10/89, Valdes) + +onedspec$dispcor/msio.x + +onedspec$dispcor/msdispcor.com + +onedspec$dispcor/msdispcor.x + +onedspec$t_msselect.x + +onedspec$dispcor/dispcor.x +onedspec$dispcor/mkpkg +onedspec$mkpkg +onedspec$x_onedspec.x + 1. New task MSDISPCOR to make dispersion correction in related + spectra in "multispec" format. This is a cross between + ECDISPCOR and DISPCOR. + 2. New tasks MSSELECT and ECSELECT to extract subsets of spectra + from echelle and multispec format. ECSELECT is simply an + alternate task name for MSSELECT. + 3. These new tasks use the procedures in the ONEDSPEC object + library but appear as logical tasks in the new MSRED package + and in the ECHELLE package. + (3/29/89, Valdes) + +onedspec$dispcor/dispcor.x + When not flux conserving the procedure asieval was being called + with a double value instead of a real giving completely incorrect + results. (3/22/89, Valdes) + +onedspec$dispcor/refmatch.x + There was a bug in the matching option in which the object image was + begin substituted for the reference image. (3/14/89, Valdes) + +onedspec$t_specplot.x +onedspec$splot.par +onedspec$splot/wrspect.x +onedspec$load_hdr.x +onedspec$identify/iddb.x + 1. Modified SPECPLOT to accept "multispec" and "echelle" formats. + 2. Modified SPLOT to accept "multispec" format for output. This is + only cosmetic since it is the same as "echelle" format. + 3. Modified ONEDSPEC header reader to accept "multispec" format. + This is only cosmetic since it is the same as "echelle" format. + 4. Modified IDENTIFY to not include the image section in the REFSPEC + parameter for use with "multispec" format. + (3/8/89, Valdes) + +onedspec$dispcor/dispcor.x +onedspec$doc/dispcor.hlp + Simple modification to allow task to operate on all lines in a 2D + image. This is how the old program also worked. (3/8/89, Valdes) + +onedspec$t_calibrate.x + 1. CALIBRATE did not take the differing lengths of the echelle orders + into account and so gave many warnings about spectrum extends outside + of flux calibration limits. + 2. The warning is now only printed once per spectrum/order rather than + for each pixel. + (2/27/89, Valdes) + +onedspec$t_specplot.x + Made CRPIX1 a real valued parameter. (2/27/89, Valdes) + +onedspec$t_widstape.x + The function mtfile is now used to determine if the input file is + a mag tape. Previously, the code was checking that the first two + letters of the input file were 'mt', which fails for remote tape + drives. (2/22/89 ShJ) + +onedspec$doc/refspectra.hlp + A new help page for the refspectra task has been installed. + (2/27/88, Davis) + +onedspec$doc/continuum.hlp + Added a warning about near zero divisions. (2/14/89, Valdes) + +onedspec$identify/idlinelist.x +onedspec$ecidentify/eclinelist.x + Setting the coordinate line list to null no longer issues a warning. + (2/13/89, Valdes) + +onedspec$specplot.x +onedspec$doc/specplot.hlp +noao$lib/scr/specplot.key + 1. Added vertical shifts in scale. + 2. Added horizontal shifts in velocity. + 3. Added velocity and redshift colon commands. + (2/8/89, Valdes) + +onedspec$splot/splot.x + The default key now prints the spectrum value at the x coordinate in + addition to the cursor x, y coordinates. (2/7/89, Valdes) + +onedspec$dispcor/dispcor.x +onedspec$dispcor/ecdispcor.x +onedspec$dispcor.par +onedspec$ecdispcor.par +imred$coude/dispcor.par +imred$echelle/ecdispcor.par +imred$iids/dispcor.par +imred$irs/dispcor.par +imred$specphot/dispcor.par +onedspec$doc/dispcor.hlp +imred$echelle/doc/ecdispcor.hlp + Changed "override" parameter to "rebin". Also rebin=no acts only + on nondispersion corrected spectra while rebin=yes acts only on + dispersion corrected spectra. (2/2/89, Valdes) + +onedspec$dispcor/refaverage.x +onedspec$dispcor/reffollow.x +onedspec$dispcor/refgspec.x +onedspec$dispcor/refinterp.x +onedspec$dispcor/refmatch.x +onedspec$dispcor/refnearest.x +onedspec$dispcor/refprecede.x +onedspec$refspectra.par +onedspec$doc/refspectra.hlp +imred$coude/refspectra.par +imred$echelle/refspectra.par +imred$iids/refspectra.par +imred$irs/refspectra.par +imred$specphot/refspectra.par + Added timewrap parameter and reorganized calling sequences so the + sortval is set only in refgspec. (2/2/89, Valdes) + +onedspec$reidentify.x + Stripped the image extension from the reference spectrum. + (1/31/89, Valdes) + +noao$lib/scr/ecidentify.key + Fixed minor typo "j Go to next order" --> "k Go to next order". + (1/26/89, Valdes) + +onedspec$dcio.x + An erroneous sfree in dc_gspec was removed. (1/26/89, Valdes) + +onedspec$idsm_keywrds.x +onedspec$load_hdr.x +onedspec$dispcor/dispcor.x +onedspec$dispcor/ecdispcor.x + Changed CRPIX usage to real. (1/26/89, Valdes) + +onedspec$names.par +imred$coude/names.par +imred$iids/names.par +imred$irs/names.par + Made the "input" parameter prompt indicate it is a list rather than + a single file. (1/24/89, Valdes) + +onedspec$splot.par +imred$coude/splot.par +imred$echelle/splot.par +imred$iids/splot.par +imred$irs/splot.par +imred$specphot/splot.par + Made the minimum line number be 1 instead of 0. (1/24/89, Valdes) + +onedspec$splot/splot.x + The 'w' window option in SPLOT now only redraws automatically in + "auto" mode. (1/24/89, Valdes) + +onedspec$ecidentify/ecffit/ecffit.x + The 'o' key now accepts the default order for fitting; i.e. a + carriage return for the prompt. Also the message about fitting + now also includes the order offset being used. (1/24/89, Valdes) + +onedspec$idgdata.x + Now allow 2D images with a second dimension of 1. (1/24/89, Valdes) + +onedspec$dispcor/refinterp.x + When interpolating on a parameter that is the same for a set of arcs + and an object one wants two arcs to be identified; i.e. the one before + and after. This did not happen until this bug fix. (1/20/89 Valdes) + +onedspec$sensfunc.par +imred$echelle/sensfunc.par +imred$iids/sensfunc.par +imred$irs/sensfunc.par +imred$specphot/sensfunc.par +onedspec$standard.par +imred$echelle/standard.par +imred$iids/standard.par +imred$irs/standard.par +imred$specphot/standard.par + Fixed missing default value for answer parameter. (1/20/89, Valdes) + +onedspec$splot/pixind.x + Removed use of AINT function which was misbehaving on Sun386i. + (12/16/88 Valdes) + +onedspec$identify/reidentfy.x +onedspec$identify/idreidentfy.x +onedspec$identify/idreplot.x + +onedspec$doc/reidentfy.hlp +onedspec$reidentfy.par +twodspec$longslit/reidentfy.par +imred$coude/reidentfy.par +imred$iids/reidentfy.par +imred$irs/reidentfy.par +imred$specplot/reidentfy.par + Added plotfile for residuals. (12/16/88 Valdes) + +onedspec$dispcor/dcio.x + If a reference spectrum is an image section its database entry will + be the file with the section stripped. Since the database entry + is written by IDENTIFY I copied the database access code that + strips the image section. (12/8/88 Valdes) + +onedspec$dispcor/dispcor.x + The use of some real variables in the flux conservation calculation + resulted in incorrect results when the resolution was very high. + The code was carefully rewritten to do all possible calculations in + double precision. (12/8/88 Valdes) + +onedspec$t_specplot.x + +onedspec$specplot.par + +onedspec$specplot.h + +onedspec$doc/specplot.hlp + +noao$lib/scr/specplot.key + +onedspec$x_onedspec.x +onedspec$onedspec.cl +onedspec$onedspec.men +onedspec$onedspec.hd +onedspec$mkpkg + New task added (12/7/88 Valdes) + +onedspec$t_standard.x + Fixed minor bug: missing parg in eprintf when dispersion solution + missing. (11/4/88 & 11/17/88) + +onedspec$identify/ididentify.x +onedspec$identify/idfitdata.x + The nonmonotonic error message was being lost because it is flushed + immediately to the screen and then the screen is cleared to redraw + the graph. This has now been fixed by checking for an error just + before the cursor read. (11/2/88) + +onedspec$identify/identify.x +onedspec$identify/iddb.x +onedspec$identify.par +onedspec$doc/identify.hlp + 1. Added the additional icfit parameters (except naverage) to IDENTIFY + so the user can set the default fitting parameters more fully. + 2. All the ICFIT fitting parameters are now written to the database and + read back. This allows IDENTIFY and REIDENTIFY to start with exactly + the same fitting parameters as previously used. (11/2/88) + +onedspec$t_bswitch.x + Added a test for the extinction correction request before trying to compute + the airmass. (11/1/88) + +onedspec$ecidentify/eccolon.x + 1. When the label parameter was initially set to user all the labels + were being printed not just those for the current aperture. The bug has + been fixed. (9/9/88) + +onedspec$dispcor/dispcor.x + 1. A bug was fixed in the log+ option of dispcor and ecdispcor. The + problem was that the end points of the wavelength region were in + linear wavelength units but the w1 and dw parameters were in log units, + causing an erroneous computation of the index for the first pixel. + This bug has been fixed. (9/9/88) + +onedspec$dispcor/refspectra.x +onedspec$onedspec.cl +onedspec$onedspec.men +onedspec$batchred.cl + +onedspec$batchred.par + +onedspec$bswitch.par + +onedspec$coefs.par - +onedspec$standard.par +onedspec$sensfunc.par + 1. BATCHRED and BSWITCH were put back into this package. + 2. COEFS was removed from this package. + 3. Enumerated strings were added to SENSFUNC and STANDARD parameter + files to prevent the tasks from dying on a bad value (i.e. clgwrd + was causing an error). By putting the allowed values in the parameter + file the CL will wait for an allowed value. + 4. REFSPECTRA does not change the value of the confirm parameter now. + (7/29/88 Valdes) + + +onedspec$splot/deblend.x +onedspec$doc/splot.hlp + 1. The fitting parameter initialization was being done even before the + 'q'. Thus, the '-' subtraction did not use the fit but the initial + parameters. + 2. Modified the initial sigma to be 1/4 of the range divided by the number + of lines. The 1/2 was too large. (7/26/88 Valdes) + +onedspec$splot.par +onedspec$splot/deblend.x +onedspec$splot/scr_help.x - +onedspec$doc/splot.hlp + 1. Removed unused parameters inblend, fixsep, difference, subtract from + parameter file. + 2. Fixed bug with '-' in deblending (continuum was not being subtracted). + 3. Removed unused source file. + 4. Update the help page. (7/19/88 Valdes) + +onedspec$splot/deblend.x + Fixed bug introduced below. (7/12/88 Valdes) + +onedspec$splot/deblend.x +onedspec$onedspec.hd +noao$lib/scr/deblend.key +onedspec$doc/splot.hlp + 1. After moving the parameter initialization to within the options loop the + initializations were being done wrong. + 2. The 'd' option was not doing what it was supposed to. + 3. Added a print newline to clear the status line if four lines were + entered since this does not go through the 'q' case which was + doing the clear. + 4. The n sigma cases had the wrong mneumonics in the help. + 5. The src definitions in the help table were pointing to wrong files + since the names and directories for the files have been changed + (7/1/88 Valdes) + + +onedspec$t_names.x +onedspec$mkpkg + Modified this task to use the ODR package. This also strips the image + extension allowing the append option to work. (6/28/88 Valdes) + +onedspec$coincor.x + When doing both coincidence and power law corrections failed to put the + output of the coicidence correction as the input to the power law + correction. (6/23/88 Valdes) + +onedspec$identify/idgdata.x + Added an error check to IMMAP. Failure to do this gave a segmentation + violation on the SUNS. (6/23/88 Valdes) + +onedspec$continuum.cl + 1. Added a parameter to allow a cursor list text file to be passed to the + normcontinuum task. + +onedspec$ecidentify/ecgdata.x +onedspec$ecidentify/ecffit/ecfcolon.x +onedspec$ecidentify/ecffit/ecfset.x +onedspec$ecidentify/ecffit/ecfsolve.x +onedspec$ecidentify/ecffit/ecfrms.x + +onedspec$ecidentify/ecffit/mkpkg +noao$lib/scr/ecidentify.key +noao$lib/scr/ecffit.key + + The following was fixed. (5/20/88 Valdes) + 1. Error in graph title string. + 2. Missing cursor key help. + 3. Error in ":function" command in fitting mode. + 4. Rms calculated with deleted points. + +onedspec$dispcor/dispcor.x +onedspec$dispcor/ecdispcor.x + 1. Failed to initialize the output spectrum to zero so that points + outsided the input data range are zero. (5/17/88 Valdes) + +onedspec$dispcor/refaverage.x + 1. Instead of checking the reference spectra for aperture and reference + flag it was test the input image. This was changed. (5/17/88 Valdes) + +onedspec$load_hdr.x +onedspec$splot/deblend.x + 1. The deblending was fitting a function without the factor of 2 in + the Gaussian sigma definition. This caused the printed Gaussian + parameters to be off by a factor of sqrt(2). + 2. Slight change to not have the header loading change the specified + input line. It is up to the calling code to determine if this is + a valid line. (5/17/88 Valdes) + +onedspec$identify/idreidentify.x + 1. Added check for nonmonotonic dispersion solution. (4/30/88) + +onedspec$onedspec.cl +onedspec$onedspec.men +onedspec$onedspec.hd + 1. Task EXTINCT was removed. The script and help page remain in case + they are desired. Later they will also disappear. The function of + this script is replaced by CALIBRATE. (4/26/88 Valdes) + 2. Task BATCHRED was removed to the IMRED packages. (4/27/88 Valdes) + +onedspec$splot/splot.x +onedspec$splot/deblend.x +onedspec$t_flatfit.x +onedspec$identify/ididentify.x +onedspec$ecidentify/ecidentify.x +onedspec$ecidentify/ecffit/ecffit.x +noao$lib/scr/splot.key +noao$lib/scr/identify.key +noao$lib/scr/ecidentify.key +noao$lib/scr/deblend.key +noao$lib/scr/ecffit.key +noao$lib/scr/flatfit.key + Added 'I' interrupt key. (4/20/88 Valdes) + +onedspec$identify/identify.h + Variables defined as integers instead of real (ID_MATCH, ID_MINSEP) + (4/18/88 Valdes) + +onedspec$sensfunc/t_sensfunc.x +onedspec$sensfunc/sfsensfunc.x +onedspec$sensfunc/sfstds.x +onedspec$sensfunc/sfginit.x +onedspec$sensfunc/sfoutput.x +onedspec$sensfunc.par +onedspec$doc/sensfunc.hlp +noao$lib/scr/sensfunc.key + 1. Added beam number to output sensitivity image header. + 2. Added 'I' interrupt key. + 3. Added aperture number selection. + 4. Added interactive query. (4/15/88 Valdes) + +onedspec$splot/getimage.x + Modified to recognize echelle format spectra on input. (4/8/88 Valdes) + +onedspec$load_hdr.x + Modified to recognize echelle format spectra on input. (4/8/88 Valdes) + +onedspec$mkpkg +onedspec$splot/mkpkg +onedspec$identify/mkpkg +onedspec$fortran/mkpkg +onedspec$onedutil.cl +onedspec$onedspec.cl +onedspec$onedspec.par +onedspec$onedspec.men +onedspec$onedspec.hd +onedspec$identify/* +onedspec$t_flatdiv.x +onedspec$t_coefs.x +onedspec$t_combine.x +onedspec$dispcor.par +onedspec$identify/identify.par --> onedspec$identify.par +onedspec$identify/reidentify.par --> onedspec$reidentify.par +onedspec$doc/dispcor.hlp + +onedspec$dispcor/* + +onedspec$ecidentify/* + +onedspec$x_onedspec.x + +onedspec$refspectra.par + +onedspec$dispcor1.par + +onedspec$ecidentify.par + +onedspec$ecreidentify.par + +onedspec$doc/refspectra.hlp + + +onedspec$x_wavecal.x - +onedspec$x_fluxcal.x - +onedspec$x_onedutil.x - +onedspec$identify/x_identify.x - +onedspec$identify/libpkg.a - +onedspec$dbx/ - +onedspec$dbxio.h - +onedspec$userstd/ - +onedspec$t_dispcor.x - +onedspec$fudge.x - +onedspec$rlsq.x - +onedspec$userstdc.x - +onedspec$readstd.x - +onedspec$qsortra.x - +onedspec$statfile.x - +onedspec$ascrcomp.x - +onedspec$identify/icghelp.x - +onedspec$splot/spflip.x - + The ONEDSPEC package has been completely reorganized by combining + executables, eliminating obsolete procedures, and adding new + versions of IDENTIFY and DISPCOR as well and new tasks for echelle + format data. (4/7/88 Valdes) + +------------------------------------------------------------------------------- + +onedspec$mkpkg +onedspec$splot/deblend.x + Fixed bugs related to initial guesses for width and peak and scaling. + Replaced Gauss-Jordan routine by Householder transformation routine + for stability. (4/6/88 Valdes) + +onedspec$load_hdr.x + The test for wavelengths in meters per second was W0 < 0.001. + Now the test is abs(W0) < 0.001. (3/10/88 Valdes) + +onedspec$identify/ididentify.x + The 't' was calling fit_to_pix with the real valued cursor position + while the procedure expects a double. Added a double coercion to fix + the bug. (2/18/88 Valdes) + +onedspec$splot/anssave.x +onedspec$splot/mktitle.x +onedspec$splot/getimage.x +onedspec$splot/splot.x +onedspec$splot/splotfun.x + 1. Titles (on the graph and in the log file) for two dimensional images + now contain the line number given as an image section. + 2. The log file title now includes a time stamp. (1/29/88 Valdes) + +onedspec$identify/ididentify.x + When recentering all the features the fitted coordinates are now + updated and the tick marks moved to the new center position. + (1/4/87 Valdes) + +onedspec$identify/iddb.x + DBGETR was declared as real for the new shift parameter causing a wrong + wavelength scale to appear. (12/22/87 Valdes) + +onedspec$doc/identify.hlp + Fixed minor typo. (12/7/87 Valdes) + +onedspec$sextract.cl + +onedspec$doc/sextract.cl + +onedspec$onedutil.cl +onedspec$onedutil.par +onedspec$onedutil.men +onedspec$onedutil.hd + Added a new task, SEXTRACT, to extract subspectra. (11/19/87) + +onedspec$t_dispcor.x + The default starting wavelength and wavelength interval are now printed + in g format so that the user sees the full value. (11/9/87) + +onedspec$identify/identify.x +onedspec$identify/reidentify.x +onedspec$identify/idgraph.x + 1. The XTOOLS change to XT_MK1D now permits the sections "column 51" + and "column 051" to be recognized identically. + 2. REIDENTIFY now aborts with a useful error message if their is not + database record for the reference image instead of later causing + a segmentation error. + 3. IDENTIFY can now plot in point mode using the GTOOLS commands if + desired. + (11/9/97 Valdes) + +noao$onedspec$sensfunc/sfextinct.x +noao$onedspec$sensfunc/sfsensfunc.x +noao$onedspec$sensfunc/sfreset.x +noao$onedspec$sensfunc/sfmarks.x +noao$onedspec$sensfunc/sfadd.x +noao$onedspec$sensfunc/sfdelete.x +noao$onedspec$sensfunc/sfundelete.x +noao$onedspec$sensfunc/sfmove.x +noao$onedspec$sensfunc/sfgraph.x +noao$onedspec$sensfunc/sfginit.x +noao$onedspec$sensfunc/sfcomposite.x +noao$onedspec$sensfunc/sfcolon.x +noao$onedspec$sensfunc/sfshift.x +noao$onedspec$sensfunc/sensfunc.h +noao$onedspec$doc/sensfunc.hlp +noao$lib/scr/sensfunc.key + A number of changes were made based on user comments. + 1. A bug was fixed which caused the ":order" command to crash the task. + The integer valued order was being passed as a char in the colon + decoding task. + 2. The shift key 's' now toggles allowing a shift to be undone + without initializing all the data. Also a message is printed + to indicate what has been done. + 3. The composite key 'c' now toggles allowing a composite to be undone + without initializing all the data. Also a message is printed + to indicate what has been done. A deleted composite point deletes + the original data at that wavelength when toggling back. + 4. The extinction key 'e' now toggles allowing an extinction + correction to be undone without initializing all the data. + Also a message is printed to indicate what has been done. + 5. A different symbol may be used to indicated added points. + 6. Changing the function or order does not automatically do a + new fit. + 7. A new key 'g' was added to do a fit and redraw the graph(s). + The existing 'f' key does a fit and overplots as before. + (11/6/87 Valdes) + +onedspec$splot/replot.x +onedspec$splot/splot.x +onedspec$splot/autoexp.x + Modified REPLOT to use GTOOLS task GTVPLOT. This allows the user to + select point mode. The calling sequence for REPLOT has a new argument + to allow calling this procedure for overplotting. (11/5/87 Valdes) + +onedspec$identify/* +onedspec$identify/iddoshift.x + + Added shift options to IDENTIFY and a refit option to REIDENTIFY. + This allows maintaining the same coordinate function with an additive + shift. (11/3/87 Valdes) + +onedspec$sensfunc/sfgraphs.x - +onedspec$sensfunc/mkpkg.x + A zero length file, possibly confused with sfgraph.x was deleted and + deleted from the mkpkg. (10/26/87 Valdes) + +onedspec$splot/deblend.x +onedspec$splot/sumflux.x + 1. The input data to the deblending routine are now scaled to values + near unity. Also the fitting is iterated three times to make the + results more consistent. + 2. When computing the line center with 'e' the data is scaled to + avoid underflows in summing residuals to the 1.5 power. + (See bug report 16) (10/22/87 Valdes) + +onedspec$sensfunc/sfsensfunc.x +onedspec$sensfunc/sfextinct.x + 1. Aperture number for new aperture in title was undefined in the first + graph. Set title after determining aperture number. + 2. In a rare case it was possible for a square root of zero to occur + in the extinction significance calculation which is fatal on VMS. + Added check of argument before square root call. (Valdes) + +onedspec$splot.par + Changed all interactive query parameters from auto mode to query + mode to force a query even when run in menu mode and with :go. + (9/15/87 Valdes) + +onedspec$t_standard.x +onedspec$t_lcalib.x +onedspec$splot/plotstd.x +onedspec$standard.par +onedspec$lcalib.par +onedspec$splot.par +onedspec$doc/standard.hlp +onedspec$doc/lcalib.hlp +onedspec$doc/splot.hlp + The magnitude to absolute flux conversion constant has been made a + user changable parameter in the three tasks dealing with the flux + calibration tables. (9/3/87 Valdes) + +onedspec$t_sensfunc.x - +onedspec$sensfunc/* + +noao$lib/scr/sensfunc.key + +onedspec$sensfunc.par +onedspec$doc/sensfunc.hlp +onedspec$t_standard.x +onedspec$doc/standard.hlp +onedspec$bswitch.par +onedspec$getextn.x + SENSFUNC has been completely rewritten. It now allows determination + of extinction, display of flux calibrated spectra, and many nice + features for displaying and manipulating the data. For full details + read the new help page. + + The new sensfunc required some modifications to STANDARD in the + format of the output file produced by standard. The parameters for + BSWITCH no longer have the grey scale parameter add_const or the + (never implemented) revised extinction file rev_ext_file which are + not produced by SENSFUNC any more. + + The extinction loading procedure was modified to allow a null + extinction file to correspond to no extinction and to eliminate the + procedure get_new_ext and fix_ext which were used for the old grey + constant and never implemented revised extinction file. (9/3/87 + Valdes) + +onedspec$splot/mkpkg +onedspec$splot/splot.x +onedspec$splot/splotfun.x + Errors getting a spectrum in function mode were ignored and the spectrum + was replotted. Changed to return the error as a warning and not redraw + the plot. + +onedspec$t_dispcor.x (routine reinterp) + The reinterpolation now has additional tests: + 1) When the interpolation point is within a minimum distance of + an input pixel (0.001) it does not interpolate. This was + done because the interpolation grid is sometimes meant to be + identical with the input but the computation of the output grid + is very slightly off (this was observed in COMBINE). + 2) If one of the points to be interpolated between has a value of + 0.0 (used to mark missing data in ONEDSPEC) then the rebinned + point is set to 0.0 in order to propagate the missing point. + This is important for combining spectra with COMBINE. (8/5/87 Valdes) + +==== +V2.5 +==== + +onedspec$t_sinterp.x + Valdes, June 22, 1987 + 1. Removed a warning message to allow comments in the input table. + +onedspec$splot/avgsnr.x + Valdes, June 19, 1987 + 1. A possible type of data is Fnu calibrated data with values in the + range 1e-25. Attempting to determine an average, rms, and + signal-to-noise ratio with SPLOT caused a divide by zero error + due to underflowing the sum of squares. This has been modified + to shift and scale the data before computing the sum of squares. + +onedspec$t_standard.x + Valdes, June 12, 1987 + 1. There was an uninitialized memory problem with the space allocated + for adding points. This bug was introduced with the May 15th + modifications to the structure of the calibration files. + +onedspec$load_hdr.x +onedspec$idsm_keywrds.x +onedspec$t_calibrate.x + Valdes, June 9, 1987 + 1. Added EXPTIME as a recognized exposure time keyword. + 2. Added check against INDEF or 0 exposure time in CALIBRATE. + +onedspec$bplot.cl + Valdes, June 4, 1987 + 1. The BPLOT script is now back the way it was earlier because the + earlier bug with the CL and list files seems to have gone away + while the new script relies on writing to parameter files which + doesn't work in the background. + +onedspec$onedspec.cl +onedspec$onedspec.hd +onedspec$onedspec.men +onedspec$powercor.cl + +onedspec$powercor.par + +onedspec$getcalib.x +onedspec$doc/powercor.hlp + + Valdes, June 1, 1987 + 1. Added task POWERCOR from IIDS. + 2. Added an error check for a bad extinction file. + +onedspec$splot/deblend.x + Valdes, May 19, 1987 + 1. A bug that was introduced into deblending during the last set of + changes was fixed. + +onedspec$onedutil.par +onedspec$lcalib.par +onedspec$t_lcalib.x + Valdes, May 19, 1987 + 1. Make the default for the calibration parameters in LCALIB to + be package parameters of the same name in keeping with the way these + parameters are used in the other ONEDSPEC tasks. + 2. Added the calibration parameters to the ONEDUTIL package and + the default is to refer to the parameters of the package that loaded + it. This will be either ONEDSPEC or one of the IMRED packages. + 3. Modified LCALIB to not require the extinction file when reading + star calibration info. + +onedspec$mkpkg +onedspec$bswitch.par +onedspec$lcalib.par +onedspec$onedspec.par +onedspec$splot.par +onedspec$standard.par +onedspec$t_lcalib.x +onedspec$t_standard.x +onedspec$x_fluxcal.x +onedspec$x_onedutil.x +onedspec$getcalib.x +onedspec$getextn.x +onedspec$plotstd.x - +onedspec$splot/mkpkg +onedspec$splot/plotstd.x + +onedspec$doc/standard.hlp +onedspec$doc/lcalib.hlp +onedspec$doc/onedspec.hlp +onedspec$doc/splot.hlp +onedspec$doc/bswitch.hlp +noao$imred/echelle (par files) +noao$imred/iids (par files) +noao$imred/irs (par files) +noao$imred/specphot (par files) +noao$lib/onedstds (data files) + Valdes, May 15, 1987 + 1. The major change was to change the format of the calibration data + from the very constrained old format to a more flexible format. + This also involved adding a new parameter "extinction" and changing + "calib_file" to "caldir". + 2. The calibration data files were converted to the new format in a + number of subdirectories. + 3. The parameter files in the IMRED directories were also updated. + 4. Moved plotstd.x to splot directory. It is an splot routine and should + be with the other splot source. + 5. Moved LCALIB from the FLUXCAL executable to the ONEDUTIL executable. + +onedspec$splot/usercoord.x + Valdes, May 8, 1987 + 1. When setting a wavelength scale using the 'u' key on data lacking + any wavelength information (W0 and WPC == INDEF) there was a bug + causing a message of the form "cursor not moved". + +onedspec$splot/deblend.x +onedspec$splot/splot.x +onedspec$splot/eqwidthcp.x + Valdes, April 30, 1987 + 1. I missed a couple of places where READ_WRITE access was used + in SPLOT (see March 13, 1987). These have been removed. + 2. There was a bug in the 'k' and 'v' type equivalent width + procedures which produced wrong results unless the cursor was + very near the center. + 3. When applying deblending to a single line the starting position + is now the minimum or maximum point of the continuum subtracted + profile rather than the center of the continuum limits. + +onedspec$splot/deblend.x +onedspec$splot/splot.x +onedspec$splot/anssave.x +onedspec$splot/eqwidthcp.x +onedspec$splot/eqwidth.x +onedspec$doc/splot.hlp +noao$lib/scr/splot.key + Valdes, April 28, 1987 + 1. SPLOT now prints only one line of output on the graphics status line + when doing deblending or equivalent width measurments. The full + output is saved in the log file and also internally. These changes + were made to allow reasonable behavior in terminals which cannot + display text and graphics simultaneously (PC emulators, VT240's). + 2. To get the full output of previous measurements during the course of + the task execution a new command ":show" has been added. + 3. It was possible for deblending to yeild negative sigmas. This has been + fixed as well. + +onedspec$doc/names.hlp + Valdes, April 27, 1987 + 1. A bug note was added to the task help stating that the append option + is intended only for image sections. Appending any other string + produces names not acceptable to ONEDSPEC. + +onedspec$identify/identify.x +onedspec$identify/ididentify.x +onedspec$identify/idlinelist.x +onedspec$identify/idnewfeature.x + Valdes, April 15, 1987 + 1. Added bell if feature not found with 'm'. + 2. When automatically identifying lines, 'l' it now requires a new line + to be within the matching distance relative to the current fit and + if two centers are withing "minsep" then the closest match to the + user coordinate is selected. + 3. Default initial graph for fitting is residuals vs. wavelength. + +onedspec$t_standard.x + Davis, April 13, 1987 + 1. At Frank's suggestion I added a test in STANDARD to make sure that + the exposure time is never less than 1 second. + +onedspec$t_standard.x + Davis, April 10, 1987 + 1. In order to check for an INDEF valued exposure time STANDARD on VMS/IRAF + was testing a boolean compared to a fp 0.0. The test was always coming up + true if the exposure keyword was defined; and exposure time was being set + to 1. If no exposure keyword was present INDEFI was being used for the + exposure time. I changed the test to test for an integer INDEF and + every thing seemed ok. Lyra, IRAF and IRAFX were updated. + +onedspec$t_standard.x + Valdes, April 3, 1987 + 1. STANDARD was using INDEF if there was no exposure time in the + header rather than the intended 1.0 as described in the + documentation. It now uses 1 for the exposure time if there + is no exposure time in the header. + +onedspec$coincor.x + Valdes, March 23, 1987 + 1. In the power correction the value of the output when the input + was negative was undefined. Now it is the input value. + +onedspec$splot/getimage.x +onedspec$splot/wrspect.x +onedspec$splot/deblend.x +onedspec$splot/eqwidth.x +onedspec$splot/eqwidthcp.x + Valdes, March 13, 1987 + 1. SPLOT no longer opens the image READ_WRITE. This was unnecessary + and would prevent someone from examining data for which they don't + have write permission. + 2. Modified the deblend and eqivalent width options to deactivate the + workstation since they produce multiline output. + +onedspec$t_dispcor.x +onedspec$dispcor.par +onedspec$doc/dispcor.par + Valdes, March 5, 1987 + 1. It is now a fatal error if the dispersion solution (from IDENTIFY) + is nonmonotonic. + 2. The starting wavelength and wavelength intervals are now list + structured parameters to allow files containing the values to + be used. With no file the user is queried and a carriage + return or nonnumeric value will use the default value. + 3. The way wavelength information is printed out has been improved. + 4. A missing carriage return was added to the error message when + an image is not found. + 5. The order of the parameters, some default values, some of the + prompts, and their modes have been changed to be more consistent + with other tasks and more easily useable with command line arguments. + 6. The help page was modified to reflect these changes. + +onedspec$identify/ididentify.x +onedspec$identify/idreidentify.x +onedspec$identify/idfitdata.x +onedspec$identify/idcolon.x + Valdes, March 5, 1987 + 1. IDENTIFY now prints a warning about a nonmonotonic coordinate + solution. + 2. Changes were made to not print the current feature when error + messages are printed thus giving the user a change to read them. + 3. When attempting to change images to a nonexistant image + the immap was improperly error checked. This could result in + fatal errors (particularly on VMS). + +onedspec$dispcor.par + Valdes, February 27, 1987 + 1. Prompt was changed from + "File containing ..." to "Database containing ..." + +onedspec$userstd/nearpt.x +onedspec$oned.h + Valdes, February 25, 1987 + 1. Changed nearest point algorithm to use NDC coordinates. This required + adding the GIO pointer to the arguments. + 2. Change all procedures calling near_pt to include GIO pointer + argument. + 3. Changed maximum distance to 0.05 (NDC) + +onedspec$splot/splot.x + Valdes, February 25, 1987 + 1. When exiting from the 'f' function mode in SPLOT the function + status line is now erased. + +noao$onedspec + Valdes, February 19, 1987 + 1. Made required GIO modifications. The tasks affected are SPLOT, + STANDARD, FLATFIT, SENSFUNC, and IDENTIFY. Please report any + bugs. + +onedspec$coincor.x +onedspec$t_coincor.x +onedspec$t_flatdiv.x +onedspec$t_flatfit.x +onedspec$doc/coincor.hlp + Valdes, February 9, 1987 + 1. A number of interface errors were fixed. + 2. The coincidence correction procedure now takes an input and output + array. Previously it modified the given array. + 3. The basic IIDS correction is now checked for values which would + cause the log function to give an exception or instruction error. + 4. The major change in COINCOR is that if the output root image name + is null then the operation is done in place. When dealing with + ~1000 images this saves on disk space and directory manipulations. + 5. The help page for COINCOR was appropriately updated. + +onedspec$fortran/polft1.f +onedspec$getextn.x +onedspec$t_calibrate.x +onedspec$t_sensfunc.x + Valdes, February 5, 1987 + 1. The following errors reported by Skip Schaller (Steward Obs, AOS port) + were fixed. + polft1.f: Minus sign out of place in expression + getextn.x: Remove declaration for max(), min(), log10() + t_calibrate.x: Remove declaration for min() + t_sensfunc.x: Remove declaration for log10() + +onedspec$oned.h + Valdes, January 30, 1987 + 1. The maximum number of beams the package can handle has been + increased from 50 to 100. + +onedspec$t_combine.x +onedspec$combine.par +onedspec$doc/combine.hlp + Valdes, January 30, 1987 + 1. An new parameter called "combine" was added which specifies the type + of combining (either average or sum). The help documentation was + updated. + +onedspec$identify/idcolon.x +onedspec$identify/ididentify.x + Valdes, January 16, 1987 + 1. Colon command dictionary and switch rewritten to use macro definitions. + 2. ? help facility rewritten to use system paging facility instead of ad + hoc menu facility. + +onedspec$gcurval + Valdes, January 12, 1987 + 1. Changed "0 0 0 q" to "0 0 1 q" since this was detected as an error + in V2.5. This file is used by BPLOT. + +onedspec$batchred.cl +noao$imred/iids/batchred.cl +noao$imred/irs/batchred.cl + Valdes, December 29, 1986 + 1. This script creates the user script "process.cl". It was creating + it with an out-of-date syntax which no longer worked. Modified + BATCHRED to create a valid script. + +onedspec$lcalib.par + Valdes, December 18, 1986 + 1. The default for the calibration file in task LCALIB is now that + for the task STANDARD. + +onedspec$identify/idreidentify.x + Valdes, December 3, 1986 + 1. REIDENTIFY was not correctly tracking when there was no fit. + 75: FIT(j) = FIT(i) ==> FIT(j) = fit + +onedspec$t_flatfit.x +onedspec$t_flatdiv.x +onedspec$flatfit.par +onedspec$flatdiv.par +onedspec$doc/flatfit.hlp +onedspec$doc/flatdiv.hlp + Valdes, December 2, 1986 + 1. The tasks FLATFIT and FLATDIV may optionally apply coincidence + corrections. They were not updated to include the IIDS nonlinear + correction made earlier. They have now been updated. + +onedspec$t_bswitch.x +onedspec$t_flatfit.x +onedspec$t_sums.x + Valdes, December 1, 1986 + 1. The tasks BSWITCH, FLATFIT, and SUMS created new images with only + the standard ONEDSPEC header information and without any other + user parameters. These tasks worked this way because they may + sum many spectra for each beam and the connection between the + input image header and output image header was not obvious. They + have been modified to use the last input image for each beam as + the image header template for the output image of that beam. + When there is no summing then the output image header will be + a copy of the input image header with updated ONEDSPEC parameters. + +onedspec$identify/idlinelist.x + Valdes, November 25, 1986 + 1. It used to be that if there were no coordinate list then the + default user coordinate was the pixel coordinate. This changed + at some point. This has been fixed. + +onedspec$identify/identify.x + Valdes, November 21, 1986 + 1. The common variable labels is now initialized every time the + task runs. + +onedspec$load_hdr.x +onedspec$splot/splot.x +onedspec$splot/usercoord.x + Valdes, November 17, 1986 + 1. Since people insist on using W0 and WPC to define the wavelength + coordinates and are then confused because CRVAL1 and CDELT1 are + used I changed the default precedence. The ONEDSPEC package now + looks for W0 and WPC first and then resorts to the FITS coordinate + keywords. Also if the coordinate values are less the 0.001 + it assumes that the units are meters and converts to Angstroms. + This arises when a strict interpretation of the FITS coordinates + (units of meters) is used for optical spectral data. + 2. The key 'p' in SPLOT has been modified to query for the starting + and ending wavelength. The default values are those last defined. + Thus, this key may be used at any time to set the wavelength scale. + To return to wavelength scale after '$' the user simply types + carriage return to accept the defaults. + 3. The key 'u' in SPLOT has been modified to work in all cases. + Previously it only worked if the plot was in pixel coordinates. + If run in wavelength coordinates funny results would be obtained. + Now the user may mark two points even in wavelength coordinates. + +onedspec$coincor.x + Valdes, November 13, 1986 + 1. The power law correction is applied only to positive data. + Negative data is not changed. + +onedspec$splot/eqwidth.x +onedspec$splot/deblend.x +onedspec$splot/eqwidthcp.x + Valdes, November 3, 1986 + 1. Changed print format statements to keep columns from running together + for flux calibrated data. + +onedspec$splot/*.x +onedspec$splot/mkpkg +onedspec$splot/idsmtn.h - +onedspec$splot/oned.h - + Valdes, October 28, 1986 + 1. Changed include references to point to include files in the main + package directory ("idsmtn.h" -> "../idsmtn.h" and + "oned.h" -> "../oned.h"). + 2. Deleted the copies of the include file in this directory. + +onedspec$t_coincor.x +onedspec$coincor.x +onedspec$coincor.par +onedspec$doc/coincor.hlp +onedspec$oned.h +onedspec$onedspec.par +onedspec$onedspec.men + Valdes, October 21, 1986 + 1. Modified COINCOR to include a power law correction as part of the + IIDS correction. + 2. A new paramter was added to COINCOR and ONEDSPEC, called "power", + for the IIDS power law correction. + 3. The help page for COINCOR was revised. + +onedspec$splot/splot.x +onedspec$splot/getimage.x +onedspec$splot/wrspect.x + Valdes, October 20, 1986 + 1. Added ability to write modified spectrum to the current image in + SPLOT. + 2. There were several errors in the code which were fixed. These + included modifying an IMIO buffer and extra arguments. + +onedspec$splot/splot.x +onedspec$splot/eqwidth.x +onedspec$splot/eqwidthcp.x +onedspec$splot/deblend.x +onedspec$splot/saveans.x +onedspec$doc/splot.hlp + Valdes, October 15, 1986 + 1. The routines for the keys 'd', 'e', 'h', 'k', and 'v' now print + information in a same format. They all have a header line and + a line containing the values. There reason for this is that, + with the additional information now included, it requires two + lines for "quantity: value" format anyway. They also print the + information which is common to all methods in the same order. + 2. The deblending routine 'd' now includes the continuum, equivalent + width, and sigma of the Gaussian fits. It also plots the continuum + slope as is done with the 'e' key. + 3. The equivalent width routine 'e' now includes the continuum. + 4. The 'h', 'k', and 'v' routines now include flux and FWHM. + 5. The 'h', 'k', and 'v' routines now work on emission lines as well + as absorption lines. + 6. The 'h', 'k', and 'v' routines define the gaussian profile in the + same way as the deblend routine; i.e. exp (-0.5 * (dw/sigma)**2) + 7. Help revised. + +onedspec$splot/splot.x +onedspec$splot/autoexp.x + Valdes, October 14, 1986 + 1. The SPLOT windowing keys 'a', 'z', ',', and '.' were not compatible + with the GTOOLS windowing. AUTOEXP.X was rewritten to use the + GTOOLS structure while operating as before. + +onedspec$splot/splot.x +onedspec$splot/eqwidthcp.x +onedspec$splot/scrhelp.x +onedspec$splot/stshelp.x +onedspec$doc/splot.hlp + Valdes, October 8, 1986 + 1. There are two methods of measuring equivalent widths using a simple + Gaussian line model. The original method which requires a unit + continuum has been restored as the 'k' key. (See the revision + of September 18, 1986). + 2. The second method recently added which uses the y cursor to mark + the continuum and uses the half flux level for determining the + line width is available with the last available key; the 'v' key. + 3. The 'h' key for one sided measurements still requires a second key + but now in addition to defining which side of the line to use + it also defines which method to used. + 4. The help page has been updated to reflect the changes. + +onedspec$doc/rebin.hlp + Valdes, October 7, 1986 + 1. Typo in V2.3 documentation fixed: "set to know" -> "set to no". + +onedspec$t_shedit.x + +onedspec$shedit.par + +onedspec$shparams.par + +onedspec$doc/shedit.hlp + +onedspec$onedspec.cl +onedspec$onedspec.men +onedspec$onedspec.hd + Valdes, September 29, 1986 + 1. A onedspec header editor called SHEDIT has been added. It uses + EPARAM as the editor. + 2. A help page is available. + +onedspec$identify/reidentify.x + Valdes, September 25, 1986 + 1. REIDENTIFY was passing a constant 0. to ID_REIDENTIFY which expects + a double. Replaced 0. with "double (0.)" as the argument. + This caused a failure in the AOS IRAF. + +onedspec$splot/eqwidthcp.x +onedspec$splot/doc/splot.hlp + Valdes, September 18, 1986 + 1. The 'k' key used to determine equivalent widths by fitting a Gaussian + profile based only on the depth of the core, the line width at some + point, and the continuum had several problems. First, people failed + to realize that the continuum had to be 1. Second, the y cursor + position was used for measuring the width of the line. Third, if + the y cursor position was not within the line then square root and + logarithm exceptions occured. These problems have been fixed as + follows: + 1. The y cursor is now used to mark the continuum. This + has been made very clear in the documentation. + 2. This allows equivalent widths to be measured for any + absorption line even when the continuum is not 1! + 3. The level at which the width of the line is measured is + now the point half way between the continuum and the minimum + point in the line. Previously this point was set by the + y cursor position. + 4. If the y cursor position is below the line minimum or + the left and right edges of the line are not found at the half + flux point an informative error is printed and the equivalent + width is not evaluated. + 5. The search for the left and right edges was previously + limited to +- 9 pixels. This limit has been removed. The + search now extends to the limits of the spectrum if necessary. + 6. The information printed includes the gaussian parameters + as well as the equivalent width. + 7. The gaussian model is plotted over the spectrum in order + to judge the reasonableness of the equivalent width measurement. + +onedspec$splot.par +onedspec$doc/splot.hlp + Valdes, September 11, 1986 + 1. Added ? to boolean prompts. The prompt + Fix separation of lines: + was confusing a user who tried to give the value of the separation. + The new prompt is + Fix separation of lines?: + 2. This parameter was also not in the documentation! + +onedspec$t_dispcor.x + Valdes, September 11, 1986 + 1. DISPCOR requires reference spectra to exist as well as the identify + database entry. The error message was misleading. The error message + is now more specific. + +onedspec$splot/splot.x +onedspec$splot/anssave.x + Valdes, September 8, 1986 + 1. Modified SPLOT to append to the answer file each time an aswer is + written rather than opening the answer file at the beginning and + closing it at the end. This eliminates the annoying creation of + a file everytime SPLOT is used. + +onedspec$t_dispcor.x + Valdes, September 8, 1986 + 1. Procedure dcorrect was defined as a function but used as a subroutine. + This was found and corrected during the Alliant port. + +onedspec$identify/xtpage.x + +onedspec$identify/xtmenu.x + +onedspec$identify/ididentify.x + Valdes, September 5, 1986 + 1. Added paging and menu features to '?' help. + +onedspec$bplot.cl + Valdes, August 26, 1986 + 1. The BPLOT script has been rewritten. Rather than calling SPLOT + in a loop, once for each image, a cursor command file is created + containing cursor commands for all the images and then SPLOT is + called with a list of images. This fixes an undiagnosed bug and + is more efficient. + +onedspec$identify/ididentify.x +onedspec$identify/iddofit.x +onedspec$identify/idgdata.x +onedspec$identify/idfitdata.x + Valdes, August 22, 1986 + 1. ICFIT no longer inherits the window from IDENTIFY. Entering ICFIT + will do autoscaling. + 2. IDENTIFY now uses the image header coordinate information if there + is no database dispersion solution. The parameters used are + CRPIX, CRVAL, and CDELT. This allows IDENTIFY to be used with + linearized spectra in the ONEDSPEC related packages. + +onedspec$identify/identify.com +onedspec$identify/identify.x +onedspec$identify/idcenter.x +onedspec$identify/idcolon.x +onedspec$identify/idshow.x +onedspec$identify/reidentify.x +onedspec$identify/identify.par +onedspec$identify/reidentify.par + Valdes, August 18, 1986 + 1. IDENTIFY and REIDENTIFY modified to include a detection threshold + parameter for feature centering. + 2. The help pages were updated. + +==================================== +Version 2.3 Release, August 18, 1986 +==================================== + +onedspec$splot/wrspect.hlp: Valdes, August 14, 1986 + 1. The test for whether a new image will overwrite an existing image + used ACCESS which is for nonimage files only. This caused a problem + with recognizing the automatic image extensions. The modification + uses IMMAP and IFERR to check if the new image would overwrite an + existing image. + +onedspec$doc/setdisp.hlp: Valdes, August 8, 1986 + 1. The wording defining the meaning of "dispaxis" was changed because + of user confusion. + +onedspec$identify/idmark.x: Valdes, August 8, 1986 + 1. The optional labels have been adjusted to be half size and + to have a path of up. Note that on a vt640 the default text + quality uses hardware generation so this change will not be + visible unless you reset the text quality to high. + 2. The size of the ticks and the gaps have changed slightly. + +onedspec$t_dispcor.x: Davis, July 28, 1986 + 1. DISPCOR was failing with a bus error on class2. It turned out that + the get_feature1 routine was trying to get the flex_par parameter out + of the image header after the image had been closed. I moved the + imunmap call to the end of the routine. + +onedspec$t_dispcor.x: Valdes, July 7, 1986 + 1. DISPCOR was opening comparison images when collecting dispersion + solutions from the database and failing to close them. In one + particular large usage 509 images were opened before + an out of memory failure! + +onedspec$splot: Valdes, July 7, 1986 + 1. In SPLOT the 'w' key has been redefined to 'i' (create a new image). + Key 'w' now windows the graph. + 2. The help page and menus updated. + +onedspec$identify/: Valdes, July 7, 1986 + 1. Redefined the 'r' key to be 't' so that 'r' can be the standard + redraw key. + 2. Help page and '?' menu updated. + +onedspec$doc/standard.hlp, lcalib.hlp, sinterp.hlp: Valdes, July 7, 1986 + 1. Help pages updated to reflect name changes in the standard + calibration files. + +onedspec$identify/: Valdes, July 3, 1986 + 1. Modified package to use new ICFIT package. + 2. Changed coordinate list parameter to onedstds$henear.dat. + 3. Updated help page for IDENTIFY to refect new default coordlist. + +onedspec$identify/identify.x,reidentify.x,idgetim.x: Valdes, July 1, 1986 + 1. Replaced calls to imtgetim with idgetim. Idgetim calls + imtgetim to get next image name but it then removes any + image extension. This is necessary to prevent having two + different names by which an image may be identified in the + database. + +===================================== +STScI Pre-release and SUN 2.3 Release +===================================== + +ondespec$getnimage.x: Valdes, June 19, 1986 + 1. Changed BOOLS in common to INTS for safety's sake. + +onedspec$(t_sensfunc.x,fudge.x,userstd.x): Valdes, June 19, 1986 + 1. SENSFUNC was not correctly accumulating grey constant corrections + between different apertures. This was fixed by rewriting the + RLSQ procedures (moved into a file of their own, rlsq.x) and + making appropriate changes in the rest of the code. + 2. The grey constant was being computed incorrectly. + +onedspec$t_flatfit.x: Valdes, June 18, 1986 + 1. FLATFIT aborted when an error is made specifying a nonexistant + image. It now prints an error message and goes on to the + next spectrum. + +onedspec$t_coefs.x: Valdes, June 16, 1986 + 1. Task was calling the wrong database package. This produced + totally wrong code since one package returns a structure + pointer and the other returns FIO channel number. + This error was probably introduced in May. + +onedspec$t_standard.x: Valdes, June 12, 1986 + 1. Minor bug in STANDARD introduced when fixing problem with + wavelengths (May 19). Title was no longer being written to + the STD file. + +onedspec$t_dispcor.x: Valdes, June 12, 1986 + 1. DISPCOR had a fixed limit of 100 comparison spectra for all + apertures in the database. If this limit was exceeded memory + would be corrupted (i.e. no check for exceeding the end of the + array). This has been changed to use dynamic memory allocation + so that there is no limit on the number of comparison spectra. + +onedspec$identify/ididentify.x: Valdes, June 11, 1986 + 1. Windowing key 'w' added. + 2. Help page updated to reflect the 'w' and 'y' keys. + +onedspec$splot.x: Valdes, June 10, 1986 + 1. Now sets dispersion correction flag when the user defines + a wavelength scale and writes a new image. + +onedspec$identify/splot.x: Valdes, June 9, 1986 + 1. Added check on the validity of the imio pointer when attempting + to unmap the image. This occured with a next image failed to + access the specified image. + +onedspec$identify/ididentify.x: Valdes, June 9, 1986 + 1. Changed Memr to Memd in 'y' option. + +onedspec$identify/reidentify.x: Valdes, June 2, 1986 + 1. Changed from file template to image template. + +onedspec$t_sensfunc.x: Valdes, June 2, 1986 + 1. Added check for square root of zero which is a fatal error on VMS. + +onedspec$t_standard.x,t_sensfunc.x: Valdes, May 19, 1986 + 1. The output of STANDARD gave the wavelengths of the left edge of the + first pixel and the right edge of the last pixel instead of the + centers. This causes slight errors downstream in SENSFUNC. + This has been changed to give the actual W0 and WEND. + I tried to check that all wavelengths were being calculated and + used correctly. + 2. SENSFUNC was not correctly using the output of STANDARD. In some + cases it assumed the starting and ending wavelengths were at + the edges of the pixel and in other cases it assumed they were + at the centers of the pixels. The errors largely canceled out + except that the W0 in the header for the SENSITIVITY image was + wrong but WPC and the number of points was correct. Again, I tried + to check that everything is now consistent. + 3. SENSFUNC was extrapolating observations when forming the composite + sensitivity curve. This leads to significant errors when some + observations do not extend as far as others in wavelength. This + was noticed as a large increase in the RMS relative to the original + RMS based only on the observations. Now extrapolations are not + allowed and only observations covering a given range of wavelengths + are used in forming the composite curve. Note that interpolations + are still used if an observation does not contain a point at a + particular wavelength. + 4. The help page for SENSFUNC was modified to explain the difference + between the RMS of the input points and the RMS of the composite + points. + 5. INTRP.F had to be modified because it considered a wavelength + equal to the first wavelength in the table as an extrapolation. + +onedspec$bswitch.par: Valdes, May 19, 1986 + 1. The BSWITCH parameter "add_const" has been changed to use the value + from SENSFUNC of the same name. The help page was also modified + +onedspec$t_sensfunc.x: Valdes, May 16, 1986 + 1. SENSFUNC was not writing a complete header needed by LONGSLIT. + Now it goes through the standard ONEDSPEC header package to create + the senstivity images. + +onedspec$t_bswitch.x: Valdes, May 14, 1986 + 1. BSWITCH was not reinitializing properly when not using IDSMODE. + The effect was to give extraneous output. + 2. All occurances of "== INDEFI" where changed to use the "IS_INDEF" + macro. + +onedspec$t_rebin.x: Valdes, May 14, 1986 + 1. If the image has not been dispersion corrected then an error is + printed and the next image is processed. + +onedspec$bplot.cl: Valdes, May 13, 1986 + 1. BPLOT has been modified to call SPLOT separately for each input + image. This has the effect of repeating the cursor file for each + image. + +onedspec$t_coefs.x: Valdes, May 12, 1986 + 1. COEFS was not writing a correct IDENTIFY database entry. + +onedspec$t_rebin.x: Valdes, May 10, 1986 + 1. Rebinning into logarithmic intervals was not working. This has + been fixed. A number of logical changes were required. + 2. Rather than use an interative method for determining the coordinate + transformation the transformation can be determined explicitly since + both the input and output coordinates are linear. + 3. The logarithm flag was previously ignored if a primary spectrum was + used. This prevented making the input and primary spectrum + the same and then specifying either log or linear output. This + is a common way to use this task for converting to log intervals. + 4. The primary spectrum was not being unmapped. + +onedutil$bplot.cl: Valdes, May 9, 1986 + 1. BPLOT has been modified to use the new SPLOT. The script is now + a simple one line call to splot. + 2. The input is now a image list instead of a file containing + image names. Note that to use a file containing image names + the syntax is now "@file". + 3. The cursor input file is now a parameter of the task allowing + users to define their own set of commands. + 4. The graphics device parameter is now standardized with other + graphics tasks. + 5. A modified help page is available. + +onedspec$splot.x: Valdes, May 9, 1986 + 1. SPLOT now accepts a list of input spectra and processes them + sequentially. The parameter name has been changed from "image" + to "images". + 2. New SPLOT parameters XMIN, XMAX, YMIN, YMAX allow the user to + set the limits of the initial plot. These values may be modified + interactively with :/xwindow and :/ywindow. + 3. A modified help page is available. + +onedspec$identify/reidentify.x: Valdes, May 8, 1986 + 1. Set log output to be flushed with every line written instead of + being buffered. + +onedspec$sflip.x: Valdes, May 8, 1986 + 1. A new task has been added to the ONEDUTIL package call SFLIP. + It flips the dispersion direction of spectra while maintaining + the proper dispersion image header parameters. + 2. A help page has been added for the task SFLIP. + +onedspec$splot: Valdes, May 7, 1986 + 1. Changed interpretation of W0 in logarithmic binning to be the + logarithm of the wavelength of the first pixel. + +onedspec$t_dispcor.x, t_rebin.x, t_combine.x: Valdes, May 7, 1986 + 1. Changed meaning of w0 in logarithmic coordinates to be consistent + with usual linear formula. That is with a logarithmic wavelength + interval the zero point is the logarithm of the starting wavelength. + 2. Assumed increasing wavelengths in both the output spectra + and the input spectra. This restriction has been lifted. + 3. Default output bins are in increasing wavelength with increasing pixel + coordinate even when the input dispersion relation has the opposite + sense. + 4. The logic in REBIN for col_out = 0 was modified appropriately. + 5. The help page for DISPCOR has been modified to indicate the new + ability to have arbitrary input and output dispersion directions. + +onedspec$userstd: Valdes, May 6, 1986 + 1. Previously no graph of the errors would be made if the residuals + were all the same. + 2. Warning message was removed. + 3. Boxes now drawn in NDC with standard size and do not depend on the + range of the data or the size of the graph. + +onedspec$userstdc.x: Valdes, May 6, 1986 + 1. Code incorrectly limited highest order for fit to one less than the + number of points. The order is now limited to the number of points. + 2. Previously no graph of the errors would be made if the residuals + were all the same. + 3. Warning messages were removed. + 4. Boxes now drawn in NDC with standard size and do not depend on the + range of the data or the size of the graph. + +onedspec$identify/idlog.x: Valdes, May 1, 1986 + 1. Column headings were adjusted. + +onedspec$onedspec.cl: Valdes, May 1, 1986 + 1. Removed loading of list and plot packages in ONEDSPEC package script. + These packages are loaded with the NOAO package. + +onedspec: Valdes, April 27, 1986 + 1. Package pathname "noao.onedspec.onedutil" added to help pages for + ONEDUTIL package tasks. + +onedspec: Valdes, April 7, 1986 + 1. OBSERVATORY task from IMRED package loaded with ONEDSPEC. + 2. Latitude parameter removed from the ONEDSPEC package parameters. + 3. DISPCOR, STANDARD, and BSWITCH latitude parameters changed to + reference OBSERVATORY parameters. + 4. The help pages for these tasks were revised. + +onedspec$t_flatfit.x: Valdes, April 7, 1986 + 1. Fixed minor bug. + +onedspec$t_sinterp.x: Valdes, April 6, 1986 + 1. Fixed bug in SINTERP. It was using CURFIT with a pointer argument + for the weights instead of a real array. CURFIT is used only if + the interpolation mode is one of the CURFIT types. Obviously + this option was never tested. + 2. Entry points removed for portability. + 3. The interpolation wavelengths when generating a curve were strongly + subject to accumulated roundoff error; x = x + dx. This was modified + to use the construct, x = x1 + (i - 1) * dx, which may still have + a precision limitation but not an accumulated roundoff error. + +onedspec: Valdes, April 5, 1986 + 1. Found very bad error in numerous places. The arguments to CLGCUR + were too few and of those that were there one was of the wrong + datatype!!! This was not a problem on the VAXes but very + bad and hard to find on the SUN. + 2. Fixed SUN bugs in SENSFUNC due to the statement: + call amovks (1, Mems[flags], npts) + Apparently numeric constants are integer sized which causes problems + on the SUN which has high order bytes first. Watch out for this + construct! + +onedspec$getnimage: Valdes, April 4, 1986 + 1. The entry points in this procedure caused tasks to fail on the + SUN. USE OF ENTRY POINTS IS HAZARDOUS TO THE HEALTH OF PORTABLE + PROGRAMS. I shall have to see if there are any more entry points + in ONEDSPEC. + +onedspec$getairm: Valdes, April 4, 1986 + 1. Fixed minor bug in determining HA from ST and RA. ST was still + assumed to be in seconds which is not the case any more. + +onedspec: Valdes, March 28, 1986 + 1. ADDSETS would fail if an image was missing. I modified it + to detect missing files and continue on. + +onedspec: Valdes, March 27, 1986 + 1. The header parameters CRPIXn, CRVALn, CDELTn have been added to + the image headers. They replace W0 and WPC though W0 and WPC + are still recorded in the header (for now). + 2. A new task, SETDISP, has been added to set the dispersion axis + (must be 1 for ONEDSPEC), the dispersion type, and the dispersion + unit. These are currently only used for labeling in IDENTIFY + and thus the task is optional for the moment. + 3. SPLOT modified to label the wavelength axis using CTYPE1 and CUNIT1. + +onedspec$splot/deblend.x: Valdes, March 27, 1986 + 1. Moved deblend.x and eqwidthcp.x to splot directory. + 2. There was a typo(?) in deblend.x of SPLOT which converted + sigma to FWHM as FWHM = 2.345 * sigma. This has been corrected + to FWHM = 2.355 * sigma. + 3. The help page for SPLOT was updated. + +onedspec$identify: Valdes, March 26, 1986 + 1. Fixed bug in IDENTIFY which failed to add new lines with the 'l' + command when the initial wavelength axis was pixels. + +onedspec$identify: Valdes, March 24, 1986 + 1. Fixed minor bug in REIDENTIFY. It was calling IC_FREE instead + of IC_FREED (the new double precision version) while the rest + of the package was in double precision. + +onedspec: Valdes, March 21-22, 1986 + 1. Continued changes in the ONEDSPEC header parameters. All the + internal ONEDSPEC header parameters are initialized. Those not + in the image header are initialized to INDEF if no other default + makes sense. Then when a new image is created only the parameters + which are not INDEF are written to the new image header. Hopefully + there isn't a obscure use in the package that assumes the default + value of a parameter is zero (this was the previous default default). + A bug of this sort occurred in SPLOT which assumed that W0 and WPC + are zero if the image has not been dispersion corrected. This was + changed. + 2. SLIST now prints INDEF for the parameters which are indefinite. + 3. UT and ST are now stored internally as real values like all the other + time and angle parameters. Previously the were stored as integer + seconds. + 4. UT, ST, RA, DEC, and HA are written to new images as sexigesimal + strings instead of real values. This is contrary to the FITS standard + but this is the way its been done previously. + 5. Comments for parameters which are updated by ONEDSPEC are deleted + when a new image is created. This is because the database interface + does not allow comments and when entering a new value the comment + could be partially overwritten resulting in a nonsensical FITS cards. + Parameters which ONEDSPEC does not use are not touched. + +onedspec$fortran/intrp.f: Valdes, March 20, 1986 + 1. Converted entry points into separate procedures. Entry points, + while legal FORTRAN, tend to cause problems except in the very + best compilers. The change was sparked by the failure of the + SUN optimizer. It is not 100% certain that this caused the + failure but it works now. + +onedspec: Valdes, March 19, 1986 + 1. All double precision variables have been change to single + precision. The double precision is an anachronism. There were + numerous type mismatches with calling procedures using double + precision and the called procedure expecting single precision. + These problems were only found recently on the SUN workstation + which has a reversed order to the bytes. On the VAX this error + is not caught. + 2. The header parameters are accessed through the image database + interface rather than directly. This cleans things up alot and + will make the transition to a real database easier. + It does, however, mean that comments and sexigesimal notation are + no longer used. + 3. Most tasks creating an output image now make a copy of the relevant + input image header. This allows header parameters which are not + recognized by ONEDSPEC to be propagated to the new images. + +onedspec$t_combine.x: Valdes, March 19, 1986 + 1. Rebinning did not work after fix to DISPCOR (Feb 14) because macro codes + were wrong. + +onedspec$t_rebin.x: Valdes, March 19, 1986 + 1. Did not work after fix to DISPCOR (Feb 14) because macro codes + were wrong. + +onedspec$identify: Valdes, March 14, 1986 + 1. Modified IDENTIFY to store the line list internally instead of + scanning the line list file every time. + +onedspec: Valdes, March 14, 1986 + 1. Fixed a bug in LOAD_HDR.X which caused a roundoff error in the UT + and ST values. This was a problem when creating a new image since + it inherited slightly different values than the original image. + 2. A double precision airmass variable was being passed to GET_AIRM which + expected a single precisions variable. This bug became apparent + on the SUN workstation. Modified GET_AIRM to expect a double + precision airmass variable. + +onedspec: Valdes, March 13, 1986 + 1. Modified IDENTIFY and REIDENTIFY to be double precision. It uses + the double precision ICFIT and CURFIT procedures. + 2. The help pages for IDENTIFY and REIDENTIFY were updated for the + changes since Release 2.2 + 3. Fixed bug in SLIST which printed W0, WPC, and AIRMASS incorrectly + on the SUN workstation. Pargr was used instead of pargd. Also fixed + possible problem with assigning INDEFR to a double variable. + +onedspec: Valdes, March 11, 1986 + 1. SENSFUNC was not putting the dispersion correction flag, DC-FLAG, + in the header for the sensitivity image. This causes LONGSLIT.FLUXCAL + to fail. This has been fixed. + +onedspec: Valdes, March 6, 1986 + 1. Added parameter to SPLOT to allow selection of the graphics output + device. + 2. Help page for SPLOT modified. + 3. New parameter file for SPLOT. Also installed in IMRED packages. + +onedspec: Valdes, Feb 27, 1986 + 1. IDENTIFY and REIDENTIFY have been modified to do shifts in user + coordinates instead of pixel coordinates. This applies to the 's' + and 'x' keys in IDENTIFY and to REIDENTIFY. The shift specified in + REIDENTIFY is now in user coordinates. Unless otherwise specified + the shifts printed by these tasks are in user coordinates instead + of pixels. + 2. A new key has been added to IDENTIFY. The key 'r' resets the + current feature to the position of the cursor. This replaces the + need to mark the new position and then delete the old position. + 3. The output of 's' and 'x' in IDENTIFY is slightly different. +=========== +Release 2.2 +=========== +From Valdes Feb 28, 1986: + +1. Fixed bug in FLATDIV which printed the image title as garbage. Also +the output record number is increment for each input spectrum regardless +of whether the input spectrum is found, has already been flatted, or +is flattened. +------ +From Valdes Feb 24, 1986: + +1. Removed junk file identify/isdir.x. +------ +From Valdes Feb 14, 1986: + +1. t_sensfunc.x, userstd.x, and fudge.x have been modified to allow +the grey scale correction to be determined interactively even when +points are deleted. + +2. Fixed bug in DISPCOR to allow interpolation between solutions. This +did not work before. +------ +From Valdes Feb 10, 1986: + +1. FLATDIV has been modified to do in-place flattening when the input +and output spectra are the same. +------ +From Valdes Jan 24, 1986: + +1. In IDENTIFY the 'l' always does a fit first before identifying +additional lines. +------ +From Valdes Jan 21, 1986: + +1. HELP pages updated. + +2. The log information written by REIDENTIFY has been made more compact +and a option to futher reduce this log information "verbose" has been added. +------ +From Valdes Jan 17, 1986: + +1. Bugs fixed affecting SPLOT and DISPCOR. +------ +From Valdes Jan 6, 1986: + +1. Problem with cursor key 'o' in SENSFUNC fixed. + +2. The 's' shift option in IDENTIFY has been modified. It now prints +the initial shift, the mean pixel shift, and the mean fractional shift +in user units. This can be conveniently used for determining velocity +shifts from a standard. +------ +From Valdes Jan 2, 1986: + +1. If the HA field was missing from a field it was being initialized to +0. which is a valid HA value. This has been changed to initialize to -100. +This value will force recomputation of the HA when determining the air mass. + +2. A bug in computing the air mass when the HA is not defined was found +and fixed. +------ +From Valdes Dec 30, 1985: + +1. A bug in DISPCOR when using a reference image and the directory +structured database has been fixed. +------ +From Valdes Dec 9, 1985: + +1. NORMCONTINUUM has been renamed to CONTINUUM and modified to have the +output type as a hidden parameter. + +2. The standard line lists have been put in the directory stdlines$. +------ +From Valdes Nov 26, 1985: + +1. SPLOT modified to use gtools graphics options. These options are +accessed with :/ commands; i.e. ":/xwindow x1 x2" sets the x display +window. + +2. SPLOT parameter "auto" replaced by parameter "options" which allows +several plotting options to be given. The options are given as a list of +possibly abbreviated strings. The two options currently defined are +"auto" and "zero". Auto is the same as before; it replots the graph +after any command that changes the graph. Zero makes the initial +default for the graph have zero as the minimum Y. +------ +From Valdes Nov 15, 1985: + +1. Modified IDENTIFY, REIDENTIFY, and DISPCOR to use directory type database +structure. Instead of a single massive database textfile separate +database text files are created for each image in the database directory. +------ +From Valdes Oct 28, 1985: + +1. Increased the efficiency of widstape from 7 seconds per spectrum to +about 2 seconds per spectrum by using low level formating. +------ +From Valdes Oct 23, 1985: + +1. Bug fix to allow zero entries in the calibration files. +------ +From Valdes Oct 9, 1985: + +1. Cursor parameter added to the tasks flatfit, splot, and standard. + +2. Defined widstape from ONEDSPEC package in the DATAIO package. The +source and executable, however, still reside in ONEDSPEC (x_onedutil.e). +Widstape and widsout should be combined and the source put in DATAIO +at some point. +------ +From Valdes Oct 7, 1985: + +1. Parameter indirections removed. + +2. Tasks IRS and IIDS moved to the IMRED package. ONEDSPEC need not +be loaded directly. The usually method should be to load IMRED and then +the appropriate instrument package. +------ +From Valdes Oct 4, 1985: + +1. Add script task normcontinuum to fit the continuum of spectra and +output a continuum normalized spectrum. This script is based on +images.fit1d. +------ +From Valdes October 1, 1985: + +1. The source code for identify and reidentify has been moved from the +longslit package to the onedspec package since these tasks are essentially +one dimensional. + +------ +From Valdes August 19, 1985: + +1. Makelib file created to maintain archive for the onedspec package. +The archive is libods.a. Makefile modified to use the library. +This removes all the .o files making directory easier to list. + +2. An attempt to write to an existing image in splot requires the +user to confirm. Overwriting an existing image now maintains the pixel +files correctly. + +3. New script task revisions pages the package revision file. +.endhelp diff --git a/noao/onedspec/aidpars.par b/noao/onedspec/aidpars.par new file mode 100644 index 00000000..005414c0 --- /dev/null +++ b/noao/onedspec/aidpars.par @@ -0,0 +1,25 @@ +# Parameters for autoidentify task. + +reflist,s,h,"",,,Reference coordinate list +refspec,s,h,"",,,Reference spectrum +#crval,s,h,"INDEF",,,Coordinate reference value +#cdelt,s,h,"INDEF",,,Coordinate interval per pixel +crpix,s,h,"INDEF",,,Coordinate reference pixel +crquad,s,h,"INDEF",,,Quadratic pixel distortion at reference pixel +cddir,s,h,"sign","unknown|sign|increasing|decreasing",,Dispersion direction +crsearch,s,h,"INDEF",,,Coordinate value search radius +cdsearch,s,h,"INDEF",,,Coordinate interval search radius +ntarget,i,h,100,,,Number of target features +#nreference,i,h,40,,,Number of reference features +npattern,i,h,5,3,10,Number of lines in patterns +nneighbors,i,h,10,2,,Number of nearest neighbors in patterns +nbins,i,h,6,1,,Maximum number of search bins +ndmax,i,h,500,1,,Maximum number of dispersions to evaluate +aidord,i,h,3,2,,Dispersion fitting order +maxnl,r,h,0.02,0.,,Maximum non-linearity +nfound,i,h,6,3,,Minimum number of lines in final solution +sigma,r,h,.05,0.,,Sigma of line centering (pixels) +minratio,r,h,0.1,0., 1.,Minimum spacing ratio to use +rms,r,h,0.1,0.,,RMS goal (fwidths) +fmatch,r,h,0.2,0.,1.,Matching goal (fraction unmatched) +debug,s,h,"",,,Print debugging information diff --git a/noao/onedspec/autoidentify.par b/noao/onedspec/autoidentify.par new file mode 100644 index 00000000..4d6c4c27 --- /dev/null +++ b/noao/onedspec/autoidentify.par @@ -0,0 +1,38 @@ +# Parameters for AUTOIDENTIFY. + +images,s,a,,,,"Images containing features to be identified" +crval,s,a,,,,"Approximate coordinate (at reference pixel)" +cdelt,s,a,,,,"Approximate dispersion" +coordlist,f,h,,,,"Coordinate list" +units,s,h,"",,,Coordinate units +interactive,s,h,"yes","no|yes|NO|YES",,"Examine identifications interactively?" +aidpars,pset,h,,,,"Automatic identification algorithm parameters +" +section,s,h,"middle line",,,"Section to apply to two dimensional images" +nsum,s,h,"1",,,"Number of lines/columns/bands to sum in 2D/3D images +" +ftype,s,h,"emission","emission|absorption",,Feature type +fwidth,r,h,4.,,,Feature width in pixels +cradius,r,h,5.,,,Centering radius in pixels +threshold,r,h,0.,0.,,Feature threshold for centering +minsep,r,h,2.,0.,,"Minimum pixel separation" +match,r,h,-3.,,,"Coordinate list matching limit +" +function,s,h,"spline3","legendre|chebyshev|spline1|spline3",,"Coordinate function" +order,i,h,1,1,,"Order of coordinate function" +sample,s,h,"*",,,"Coordinate sample regions" +niterate,i,h,10,0,,"Rejection iterations" +low_reject,r,h,2.,0.,,"Lower rejection sigma" +high_reject,r,h,2.,0.,,"Upper rejection sigma" +grow,r,h,0.,0.,,"Rejection growing radius +" +dbwrite,s,h,"yes","no|yes|NO|YES",,"Write results to database?" +overwrite,b,h,"yes",,,"Overwrite existing database entries?" +database,f,h,database,,,"Database in which to record feature data" +verbose,b,h,yes,,,"Verbose output?" +logfile,s,h,"logfile",,,"List of log files" +plotfile,s,h,"",,,"Plot file for residuals" +graphics,s,h,"stdgraph",,,"Graphics output device" +cursor,*gcur,h,"",,,"Graphics cursor input +" +query,s,q,,,," " diff --git a/noao/onedspec/bplot.cl b/noao/onedspec/bplot.cl new file mode 100644 index 00000000..146fa2f5 --- /dev/null +++ b/noao/onedspec/bplot.cl @@ -0,0 +1,54 @@ +# BPLOT -- Batch plotting of spectra with SPLOT + +procedure bplot (images) + +string images {prompt="List of images to plot"} +string apertures = "" {prompt="List of apertures to plot"} +int band = 1 {prompt="Band to plot"} +string graphics = "stdgraph" {prompt="Graphics output device"} +string cursor = "onedspec$gcurval.dat" {prompt="Cursor file(s)\n\nSPLOT query parameters to fix"} + +string next_image = "" {prompt="Next image to plot"} +string new_image = "" {prompt="Image to create"} +bool overwrite = yes {prompt="Overwrite image?"} +string spec2 = "" {prompt="Spectrum"} +real constant = 0. {prompt="Constant to be applied"} +real wavelength = 0. {prompt="Dispersion coordinate"} +file linelist = "" {prompt="File"} +real wstart = 0. {prompt="Starting wavelength"} +real wend = 0. {prompt="Ending wavelength"} +real dw = 0. {prompt="Wavelength per pixel"} +int boxsize = 2 {prompt="Smoothing box size\n"} + +struct *ilist, *clist + +begin + int line, ap + file ifile, cfile, cur, image + + ifile = mktemp ("bplot") + cfile = mktemp ("bplot") + + slist (images, apertures=apertures, long_header=no, > ifile) + files (cursor, > cfile) + cur = "" + + ilist = ifile; clist = cfile + while (fscan (ilist, image, line, ap) != EOF) { + if (nscan() < 3) + next + if ((cursor != "") && (fscan (clist, cur) == EOF)) { + clist = cfile + line = fscan (clist, cur) + } + splot (image, line=ap, band=band, graphics=graphics, cursor=cur, + next_image=next_image, new_image=new_image, + overwrite=overwrite, spec2=spec2, constant=constant, + wavelength=wavelength, linelist=linelist, wstart=wstart, + wend=wend, dw=dw, boxsize=boxsize) + } + clist = ""; ilist = "" + + delete (ifile, verify=no) + delete (cfile, verify=no) +end diff --git a/noao/onedspec/calibrate.par b/noao/onedspec/calibrate.par new file mode 100644 index 00000000..5f805c46 --- /dev/null +++ b/noao/onedspec/calibrate.par @@ -0,0 +1,13 @@ +# CALIBRATE parameter file + +input,s,a,,,,Input spectra to calibrate +output,s,a,,,,Output calibrated spectra +extinct,b,h,yes,,,Apply extinction correction? +flux,b,h,yes,,,Apply flux calibration? +extinction,s,h,,,,Extinction file +observatory,s,h,)_.observatory,,,Observatory of observation +ignoreaps,b,h,no,,,Ignore aperture numbers in flux calibration? +sensitivity,s,h,"sens",,,Image root name for sensitivity spectra +fnu,b,h,no,,,Create spectra having units of FNU? +airmass,r,q,,1.,,Airmass +exptime,r,q,,,,Exposure time (seconds) diff --git a/noao/onedspec/continuum.par b/noao/onedspec/continuum.par new file mode 100644 index 00000000..6a43d804 --- /dev/null +++ b/noao/onedspec/continuum.par @@ -0,0 +1,25 @@ +input,s,a,,,,Input images +output,s,a,,,,Output images +lines,s,h,"*",,,Image lines to be fit +bands,s,h,"1",,,Image bands to be fit +type,s,h,"ratio","data|fit|difference|ratio",,Type of output +replace,b,h,no,,,Replace rejected points by fit? +wavescale,b,h,yes,,,Scale the X axis with wavelength? +logscale,b,h,no,,,Take the log (base 10) of both axes? +override,b,h,no,,,Override previously fit lines? +listonly,b,h,no,,,List fit but don't modify any images? +logfiles,s,h,"logfile",,,List of log files +interactive,b,h,yes,,,Set fitting parameters interactively? +sample,s,h,"*",,,Sample points to use in fit +naverage,i,h,1,,,Number of points in sample averaging +function,s,h,"spline3","spline3|legendre|chebyshev|spline1",,Fitting function +order,i,h,1,1,,Order of fitting function +low_reject,r,h,2.,0.,,Low rejection in sigma of fit +high_reject,r,h,0.,0.,,High rejection in sigma of fit +niterate,i,h,10,0,,Number of rejection iterations +grow,r,h,1.,0.,,Rejection growing radius +markrej,b,h,yes,,,Mark rejected points? +graphics,s,h,"stdgraph",,,Graphics output device +cursor,*gcur,h,"",,,Graphics cursor input +ask,s,q,"yes","yes|no|skip|YES|NO|SKIP",," " +mode,s,h,"ql" diff --git a/noao/onedspec/deredden.par b/noao/onedspec/deredden.par new file mode 100644 index 00000000..f787033a --- /dev/null +++ b/noao/onedspec/deredden.par @@ -0,0 +1,10 @@ +# DEREDDEN parameter file + +input,s,a,,,,Input spectra to correct +output,s,a,,,,Output corrected spectra +value,r,a,,,,Extinction parameter value +R,r,h,3.1,,,A(V)/E(B-V) +type,s,h,"E(B-V)","A(V)|E(B-V)|c",,Type of extinction parameter +apertures,s,h,"",,,Apertures to correct +override,b,h,no,,,Override previous correction? +uncorrect,b,h,yes,,,Uncorrect previous correction? diff --git a/noao/onedspec/dispcor.par b/noao/onedspec/dispcor.par new file mode 100644 index 00000000..0fd17027 --- /dev/null +++ b/noao/onedspec/dispcor.par @@ -0,0 +1,19 @@ +input,s,a,,,,List of input spectra +output,s,a,,,,List of output spectra +linearize,b,h,yes,,,Linearize (interpolate) spectra? +database,s,h,"database",,,Dispersion solution database +table,s,h,"",,,Wavelength table for apertures +w1,r,h,INDEF,,,Starting wavelength +w2,r,h,INDEF,,,Ending wavelength +dw,r,h,INDEF,,,Wavelength interval per pixel +nw,i,h,INDEF,,,Number of output pixels +log,b,h,no,,,Logarithmic wavelength scale? +flux,b,h,yes,,,Conserve total flux? +blank,r,h,0.,,,Output value of points not in input +samedisp,b,h,no,,,Same dispersion in all apertures? +global,b,h,no,,,Apply global defaults? +ignoreaps,b,h,no,,,Ignore apertures? +confirm,b,h,no,,,Confirm dispersion coordinates? +listonly,b,h,no,,,List the dispersion coordinates only? +verbose,b,h,yes,,,Print linear dispersion assignments? +logfile,s,h,"",,,Log file diff --git a/noao/onedspec/dispcor/dcio.x b/noao/onedspec/dispcor/dcio.x new file mode 100644 index 00000000..b700da6a --- /dev/null +++ b/noao/onedspec/dispcor/dcio.x @@ -0,0 +1,1155 @@ +include +include +include +include +include +include +include "dispcor.h" + +# Symbol table structure for the dispersion solutions. +define LEN_DC 11 # Length of dispersion solution struct. +define DC_FORMAT Memi[$1] # Type of dispersion +define DC_PAPS Memi[$1+1] # Pointer to aperture numbers +define DC_PAPCEN Memi[$1+2] # Pointer to aperture centers +define DC_PUN Memi[$1+3] # Pointer to units +define DC_PSHIFT Memi[$1+4] # Pointer to shifts +define DC_PCOEFF Memi[$1+5] # Pointer to coefficients +define DC_NAPS Memi[$1+6] # Number of apertures +define DC_OFFSET Memi[$1+7] # Aperture to order offset +define DC_SLOPE Memi[$1+8] # Aperture to order slope +define DC_COEFFS Memi[$1+9] # Dispersion coefficients +define DC_SHIFT Memr[P2R($1+10)]# Dispersion function shift + + +# DC_OPEN -- Initialize the dispersion data structures +# DC_CLOSE -- Close the dispersion data structures +# DC_GMS -- Get a multispec spectrum +# DC_GMSDB -- Get a multispec dispersion database entry +# DC_REFSHFT -- Get a reference shift +# DC_GEC -- Get an echelle spectrum +# DC_GECDB -- Get an echelle dispersion database entry +# DC_ECMS -- Convert echelle dispersion coeffs to multispec coeffs + + +# DC_OPEN -- Initialize the dispersion routines. This consists +# of opening a symbol table for the dispersion solution functions. A +# symbol table is used since the same dispersion reference (arc image) +# may be be used multiple times and the database access is slow. + +procedure dc_open (stp, db) + +pointer stp # Symbol table pointer +char db[SZ_FNAME] # Database name + +pointer sym, stopen(), stenter(), stpstr() + +begin + stp = stopen ("disp", 10, 10, 10*SZ_FNAME) + sym = stenter (stp, "database", 1) + Memi[sym] = stpstr (stp, db, 0) +end + + +# DC_CLOSE -- Close the dispersion data structures. + +procedure dc_close (stp) + +int i +pointer stp, sym, sthead, stnext + +begin + # Close each dispersion function and then the symbol table. + for (sym = sthead (stp); sym != NULL; sym = stnext (stp, sym)) { + if (DC_FORMAT(sym) == 1) { + do i = 1, DC_NAPS(sym) { + call un_close (Memi[DC_PUN(sym)+i-1]) + call mfree (Memi[DC_PCOEFF(sym)+i-1], TY_DOUBLE) + } + call mfree (DC_PAPS(sym), TY_INT) + call mfree (DC_PAPCEN(sym), TY_REAL) + call mfree (DC_PUN(sym), TY_POINTER) + call mfree (DC_PSHIFT(sym), TY_DOUBLE) + call mfree (DC_PCOEFF(sym), TY_POINTER) + } else if (DC_FORMAT(sym) == 2) { + call un_close (DC_PUN(sym)) + call mfree (DC_COEFFS(sym), TY_DOUBLE) + } + } + call stclose (stp) +end + + +# DC_GMS -- Get a multispec spectrum. This consists of mapping the image +# and setting a MWCS coordinate transformation. If not dispersion corrected +# the dispersion function is found in the database for the reference +# spectra and set in the SMW. + +procedure dc_gms (spec, im, smw, stp, ignoreaps, ap, fd1, fd2) + +char spec[ARB] #I Spectrum name +pointer im #I IMIO pointer +pointer smw #I SMW pointer +pointer stp #I Dispersion symbol table +int ignoreaps #I Ignore aperture numbers? +pointer ap #O Aperture data structure +int fd1 #I Logfile descriptor +int fd2 #I Logfile descriptor + +double wt1, wt2, dval +int i, j, k, k1, k2, l, dc, sfd, naps, naps1, naps2, ncoeffs +pointer sp, str1, str2, papcen, pshift, coeffs, ct1, ct2, un, un1, un2 +pointer paps1, paps2, punits1, punits2, pshift1, pshift2, pcoeff1, pcoeff2 + +bool un_compare() +double smw_c1trand() +int imaccf(), nscan(), stropen() +pointer smw_sctran(), un_open() +errchk dc_gmsdb, dc_refshft, imgstr, smw_sctran, un_open + +define done_ 90 + +begin + call smark (sp) + call salloc (str1, SZ_LINE, TY_CHAR) + call salloc (str2, SZ_LINE, TY_CHAR) + + # Set WCS attributes + naps = IM_LEN(im,2) + call calloc (ap, LEN_AP(naps), TY_STRUCT) + do i = 1, naps { + DC_PL(ap,i) = i + DC_CF(ap,i) = NULL + call smw_gwattrs (smw, DC_PL(ap,i), 1, DC_AP(ap,i), DC_BM(ap,i), + DC_DT(ap,i), DC_W1(ap,i), DC_DW(ap,i), DC_NW(ap,i), DC_Z(ap,i), + DC_LW(ap,i), DC_UP(ap,i), DC_CF(ap,i)) + if (i == 1) { + iferr (call mw_gwattrs (SMW_MW(smw,0), 1, "units", Memc[str1], + SZ_LINE)) + Memc[str1] = EOS + DC_UN(ap,i) = un_open (Memc[str1]) + } + dc = DC_DT(ap,i) + } + + # Check if the spectra have been dispersion corrected + # by an earlier version of DISPCOR. If so then don't allow + # another database dispersion correction. This assumes all + # spectra have the same dispersion type. Check for a + # reference spectrum. + + #if ((imaccf (im, "REFSPEC1") == NO) || + # (dc > -1 && imaccf (im, "DCLOG1") == NO)) { + if (imaccf (im, "REFSPEC1") == NO) { + if (fd1 != NULL) { + call fprintf (fd1, + "%s: Resampling using current coordinate system\n") + call pargstr (spec) + } + if (fd2 != NULL) { + call fprintf (fd2, + "%s: Resampling using current coordinate system\n") + call pargstr (spec) + } + goto done_ + } + + # Get the reference spectra dispersion function from the database + # and determine a reference shift. + + iferr { + call imgstr (im, "REFSPEC1", Memc[str1], SZ_LINE) + call sscan (Memc[str1]) + call gargwrd (Memc[str1], SZ_LINE) + call gargd (wt1) + if (nscan() == 1) + wt1 = 1. + } then { + call strcpy (spec, Memc[str1], SZ_FNAME) + wt1 = 1. + } + iferr (call dc_gmsdb (Memc[str1], stp, paps1, papcen, punits1, pshift, + pcoeff1, naps1)) { + call sfree (sp) + call erract (EA_ERROR) + } + call salloc (pshift1, naps1, TY_DOUBLE) + call amovd (Memd[pshift], Memd[pshift1], naps1) + if (fd1 != NULL) { + call fprintf (fd1, "%s: REFSPEC1 = '%s %.8g'\n") + call pargstr (spec) + call pargstr (Memc[str1]) + call pargd (wt1) + } + if (fd2 != NULL) { + call fprintf (fd2, "%s: REFSPEC1 = '%s %.8g'\n") + call pargstr (spec) + call pargstr (Memc[str1]) + call pargd (wt1) + } + + iferr (call dc_refshft (spec, stp, Memc[str1], "REFSHFT1", im, + Memi[paps1], Memr[papcen], Memd[pshift1], naps1, fd1, fd2)) + ; + + iferr { + call imgstr (im, "REFSPEC2", Memc[str1], SZ_LINE) + call sscan (Memc[str1]) + call gargwrd (Memc[str1], SZ_LINE) + call gargd (wt2) + if (nscan() == 1) + wt2 = 1. + call dc_gmsdb (Memc[str1], stp, paps2, papcen, punits2, pshift, + pcoeff2, naps2) + call salloc (pshift2, naps2, TY_DOUBLE) + call amovd (Memd[pshift], Memd[pshift2], naps2) + if (fd1 != NULL) { + call fprintf (fd1, "%s: REFSPEC2 = '%s %.8g'\n") + call pargstr (spec) + call pargstr (Memc[str1]) + call pargd (wt2) + } + if (fd2 != NULL) { + call fprintf (fd2, "%s: REFSPEC2 = '%s %.8g'\n") + call pargstr (spec) + call pargstr (Memc[str1]) + call pargd (wt2) + } + iferr (call dc_refshft (spec, stp, Memc[str1], + "REFSHFT2", im, Memi[paps2], Memr[papcen], Memd[pshift2], + naps2, fd1, fd2)) + ; + } then + wt2 = 0. + + # Adjust weights to unit sum. + dval = wt1 + wt2 + wt1 = wt1 / dval + wt2 = wt2 / dval + + # Enter dispersion function in the MWCS. + do i = 1, naps { + j = DC_AP(ap,i) + for (k1=0; k1 0.) + l = 2 * l + call realloc (DC_CF(ap,i), l, TY_CHAR) + call aclrc (Memc[DC_CF(ap,i)], l) + sfd = stropen (Memc[DC_CF(ap,i)], l, NEW_FILE) + call fprintf (sfd, "%.8g %g") + call pargd (wt1) + call pargd (Memd[pshift1+k1]) + dval = DC_DW(ap,i) * (DC_NW(ap,i) - 1) / 2. + call fprintf (sfd, " 1 2 1 %d %g %g") + call pargi (DC_NW(ap,i)) + call pargd (DC_W1(ap,i) + dval) + call pargd (dval) + } + } else { + ncoeffs = nint (Memd[coeffs]) + l = 20 * (ncoeffs + 2) + if (wt2 > 0.) + l = 2 * l + call realloc (DC_CF(ap,i), l, TY_CHAR) + call aclrc (Memc[DC_CF(ap,i)], l) + sfd = stropen (Memc[DC_CF(ap,i)], l, NEW_FILE) + call fprintf (sfd, "%.8g %g %d %d") + call pargd (wt1) + call pargd (Memd[pshift1+k1]) + call pargi (nint (Memd[coeffs+1])) + call pargi (nint (Memd[coeffs+2])) + do k = 3, ncoeffs { + call fprintf (sfd, " %.15g") + call pargd (Memd[coeffs+k]) + } + } + + if (wt2 > 0.) { + for (k2=0; k2 0) { + for (i = 1; i <= naps; i = i + 1) { + iferr (Memi[paps+i-1] = dtgeti (dt, i, "aperture")) + Memi[paps+i-1] = INDEFI + iferr (low = dtgetr (dt, i, "aplow")) + low = INDEF + iferr (high = dtgetr (dt, i, "aphigh")) + high = INDEF + if (IS_INDEF(low) || IS_INDEF(high)) + Memr[papcen+i-1] = 0. + else + Memr[papcen+i-1] = (low + high) / 2. + iferr (call dtgstr (dt, i, "units", Memc[str], SZ_LINE)) + call strcpy ("Angstroms", Memc[str], SZ_LINE) + Memi[punits+i-1] = un_open (Memc[str]) + iferr (Memd[pshift+i-1] = dtgetr (dt, i, "shift")) + Memd[pshift+i-1] = 0. + iferr { + n = dtgeti (dt, i, "coefficients") + call malloc (coeffs, 1+n, TY_DOUBLE) + Memd[coeffs] = n + call dtgad (dt, i, "coefficients", Memd[coeffs+1], n, n) + Memi[pcoeff+i-1] = coeffs + } then + Memi[pcoeff+i-1] = NULL + } + } else { + Memi[paps] = INDEFI + Memr[papcen] = INDEFR + Memi[punits] = un_open ("") + Memd[pshift] = 0. + call malloc (coeffs, 100, TY_DOUBLE) + n = 3 + call seek (Memi[dt], BOF) + while (getline (Memi[dt], Memc[str]) != EOF) { + i = 1 + if (ctod (Memc[str], i, dval) == 0) + next + if (mod (n, 100) == 0) + call realloc (coeffs, n+100, TY_DOUBLE) + Memd[coeffs+n] = dval + n = n + 1 + } + Memd[coeffs] = n - 1 + Memd[coeffs+1] = 5 + Memd[coeffs+2] = n - 3 + Memi[pcoeff] = coeffs + } + + call dtunmap (dt) + call sfree (sp) + + sym = stenter (stp, spec, LEN_DC) + DC_FORMAT(sym) = 1 + DC_PAPS(sym) = paps + DC_PAPCEN(sym) = papcen + DC_PUN(sym) = punits + DC_PSHIFT(sym) = pshift + DC_PCOEFF(sym) = pcoeff + DC_NAPS(sym) = naps + } else { + if (DC_FORMAT(sym) != 1) + call error (1, "Not a multispec dispersion function") + paps = DC_PAPS(sym) + papcen = DC_PAPCEN(sym) + punits = DC_PUN(sym) + pshift = DC_PSHIFT(sym) + pcoeff = DC_PCOEFF(sym) + naps = DC_NAPS(sym) + } +end + + +# DC_REFSHFT -- Compute dispersion shift. + +procedure dc_refshft (spec, stp, refspec, keywrd, im, aps, apcens, shifts, + naps, fd1, fd2) + +char spec[ARB] # Spectrum to be corrected +pointer stp # Symbol table pointer +char refspec[ARB] # Reference spectrum +char keywrd[ARB] # Header keyword (for log only) +pointer im # IMIO pointer to spectrum to be corrected +int aps[naps] # Reference apertures +real apcens[naps] # Reference aperture centers +double shifts[naps] # Reference aperture shifts (to be modified) +int naps # Number of refernce apertures +int fd1 # Logfile descriptor +int fd2 # Logfile descriptor + +int i, j, k, pnaps +double apcen, shift, sumx, sumy, sumxx, sumyy, sumxy, a, b +pointer sp, refshft, option, paps, papcen, punits, pshift, pcoeff +bool streq() +errchk imgstr, dc_gmsdb + +begin + call smark (sp) + call salloc (refshft, SZ_FNAME, TY_CHAR) + call salloc (option, SZ_FNAME, TY_CHAR) + + # Parse header parameter. + call imgstr (im, keywrd, Memc[refshft], SZ_FNAME) + call sscan (Memc[refshft]) + call gargwrd (Memc[refshft], SZ_FNAME) + if (streq (Memc[refshft], refspec)) { + call sfree (sp) + return + } + call gargwrd (Memc[option], SZ_FNAME) + + # Get reference shift apertures. + call dc_gmsdb (Memc[refshft], stp, paps, papcen, punits, pshift, + pcoeff, pnaps) + if (pnaps == 0) { + call sfree (sp) + return + } + + # Compute mean shift and RMS. + sumy = 0. + sumyy = 0. + do i = 1, pnaps { + sumy = sumy + Memd[pshift+i-1] + sumyy = sumyy + Memd[pshift+i-1] ** 2 + } + sumy = sumy / pnaps + sumyy = sqrt (max (0.D0, sumyy / pnaps - sumy ** 2)) + + # Print. + if (fd1 != NULL) { + call fprintf (fd1, "%s: %s = '%s %s', shift = %.6g, rms = %.6g\n") + call pargstr (spec) + call pargstr (keywrd) + call pargstr (Memc[refshft]) + call pargstr (Memc[option]) + call pargd (sumy) + call pargd (sumyy) + } + if (fd2 != NULL) { + call fprintf (fd2, "%s: %s = '%s %s', shift = %.6g, rms = %.6g\n") + call pargstr (spec) + call pargstr (keywrd) + call pargstr (Memc[refshft]) + call pargstr (Memc[option]) + call pargd (sumy) + call pargd (sumyy) + } + + if (streq (Memc[option], "interp")) { + if (pnaps > 1) { + sumx = 0. + sumy = 0. + sumxx = 0. + sumyy = 0. + sumxy = 0. + do i = 0, pnaps-1 { + apcen = Memr[papcen+i] + shift = Memd[pshift+i] + sumx = sumx + apcen + sumy = sumy + shift + sumxx = sumxx + apcen * apcen + sumyy = sumyy + shift * shift + sumxy = sumxy + apcen * shift + } + b = pnaps * sumxx - sumx * sumx + a = (sumy * sumxx - sumx * sumxy) / b + b = (pnaps * sumxy - sumx * sumy) / b + } else { + a = sumy + b = 0. + } + do i = 1, naps + shifts[i] = shifts[i] + a + b * apcens[i] + if (fd1 != NULL) { + call fprintf (fd1, "\tintercept = %.6g, slope = %.6g\n") + call pargd (a) + call pargd (b) + } + if (fd2 != NULL) { + call fprintf (fd2, "\tintercept = %.6g, slope = %.6g\n") + call pargd (a) + call pargd (b) + } + } else if (streq (Memc[option], "nearest")) { + do i = 1, naps { + k = 0 + sumy = abs (apcens[i] - Memr[papcen]) + for (j = 1; j < pnaps; j = j + 1) + if (abs (apcens[i] - Memr[papcen+j]) < sumy) { + k = j + sumy = abs (apcens[i] - Memr[papcen+k]) + } + shifts[i] = shifts[i] + Memd[pshift+k] + if (fd1 != NULL) { + call fprintf (fd1, "\t%4d %7.2f %4d %7.2f %.6g\n") + call pargi (aps[i]) + call pargr (apcens[i]) + call pargi (Memi[paps+k]) + call pargr (Memr[papcen+k]) + call pargd (Memd[pshift+k]) + } + if (fd2 != NULL) { + call fprintf (fd2, "\t%4d %7.2f %4d %7.2f %.6g\n") + call pargi (aps[i]) + call pargr (apcens[i]) + call pargi (Memi[paps+k]) + call pargr (Memr[papcen+k]) + call pargd (Memd[pshift+k]) + } + } + } else + call aaddkd (shifts, sumy, shifts, naps) + + call sfree (sp) +end + + +# DC_GEC -- Get an echelle spectrum. This consists of mapping the image +# and setting a MWCS coordinate transformation. If not dispersion corrected +# the dispersion function is found in the database for the reference +# spectra and set in the SMW. + +procedure dc_gec (spec, im, smw, stp, ap, fd1, fd2) + +char spec[ARB] #I Spectrum name +pointer im #I IMIO pointer +pointer smw #I SMW pointers +pointer stp #I Symbol table +pointer ap #O Aperture data structure +int fd1 #I Logfile descriptor +int fd2 #I Logfile descriptor + +double wt1, wt2, dval +int i, j, k, l, dc, sfd, naps, ncoeffs, offset, slope +pointer sp, str1, str2, coeff, coeffs, ct1, ct2, un1, un2, un3 +pointer pshift1, pshift2, pshift3, pcoeff1, pcoeff2, pcoeff3 + +bool un_compare() +double smw_c1trand() +int imaccf(), nscan(), stropen() +pointer smw_sctran(), un_open() +errchk dc_gecdb, imgstr, smw_sctran, un_open + +define done_ 90 + +begin + call smark (sp) + call salloc (str1, SZ_LINE, TY_CHAR) + call salloc (str2, SZ_LINE, TY_CHAR) + coeff = NULL + + # Set WCS attributes + naps = IM_LEN(im,2) + call calloc (ap, LEN_AP(naps), TY_STRUCT) + do i = 1, naps { + DC_PL(ap,i) = i + call smw_gwattrs (smw, DC_PL(ap,i), 1, DC_AP(ap,i), DC_BM(ap,i), + DC_DT(ap,i), DC_W1(ap,i), DC_DW(ap,i), DC_NW(ap,i), DC_Z(ap,i), + DC_LW(ap,i), DC_UP(ap,i), coeff) + if (i == 1) { + iferr (call mw_gwattrs (SMW_MW(smw,0), 1, "units", Memc[str1], + SZ_LINE)) + Memc[str1] = EOS + DC_UN(ap,i) = un_open (Memc[str1]) + } + dc = DC_DT(ap,i) + } + + # Check if the spectra have been dispersion corrected + # by an earlier version of DISPCOR. If so then don't allow + # another database dispersion correction. This assumes all + # spectra have the same dispersion type. Check for a + # reference spectrum. + + #if ((imaccf (im, "REFSPEC1") == NO) || + # (dc > -1 && imaccf (im, "DCLOG1") == NO)) { + if (imaccf (im, "REFSPEC1") == NO) { + if (fd1 != NULL) { + call fprintf (fd1, + "%s: Resampling using current coordinate system\n") + call pargstr (spec) + } + if (fd2 != NULL) { + call fprintf (fd2, + "%s: Resampling using current coordinate system\n") + call pargstr (spec) + } + goto done_ + } + + # Get the reference spectra dispersion function from the database + # and determine a reference shift. + + iferr { + call imgstr (im, "REFSPEC1", Memc[str1], SZ_LINE) + call sscan (Memc[str1]) + call gargwrd (Memc[str1], SZ_LINE) + call gargd (wt1) + if (nscan() == 1) + wt1 = 1. + } then { + call strcpy (spec, Memc[str1], SZ_LINE) + wt1 = 1. + } + call salloc (pshift1, naps, TY_DOUBLE) + call salloc (pcoeff1, naps, TY_POINTER) + slope = 0 + iferr (call dc_gecdb (Memc[str1], stp, ap, un1, Memd[pshift1], + Memi[pcoeff1], naps, offset, slope)) { + call sfree (sp) + call erract (EA_ERROR) + } + if (fd1 != NULL) { + call fprintf (fd1, "%s: REFSPEC1 = '%s %.8g'\n") + call pargstr (spec) + call pargstr (Memc[str1]) + call pargd (wt1) + } + if (fd2 != NULL) { + call fprintf (fd2, "%s: REFSPEC1 = '%s %.8g'\n") + call pargstr (spec) + call pargstr (Memc[str1]) + call pargd (wt1) + } + + iferr { + call imgstr (im, "refshft1", Memc[str1], SZ_LINE) + call salloc (pshift3, naps, TY_DOUBLE) + call salloc (pcoeff3, naps, TY_POINTER) + call dc_gecdb (Memc[str1], stp, ap, un3, Memd[pshift3], + Memi[pcoeff3], naps, offset, slope) + if (fd1 != NULL) { + call fprintf (fd1, "%s: REFSHFT1 = '%s', shift = %.6g\n") + call pargstr (spec) + call pargstr (Memc[str1]) + call pargd (Memd[pshift3]) + } + if (fd2 != NULL) { + call fprintf (fd2, "%s: REFSHFT1 = '%s', shift = %.6g\n") + call pargstr (spec) + call pargstr (Memc[str1]) + call pargd (Memd[pshift3]) + } + call aaddd (Memd[pshift1], Memd[pshift3], Memd[pshift1], naps) + } then + ; + + iferr { + call imgstr (im, "REFSPEC2", Memc[str1], SZ_LINE) + call sscan (Memc[str1]) + call gargwrd (Memc[str1], SZ_LINE) + call gargd (wt2) + if (nscan() == 1) + wt2 = 1. + call salloc (pshift2, naps, TY_DOUBLE) + call salloc (pcoeff2, naps, TY_POINTER) + call dc_gecdb (Memc[str1], stp, ap, un2, Memd[pshift2], + Memi[pcoeff2], naps, offset, slope) + if (fd1 != NULL) { + call fprintf (fd1, "%s: REFSPEC2 = '%s %.8g'\n") + call pargstr (spec) + call pargstr (Memc[str1]) + call pargd (wt2) + } + if (fd2 != NULL) { + call fprintf (fd2, "%s: REFSPEC2 = '%s %.8g'\n") + call pargstr (spec) + call pargstr (Memc[str1]) + call pargd (wt2) + } + + iferr { + call imgstr (im, "refshft2", Memc[str1], SZ_LINE) + call salloc (pshift3, naps, TY_DOUBLE) + call salloc (pcoeff3, naps, TY_POINTER) + call dc_gecdb (Memc[str1], stp, ap, un3, Memd[pshift3], + Memi[pcoeff3], naps, offset, slope) + if (fd1 != NULL) { + call fprintf (fd1, "%s: REFSHFT2 = '%s', shift = %.6g\n") + call pargstr (spec) + call pargstr (Memc[str1]) + call pargd (Memd[pshift3]) + } + if (fd2 != NULL) { + call fprintf (fd2, "%s: REFSHFT2 = '%s', shift = %.6g\n") + call pargstr (spec) + call pargstr (Memc[str1]) + call pargd (Memd[pshift3]) + } + call aaddd (Memd[pshift1], Memd[pshift3], Memd[pshift1], naps) + } then + ; + } then + wt2 = 0. + + # Adjust weights to unit sum. + dval = wt1 + wt2 + wt1 = wt1 / dval + wt2 = wt2 / dval + + # Enter dispersion function in the MWCS. + do i = 1, naps { + coeffs = Memi[pcoeff1+i-1] + ncoeffs = nint (Memd[coeffs]) + l = 20 * (ncoeffs + 2) + if (wt2 > 0.) + l = 2 * l + call realloc (coeff, l, TY_CHAR) + call aclrc (Memc[coeff], l) + sfd = stropen (Memc[coeff], l, NEW_FILE) + call fprintf (sfd, "%.8g %g") + call pargd (wt1) + call pargd (Memd[pshift1+i-1]) + + # The following assumes some knowledge of the data structure in + # order to shortten the the attribute string. + + call fprintf (sfd, " %d %d %.8g %.8g") + call pargi (nint (Memd[coeffs+1])) + call pargi (nint (Memd[coeffs+2])) + call pargd (Memd[coeffs+3]) + call pargd (Memd[coeffs+4]) + do j = 5, ncoeffs { + call fprintf (sfd, " %.15g") + call pargd (Memd[coeffs+j]) + } + + if (wt2 > 0.) { + coeffs = Memi[pcoeff2+i-1] + ncoeffs = nint (Memd[coeffs]) + call fprintf (sfd, "%.8g %g") + call pargd (wt2) + call pargd (Memd[pshift2+i-1]) + call fprintf (sfd, " %d %d %.8g %.8g") + call pargi (nint (Memd[coeffs+1])) + call pargi (nint (Memd[coeffs+2])) + call pargd (Memd[coeffs+3]) + call pargd (Memd[coeffs+4]) + do j = 5, ncoeffs { + call fprintf (sfd, " %.15g") + call pargd (Memd[coeffs+j]) + } + if (!un_compare (un1, un2)) { + call sfree (sp) + call error (2, + "Can't combine references with different units") + } + } + + if (i == 1) { + if (UN_LABEL(un1) != EOS) + call mw_swattrs (SMW_MW(smw,0), 1, "label", UN_LABEL(un1)) + if (UN_UNITS(un1) != EOS) + call mw_swattrs (SMW_MW(smw,0), 1, "units", UN_UNITS(un1)) + call un_close (DC_UN(ap,i)) + DC_UN(ap,i) = un1 + } + DC_DT(ap,i) = 2 + call smw_swattrs (smw, DC_PL(ap,i), 1, DC_AP(ap,i), DC_BM(ap,i), + DC_DT(ap,i), DC_W1(ap,i), DC_DW(ap,i), DC_NW(ap,i), DC_Z(ap,i), + DC_LW(ap,i), DC_UP(ap,i), Memc[coeff]) + call strclose (sfd) + } + + # Update the linear part of WCS. + ct1 = smw_sctran (smw, "logical", "physical", 2) + ct2 = smw_sctran (smw, "physical", "world", 3) + do i = 1, naps { + call smw_gwattrs (smw, DC_PL(ap,i), 1, DC_AP(ap,i), DC_BM(ap,i), + DC_DT(ap,i), DC_W1(ap,i), DC_DW(ap,i), DC_NW(ap,i), DC_Z(ap,i), + DC_LW(ap,i), DC_UP(ap,i), coeff) + wt1 = nint (smw_c1trand (ct1, double(i))) + call smw_c2trand (ct2, 1D0, wt1, DC_W1(ap,i), wt2) + call smw_c2trand (ct2, double(DC_NW(ap,i)), wt1, DC_W2(ap,i), wt2) + DC_DW(ap,i) = (DC_W2(ap,i) - DC_W1(ap,i)) / (DC_NW(ap,i) - 1) + call smw_swattrs (smw, DC_PL(ap,i), 1, DC_AP(ap,i), DC_BM(ap,i), + DC_DT(ap,i), DC_W1(ap,i), DC_DW(ap,i), DC_NW(ap,i), DC_Z(ap,i), + DC_LW(ap,i), DC_UP(ap,i), Memc[coeff]) + } + call smw_ctfree (ct1) + call smw_ctfree (ct2) + +done_ # Set aperture parameters in terms of logical image. + ct1 = smw_sctran (smw, "physical", "logical", 1) + j = nint (smw_c1trand (ct1, 1D0)) + do i = 1, naps { + k = nint (smw_c1trand (ct1, double(DC_NW(ap,i)))) + DC_NW(ap,i) = min (IM_LEN(im,1), max (j, k)) + } + call smw_ctfree (ct1) + + ct1 = smw_sctran (smw, "logical", "world", 3) + do i = 1, naps { + wt1 = i + call smw_c2trand (ct1, 1D0, wt1, DC_W1(ap,i), wt2) + call smw_c2trand (ct1, double(DC_NW(ap,i)), wt1, DC_W2(ap,i), wt2) + DC_DW(ap,i) = (DC_W2(ap,i) - DC_W1(ap,i)) / (DC_NW(ap,i) - 1) + } + call smw_ctfree (ct1) + + call mfree (coeff, TY_CHAR) + call sfree (sp) +end + + +# DC_GECDB -- Get a dispersion database entry. +# The database entry is read only once from the database and stored in a +# symbol table keyed by the spectrum name. Subsequent requests for the +# reference spectrum returns the data from the symbol table. + +procedure dc_gecdb (spec, stp, ap, un, shifts, pcoeff, naps, offset, slope) + +char spec[ARB] # Spectrum image name +pointer stp # Symbol table pointer +pointer ap # Aperture data structure +pointer un # Units +double shifts[naps] # Shifts +pointer pcoeff[naps] # Pointer to coefficients +int naps # Number of apertures +int offset # Aperture to order offset +int slope # Aperture to order slope + +double shift +real dtgetr() +int i, rec, offst, slpe, n, dtlocate(), dtgeti() +pointer sp, str, coeffs, sym, db, dt +pointer stfind(), stenter(), strefsbuf(), dtmap1(), un_open() +errchk dtmap1, dtlocate, dtgeti, dtgad, un_open + +begin + # Check if dispersion solution is in the symbol table from a previous + # call. If not in the symbol table get it from the database and + # store it in the symbol table. + + sym = stfind (stp, spec) + if (sym == NULL) { + call smark (sp) + call salloc (str, SZ_LINE, TY_CHAR) + call strcpy ("ec", Memc[str], SZ_LINE) + call imgcluster (spec, Memc[str+2], SZ_LINE-2) + call xt_imroot (Memc[str+2], Memc[str+2], SZ_LINE-2) + db = strefsbuf (stp, Memi[stfind (stp, "database")]) + dt = dtmap1 (Memc[db], Memc[str], READ_ONLY) + + call sprintf (Memc[str], SZ_LINE, "ecidentify %s") + call pargstr (spec) + iferr (rec = dtlocate (dt, Memc[str])) { + call sprintf (Memc[str], SZ_LINE, + "DISPCOR: Echelle dispersion function not found (%s/%s)") + call pargstr (DT_DNAME(dt)) + call pargstr (DT_FNAME(dt)) + call fatal (0, Memc[str]) + } + + iferr (call dtgstr (dt, rec, "units", Memc[str], SZ_LINE)) + call strcpy ("Angstroms", Memc[str], SZ_LINE) + un = un_open (Memc[str]) + iferr (offst = dtgeti (dt, rec, "offset")) + offst = 0 + iferr (slpe = dtgeti (dt, rec, "slope")) + slpe = 1 + iferr (shift = dtgetr (dt, rec, "shift")) + shift = 0. + n = dtgeti (dt, rec, "coefficients") + call malloc (coeffs, n, TY_DOUBLE) + call dtgad (dt, rec, "coefficients", Memd[coeffs], n, n) + + sym = stenter (stp, spec, LEN_DC) + DC_FORMAT(sym) = 2 + DC_PUN(sym) = un + DC_OFFSET(sym) = offst + DC_SLOPE(sym) = slpe + DC_SHIFT(sym) = shift + DC_COEFFS(sym) = coeffs + + call dtunmap (dt) + call sfree (sp) + } else { + if (DC_FORMAT(sym) != 2) + call error (1, "Not an echelle dispersion function") + un = DC_PUN(sym) + offst = DC_OFFSET(sym) + slpe = DC_SLOPE(sym) + coeffs = DC_COEFFS(sym) + shift = DC_SHIFT(sym) + } + + # Check aperture to order parameters. + if (slope == 0) { + offset = offst + slope = slpe + } else if (offset != offst || slope != slpe) { + call eprintf ( + "WARNING: Echelle order offsets/slopes are not the same.\n") + } + + # Convert to multispec coefficients + do i = 1, naps { + DC_BM(ap,i) = offset + slope * DC_AP(ap,i) + call dc_ecms (DC_BM(ap,i), Memd[coeffs], pcoeff[i]) + shifts[i] = shift / DC_BM(ap,i) + } +end + + +# DC_ECMS -- Convert echelle dispersion coefficients to multispec coefficients + +procedure dc_ecms (order, eccoeff, mscoeff) + +int order # Echelle order +double eccoeff[ARB] # Echelle dispersion coefficients +pointer mscoeff # Pointer to multispec coefficients + +int i, j, k, type, xorder, yorder +double xmin, xmax, ymin, ymax, ymaxmin, yrange, y, coeff, a, b, c + +begin + type = nint (eccoeff[1]) + xorder = nint (eccoeff[2]) + yorder = nint (eccoeff[3]) + xmin = eccoeff[5] + xmax = eccoeff[6] + ymin = eccoeff[7] + ymax = eccoeff[8] + + yrange = 2. / (ymax - ymin) + ymaxmin = (ymax + ymin) / 2 + y = (order - ymaxmin) * yrange + + call malloc (mscoeff, 5+xorder, TY_DOUBLE) + Memd[mscoeff] = 4+xorder + Memd[mscoeff+1] = type + Memd[mscoeff+2] = xorder + Memd[mscoeff+3] = xmin + Memd[mscoeff+4] = xmax + + switch (type) { + case 1: + do k = 1, xorder { + j = 9 + k - 1 + coeff = eccoeff[j] + if (yorder > 1) { + j = j + xorder + coeff = coeff + eccoeff[j] * y + } + if (yorder > 2) { + a = 1 + b = y + do i = 3, yorder { + c = 2 * y * b - a + j = j + xorder + coeff = coeff + eccoeff[j] * c + a = b + b = c + } + } + Memd[mscoeff+4+k] = coeff / order + } + case 2: + do k = 1, xorder { + j = 9 + k - 1 + coeff = eccoeff[j] + if (yorder > 1) { + j = j + xorder + coeff = coeff + eccoeff[j] * y + } + if (yorder > 2) { + a = 1 + b = y + do i = 3, yorder { + c = ((2 * i - 3) * y * b - (i - 2) * a) / (i - 1) + j = j + xorder + coeff = coeff + eccoeff[j] * c + a = b + b = c + } + } + Memd[mscoeff+4+k] = coeff / order + } + } +end diff --git a/noao/onedspec/dispcor/dctable.h b/noao/onedspec/dispcor/dctable.h new file mode 100644 index 00000000..4cf3657a --- /dev/null +++ b/noao/onedspec/dispcor/dctable.h @@ -0,0 +1,11 @@ +# Wavelength table structure +define TBL_LEN 14 +define TBL_W1 Memd[P2D($1)] # Starting wavelength +define TBL_W2 Memd[P2D($1+2)] # Ending wavelength +define TBL_DW Memd[P2D($1+4)] # Wavelength interval +define TBL_WMIN Memd[P2D($1+6)] # Minimum wavelength for global +define TBL_WMAX Memd[P2D($1+8)] # Maximum wavelength for global +define TBL_AP Memi[$1+10] # Aperture +define TBL_NW Memi[$1+11] # Number of points +define TBL_NWMAX Memi[$1+12] # Maximum number of points for global +define TBL_CONFIRM Memi[$1+13] # Confirm? diff --git a/noao/onedspec/dispcor/dctable.x b/noao/onedspec/dispcor/dctable.x new file mode 100644 index 00000000..93f27531 --- /dev/null +++ b/noao/onedspec/dispcor/dctable.x @@ -0,0 +1,145 @@ +include +include +include "dctable.h" +include + + +# DC_TABLE -- Set default wavelengths. +# This may be specified by the task parameters alone, from a reference image, +# or from a text table. A reference image or table allows separate +# wavelength parameters for each aperture. The text table columns are the +# aperture number, starting wavelength, ending wavelength, wavelength +# interval per pixel, and number of pixels. Any of these values may be +# INDEF. + +procedure dc_table (table, naps) + +pointer table # Table pointer (returned) +int naps # Number of apertures (returned) + +int i, j, ap, nw, fd, clgeti(), open(), fscan(), nscan(), btoi(), nowhite() +double ws, we, dw, clgetd() +pointer sp, fname, tbl, mw, sh, immap(), smw_openim() +bool clgetb() +errchk smw_openim(), shdr_open() + +begin + call smark (sp) + call salloc (fname, SZ_FNAME, TY_CHAR) + call clgstr ("table", Memc[fname], SZ_FNAME) + + # Set defaults. + naps = 0 + call malloc (table, 10, TY_INT) + call malloc (Memi[table], TBL_LEN, TY_STRUCT) + tbl= Memi[table] + TBL_W1(tbl) = clgetd ("w1") + TBL_W2(tbl) = clgetd ("w2") + TBL_DW(tbl) = clgetd ("dw") + TBL_NW(tbl) = clgeti ("nw") + TBL_WMIN(tbl) = MAX_REAL + TBL_WMAX(tbl) = -MAX_REAL + TBL_NWMAX(tbl) = 0 + TBL_CONFIRM(tbl) = btoi (clgetb ("confirm")) + + # Read a reference image or table if specified and add entries to + # the table array. + + if (nowhite (Memc[fname], Memc[fname], SZ_FNAME) > 0) { + ifnoerr (fd = immap (Memc[fname], READ_ONLY, 0)) { + mw = smw_openim (fd) + call shdr_open (fd, mw, 1, 1, INDEFI, SHHDR, sh) + if (DC(sh) == DCLINEAR || DC(sh) == DCLOG) { + do j = 1, IM_LEN(fd,2) { + call shdr_open (fd, mw, j, 1, INDEFI, SHHDR, sh) + call dc_getentry (false, AP(sh), table, naps, i) + tbl = Memi[table+i] + TBL_AP(tbl) = AP(sh) + TBL_NW(tbl) = SN(sh) + TBL_W1(tbl) = W0(sh) + TBL_W2(tbl) = W1(sh) + TBL_DW(tbl) = WP(sh) + } + } + call shdr_close (sh) + call smw_close (mw) + call imunmap (fd) + } else { + ifnoerr (fd = open (Memc[fname], READ_ONLY, TEXT_FILE)) { + while (fscan (fd) != EOF) { + call gargi (ap) + call gargd (ws) + call gargd (we) + call gargd (dw) + call gargi (nw) + if (nscan() < 5) + next + + call dc_getentry (false, ap, table, naps, i) + tbl = Memi[table+i] + TBL_AP(tbl) = ap + TBL_W1(tbl) = ws + TBL_W2(tbl) = we + TBL_DW(tbl) = dw + TBL_NW(tbl) = nw + } + call close (fd) + } else + call error (1, "Can't access wavelength table") + } + } + + # If ignoreaps=yes then replace INDEFs in the default entry with + # the first non-INDEF entry. + + if (clgetb ("ignoreaps") && naps > 0) { + tbl= Memi[table] + if (IS_INDEFD(TBL_W1(tbl))) + TBL_W1(tbl) = TBL_W1(Memi[table+1]) + if (IS_INDEFD(TBL_W2(tbl))) + TBL_W2(tbl) = TBL_W2(Memi[table+1]) + if (IS_INDEFD(TBL_DW(tbl))) + TBL_DW(tbl) = TBL_DW(Memi[table+1]) + if (IS_INDEFI(TBL_NW(tbl))) + TBL_NW(tbl) = TBL_NW(Memi[table+1]) + } + + call sfree (sp) +end + + +# DC_GETENTRY -- Get entry from wavelength table. Return the index. Allocate +# a new entry if needed. + +procedure dc_getentry (apflag, ap, table, naps, index) + +bool apflag # Ignore aperture numbers? +int ap # Aperture +pointer table # Wavelength table +int naps # Number of apertures +int index # Table index of entry + +pointer tbl + +begin + for (index=1; index<=naps; index=index+1) + if (apflag || TBL_AP(Memi[table+index]) == ap) + return + + naps = naps + 1 + if (mod (naps, 10) == 0) + call realloc (table, naps+10, TY_INT) + call malloc (Memi[table+naps], TBL_LEN, TY_STRUCT) + + index = naps + tbl = Memi[table+index] + TBL_AP(tbl) = ap + TBL_W1(tbl) = TBL_W1(Memi[table]) + TBL_W2(tbl) = TBL_W2(Memi[table]) + TBL_DW(tbl) = TBL_DW(Memi[table]) + TBL_NW(tbl) = TBL_NW(Memi[table]) + TBL_WMIN(tbl) = TBL_WMIN(Memi[table]) + TBL_WMAX(tbl) = TBL_WMAX(Memi[table]) + TBL_NWMAX(tbl) = TBL_NWMAX(Memi[table]) + TBL_CONFIRM(tbl) = TBL_CONFIRM(Memi[table]) +end diff --git a/noao/onedspec/dispcor/dispcor.h b/noao/onedspec/dispcor/dispcor.h new file mode 100644 index 00000000..51167973 --- /dev/null +++ b/noao/onedspec/dispcor/dispcor.h @@ -0,0 +1,16 @@ +# Aperture data structure + +define LEN_AP ($1*20) # Length of DC data structure +define DC_PL Memi[$1+($2-1)*20+1] # Physical line number +define DC_AP Memi[$1+($2-1)*20+2] # Aperture number +define DC_BM Memi[$1+($2-1)*20+3] # Beam number +define DC_DT Memi[$1+($2-1)*20+4] # Dispersion type +define DC_NW Memi[$1+($2-1)*20+5] # Number of pixels in spectrum +define DC_W1 Memd[P2D($1+($2-1)*20+6)] # Wavelength of first pixel +define DC_W2 Memd[P2D($1+($2-1)*20+8)] # Wavelength of last pixel +define DC_DW Memd[P2D($1+($2-1)*20+10)] # Wavelength interval per pixel +define DC_Z Memd[P2D($1+($2-1)*20+12)] # Redshift +define DC_LW Memr[P2R($1+($2-1)*20+14)] # Aperture lower limit (2) +define DC_UP Memr[P2R($1+($2-1)*20+16)] # Aperture upper limit (2) +define DC_CF Memi[$1+($2-1)*20+18] # Pointer to coefficients +define DC_UN Memi[$1+($2-1)*20+19] # Units diff --git a/noao/onedspec/dispcor/dispcor.x b/noao/onedspec/dispcor/dispcor.x new file mode 100644 index 00000000..7f2c32a8 --- /dev/null +++ b/noao/onedspec/dispcor/dispcor.x @@ -0,0 +1,233 @@ +include + +# DISPCOR -- Dispersion correct input spectrum to output spectrum. +# This procedure uses the MWCS forward and inverse transformations +# and interpolate the input data, conserving flux if desired. Image +# interpolation uses the image interpolation package and flux conservation +# integrates the interpolation function across the output pixel. This +# procedure does some CLIO to get the interpolation function and to +# query whether to conserve flux. + +procedure dispcor (cti, linei, cto, lineo, in, npts, out, nw, flux) + +pointer cti #I MWCS input inverse transformation +int linei #I Spectrum line +pointer cto #I MWCS output forward transformation +int lineo #I Spectrum line +real in[npts] #I Input spectrum +int npts #I Number of input pixels +real out[nw] #O Output spectrum +int nw #I Number of output pixels +bool flux #I Conserve flux + +char interp[10] +bool ofb_a, ofb_b +int i, j, ia, ib, clgwrd() +real a, b, sum, asieval(), asigrl() +double x, xmin, xmax, w, y1, y2, smw_c1trand() +pointer asi, temp + +begin + # Get the image buffers fit the interpolation function to the + # input spectrum. Extend the interpolation by one pixel at each end. + + call malloc (temp, npts+2, TY_REAL) + call amovr (in, Memr[temp+1], npts) + Memr[temp] = in[1] + Memr[temp+npts+1] = in[npts] + + call asiinit (asi, clgwrd ("interp", interp, 10, II_FUNCTIONS)) + call asifit (asi, Memr[temp], npts+2) + + call mfree (temp, TY_REAL) + + # Determine edges of output pixels in input spectrum and integrate + # using ASIGRL. If not flux conserving take the average. + + xmin = 0.5 + xmax = npts + 0.5 + + x = 0.5 + if (IS_INDEFI(lineo)) + w = smw_c1trand (cto, x) + else { + y1 = lineo + call smw_c2trand (cto, x, y1, w, y2) + } + if (IS_INDEFI(linei)) + x = smw_c1trand (cti, w) + else { + #y2 = linei + call smw_c2trand (cti, w, y2, x, y1) + } + ofb_b = (x < xmin || x > xmax) + b = max (xmin, min (xmax, x)) + 1 + do i = 1, nw { + ofb_a = ofb_b + a = b + x = i + 0.5 + if (IS_INDEFI(lineo)) + w = smw_c1trand (cto, x) + else { + y1 = lineo + call smw_c2trand (cto, x, y1, w, y2) + } + if (IS_INDEFI(linei)) + x = smw_c1trand (cti, w) + else { + #y2 = linei + call smw_c2trand (cti, w, y2, x, y1) + } + ofb_b = (x < xmin || x > xmax) + b = max (xmin, min (xmax, x)) + 1 + if (ofb_a && ofb_b) + out[i] = 0. + else if (a <= b) { + ia = nint (a + 0.5) + ib = nint (b - 0.5) + if (abs (a+0.5-ia) < 0.00001 && abs (b-0.5-ib) < 0.00001) { + sum = 0. + do j = ia, ib + sum = sum + asieval (asi, real(j)) + out[i] = sum + } else + out[i] = asigrl (asi, a, b) + if (!flux) + out[i] = out[i] / max (b - a, 1e-4) + } else { + ib = nint (b + 0.5) + ia = nint (a - 0.5) + if (abs (a-0.5-ia) < 0.00001 && abs (b+0.5-ib) < 0.00001) { + sum = 0. + do j = ib, ia + sum = sum + asieval (asi, real(j)) + out[i] = sum + } else + out[i] = asigrl (asi, b, a) + if (!flux) + out[i] = out[i] / max (a - b, 1e-4) + } + } + + call asifree (asi) +end + + +# DISPCORA -- Dispersion correct input spectrum to output spectrum. +# This procedure uses the MWCS forward and inverse transformations +# and interpolate the input data, conserving flux if desired. Image +# interpolation uses the image interpolation package and flux conservation +# integrates the interpolation function across the output pixel. This +# procedure does some CLIO to get the interpolation function and to +# query whether to conserve flux. +# +# This differs from DISPCOR by the "blank" argument. + +procedure dispcora (cti, linei, cto, lineo, in, npts, out, nw, flux, blank) + +pointer cti #I MWCS input inverse transformation +int linei #I Spectrum line +pointer cto #I MWCS output forward transformation +int lineo #I Spectrum line +real in[npts] #I Input spectrum +int npts #I Number of input pixels +real out[nw] #O Output spectrum +int nw #I Number of output pixels +bool flux #I Conserve flux +real blank #I Out of bounds value (INDEF to leave unchanged + +char interp[10] +bool ofb_a, ofb_b +int i, j, ia, ib, clgwrd() +real a, b, sum, asieval(), asigrl() +double x, xmin, xmax, w, y1, y2, smw_c1trand() +pointer asi, temp + +begin + # Get the image buffers fit the interpolation function to the + # input spectrum. Extend the interpolation by one pixel at each end. + + call malloc (temp, npts+2, TY_REAL) + call amovr (in, Memr[temp+1], npts) + Memr[temp] = in[1] + Memr[temp+npts+1] = in[npts] + + call asiinit (asi, clgwrd ("interp", interp, 10, II_FUNCTIONS)) + call asifit (asi, Memr[temp], npts+2) + + call mfree (temp, TY_REAL) + + # Determine edges of output pixels in input spectrum and integrate + # using ASIGRL. If not flux conserving take the average. + + xmin = 0.5 + xmax = npts + 0.5 + + x = 0.5 + if (IS_INDEFI(lineo)) + w = smw_c1trand (cto, x) + else { + y1 = lineo + call smw_c2trand (cto, x, y1, w, y2) + } + if (IS_INDEFI(linei)) + x = smw_c1trand (cti, w) + else { + #y2 = linei + call smw_c2trand (cti, w, y2, x, y1) + } + ofb_b = (x < xmin || x > xmax) + b = max (xmin, min (xmax, x)) + 1 + do i = 1, nw { + ofb_a = ofb_b + a = b + x = i + 0.5 + if (IS_INDEFI(lineo)) + w = smw_c1trand (cto, x) + else { + y1 = lineo + call smw_c2trand (cto, x, y1, w, y2) + } + if (IS_INDEFI(linei)) + x = smw_c1trand (cti, w) + else { + #y2 = linei + call smw_c2trand (cti, w, y2, x, y1) + } + ofb_b = (x < xmin || x > xmax) + b = max (xmin, min (xmax, x)) + 1 + if (ofb_a && ofb_b) { + if (!IS_INDEFR(blank)) + out[i] = blank + } else if (a == b) { + if (!IS_INDEFR(blank)) + out[i] = blank + } else if (a < b) { + ia = nint (a + 0.5) + ib = nint (b - 0.5) + if (abs (a+0.5-ia) < 0.00001 && abs (b-0.5-ib) < 0.00001) { + sum = 0. + do j = ia, ib + sum = sum + asieval (asi, real(j)) + out[i] = sum + } else + out[i] = asigrl (asi, a, b) + if (!flux) + out[i] = out[i] / max (b - a, 1e-4) + } else { + ib = nint (b + 0.5) + ia = nint (a - 0.5) + if (abs (a-0.5-ia) < 0.00001 && abs (b+0.5-ib) < 0.00001) { + sum = 0. + do j = ib, ia + sum = sum + asieval (asi, real(j)) + out[i] = sum + } else + out[i] = asigrl (asi, b, a) + if (!flux) + out[i] = out[i] / max (a - b, 1e-4) + } + } + + call asifree (asi) +end diff --git a/noao/onedspec/dispcor/mkpkg b/noao/onedspec/dispcor/mkpkg new file mode 100644 index 00000000..e609106e --- /dev/null +++ b/noao/onedspec/dispcor/mkpkg @@ -0,0 +1,28 @@ +# DISPCOR Task + +$checkout libpkg.a .. +$update libpkg.a +$checkin libpkg.a .. +$exit + +libpkg.a: + dcio.x dispcor.h \ + + dctable.x dctable.h + dispcor.x + ranges.x + refaverage.x refspectra.h + reffollow.x refspectra.h + refgspec.x refspectra.com refspectra.h + refinterp.x refspectra.h + refmatch.x refspectra.h + refmsgs.x refspectra.com refspectra.h + refnearest.x refspectra.h + refnoextn.x + refprecede.x refspectra.h + refspectra.x refspectra.com refspectra.h + reftable.x refspectra.h + t_dispcor.x dctable.h dispcor.h \ + + t_disptrans.x + ; diff --git a/noao/onedspec/dispcor/ranges.x b/noao/onedspec/dispcor/ranges.x new file mode 100644 index 00000000..403b81f7 --- /dev/null +++ b/noao/onedspec/dispcor/ranges.x @@ -0,0 +1,239 @@ +include +include + +define FIRST 0 # Default starting range +define LAST MAX_INT # Default ending range +define STEP 1 # Default step +define EOLIST -1 # End of list + +# DECODE_RANGES -- Parse a string containing a list of integer numbers or +# ranges, delimited by either spaces or commas. Return as output a list +# of ranges defining a list of numbers, and the count of list numbers. +# Range limits must be positive nonnegative integers. ERR is returned as +# the function value if a conversion error occurs. The list of ranges is +# delimited by EOLIST. + +int procedure decode_ranges (range_string, ranges, max_ranges, nvalues) + +char range_string[ARB] # Range string to be decoded +int ranges[3, max_ranges] # Range array +int max_ranges # Maximum number of ranges +int nvalues # The number of values in the ranges + +int ip, nrange, first, last, step, ctoi() + +begin + ip = 1 + nvalues = 0 + + do nrange = 1, max_ranges - 1 { + # Defaults to all nonnegative integers + first = FIRST + last = LAST + step = STEP + + # Skip delimiters + while (IS_WHITE(range_string[ip]) || range_string[ip] == ',') + ip = ip + 1 + + # Get first limit. + # Must be a number, '-', 'x', or EOS. If not return ERR. + if (range_string[ip] == EOS) { # end of list + if (nrange == 1) { + # Null string defaults + ranges[1, 1] = first + ranges[2, 1] = last + ranges[3, 1] = step + ranges[1, 2] = EOLIST + nvalues = MAX_INT + return (OK) + } else { + ranges[1, nrange] = EOLIST + return (OK) + } + } else if (range_string[ip] == '-') + ; + else if (range_string[ip] == 'x') + ; + else if (IS_DIGIT(range_string[ip])) { # ,n.. + if (ctoi (range_string, ip, first) == 0) + return (ERR) + } else + return (ERR) + + # Skip delimiters + while (IS_WHITE(range_string[ip]) || range_string[ip] == ',') + ip = ip + 1 + + # Get last limit + # Must be '-', or 'x' otherwise last = first. + if (range_string[ip] == 'x') + ; + else if (range_string[ip] == '-') { + ip = ip + 1 + while (IS_WHITE(range_string[ip]) || range_string[ip] == ',') + ip = ip + 1 + if (range_string[ip] == EOS) + ; + else if (IS_DIGIT(range_string[ip])) { + if (ctoi (range_string, ip, last) == 0) + return (ERR) + } else if (range_string[ip] == 'x') + ; + else + return (ERR) + } else + last = first + + # Skip delimiters + while (IS_WHITE(range_string[ip]) || range_string[ip] == ',') + ip = ip + 1 + + # Get step. + # Must be 'x' or assume default step. + if (range_string[ip] == 'x') { + ip = ip + 1 + while (IS_WHITE(range_string[ip]) || range_string[ip] == ',') + ip = ip + 1 + if (range_string[ip] == EOS) + ; + else if (IS_DIGIT(range_string[ip])) { + if (ctoi (range_string, ip, step) == 0) + ; + } else if (range_string[ip] == '-') + ; + else + return (ERR) + } + + # Output the range triple. + ranges[1, nrange] = first + ranges[2, nrange] = last + ranges[3, nrange] = step + nvalues = nvalues + abs (last-first) / step + 1 + } + + return (ERR) # ran out of space +end + + +# GET_NEXT_NUMBER -- Given a list of ranges and the current file number, +# find and return the next file number. Selection is done in such a way +# that list numbers are always returned in monotonically increasing order, +# regardless of the order in which the ranges are given. Duplicate entries +# are ignored. EOF is returned at the end of the list. + +int procedure get_next_number (ranges, number) + +int ranges[ARB] # Range array +int number # Both input and output parameter + +int ip, first, last, step, next_number, remainder + +begin + # If number+1 is anywhere in the list, that is the next number, + # otherwise the next number is the smallest number in the list which + # is greater than number+1. + + number = number + 1 + next_number = MAX_INT + + for (ip=1; ranges[ip] != EOLIST; ip=ip+3) { + first = min (ranges[ip], ranges[ip+1]) + last = max (ranges[ip], ranges[ip+1]) + step = ranges[ip+2] + if (number >= first && number <= last) { + remainder = mod (number - first, step) + if (remainder == 0) + return (number) + if (number - remainder + step <= last) + next_number = number - remainder + step + } else if (first > number) + next_number = min (next_number, first) + } + + if (next_number == MAX_INT) + return (EOF) + else { + number = next_number + return (number) + } +end + + +# GET_PREVIOUS_NUMBER -- Given a list of ranges and the current file number, +# find and return the previous file number. Selection is done in such a way +# that list numbers are always returned in monotonically decreasing order, +# regardless of the order in which the ranges are given. Duplicate entries +# are ignored. EOF is returned at the end of the list. + +int procedure get_previous_number (ranges, number) + +int ranges[ARB] # Range array +int number # Both input and output parameter + +int ip, first, last, step, next_number, remainder + +begin + # If number-1 is anywhere in the list, that is the previous number, + # otherwise the previous number is the largest number in the list which + # is less than number-1. + + number = number - 1 + next_number = 0 + + for (ip=1; ranges[ip] != EOLIST; ip=ip+3) { + first = min (ranges[ip], ranges[ip+1]) + last = max (ranges[ip], ranges[ip+1]) + step = ranges[ip+2] + if (number >= first && number <= last) { + remainder = mod (number - first, step) + if (remainder == 0) + return (number) + if (number - remainder >= first) + next_number = number - remainder + } else if (last < number) { + remainder = mod (last - first, step) + if (remainder == 0) + next_number = max (next_number, last) + else if (last - remainder >= first) + next_number = max (next_number, last - remainder) + } + } + + if (next_number == 0) + return (EOF) + else { + number = next_number + return (number) + } +end + + +# IS_IN_RANGE -- Test number to see if it is in range. +# If the number is INDEFI then it is mapped to the maximum integer. + +bool procedure is_in_range (ranges, number) + +int ranges[ARB] # Range array +int number # Number to be tested against ranges + +int ip, first, last, step, num + +begin + if (IS_INDEFI (number)) + num = MAX_INT + else + num = number + + for (ip=1; ranges[ip] != EOLIST; ip=ip+3) { + first = min (ranges[ip], ranges[ip+1]) + last = max (ranges[ip], ranges[ip+1]) + step = ranges[ip+2] + if (num >= first && num <= last) + if (mod (num - first, step) == 0) + return (true) + } + + return (false) +end diff --git a/noao/onedspec/dispcor/refaverage.x b/noao/onedspec/dispcor/refaverage.x new file mode 100644 index 00000000..e25866c4 --- /dev/null +++ b/noao/onedspec/dispcor/refaverage.x @@ -0,0 +1,84 @@ +include "refspectra.h" + +# REFAVERAGE -- Assign reference spectrum by averageing reference list. +# In earlier version the reference apertures were always set to all + +procedure refaverage (input, refs) + +pointer input # List of input spectra +pointer refs # List of reference spectra + +int ap +double sortval +real wt1, wt2 +pointer sp, image, ref1, ref2, gval + +bool refgref(), refginput() +int imtgetim(), imtlen() + +begin + call smark (sp) + call salloc (image, SZ_FNAME, TY_CHAR) + call salloc (ref1, SZ_FNAME, TY_CHAR) + call salloc (ref2, SZ_FNAME, TY_CHAR) + + # Get reference spectra to average. + switch (imtlen (refs)) { + case 0: + call error (0, "No reference spectra specified") + case 1: + ap = imtgetim (refs, Memc[ref1], SZ_FNAME) + call refnoextn (Memc[ref1]) + if (!refgref (Memc[ref1], ap, sortval, gval)) { + call sfree (sp) + return + } + wt1 = 1. + wt2 = 0. + case 2: + ap = imtgetim (refs, Memc[ref1], SZ_FNAME) + ap = imtgetim (refs, Memc[ref2], SZ_FNAME) + call refnoextn (Memc[ref1]) + call refnoextn (Memc[ref2]) + if (!refgref (Memc[ref1], ap, sortval, gval)) { + call sfree (sp) + return + } + if (!refgref (Memc[ref2], ap, sortval, gval)) { + call sfree (sp) + return + } + wt1 = 0.5 + wt2 = 0.5 + default: + ap = imtgetim (refs, Memc[ref1], SZ_FNAME) + ap = imtgetim (refs, Memc[ref2], SZ_FNAME) + call refnoextn (Memc[ref1]) + call refnoextn (Memc[ref2]) + if (!refgref (Memc[ref1], ap, sortval, gval)) { + call sfree (sp) + return + } + if (!refgref (Memc[ref2], ap, sortval, gval)) { + call sfree (sp) + return + } + wt1 = 0.5 + wt2 = 0.5 + call eprintf ("WARNING: Averaging only first two reference spectra") + } + + # Assign reference spectra to each input spectrum. + # Skip spectra which are not of the appropriate aperture + # or have been assigned previously (unless overriding). + + while (imtgetim (input, Memc[image], SZ_FNAME) != EOF) { + call refnoextn (Memc[image]) + if (!refginput (Memc[image], ap, sortval, gval)) + next + + call refspectra (Memc[image], Memc[ref1], wt1, Memc[ref2], wt2) + } + + call sfree (sp) +end diff --git a/noao/onedspec/dispcor/reffollow.x b/noao/onedspec/dispcor/reffollow.x new file mode 100644 index 00000000..a320c504 --- /dev/null +++ b/noao/onedspec/dispcor/reffollow.x @@ -0,0 +1,114 @@ +include +include "refspectra.h" + + +# REFFOLLOW -- Assign following reference spectrum based on sort key. +# If there is no following spectrum assign the nearest preceding spectrum. + +procedure reffollow (input, refs) + +pointer input # List of input spectra +pointer refs # List of reference spectra + +bool ignoreaps # Ignore apertures? + +int i, i1, i2, nrefs, ap +double sortval, d, d1, d2 +pointer sp, image, gval, refimages, refaps, refvals, refgvals + +bool clgetb(), streq(), refginput(), refgref() +int imtgetim(), imtlen() + +begin + call smark (sp) + call salloc (image, SZ_FNAME, TY_CHAR) + + # Task parameters + ignoreaps = clgetb ("ignoreaps") + + # Tabulate reference spectra. This expands the reference list, + # checks the spectrum is a reference spectrum of the appropriate + # aperture. + + call salloc (refimages, imtlen (refs), TY_INT) + call salloc (refaps, imtlen (refs), TY_INT) + call salloc (refvals, imtlen (refs), TY_DOUBLE) + call salloc (refgvals, imtlen (refs), TY_INT) + nrefs = 0 + while (imtgetim (refs, Memc[image], SZ_FNAME) != EOF) { + call refnoextn (Memc[image]) + if (!refgref (Memc[image], ap, sortval, gval)) + next + + for (i=0; i 0.) && (d < d1)) { + i1 = i + d1 = d + } + if ((d <= 0.) && (d > d2)) { + i2 = i + d2 = d + } + } + + if (i2 > 0) # Nearest following spectrum + call refspectra (Memc[image], Memc[Memi[refimages+i2-1]], 1., + Memc[Memi[refimages+i2-1]], 0.) + else if (i1 > 0) # Nearest preceding spectrum + call refspectra (Memc[image], Memc[Memi[refimages+i1-1]], 1., + Memc[Memi[refimages+i1-1]], 0.) + else { # No reference spectrum found + call refprint (STDERR, NO_REFSPEC, Memc[image], "", "", "", + ap, 0, "") + do i = 1, nrefs { + if (!streq (Memc[gval], Memc[Memi[refgvals+i-1]])) { + call refprint (STDERR, REF_GROUP, Memc[image], + Memc[Memi[refimages+i-1]], Memc[gval], + Memc[Memi[refgvals+i-1]], ap, Memi[refaps+i-1], "") + next + } + if (!ignoreaps && ap != Memi[refaps+i-1]) + call refprint (STDERR, REF_AP, Memc[image], + Memc[Memi[refimages+i-1]], Memc[gval], + Memc[Memi[refgvals+i-1]], ap, Memi[refaps+i-1], "") + next + } + } + } + + call sfree (sp) +end diff --git a/noao/onedspec/dispcor/refgspec.x b/noao/onedspec/dispcor/refgspec.x new file mode 100644 index 00000000..bb851307 --- /dev/null +++ b/noao/onedspec/dispcor/refgspec.x @@ -0,0 +1,268 @@ +include +include "refspectra.h" + +# REFOPEN -- Set verbose and log file descriptors and open symbol table. +# REFCLOSE -- Close file descriptors and symbol table +# REFGSPEC -- Get a spectrum from the symbol table. Map it only once. +# REFGINPUT -- Get input spectrum. Apply various checks. +# REFGREF -- Get reference spectrum. Apply various checks. + +define REF_LEN 6 # Length of reference structure +define REF_SORTVAL Memd[P2D($1)] # Sort value +define REF_AP Memi[$1+2] # Aperture number +define REF_GVAL Memi[$1+3] # Sort value +define REF_SPEC1 Memi[$1+4] # Offset for reference spectrum 1 +define REF_SPEC2 Memi[$1+5] # Offset for reference spectrum 2 + + +# REFOPEN -- Set verbose and log file descriptors and open symbol table. +# The file descriptors and symbol table pointer are in common. A null +# file descriptor indicates no output. + +procedure refopen () + +bool clgetb() +real clgetr() +pointer rng_open(), stopen() +int fd, btoi(), clpopnu(), clgfil(), open(), nowhite() +errchk open() + +include "refspectra.com" + +begin + call malloc (sort, SZ_FNAME, TY_CHAR) + call malloc (group, SZ_FNAME, TY_CHAR) + + # Check log files + logfiles = clpopnu ("logfiles") + while (clgfil (logfiles, Memc[sort], SZ_FNAME) != EOF) { + fd = open (Memc[sort], APPEND, TEXT_FILE) + call close (fd) + } + call clprew (logfiles) + + # Get other parameters + call clgstr ("apertures", Memc[sort], SZ_FNAME) + iferr (aps = rng_open (Memc[sort], INDEF, INDEF, INDEF)) + call error (0, "Bad aperture list") + call clgstr ("refaps", Memc[sort], SZ_FNAME) + iferr (raps = rng_open (Memc[sort], INDEF, INDEF, INDEF)) + call error (0, "Bad reference aperture list") + call clgstr ("sort", Memc[sort], SZ_FNAME) + call clgstr ("group", Memc[group], SZ_FNAME) + time = btoi (clgetb ("time")) + timewrap = clgetr ("timewrap") + verbose = btoi (clgetb ("verbose")) + + fd = nowhite (Memc[sort], Memc[sort], SZ_FNAME) + fd = nowhite (Memc[group], Memc[group], SZ_FNAME) + + # Open symbol table. + stp = stopen ("refspectra", 10, 20, 10*SZ_FNAME) +end + + +# REFCLOSE -- Finish up + +procedure refclose () + +include "refspectra.com" + +begin + call mfree (sort, TY_CHAR) + call mfree (group, TY_CHAR) + call clpcls (logfiles) + call stclose (stp) + call rng_close (raps) + call rng_close (aps) +end + + +# REFGSPEC -- Get a spectrum from the symbol table. Map it only once. +# All access to spectra is through this routine. It returns header parameters. +# Because the spectra may be accessed in very random order and many times +# the information is stored in a symbol table keyed on the spectrum name. +# The spectrum need be mapped only once! Any error from IMMAP is returned. + +procedure refgspec (spec, ap, sortval, gval, ref1, ref2) + +char spec[ARB] # Spectrum image name +int ap # Spectrum aperture number +double sortval # Spectrum sort value +pointer gval # Group string +pointer ref1 # Reference spectrum 1 +pointer ref2 # Reference spectrum 2 + +pointer sym, stfind(), stenter(), stpstr(), strefsbuf() +pointer im, str, immap() +bool streq() +int imgeti(), strlen() +double imgetd() +errchk immap, imgetd, imgstr + +include "refspectra.com" + +begin + # Check if spectrum is in the symbol table from a previous call. + # If not in the symbol table map the image, get the header parameters, + # and store them in the symbol table. + + sym = stfind (stp, spec) + if (sym == NULL) { + im = immap (spec, READ_ONLY, 0) + iferr (ap = imgeti (im, "BEAM-NUM")) + ap = 1 + + # Failure to find a specified keyword is a fatal error. + iferr { + if (Memc[sort] == EOS || streq (Memc[sort], "none") || + select == MATCH || select == AVERAGE) + sortval = INDEFD + else { + sortval = imgetd (im, Memc[sort]) + if (time == YES) + sortval = mod (sortval + 24. - timewrap, 24.0D0) + } + + call malloc (str, SZ_FNAME, TY_CHAR) + if (Memc[group] == EOS || streq (Memc[group], "none") || + select == MATCH || select == AVERAGE) + Memc[str] = EOS + else + call imgstr (im, Memc[group], Memc[str], SZ_FNAME) + gval = stpstr (stp, Memc[str], strlen (Memc[str])+1) + } then + call erract (EA_FATAL) + + iferr (call imgstr (im, "refspec1", Memc[str], SZ_FNAME)) + Memc[str] = EOS + ref1 = stpstr (stp, Memc[str], strlen (Memc[str])+1) + iferr (call imgstr (im, "refspec2", Memc[str], SZ_FNAME)) + Memc[str] = EOS + ref2 = stpstr (stp, Memc[str], strlen (Memc[str])+1) + call mfree (str, TY_CHAR) + + call imunmap (im) + + sym = stenter (stp, spec, REF_LEN) + REF_AP(sym) = ap + REF_SORTVAL(sym) = sortval + REF_GVAL(sym) = gval + REF_SPEC1(sym) = ref1 + REF_SPEC2(sym) = ref2 + } + ap = REF_AP(sym) + sortval = REF_SORTVAL(sym) + gval = strefsbuf (stp, REF_GVAL(sym)) + ref1 = strefsbuf (stp, REF_SPEC1(sym)) + ref2 = strefsbuf (stp, REF_SPEC2(sym)) +end + + +# REFGINPUT -- Get input spectrum. Apply various checks. +# This calls REFGSPEC and then checks: +# 1. The spectrum is found. +# 2. The spectrum has not been assigned reference spectra previously. +# If it has then determine whether to override the assignment. +# 3. Check if the aperture is correct. +# Return true if the spectrum is acceptable and false if not. + +bool procedure refginput (spec, ap, val, gval) + +char spec[ARB] # Spectrum image name +int ap # Spectrum aperture number (returned) +double val # Spectrum sort value (returned) +pointer gval # Spectrum group value (returned) + +bool clgetb(), rng_elementi() +pointer ref1, ref2 +errchk refgspec + +include "refspectra.com" + +define err_ 99 + +begin + # Get the spectrum from the symbol table. + iferr (call refgspec (spec, ap, val, gval, ref1, ref2)) { + call refmsgs (NO_SPEC, spec, "", "", "", ap, 0, "") + goto err_ + } + + # Check if it has a previous reference spectrum. Override if desired. + if (Memc[ref1] != EOS) { + if (!clgetb ("override")) { + call refmsgs (DEF_REFSPEC, spec, Memc[ref1], "", "", ap, 0, + Memc[ref2]) + goto err_ + } else { + call refmsgs (OVR_REFSPEC, spec, Memc[ref1], "", "", ap, 0, + Memc[ref2]) + } + } + + # Check aperture numbers. + if (aps != NULL) { + if (!rng_elementi (aps, ap)) { + call refmsgs (BAD_AP, spec, "", "", "", ap, 0, "") + goto err_ + } + } + + return (true) + +err_ + return (false) +end + + +# REFGREF -- Get reference spectrum. Apply various checks. +# This calls REFGSPEC and then checks: +# 1. The spectrum is found. +# 2. The spectrum is a reference spectrum, i.e. has an IDENTIFY +# record. This is signaled by having a reference equivalent to +# itself. +# 3. Check if the aperture is correct. +# Return true if the spectrum is acceptable and false if not. + +bool procedure refgref (spec, ap, val, gval) + +char spec[ARB] # Spectrum image name +int ap # Spectrum aperture number (returned) +double val # Spectrum sort value (returned) +pointer gval # Spectrum group value (returned) + +bool strne(), rng_elementi() +pointer ref1, ref2 +errchk refgspec + +include "refspectra.com" + +define err_ 99 + +begin + # Get spectrum from symbol table. + iferr (call refgspec (spec, ap, val, gval, ref1, ref2)) { + call refmsgs (NO_REF, spec, "", "", "", ap, 0, "") + goto err_ + } + + # Check if spectrum is a reference spectrum. + if (strne (spec, Memc[ref1])) { + call refmsgs (NOT_REFSPEC, spec, "", "", "", ap, 0, "") + goto err_ + } + + # Check aperture numbers. + if (raps != NULL) { + if (!rng_elementi (raps, ap)) { + call refmsgs (BAD_REFAP, spec, "", "", "", ap, 0, "") + goto err_ + } + } + + return (true) + +err_ + return (false) +end diff --git a/noao/onedspec/dispcor/refinterp.x b/noao/onedspec/dispcor/refinterp.x new file mode 100644 index 00000000..b074c053 --- /dev/null +++ b/noao/onedspec/dispcor/refinterp.x @@ -0,0 +1,127 @@ +include +include "refspectra.h" + + +# REFINTERP -- Assign reference spectra to interpolate between based on sort +# key. The nearest preceding and following spectra are assigned weights based +# on their distance. If there is no preceding and following spectrum then +# the nearest spectrum is assigned. + +procedure refinterp (input, refs) + +pointer input # List of input spectra +pointer refs # List of reference spectra + +bool ignoreaps # Ignore apertures? + +int i, i1, i2, nrefs, ap +double sortval, d, d1, d2 +real wt1, wt2 +pointer sp, image, gval, refimages, refaps, refvals, refgvals + +bool clgetb(), streq(), refginput(), refgref() +int imtgetim(), imtlen() + +begin + call smark (sp) + call salloc (image, SZ_FNAME, TY_CHAR) + + # Task parameters + ignoreaps = clgetb ("ignoreaps") + + # Tabulate reference spectra. This expands the reference list, + # checks the spectrum is a reference spectrum of the appropriate + # aperture. + + call salloc (refimages, imtlen (refs), TY_INT) + call salloc (refaps, imtlen (refs), TY_INT) + call salloc (refvals, imtlen (refs), TY_DOUBLE) + call salloc (refgvals, imtlen (refs), TY_INT) + nrefs = 0 + while (imtgetim (refs, Memc[image], SZ_FNAME) != EOF) { + call refnoextn (Memc[image]) + if (!refgref (Memc[image], ap, sortval, gval)) + next + + for (i=0; i= 0.) && (d < d1)) { + i1 = i + d1 = d + } else if ((d <= 0.) && (d > d2)) { + i2 = i + d2 = d + } + } + + if (i1 > 0 && i2 > 0) { # Weight spectra + if (d1 - d2 == 0.) { + wt1 = 0.5 + wt2 = 0.5 + } else { + wt1 = -d2 / (d1 - d2) + wt2 = d1 / (d1 - d2) + } + call refspectra (Memc[image], Memc[Memi[refimages+i1-1]], wt1, + Memc[Memi[refimages+i2-1]], wt2) + } else if (i1 > 0) # Nearest preceding spectrum + call refspectra (Memc[image], Memc[Memi[refimages+i1-1]], 1., + Memc[Memi[refimages+i1-1]], 0.) + else if (i2 > 0) # Nearest following spectrum + call refspectra (Memc[image], Memc[Memi[refimages+i2-1]], 1., + Memc[Memi[refimages+i2-1]], 0.) + else { # No reference spectrum found + call refprint (STDERR, NO_REFSPEC, Memc[image], "", "", "", + ap, 0, "") + do i = 1, nrefs { + if (!streq (Memc[gval], Memc[Memi[refgvals+i-1]])) { + call refprint (STDERR, REF_GROUP, Memc[image], + Memc[Memi[refimages+i-1]], Memc[gval], + Memc[Memi[refgvals+i-1]], ap, Memi[refaps+i-1], "") + next + } + if (!ignoreaps && ap != Memi[refaps+i-1]) + call refprint (STDERR, REF_AP, Memc[image], + Memc[Memi[refimages+i-1]], Memc[gval], + Memc[Memi[refgvals+i-1]], ap, Memi[refaps+i-1], "") + next + } + } + } + + call sfree (sp) +end diff --git a/noao/onedspec/dispcor/refmatch.x b/noao/onedspec/dispcor/refmatch.x new file mode 100644 index 00000000..c94a7113 --- /dev/null +++ b/noao/onedspec/dispcor/refmatch.x @@ -0,0 +1,43 @@ +include "refspectra.h" + +# REFMATCH -- Assign reference spectrum by match against reference list. + +procedure refmatch (input, refs) + +pointer input # List of input spectra +pointer refs # List of reference spectra + +int ap +double sortval +pointer sp, image, refimage, gval + +bool refgref(), refginput() +int imtgetim(), imtlen() + +begin + if (imtlen (input) != imtlen (refs)) + call error (0, "Input and reference list have different lengths") + + call smark (sp) + call salloc (image, SZ_FNAME, TY_CHAR) + call salloc (refimage, SZ_FNAME, TY_CHAR) + + # Assign reference spectra to each input spectrum. + # Skip spectra which are not of the appropriate aperture + # or have been assigned previously (unless overriding). + + while ((imtgetim (input, Memc[image], SZ_FNAME) != EOF) && + (imtgetim (refs, Memc[refimage], SZ_FNAME) != EOF)) { + call refnoextn (Memc[image]) + call refnoextn (Memc[refimage]) + if (!refginput (Memc[image], ap, sortval, gval)) + next + if (!refgref (Memc[refimage], ap, sortval, gval)) + next + + call refspectra (Memc[image], Memc[refimage], 1., + Memc[refimage], 0.) + } + + call sfree (sp) +end diff --git a/noao/onedspec/dispcor/refmsgs.x b/noao/onedspec/dispcor/refmsgs.x new file mode 100644 index 00000000..a374088e --- /dev/null +++ b/noao/onedspec/dispcor/refmsgs.x @@ -0,0 +1,108 @@ +include "refspectra.h" + + +# REFMSGS -- Print any verbose messages to log files. All messages +# except the assignments go through this procedure. It calls REFPRINT with +# each output stream. + +procedure refmsgs (msg, spec, ref, gval, gvalref, ap, apref, ref2) + +int msg # Message code +char spec[ARB] # Spectrum +char ref[ARB] # Reference spectrum +char gval[ARB] # Group value +char gvalref[ARB] # Group value in reference +int ap # Aperture +int apref # Aperture in reference +char ref2[ARB] # Reference spectrum 2 + +int fd, clgfil(), open() +pointer sp, logfile +include "refspectra.com" + +begin + if (verbose == NO) + return + + call smark (sp) + call salloc (logfile, SZ_FNAME, TY_CHAR) + while (clgfil (logfiles, Memc[logfile], SZ_FNAME) != EOF) { + fd = open (Memc[logfile], APPEND, TEXT_FILE) + call refprint (fd, msg, spec, ref, gval, gvalref, ap, apref, ref2) + call close (fd) + } + call clprew (logfiles) + + call sfree (sp) +end + + +# REFPRINT -- Print requested message with appropriate parameters if non-null +# stream is specified. + +procedure refprint (fd, msg, spec, ref, gval, gvalref, ap, apref, ref2) + +int fd # File descriptor +int msg # Message code +char spec[ARB] # Spectrum +char ref[ARB] # Reference spectrum +char gval[ARB] # Group value +char gvalref[ARB] # Group value in reference +int ap # Aperture +int apref # Aperture in reference +char ref2[ARB] # Reference spectrum 2 + +include "refspectra.com" + +begin + if (fd == NULL) + return + + switch (msg) { + case NO_SPEC: + call fprintf (fd, "[%s] Spectrum not found\n") + call pargstr (spec) + case NO_REF: + call fprintf (fd, "[%s] Reference spectrum not found\n") + call pargstr (spec) + case NOT_REFSPEC: + call fprintf (fd, "[%s] Not a reference spectrum\n") + call pargstr (spec) + case NO_REFSPEC: + call fprintf (fd, "[%s] No reference spectrum found\n") + call pargstr (spec) + case DEF_REFSPEC: + call fprintf (fd, "[%s] Reference spectra already defined: %s %s\n") + call pargstr (spec) + call pargstr (ref) + call pargstr (ref2) + case OVR_REFSPEC: + call fprintf (fd, + "[%s] Overriding previous reference spectra: %s %s\n") + call pargstr (spec) + call pargstr (ref) + call pargstr (ref2) + case BAD_AP: + call fprintf (fd, "[%s] Wrong aperture: %d\n") + call pargstr (spec) + call pargi (ap) + case BAD_REFAP: + call fprintf (fd, "[%s] Wrong reference aperture: %d\n") + call pargstr (spec) + call pargi (ap) + case REF_GROUP: + call fprintf (fd, "Input [%s] %s = %s : Ref [%s] %s = %s\n") + call pargstr (spec) + call pargstr (Memc[group]) + call pargstr (gval) + call pargstr (ref) + call pargstr (Memc[group]) + call pargstr (gvalref) + case REF_AP: + call fprintf (fd, "Input [%s] ap = %d : Ref [%s] ap = %d\n") + call pargstr (spec) + call pargi (ap) + call pargstr (ref) + call pargi (apref) + } +end diff --git a/noao/onedspec/dispcor/refnearest.x b/noao/onedspec/dispcor/refnearest.x new file mode 100644 index 00000000..78ebb62b --- /dev/null +++ b/noao/onedspec/dispcor/refnearest.x @@ -0,0 +1,104 @@ +include +include "refspectra.h" + + +# REFNEAREST -- Assign nearest reference spectrum based on sort key. + +procedure refnearest (input, refs) + +pointer input # List of input spectra +pointer refs # List of reference spectra + +bool ignoreaps # Ignore apertures? + +int i, i1, nrefs, ap +double sortval, d, d1 +pointer sp, image, gval, refimages, refaps, refvals, refgvals + +bool clgetb(), streq(), refginput(), refgref() +int imtgetim(), imtlen() + +begin + call smark (sp) + call salloc (image, SZ_FNAME, TY_CHAR) + + # Task parameters + ignoreaps = clgetb ("ignoreaps") + + # Tabulate reference spectra. This expands the reference list, + # checks the spectrum is a reference spectrum of the appropriate + # aperture. + + call salloc (refimages, imtlen (refs), TY_POINTER) + call salloc (refaps, imtlen (refs), TY_INT) + call salloc (refvals, imtlen (refs), TY_DOUBLE) + call salloc (refgvals, imtlen (refs), TY_POINTER) + nrefs = 0 + while (imtgetim (refs, Memc[image], SZ_FNAME) != EOF) { + call refnoextn (Memc[image]) + if (!refgref (Memc[image], ap, sortval, gval)) + next + + for (i=0; i 0) # Assign nearest reference spectrum + call refspectra (Memc[image], Memc[Memi[refimages+i1-1]], 1., + Memc[Memi[refimages+i1-1]], 0.) + else { # No reference spectrum found + call refprint (STDERR, NO_REFSPEC, Memc[image], "", "", "", + ap, 0, "") + do i = 1, nrefs { + if (!streq (Memc[gval], Memc[Memi[refgvals+i-1]])) { + call refprint (STDERR, REF_GROUP, Memc[image], + Memc[Memi[refimages+i-1]], Memc[gval], + Memc[Memi[refgvals+i-1]], ap, Memi[refaps+i-1], "") + next + } + if (!ignoreaps && ap != Memi[refaps+i-1]) + call refprint (STDERR, REF_AP, Memc[image], + Memc[Memi[refimages+i-1]], Memc[gval], + Memc[Memi[refgvals+i-1]], ap, Memi[refaps+i-1], "") + next + } + } + } + + call sfree (sp) +end diff --git a/noao/onedspec/dispcor/refnoextn.x b/noao/onedspec/dispcor/refnoextn.x new file mode 100644 index 00000000..4c48b194 --- /dev/null +++ b/noao/onedspec/dispcor/refnoextn.x @@ -0,0 +1,29 @@ +# REFNOEXTN -- Strip any image extensions + +procedure refnoextn (spec) + +char spec[ARB] # Image name + +int i, strlen() +bool streq() + +begin + i = strlen (spec) + call imgimage (spec, spec, i) + + i = strlen (spec) + switch (spec[i]) { + case 'h': + if (i > 3 && spec[i-3] == '.') + spec[i-3] = EOS + case 'l': + if (i > 2 && streq (spec[i-2], ".pl")) + spec[i-2] = EOS + case 's': + if (i > 4 && streq (spec[i-4], ".fits")) + spec[i-4] = EOS + case 't': + if (i > 3 && streq (spec[i-3], ".fit")) + spec[i-3] = EOS + } +end diff --git a/noao/onedspec/dispcor/refprecede.x b/noao/onedspec/dispcor/refprecede.x new file mode 100644 index 00000000..c2ba0467 --- /dev/null +++ b/noao/onedspec/dispcor/refprecede.x @@ -0,0 +1,114 @@ +include +include "refspectra.h" + + +# REFPRECEDE -- Assign preceding reference spectrum based on sort key. +# If there is no preceding spectrum assign the nearest following spectrum. + +procedure refprecede (input, refs) + +pointer input # List of input spectra +pointer refs # List of reference spectra + +bool ignoreaps # Ignore aperture numbers? + +int i, i1, i2, nrefs, ap +double sortval, d, d1, d2 +pointer sp, image, gval, refimages, refaps, refvals, refgvals + +bool clgetb(), streq(), refginput(), refgref() +int imtgetim(), imtlen() + +begin + call smark (sp) + call salloc (image, SZ_FNAME, TY_CHAR) + + # Task parameters + ignoreaps = clgetb ("ignoreaps") + + # Tabulate reference spectra. This expands the reference list, + # checks the spectrum is a reference spectrum of the appropriate + # aperture. + + call salloc (refimages, imtlen (refs), TY_INT) + call salloc (refaps, imtlen (refs), TY_INT) + call salloc (refvals, imtlen (refs), TY_DOUBLE) + call salloc (refgvals, imtlen (refs), TY_INT) + nrefs = 0 + while (imtgetim (refs, Memc[image], SZ_FNAME) != EOF) { + call refnoextn (Memc[image]) + if (!refgref (Memc[image], ap, sortval, gval)) + next + + for (i=0; i= 0.) && (d < d1)) { + i1 = i + d1 = d + } + if ((d < 0.) && (d < d2)) { + i2 = i + d2 = d + } + } + + if (i1 > 0) # Nearest preceding spectrum + call refspectra (Memc[image], Memc[Memi[refimages+i1-1]], 1., + Memc[Memi[refimages+i1-1]], 0.) + else if (i2 > 0) # Nearest following spectrum + call refspectra (Memc[image], Memc[Memi[refimages+i2-1]], 1., + Memc[Memi[refimages+i2-1]], 0.) + else { # No reference spectrum found + call refprint (STDERR, NO_REFSPEC, Memc[image], "", "", "", + ap, 0, "") + do i = 1, nrefs { + if (!streq (Memc[gval], Memc[Memi[refgvals+i-1]])) { + call refprint (STDERR, REF_GROUP, Memc[image], + Memc[Memi[refimages+i-1]], Memc[gval], + Memc[Memi[refgvals+i-1]], ap, Memi[refaps+i-1], "") + next + } + if (!ignoreaps && ap != Memi[refaps+i-1]) + call refprint (STDERR, REF_AP, Memc[image], + Memc[Memi[refimages+i-1]], Memc[gval], + Memc[Memi[refgvals+i-1]], ap, Memi[refaps+i-1], "") + next + } + } + } + + call sfree (sp) +end diff --git a/noao/onedspec/dispcor/refspectra.com b/noao/onedspec/dispcor/refspectra.com new file mode 100644 index 00000000..7c5dc622 --- /dev/null +++ b/noao/onedspec/dispcor/refspectra.com @@ -0,0 +1,15 @@ +# Common parameters for logging and the spectrum symbol table. + +pointer aps # Pointer to aperture list +pointer raps # Pointer to reference aperture list +pointer sort # Pointer to sort keyword +pointer group # Pointer to group keyword +int select # Selection type +int time # Is sort keyword a time? +real timewrap # Timewrap parameter +int verbose # Verbose output? +int logfiles # List of log files +pointer stp # Symbol table for previously mapped spectra + +common /refcom/ aps, raps, sort, group, select, time, timewrap, verbose, + logfiles, stp diff --git a/noao/onedspec/dispcor/refspectra.h b/noao/onedspec/dispcor/refspectra.h new file mode 100644 index 00000000..c7ba397a --- /dev/null +++ b/noao/onedspec/dispcor/refspectra.h @@ -0,0 +1,30 @@ +# Selection method keywords and codes. + +define SELECT "|match|nearest|preceding|following|interp|average|" +define MATCH 1 # Match input and reference lists +define NEAREST 2 # Nearest reference +define PRECEDING 3 # Preceding reference +define FOLLOWING 4 # Following reference +define INTERP 5 # Interpolate between nearest references +define AVERAGE 6 # Average first two reference spectra + +# Reference list types. + +define LIST 1 # References are an image list +define TABLE 2 # Referenece are a table + +# Maximum number of aperture ranges. +define NRANGES 100 + +# Message codes (see procedure refprint) + +define NO_SPEC 1 # Spectrum not found (immap failed) +define NO_REF 2 # Reference spectrum not found (immap failed) +define NOT_REFSPEC 3 # Not a reference spectrum +define NO_REFSPEC 4 # No reference spectrum found +define DEF_REFSPEC 5 # Reference spectra already defined +define OVR_REFSPEC 6 # Override reference spectra +define BAD_AP 7 # Bad aperture +define BAD_REFAP 8 # Bad reference aperture +define REF_GROUP 9 # Group +define REF_AP 10 # Aperture diff --git a/noao/onedspec/dispcor/refspectra.x b/noao/onedspec/dispcor/refspectra.x new file mode 100644 index 00000000..57a18e43 --- /dev/null +++ b/noao/onedspec/dispcor/refspectra.x @@ -0,0 +1,186 @@ +include "refspectra.h" + + +# T_REFSPECTRA -- Assign reference spectra. +# Reference spectra are assigned to input spectra from a specified list of +# reference spectra with various criteria. This procedure only gets some +# of the task parameters and switches to separate procedures for each +# implemented assignment method. The reference spectra may be specified by +# and image list or a lookup table. The difference is determined by attempting +# to map the first reference element in the list as an image. + +procedure t_refspectra () + +pointer input # List of input images +pointer refs # List of reference images +#int select # Selection method for reference spectra +int type # Type of reference specification + +int clgwrd(), imtgetim() +pointer sp, ref, im, imtopenp(), immap() +errchk immap + +include "refspectra.com" + +begin + call smark (sp) + call salloc (ref, SZ_LINE, TY_CHAR) + + # Get input and reference spectra lists. Determine selection method. + input = imtopenp ("input") + call clgstr ("records", Memc[ref], SZ_LINE) + call odr_openp (input, Memc[ref]) + refs = imtopenp ("references") + select = clgwrd ("select", Memc[ref], SZ_FNAME, SELECT) + + # Determine if reference list is a table. + if (imtgetim (refs, Memc[ref], SZ_FNAME) != EOF) { + call refnoextn (Memc[ref]) + iferr { + im = immap (Memc[ref], READ_ONLY, 0) + call imunmap (im) + type = LIST + } then + type = TABLE + } else + call error (0, "No reference spectra specified") + call imtrew (refs) + + # Initialize confirm flag, symbol table and logging streams. + call refconfirm1 () + call refopen () + + # Switch of reference list type and selection method. + if (type == LIST) { + switch (select) { + case MATCH: + call refmatch(input, refs) + case NEAREST: + call refnearest (input, refs) + case PRECEDING: + call refprecede (input, refs) + case FOLLOWING: + call reffollow (input, refs) + case INTERP: + call refinterp (input, refs) + case AVERAGE: + call refaverage (input, refs) + } + } else + call reftable (input, Memc[ref], select) + + call refclose () + call imtclose (input) + call imtclose (refs) + call sfree (sp) +end + + +# REFSPECTRA -- Confirm and set reference spectra in header. +# 1. Confirm assignments if desired. +# 2. Log output to logfiles if desired. +# 3. Update assignment if desired. +# Note that if wt1 > 0.995 then only the first reference spectrum is +# set with no weight specified. No weight implies no interpolation. + +procedure refspectra (image, ref1, wt1, ref2, wt2) + +char image[ARB] # Spectrum image name +char ref1[ARB] # Reference spectrum image name +real wt1 # Weight +char ref2[ARB] # Reference spectrum image name +real wt2 # Weight +bool confirm # Confirm assignments? + +int fd, clgfil(), open(), clgwrd() +bool clgetb(), streq() +pointer im, sp, str, immap() +errchk immap + +include "refspectra.com" + +begin + call smark (sp) + call salloc (str, SZ_LINE, TY_CHAR) + + # Confirm assignments. + if (confirm) { + if (wt1 < 0.995) { + call printf ("[%s] refspec1='%s %.8g'\n") + call pargstr (image) + call pargstr (ref1) + call pargr (wt1) + call printf ("[%s] refspec2='%s %.8g' ") + call pargstr (image) + call pargstr (ref2) + call pargr (wt2) + } else { + call printf ("[%s] refspec1='%s' ") + call pargstr (image) + call pargstr (ref1) + } + call flush (STDOUT) + fd = clgwrd ("answer", Memc[str], SZ_LINE, "|no|yes|YES|") + switch (fd) { + case 1: + call sfree (sp) + return + case 3: + confirm = false + } + } + + # Log output. + while (clgfil (logfiles, Memc[str], SZ_LINE) != EOF) { + if (streq (Memc[str], "STDOUT") && confirm) + next + fd = open (Memc[str], APPEND, TEXT_FILE) + if (wt1 < 0.995) { + call fprintf (fd, "[%s] refspec1='%s %.8g'\n") + call pargstr (image) + call pargstr (ref1) + call pargr (wt1) + call fprintf (fd, "[%s] refspec2='%s %.8g'\n") + call pargstr (image) + call pargstr (ref2) + call pargr (wt2) + } else { + call fprintf (fd, "[%s] refspec1='%s'\n") + call pargstr (image) + call pargstr (ref1) + } + call close (fd) + } + call clprew (logfiles) + + # If updating the assigments map the spectrum READ_WRITE and set + # the keywords REFSPEC1 and REFSPEC2. REFSPEC2 is not set if not + # interpolating. + + if (clgetb ("assign")) { + im = immap (image, READ_WRITE, 0) + if (wt1 < 0.9999995D0) { + call sprintf (Memc[str], SZ_LINE, "%s %.8g") + call pargstr (ref1) + call pargr (wt1) + call imastr (im, "refspec1", Memc[str]) + call sprintf (Memc[str], SZ_LINE, "%s %.8g") + call pargstr (ref2) + call pargr (wt2) + call imastr (im, "refspec2", Memc[str]) + } else { + call imastr (im, "refspec1", ref1) + iferr (call imdelf (im, "refspec2")) + ; + } + call imunmap (im) + } + + call sfree (sp) + return + +entry refconfirm1 () + + confirm = clgetb ("confirm") + +end diff --git a/noao/onedspec/dispcor/reftable.x b/noao/onedspec/dispcor/reftable.x new file mode 100644 index 00000000..abdf1f4a --- /dev/null +++ b/noao/onedspec/dispcor/reftable.x @@ -0,0 +1,109 @@ +include +include "refspectra.h" + + +# REFTABLE -- For each input image select reference spectrum list from a table. +# The table is read from the file and stored in a simple symbol table. +# +# The table consists of pairs of words. The first word is a list of spectra +# and the second word is the reference spectrum list to be used for each +# spectrum in the first list. Note that the first list is not an input +# list. As a convenience if a reference list is missing the preceding list +# is implied. Some examples follow. +# +# spec1 spec2,spec3,spec4 +# spec5 +# spec6,spec7 spect8,spec9 +# spec10 spec11 +# spec12 spec13 +# spec14 spec15 + +procedure reftable (list, table, select) + +pointer list # List of input spectra +char table[ARB] # Reference table +int select # Selection method + +int i, fd, input, refs +pointer stp, sym +pointer sp, image, ref1, ref2 + +pointer stopen(), strefsbuf(), stenter(), stpstr(), stfind(), imtopen() +int imtgetim(), open(), fscan(), nscan() +errchk open + +begin + # Read the table. Return an error if the file can't be opened. + # Read each table entry of spectrum list and reference list. + # Expand the input list to make a symbol table keyed on the + # spectrum with the reference list string as it's value. + # As a convenience if a reference list is missing the preceding + # list is implied. + + fd = open (table, READ_ONLY, TEXT_FILE) + + call smark (sp) + call salloc (image, SZ_FNAME, TY_CHAR) + call salloc (ref1, SZ_FNAME, TY_CHAR) + call salloc (ref2, SZ_FNAME, TY_CHAR) + + stp = stopen ("table", 10, 10, 20*SZ_FNAME) + while (fscan (fd) != EOF) { + call gargwrd (Memc[image], SZ_FNAME) + call gargwrd (Memc[ref1], SZ_FNAME) + if (nscan() < 1) + next + if (nscan() < 2) + call strcpy (Memc[ref2], Memc[ref1], SZ_FNAME) + else + call strcpy (Memc[ref1], Memc[ref2], SZ_FNAME) + + i = stpstr (stp, Memc[ref1], SZ_FNAME) + + input = imtopen (Memc[image]) + while (imtgetim (input, Memc[image], SZ_FNAME) != EOF) { + call refnoextn (Memc[image]) + sym = stenter (stp, Memc[image], 1) + Memi[sym] = i + } + call imtclose (input) + } + call close (fd) + + # For each input spectrum find the appropriate reference spectrum list. + # If no list is found print a message and continue. Switch on the + # selection method. + + while (imtgetim (list, Memc[image], SZ_FNAME) != EOF) { + call refnoextn (Memc[image]) + sym = stfind (stp, Memc[image]) + if (sym == NULL) { + call refmsgs (NO_REFSPEC, Memc[image], "", "", "", 0, 0, "") + next + } + + input = imtopen (Memc[image]) + refs = imtopen (Memc[strefsbuf (stp, Memi[sym])]) + + switch (select) { + case MATCH: + call refmatch(input, refs) + case NEAREST: + call refnearest (input, refs) + case PRECEDING: + call refprecede (input, refs) + case FOLLOWING: + call reffollow (input, refs) + case INTERP: + call refinterp (input, refs) + case AVERAGE: + call refaverage (input, refs) + } + + call imtclose (input) + call imtclose (refs) + } + + call stclose (stp) + call sfree (sp) +end diff --git a/noao/onedspec/dispcor/t_dispcor.x b/noao/onedspec/dispcor/t_dispcor.x new file mode 100644 index 00000000..94aeba44 --- /dev/null +++ b/noao/onedspec/dispcor/t_dispcor.x @@ -0,0 +1,1336 @@ +include +include +include +include +include +include "dispcor.h" +include "dctable.h" +include +include + +# Dispersion types. +define MULTISPEC 1 +define ECHELLE 2 + + +# T_DISPCOR -- Dispersion correct spectra. + +procedure t_dispcor () + +int in # List of input spectra +int out # List of output spectra +bool linearize # Linearize spectra? +bool log # Log scale? +bool flux # Conserve flux? +real blank # Blank value +int ignoreaps # Ignore aperture numbers? +int fd1 # Log file descriptor +int fd2 # Log file descriptor + +int i, format, naps +int open(), nowhite(), imtopenp(), imtgetim(), errcode(), btoi() +pointer sp, input, output, str, err, stp, table +pointer im, im1, smw, smw1, ap, immap(), smw_openim() +bool clgetb() +real clgetr() +errchk open, immap, smw_openim, dc_gms, dc_gec, dc_multispec, dc_echelle + +begin + call smark (sp) + call salloc (input, SZ_FNAME, TY_CHAR) + call salloc (output, SZ_FNAME, TY_CHAR) + call salloc (str, SZ_LINE, TY_CHAR) + call salloc (err, SZ_LINE, TY_CHAR) + + # Task parameters + in = imtopenp ("input") + out = imtopenp ("output") + call clgstr ("records", Memc[str], SZ_LINE) + call odr_openp (in, Memc[str]) + call odr_openp (out, Memc[str]) + call clgstr ("database", Memc[str], SZ_FNAME) + call clgstr ("logfile", Memc[err], SZ_LINE) + linearize = clgetb ("linearize") + ignoreaps = btoi (clgetb ("ignoreaps")) + + # Initialize the database cacheing and wavelength table. + call dc_open (stp, Memc[str]) + if (linearize) { + log = clgetb ("log") + flux = clgetb ("flux") + blank = clgetr ("blank") + + call dc_table (table, naps) + if (clgetb ("global")) { + if (clgetb ("samedisp")) + call dc_global1 (in, stp, log, table, naps) + else + call dc_global (in, stp, log, table, naps) + } + } + + # Open logfile if specified. + if (clgetb ("verbose")) + fd1 = STDOUT + if (nowhite (Memc[err], Memc[err], SZ_LINE) != 0) + fd2 = open (Memc[err], APPEND, TEXT_FILE) + else + fd2 = NULL + + # Loop through each input image. Do the dispersion correction + # in place if no output spectrum list is given or if the input + # and output spectra names are the same. + + while (imtgetim (in, Memc[input], SZ_FNAME) != EOF) { + if (imtgetim (out, Memc[output], SZ_FNAME) == EOF) + call strcpy (Memc[input], Memc[output], SZ_FNAME) + + iferr { + im = NULL; im1 = NULL + smw = NULL; smw1 = NULL + ap = NULL + + i = immap (Memc[input], READ_ONLY, 0); im = i + i = smw_openim (im); smw = i + + switch (SMW_FORMAT(smw)) { + case SMW_ND: + # Use first line for reference. + switch (SMW_LDIM(smw)) { + case 1: + call strcpy (Memc[input], Memc[str], SZ_LINE) + case 2: + switch (SMW_LAXIS(smw,1)) { + case 1: + call sprintf (Memc[str], SZ_LINE, "%s[*,1]") + call pargstr (Memc[input]) + case 2: + call sprintf (Memc[str], SZ_LINE, "%s[1,*]") + call pargstr (Memc[input]) + } + case 3: + switch (SMW_LAXIS(smw,1)) { + case 1: + call sprintf (Memc[str], SZ_LINE, "%s[*,1,1]") + call pargstr (Memc[input]) + case 2: + call sprintf (Memc[str], SZ_LINE, "%s[1,*,1]") + call pargstr (Memc[input]) + case 3: + call sprintf (Memc[str], SZ_LINE, "%s[*,1,1]") + call pargstr (Memc[input]) + } + } + im1 = immap (Memc[str], READ_ONLY, 0) + smw1 = smw_openim (im1) + call smw_ndes (im1, smw1) + if (SMW_PDIM(smw1) == 1) + call smw_esms (smw1) + + call dc_gms (Memc[input], im1, smw1, stp, YES, ap, fd1, fd2) + call dc_ndspec (im, smw, smw1, ap, Memc[input], + Memc[output], linearize, log, flux, blank, table, naps, + fd1, fd2) + default: + # Get dispersion functions. Determine type of dispersion + # by the error return. + + format = MULTISPEC + iferr (call dc_gms (Memc[input], im, smw, stp, ignoreaps, + ap, fd1, fd2)) { + if (errcode() > 1 && errcode() < 100) + call erract (EA_ERROR) + format = ECHELLE + iferr (call dc_gec (Memc[input], im, smw, stp, ap, + fd1, fd2)) { + if (errcode() > 1 && errcode() < 100) + call erract (EA_ERROR) + call erract (EA_WARN) + iferr (call dc_gms (Memc[input], im, smw, stp, + ignoreaps, ap, fd1, fd2)) + call erract (EA_WARN) + call sprintf (Memc[err], SZ_LINE, + "%s: Dispersion data not found") + call pargstr (Memc[input]) + call error (1, Memc[err]) + } + } + + switch (format) { + case MULTISPEC: + call dc_multispec (im, smw, ap, Memc[input], + Memc[output], linearize, log, flux, blank, table, + naps, fd1, fd2) + case ECHELLE: + call dc_echelle (im, smw, ap, Memc[input], + Memc[output], linearize, log, flux, blank, table, + naps, fd1, fd2) + } + } + } then + call erract (EA_WARN) + + if (ap != NULL) + call mfree (ap, TY_STRUCT) + if (smw1 != NULL) + call smw_close (smw1) + if (im1 != NULL) + call imunmap (im1) + if (smw != NULL) + call smw_close (smw) + if (im != NULL) + call imunmap (im) + } + + # Finish up. + if (linearize) + do i = 0, naps + call mfree (Memi[table+i], TY_STRUCT) + call mfree (table, TY_INT) + call dc_close (stp) + call imtclose (in) + call imtclose (out) + if (fd1 != NULL) + call close (fd1) + if (fd2 != NULL) + call close (fd2) + call sfree (sp) +end + + +# DC_NDSPEC -- Dispersion correct N-dimensional spectrum. + +procedure dc_ndspec (in, smw, smw1, ap, input, output, linearize, log, flux, + blank, table, naps, fd1, fd2) + +pointer in # Input IMIO pointer +pointer smw # SMW pointer +pointer smw1 # SMW pointer +pointer ap # Aperture pointer +char input[ARB] # Input multispec spectrum +char output[ARB] # Output root name +bool linearize # Linearize? +bool log # Log wavelength parameters? +bool flux # Conserve flux? +real blank # Blank value +pointer table # Wavelength table +int naps # Number of apertures +int fd1 # Log file descriptor +int fd2 # Log file descriptor + +int i, j, nin, ndim, dispaxis, n1, n2, n3 +pointer sp, temp, str, out, mwout, cti, cto, indata, outdata +pointer immap(), imgs3r(), imps3r(), mw_open(), smw_sctran() +bool clgetb(), streq() +errchk immap, mw_open, smw_open, dispcor, imgs3r, imps3r + +begin + # Determine the wavelength parameters. + call dc_wavelengths (in, ap, output, log, table, naps, 1, + DC_AP(ap,1), DC_W1(ap,1), DC_W2(ap,1), DC_DW(ap,1), DC_NW(ap,1)) + DC_Z(ap,1) = 0. + if (log) + DC_DT(ap,1) = 1 + else + DC_DT(ap,1) = 0 + + call dc_log (fd1, output, ap, 1, log) + call dc_log (fd2, output, ap, 1, log) + + if (clgetb ("listonly")) + return + + call smark (sp) + call salloc (temp, SZ_FNAME, TY_CHAR) + call salloc (str, SZ_LINE, TY_CHAR) + + # Open output image. Use temp. image if output is the same as input. + if (streq (input, output)) { + call mktemp ("temp", Memc[temp], SZ_LINE) + out = immap (Memc[temp], NEW_COPY, in) + if (IM_PIXTYPE(out) != TY_DOUBLE) + IM_PIXTYPE(out) = TY_REAL + } else { + out = immap (output, NEW_COPY, in) + if (IM_PIXTYPE(out) != TY_DOUBLE) + IM_PIXTYPE(out) = TY_REAL + } + + # Set dimensions. + ndim = SMW_LDIM(smw) + dispaxis = SMW_LAXIS(smw,1) + n1 = DC_NW(ap,1) + n2 = SMW_LLEN(smw,2) + n3 = SMW_LLEN(smw,3) + nin = IM_LEN(in,dispaxis) + IM_LEN(out,dispaxis) = n1 + + # Set WCS header. + mwout = mw_open (NULL, ndim) + call mw_newsystem (mwout, "world", ndim) + do i = 1, ndim + call mw_swtype (mwout, i, 1, "linear", "") + if (UN_LABEL(DC_UN(ap,1)) != EOS) + call mw_swattrs (mwout, dispaxis, "label", UN_LABEL(DC_UN(ap,1))) + if (UN_UNITS(DC_UN(ap,1)) != EOS) + call mw_swattrs (mwout, dispaxis, "units", UN_UNITS(DC_UN(ap,1))) + call smw_open (mwout, NULL, out) + call smw_swattrs (mwout, INDEFI, INDEFI, INDEFI, INDEFI, DC_DT(ap,1), + DC_W1(ap,1), DC_DW(ap,1), DC_NW(ap,1), DC_Z(ap,1), INDEFR, INDEFR, + "") + + # Set WCS transformations. + cti = smw_sctran (smw1, "world", "logical", 3) + switch (dispaxis) { + case 1: + cto = smw_sctran (mwout, "logical", "world", 1) + case 2: + cto = smw_sctran (mwout, "logical", "world", 2) + case 3: + cto = smw_sctran (mwout, "logical", "world", 4) + } + + # Dispersion correct. + do j = 1, n3 { + do i = 1, n2 { + switch (dispaxis) { + case 1: + indata = imgs3r (in, 1, nin, i, i, j, j) + outdata = imps3r (out, 1, n1, i, i, j, j) + case 2: + indata = imgs3r (in, i, i, 1, nin, j, j) + outdata = imps3r (out, i, i, 1, n1, j, j) + case 3: + indata = imgs3r (in, i, i, j, j, 1, nin) + outdata = imps3r (out, i, i, j, j, 1, n1) + } + + call aclrr (Memr[outdata], n1) + call dispcora (cti, 1, cto, INDEFI, Memr[indata], nin, + Memr[outdata], n1, flux, blank) + } + } + + # Save REFSPEC keywords if present. + call dc_refspec (out) + + # Finish up. Replace input by output if needed. + call smw_ctfree (cti) + call smw_ctfree (cto) + call smw_saveim (mwout, out) + call smw_close (mwout) + call imunmap (out) + call imunmap (in) + if (streq (input, output)) { + call imdelete (input) + call imrename (Memc[temp], output) + } + + call sfree (sp) +end + + +# DC_MULTISPEC -- Linearize multispec apertures into an MULTISPEC format +# spectrum. The number of pixels in each image line is the maximum +# required to contain the longest spectrum. + +procedure dc_multispec (in, smw, ap, input, output, linearize, log, flux, + blank, table, naps, fd1, fd2) + +pointer in # Input IMIO pointer +pointer smw # SMW pointer +pointer ap # Aperture pointer +char input[ARB] # Input multispec spectrum +char output[ARB] # Output root name +bool linearize # Linearize? +bool log # Log wavelength parameters? +bool flux # Conserve flux? +real blank # Blank value +pointer table # Wavelength table +int naps # Number of apertures +int fd1 # Log file descriptor +int fd2 # Log file descriptor + +int i, j, nc, nl, nb, axis[2] +pointer sp, temp, str, out, mwout, cti, cto, indata, outdata +pointer immap(), imgl3r(), impl3r() +pointer mw_open(), smw_sctran() +bool clgetb(), streq() +errchk immap, mw_open, smw_open, dispcor, imgl3r, impl3r + +data axis/1,2/ + +begin + # Determine the wavelength parameters for each aperture. + # The options are to have all apertures have the same dispersion + # or have each aperture have independent dispersion. The global + # parameters have already been calculated if needed. + + nc = IM_LEN(in,1) + nl = IM_LEN(in,2) + nb = IM_LEN(in,3) + + if (linearize) { + if (log) + DC_DT(ap,1) = 1 + else + DC_DT(ap,1) = 0 + if (clgetb ("samedisp")) { + call dc_wavelengths1 (in, smw, ap, output, log, table, naps, + DC_W1(ap,1), DC_W2(ap,1), DC_DW(ap,1), DC_NW(ap,1)) + if ((DC_DW(ap,1)*(DC_W2(ap,1)-DC_W1(ap,1)) <= 0.) || + (DC_NW(ap,1) < 1)) + call error (1, "Error in wavelength scale") + do i = 2, nl { + DC_W1(ap,i) = DC_W1(ap,1) + DC_W2(ap,i) = DC_W2(ap,1) + DC_DW(ap,i) = DC_DW(ap,1) + DC_NW(ap,i) = DC_NW(ap,1) + DC_Z(ap,i) = 0. + DC_DT(ap,i) = DC_DT(ap,1) + } + } else { + do i = 1, nl { + call dc_wavelengths (in, ap, output, log, table, naps, i, + DC_AP(ap,i), DC_W1(ap,i), DC_W2(ap,i), DC_DW(ap,i), + DC_NW(ap,i)) + DC_Z(ap,i) = 0. + DC_DT(ap,i) = DC_DT(ap,1) + } + } + } + call dc_log (fd1, output, ap, nl, log) + call dc_log (fd2, output, ap, nl, log) + + if (clgetb ("listonly")) + return + + call smark (sp) + call salloc (temp, SZ_FNAME, TY_CHAR) + call salloc (str, SZ_LINE, TY_CHAR) + + # Use a temporary image if the output has the same name as the input. + if (streq (input, output)) { + if (linearize) { + call mktemp ("temp", Memc[temp], SZ_LINE) + out = immap (Memc[temp], NEW_COPY, in) + if (IM_PIXTYPE(out) != TY_DOUBLE) + IM_PIXTYPE(out) = TY_REAL + } else { + call imunmap (in) + i = immap (input, READ_WRITE, 0) + in = i + out = i + } + } else { + out = immap (output, NEW_COPY, in) + if (IM_PIXTYPE(out) != TY_DOUBLE) + IM_PIXTYPE(out) = TY_REAL + } + + # Set MWCS or linearize + if (!linearize) { + if (out != in) + do j = 1, nb + do i = 1, nl + call amovr (Memr[imgl3r(in,i,j)], Memr[impl3r(out,i,j)], + IM_LEN(in,1)) + call smw_saveim (smw, out) + } else { + if (nb > 1) + i = 3 + else + i = 2 + mwout = mw_open (NULL, i) + call mw_newsystem (mwout, "multispec", i) + call mw_swtype (mwout, axis, 2, "multispec", "") + if (UN_LABEL(DC_UN(ap,1)) != EOS) + call mw_swattrs (mwout, 1, "label", UN_LABEL(DC_UN(ap,1))) + if (UN_UNITS(DC_UN(ap,1)) != EOS) + call mw_swattrs (mwout, 1, "units", UN_UNITS(DC_UN(ap,1))) + if (i == 3) + call mw_swtype (mwout, 3, 1, "linear", "") + call smw_open (mwout, NULL, out) + do i = 1, nl { + call smw_swattrs (mwout, i, 1, DC_AP(ap,i), DC_BM(ap,i), + DC_DT(ap,i), DC_W1(ap,i), DC_DW(ap,i), DC_NW(ap,i), + DC_Z(ap,i), DC_LW(ap,i), DC_UP(ap,i), "") + call smw_gapid (smw, i, 1, Memc[str], SZ_LINE) + call smw_sapid (mwout, i, 1, Memc[str]) + } + + IM_LEN(out,1) = DC_NW(ap,1) + do i = 2, nl + IM_LEN(out,1) = max (DC_NW(ap,i), IM_LEN(out,1)) + cti = smw_sctran (smw, "world", "logical", 3) + cto = smw_sctran (mwout, "logical", "world", 3) + do j = 1, nb { + do i = 1, nl { + indata = imgl3r (in, i, j) + outdata = impl3r (out, i, j) + call aclrr (Memr[outdata], IM_LEN(out,1)) + call dispcora (cti, i, cto, i, Memr[indata], nc, + Memr[outdata], DC_NW(ap,i), flux, blank) + if (DC_NW(ap,i) < IM_LEN(out,1)) + call amovkr (Memr[outdata+DC_NW(ap,i)-1], + Memr[outdata+DC_NW(ap,i)],IM_LEN(out,1)-DC_NW(ap,i)) + } + } + call smw_ctfree (cti) + call smw_ctfree (cto) + call smw_saveim (mwout, out) + call smw_close (mwout) + } + + # Save REFSPEC keywords if present. + call dc_refspec (out) + + # Finish up. Replace input by output if needed. + if (out == in) { + call imunmap (in) + } else { + call imunmap (in) + call imunmap (out) + if (streq (input, output)) { + call imdelete (input) + call imrename (Memc[temp], output) + } + } + + call sfree (sp) +end + + +# DC_ECHELLE -- Linearize echelle orders into an ECHELLE format +# spectrum. The number of pixels in each image line is the maximum +# required to contain the longest spectrum. + +procedure dc_echelle (in, smw, ap, input, output, linearize, log, flux, + blank, table, naps, fd1, fd2) + +pointer in # IMIO pointer +pointer smw # SMW pointers +pointer ap # Aperture pointer +char input[ARB] # Input multispec spectrum +char output[ARB] # Output root name +bool linearize # Linearize? +bool log # Log wavelength parameters? +bool flux # Conserve flux? +real blank # Blank value +pointer table # Wavelength table +int naps # Number of apertures +int fd1 # Log file descriptor +int fd2 # Log file descriptor + +int i, j, nc, nl, nb, axis[2] +pointer sp, temp, str, out, mwout, cti, cto, indata, outdata +pointer immap(), imgl3r(), impl3r() +pointer mw_open(), smw_sctran() +bool clgetb(), streq() +errchk immap, mw_open, smw_open, dispcor, imgl3r, impl3r + +data axis/1,2/ + +begin + # Determine the wavelength parameters for each aperture. + + nc = IM_LEN(in,1) + nl = IM_LEN(in,2) + nb = IM_LEN(in,3) + + if (linearize) { + if (log) + DC_DT(ap,1) = 1 + else + DC_DT(ap,1) = 0 + do i = 1, nl { + call dc_wavelengths (in, ap, output, log, table, naps, + i, DC_AP(ap,i), DC_W1(ap,i), DC_W2(ap,i), DC_DW(ap,i), + DC_NW(ap,i)) + DC_Z(ap,i) = 0. + DC_DT(ap,i) = DC_DT(ap,1) + } + } + call dc_log (fd1, output, ap, nl, log) + call dc_log (fd2, output, ap, nl, log) + + if (clgetb ("listonly")) + return + + call smark (sp) + call salloc (temp, SZ_FNAME, TY_CHAR) + call salloc (str, SZ_LINE, TY_CHAR) + + # Use a temporary image if the output has the same name as the input. + if (streq (input, output)) { + if (linearize) { + call mktemp ("temp", Memc[temp], SZ_LINE) + out = immap (Memc[temp], NEW_COPY, in) + if (IM_PIXTYPE(out) != TY_DOUBLE) + IM_PIXTYPE(out) = TY_REAL + } else { + call imunmap (in) + i = immap (input, READ_WRITE, 0) + in = i + out = i + } + } else { + out = immap (output, NEW_COPY, in) + if (IM_PIXTYPE(out) != TY_DOUBLE) + IM_PIXTYPE(out) = TY_REAL + } + + # Set MWCS or linearize + if (!linearize) { + if (out != in) + do j = 1, nb + do i = 1, nl + call amovr (Memr[imgl3r(in,i,j)], Memr[impl3r(out,i,j)], + IM_LEN(in,1)) + call smw_saveim (smw, out) + } else { + if (nb > 1) + i = 3 + else + i = 2 + mwout = mw_open (NULL, i) + call mw_newsystem (mwout, "multispec", i) + call mw_swtype (mwout, axis, 2, "multispec", "") + if (UN_LABEL(DC_UN(ap,1)) != EOS) + call mw_swattrs (mwout, 1, "label", UN_LABEL(DC_UN(ap,1))) + if (UN_UNITS(DC_UN(ap,1)) != EOS) + call mw_swattrs (mwout, 1, "units", UN_UNITS(DC_UN(ap,1))) + if (i == 3) + call mw_swtype (mwout, 3, 1, "linear", "") + call smw_open (mwout, NULL, out) + do i = 1, nl { + call smw_swattrs (mwout, i, 1, DC_AP(ap,i), DC_BM(ap,i), + DC_DT(ap,i), DC_W1(ap,i), DC_DW(ap,i), DC_NW(ap,i), + DC_Z(ap,i), DC_LW(ap,i), DC_UP(ap,i), "") + call smw_gapid (smw, i, 1, Memc[str], SZ_LINE) + call smw_sapid (mwout, i, 1, Memc[str]) + } + + IM_LEN(out,1) = DC_NW(ap,1) + do i = 2, nl + IM_LEN(out,1) = max (DC_NW(ap,i), IM_LEN(out,1)) + cti = smw_sctran (smw, "world", "logical", 3) + cto = smw_sctran (mwout, "logical", "world", 3) + do j = 1, nb { + do i = 1, nl { + indata = imgl3r (in, i, j) + outdata = impl3r (out, i, j) + call aclrr (Memr[outdata], IM_LEN(out,1)) + call dispcora (cti, i, cto, i, Memr[indata], nc, + Memr[outdata], DC_NW(ap,i), flux, blank) + if (DC_NW(ap,i) < IM_LEN(out,1)) + call amovkr (Memr[outdata+DC_NW(ap,i)-1], + Memr[outdata+DC_NW(ap,i)],IM_LEN(out,1)-DC_NW(ap,i)) + } + } + call smw_ctfree (cti) + call smw_ctfree (cto) + call smw_saveim (mwout, out) + call smw_close (mwout) + } + + # Save REFSPEC keywords if present. + call dc_refspec (out) + + # Finish up. Replace input by output if needed. + if (out == in) { + call imunmap (in) + } else { + call imunmap (in) + call imunmap (out) + if (streq (input, output)) { + call imdelete (input) + call imrename (Memc[temp], output) + } + } + + call sfree (sp) +end + + +# DC_GLOBAL1 -- Set global wavelength parameters using the minimum and +# maximum wavelengths and and the minimum dispersion over all apertures. + +procedure dc_global1 (in, stp, log, table, naps) + +pointer in # Input list +pointer stp # Symbol table +bool log # Logarithmic scale? +pointer table # Wavelength table +int naps # Number of apertures + +int i, nwmax, imtgetim() +double w1, w2, dw, wmin, wmax, dwmin +pointer sp, input, str, im, mw, ap, tbl, immap(), smw_openim() +errchk dc_gms, dc_gec, smw_openim + +begin + call smark (sp) + call salloc (input, SZ_FNAME, TY_CHAR) + call salloc (str, SZ_LINE, TY_CHAR) + + # Go through all the reference spectra and determine the + # minimum and maximum wavelengths and maximum number of pixels. + # If there is no entry in the wavelength table add it. + + wmin = MAX_REAL + wmax = -MAX_REAL + dwmin = MAX_REAL + + while (imtgetim (in, Memc[input], SZ_FNAME) != EOF) { + iferr (im = immap (Memc[input], READ_ONLY, 0)) + next + mw = smw_openim (im) + switch (SMW_FORMAT(mw)) { + case SMW_ND: + nwmax = SMW_NW(mw) + dw = SMW_DW(mw) + w1 = SMW_W1(mw) + w2 = w1 + dw * (nwmax - 1) + wmin = min (wmin, w1, w2) + wmax = max (wmax, w1, w2) + dwmin = min (dwmin, abs (dw)) + default: + iferr { + iferr (call dc_gms (Memc[input], im, mw, stp, NO, ap, + NULL, NULL)) { + iferr (call dc_gec (Memc[input], im, mw, stp, ap, + NULL, NULL)) { + call sprintf (Memc[str], SZ_LINE, + "%s: Dispersion data not found") + call pargstr (Memc[input]) + call error (1, Memc[str]) + } + } + + do i = 1, IM_LEN(im,2) { + w1 = DC_W1(ap,i) + w2 = DC_W2(ap,i) + dw = DC_DW(ap,i) + wmin = min (wmin, w1, w2) + wmax = max (wmax, w1, w2) + dwmin = min (dwmin, abs (dw)) + } + } then + ; + } + + call mfree (ap, TY_STRUCT) + call smw_close (mw) + call imunmap (im) + } + call imtrew (in) + + nwmax = (wmax - wmin) / dwmin + 1.5 + + # Enter the global entry in the first table entry. + tbl = Memi[table] + call dc_defaults (wmin, wmax, nwmax, + TBL_W1(tbl), TBL_W2(tbl), TBL_DW(tbl), TBL_NW(tbl)) + + call sfree (sp) +end + + +# DC_GLOBAL -- Set global wavelength parameters. This is done for each +# aperture separately. The wavelength table may be used to specify separate +# fixed parameters for each aperture. + +procedure dc_global (in, stp, log, table, naps) + +pointer in # Input list +pointer stp # Symbol table +bool log # Logarithmic scale? +pointer table # Wavelength table +int naps # Number of apertures + +int i, j, nw, imtgetim() +double w1, w2, dw +pointer sp, input, str, im, mw, ap, tbl, immap(), smw_openim() +errchk dc_gms, dc_gec, smw_openim + +begin + call smark (sp) + call salloc (input, SZ_FNAME, TY_CHAR) + call salloc (str, SZ_LINE, TY_CHAR) + + # Go through all the reference spectra and determine the + # minimum and maximum wavelengths and maximum number of pixels. + # Do this by aperture. If there is no entry in the wavelength + # table add it. + + while (imtgetim (in, Memc[input], SZ_FNAME) != EOF) { + iferr (im = immap (Memc[input], READ_ONLY, 0)) + next + mw = smw_openim (im) + switch (SMW_FORMAT(mw)) { + case SMW_ND: + tbl = Memi[table] + nw = SMW_NW(mw) + dw = SMW_DW(mw) + w1 = SMW_W1(mw) + w2 = w1 + dw * (nw - 1) + TBL_WMIN(tbl) = min (TBL_WMIN(tbl), w1, w2) + TBL_WMAX(tbl) = max (TBL_WMAX(tbl), w1, w2) + TBL_NWMAX(tbl) = max (TBL_NWMAX(tbl), nw) + default: + iferr { + iferr (call dc_gms (Memc[input], im, mw, stp, NO, ap, + NULL, NULL)) { + iferr (call dc_gec (Memc[input], im, mw, stp, ap, + NULL, NULL)) { + call sprintf (Memc[str], SZ_LINE, + "%s: Dispersion data not found") + call pargstr (Memc[input]) + call error (1, Memc[str]) + } + } + + do i = 1, IM_LEN(im,2) { + call dc_getentry (false, DC_AP(ap,i), table, naps, j) + tbl = Memi[table+j] + + nw = DC_NW(ap,i) + w1 = DC_W1(ap,i) + w2 = DC_W2(ap,i) + TBL_WMIN(tbl) = min (TBL_WMIN(tbl), w1, w2) + TBL_WMAX(tbl) = max (TBL_WMAX(tbl), w1, w2) + TBL_NWMAX(tbl) = max (TBL_NWMAX(tbl), nw) + } + } then + ; + } + + call mfree (ap, TY_STRUCT) + call smw_close (mw) + call imunmap (im) + } + call imtrew (in) + + do i = 0, naps { + tbl = Memi[table+i] + call dc_defaults (TBL_WMIN(tbl), TBL_WMAX(tbl), TBL_NWMAX(tbl), + TBL_W1(tbl), TBL_W2(tbl), TBL_DW(tbl), TBL_NW(tbl)) + } + + call sfree (sp) +end + + +# DC_WAVELENGTHS1 -- Set output wavelength parameters for a spectrum. +# Fill in any INDEF values using the limits of the dispersion function +# over all apertures and the minimum dispersion over all apertures. The +# user may then confirm and change the wavelength parameters if desired. + +procedure dc_wavelengths1 (im, smw, ap, output, log, table, naps, w1, w2, dw,nw) + +pointer im # IMIO pointer +pointer smw # SMW pointer +pointer ap # Aperture structure +char output[ARB] # Output image name +bool log # Logarithm wavelength parameters? +pointer table # Wavelength table +int naps # Number of apertures +double w1, w2, dw # Image wavelength parameters +int nw # Image wavelength parameter + +int i, n, nwt, clgeti(), clgwrd() +double a, b, c, w1t, w2t, dwt, y1, y2, dy, clgetd() +pointer sp, key, str, tbl +bool clgetb() + +begin + call smark (sp) + call salloc (key, SZ_FNAME, TY_CHAR) + call salloc (str, SZ_LINE, TY_CHAR) + + # Get aperture parameters. + tbl = Memi[table] + w1t = TBL_W1(tbl) + w2t = TBL_W2(tbl) + dwt = TBL_DW(tbl) + nwt = TBL_NW(tbl) + + # If there are undefined wavelength scale parameters get + # defaults based on the reference spectrum. + + if (IS_INDEFD(w1t)||IS_INDEFD(w2t)||IS_INDEFD(dwt)||IS_INDEFD(nwt)) { + a = MAX_REAL + b = -MAX_REAL + c = MAX_REAL + + do i = 1, IM_LEN(im,2) { + n = DC_NW(ap,i) + y1 = DC_W1(ap,i) + y2 = DC_W2(ap,i) + dy = DC_DW(ap,i) + a = min (a, y1, y2) + b = max (b, y1, y2) + c = min (c, dy) + } + n = (b - a) / c + 1.5 + } + + call dc_defaults (a, b, n, w1t, w2t, dwt, nwt) + w1 = w1t + w2 = w2t + dw = dwt + nw = nwt + + # Print the wavelength scale and allow the user to confirm and + # change the wavelength scale. A test is done to check which + # parameters the user changes and give them priority in filling + # in the remaining parameters. + + if (TBL_CONFIRM(tbl) == YES) { + repeat { + call printf ("%s: w1 = %g, w2 = %g, dw = %g, nw = %d\n") + call pargstr (output) + call pargd (w1) + call pargd (w2) + call pargd (dw) + call pargi (nw) + + i = clgwrd ("dispcor1.change", Memc[str],SZ_LINE, "|yes|no|NO|") + switch (i) { + case 2: + break + case 3: + TBL_CONFIRM(tbl) = NO + break + } + call clputd ("dispcor1.w1", w1) + call clputd ("dispcor1.w2", w2) + call clputd ("dispcor1.dw", dw) + call clputi ("dispcor1.nw", nw) + a = w1 + b = w2 + c = dw + n = nw + w1 = clgetd ("dispcor1.w1") + w2 = clgetd ("dispcor1.w2") + dw = clgetd ("dispcor1.dw") + nw = clgeti ("dispcor1.nw") + + # If no INDEF's set unchanged parameters to INDEF. + i = 0 + if (IS_INDEFD(w1)) + i = i + 1 + if (IS_INDEFD(w2)) + i = i + 1 + if (IS_INDEFD(dw)) + i = i + 1 + if (IS_INDEFI(nw)) + i = i + 1 + if (i == 0) { + if (w1 == a) + w1 = INDEFD + if (w2 == b) + w2 = INDEFD + if (dw == c) + dw = INDEFD + if (nw == n) + nw = INDEFI + } + + call dc_defaults (a, b, n, w1, w2, dw, nw) + + if (clgetb ("global")) { + TBL_W1(tbl) = w1 + TBL_W2(tbl) = w2 + TBL_DW(tbl) = dw + TBL_NW(tbl) = nw + } + } + } + call sfree (sp) +end + + +# DC_WAVELENGTHS -- Set output wavelength parameters for a spectrum for +# each aperture. The fixed parameters are given in the wavelength table. +# If there is no entry in the table for an aperture use the global +# default (entry 0). Fill in INDEF values using the limits and number +# of pixels for the aperture. The user may then confirm and change the +# wavelength parameters if desired. + +procedure dc_wavelengths (im, ap, output, log, table, naps, line, apnum, + w1, w2, dw, nw) + +pointer im # IMIO pointer +pointer ap # Aperture structure +char output[ARB] # Output image name +bool log # Logarithm wavelength parameters? +pointer table # Wavelength table +int naps # Number of apertures +int line # Line +int apnum # Aperture number +double w1, w2, dw # Image wavelength parameters +int nw # Image wavelength parameter + +int i, n, nwt, clgeti(), clgwrd() +double a, b, c, w1t, w2t, dwt, clgetd() +pointer sp, str, tbl +bool clgetb() + +begin + call smark (sp) + call salloc (str, SZ_LINE, TY_CHAR) + + # Get aperture parameters. + call dc_getentry (false, apnum, table, naps, i) + tbl = Memi[table+i] + + w1t = TBL_W1(tbl) + w2t = TBL_W2(tbl) + dwt = TBL_DW(tbl) + nwt = TBL_NW(tbl) + + # If there are undefined wavelength scale parameters get + # defaults based on the reference spectrum. + + if (IS_INDEFD(w1t)||IS_INDEFD(w2t)||IS_INDEFD(dwt)||IS_INDEFI(nwt)) { + a = DC_W1(ap,line) + b = DC_W2(ap,line) + n = DC_NW(ap,line) + } + + call dc_defaults (a, b, n, w1t, w2t, dwt, nwt) + w1 = w1t + w2 = w2t + dw = dwt + nw = nwt + + # Print the wavelength scale and allow the user to confirm and + # change the wavelength scale. A test is done to check which + # parameters the user changes and give them priority in filling + # in the remaining parameters. + + if (TBL_CONFIRM(tbl) == YES) { + repeat { + call printf ( + "%s: ap = %d, w1 = %g, w2 = %g, dw = %g, nw = %d\n") + call pargstr (output) + call pargi (apnum) + call pargd (w1) + call pargd (w2) + call pargd (dw) + call pargi (nw) + i = clgwrd ("dispcor1.change", Memc[str],SZ_LINE, "|yes|no|NO|") + switch (i) { + case 2: + break + case 3: + TBL_CONFIRM(tbl) = NO + break + } + call clputd ("dispcor1.w1", w1) + call clputd ("dispcor1.w2", w2) + call clputd ("dispcor1.dw", dw) + call clputi ("dispcor1.nw", nw) + a = w1 + b = w2 + c = dw + n = nw + w1 = clgetd ("dispcor1.w1") + w2 = clgetd ("dispcor1.w2") + dw = clgetd ("dispcor1.dw") + nw = clgeti ("dispcor1.nw") + + # If no INDEF's set unchanged parameters to INDEF. + i = 0 + if (IS_INDEFD(w1)) + i = i + 1 + if (IS_INDEFD(w2)) + i = i + 1 + if (IS_INDEFD(dw)) + i = i + 1 + if (IS_INDEFI(nw)) + i = i + 1 + if (i == 0) { + if (w1 == a) + w1 = INDEFD + if (w2 == b) + w2 = INDEFD + if (dw == c) + dw = INDEFD + if (nw == n) + nw = INDEFI + } + + call dc_defaults (a, b, n, w1, w2, dw, nw) + + if (clgetb ("global")) { + TBL_W1(tbl) = w1 + TBL_W2(tbl) = w2 + TBL_DW(tbl) = dw + TBL_NW(tbl) = nw + } + } + } + call sfree (sp) +end + + +# DC_DEFAULTS -- Given some set of wavelength scale with others undefined +# (INDEF) plus some defaults fill in the undefined parameters and make +# the wavelength scale consistent. The logic of this task is complex +# and is meant to provide an "intelligent" result based on what users +# want. + +procedure dc_defaults (a, b, n, w1, w2, dw, nw) + +double a # Default wavelength endpoint +double b # Default wavelength endpoint +int n # Default number of pixels +double w1 # Starting wavelength +double w2 # Ending wavelength +double dw # Wavelength interval +int nw # Number of pixels + +int nindef + +begin + # Determine how many input parameters are specfied. + nindef = 0 + if (IS_INDEFD(w1)) + nindef = nindef + 1 + if (IS_INDEFD(w2)) + nindef = nindef + 1 + if (IS_INDEFD(dw)) + nindef = nindef + 1 + if (IS_INDEFI(nw)) + nindef = nindef + 1 + + # Depending on how many parameters are specified fill in the + # INDEF parameters. + + switch (nindef) { + case 0: + # All parameters specified. First round NW to be consistent with + # w1, w2, and dw. Then adjust w2 to nearest pixel. It is possible + # that nw will be negative. Checks for this should be made by the + # call in program. + + nw = (w2 - w1) / dw + 1.5 + w2 = w1 + dw * (nw - 1) + case 1: + # Find the unspecified parameter and compute it from the other + # three specified parameters. For nw need to adjust w2 to + # agree with a pixel. + + if (IS_INDEFD(w1)) + w1 = w2 - dw * (nw - 1) + if (IS_INDEFD(w2)) + w2 = w1 + dw * (nw - 1) + if (IS_INDEFD(dw)) + dw = (w2 - w1) / (nw - 1) + if (IS_INDEFI(nw)) { + nw = (w2 - w1) / dw + 1.5 + w2 = w1 + dw * (nw - 1) + } + case 2: + # Fill in two unspecified parameters using the defaults. + # This is tricky. + + if (IS_INDEFD(dw)) { + if (IS_INDEFD(w1)) { + if (abs (w2 - a) > abs (w2 - b)) + w1 = a + else + w1 = b + dw = (w2 - w1) / (nw - 1) + } else if (IS_INDEFD(w2)) { + if (abs (w1 - a) > abs (w1 - b)) + w2 = a + else + w2 = b + dw = (w2 - w1) / (nw - 1) + } else { + dw = (b - a) / n + nw = abs ((w2 - w1) / dw) + 1.5 + dw = (w2 - w1) / (nw - 1) + } + } else if (IS_INDEFI(nw)) { + if (IS_INDEFD(w1)) { + if (dw > 0.) + w1 = min (a, b) + else + w1 = max (a, b) + nw = (w2 - w1) / dw + 1.5 + w1 = w2 - dw * (nw - 1) + } else { + if (dw > 0.) + w2 = max (a, b) + else + w2 = min (a, b) + nw = (w2 - w1) / dw + 1.5 + w2 = w1 + dw * (nw - 1) + } + } else { + if (dw > 0.) + w1 = min (a, b) + else + w1 = max (a, b) + w2 = w1 + dw * (nw - 1) + } + case 3: + # Find the one specfied parameter and compute the others using + # the supplied defaults. + + if (!IS_INDEFD(w1)) { + if (abs (w1 - a) > abs (w1 - b)) + w2 = a + else + w2 = b + dw = (b - a) / n + nw = abs ((w2 - w1) / dw) + 1.5 + dw = (w2 - w1) / (nw - 1) + } else if (!IS_INDEFD(w2)) { + if (abs (w2 - a) > abs (w2 - b)) + w1 = a + else + w1 = b + dw = (b - a) / n + nw = abs ((w2 - w1) / dw) + 1.5 + dw = (w2 - w1) / (nw - 1) + } else if (!IS_INDEFI(nw)) { + w1 = min (a, b) + w2 = max (a, b) + dw = (w2 - w1) / (nw - 1) + } else if (dw < 0.) { + w1 = max (a, b) + w2 = min (a, b) + nw = (w2 - w1) / dw + 1.5 + w2 = w1 + dw * (nw - 1) + } else { + w1 = min (a, b) + w2 = max (a, b) + nw = (w2 - w1) / dw + 1.5 + w2 = w1 + dw * (nw - 1) + } + case 4: + # Given only defaults compute a wavelength scale. The dispersion + # is kept close to the default. + w1 = min (a, b) + w2 = max (a, b) + dw = (b - a) / (n - 1) + nw = abs ((w2 - w1) / dw) + 1.5 + dw = (w2 - w1) / (nw - 1) + } +end + + +# DC_LOG -- Print log of wavlength paramters + +procedure dc_log (fd, output, ap, naps, log) + +int fd # Output file descriptor +char output[ARB] # Output image name +pointer ap # Aperture structure +int naps # Number of apertures +bool log # Log dispersion? + +int i + +begin + if (fd == NULL) + return + + for (i=2; i<=naps; i=i+1) { + if (DC_W1(ap,i) != DC_W1(ap,1)) + break + if (DC_W2(ap,i) != DC_W2(ap,1)) + break + if (DC_DW(ap,i) != DC_DW(ap,1)) + break + if (DC_NW(ap,i) != DC_NW(ap,1)) + break + } + + if (naps == 1 || i <= naps) { + do i = 1, naps { + call fprintf (fd, + "%s: ap = %d, w1 = %8g, w2 = %8g, dw = %8g, nw = %d") + call pargstr (output) + call pargi (DC_AP(ap,i)) + call pargd (DC_W1(ap,i)) + call pargd (DC_W2(ap,i)) + call pargd (DC_DW(ap,i)) + call pargi (DC_NW(ap,i)) + if (log) { + call fprintf (fd, ", log = %b") + call pargb (log) + } + call fprintf (fd, "\n") + } + } else { + call fprintf (fd, + "%s: w1 = %8g, w2 = %8g, dw = %8g, nw = %d") + call pargstr (output) + call pargd (DC_W1(ap,1)) + call pargd (DC_W2(ap,1)) + call pargd (DC_DW(ap,1)) + call pargi (DC_NW(ap,1)) + if (log) { + call fprintf (fd, ", log = %b") + call pargb (log) + } + call fprintf (fd, "\n") + } + call flush (fd) +end + + +# DC_REFSPEC -- Save REFSPEC keywords in DCLOG keywords. + +procedure dc_refspec (im) + +pointer im #U IMIO pointer + +int i, j, imaccf() +pointer sp, dckey, dcstr, refkey, refstr + +begin + call smark (sp) + call salloc (dckey, SZ_FNAME, TY_CHAR) + call salloc (dcstr, SZ_LINE, TY_CHAR) + call salloc (refkey, SZ_FNAME, TY_CHAR) + call salloc (refstr, SZ_LINE, TY_CHAR) + + for (i=1;; i=i+1) { + call sprintf (Memc[dckey], SZ_FNAME, "DCLOG%d") + call pargi (i) + if (imaccf (im, Memc[dckey]) == NO) + break + } + + do j = 1, 4 { + if (j == 1) + call strcpy ("REFSPEC1", Memc[refkey], SZ_FNAME) + else if (j == 2) + call strcpy ("REFSPEC2", Memc[refkey], SZ_FNAME) + else if (j == 3) + call strcpy ("REFSHFT1", Memc[refkey], SZ_FNAME) + else if (j == 4) + call strcpy ("REFSHFT2", Memc[refkey], SZ_FNAME) + + ifnoerr (call imgstr (im, Memc[refkey], Memc[refstr], SZ_LINE)) { + call sprintf (Memc[dckey], SZ_FNAME, "DCLOG%d") + call pargi (i) + call sprintf (Memc[dcstr], SZ_LINE, "%s = %s") + call pargstr (Memc[refkey]) + call pargstr (Memc[refstr]) + call imastr (im, Memc[dckey], Memc[dcstr]) + call imdelf (im, Memc[refkey]) + i = i + 1 + } + } + + call sfree (sp) +end diff --git a/noao/onedspec/dispcor/t_disptrans.x b/noao/onedspec/dispcor/t_disptrans.x new file mode 100644 index 00000000..ee108472 --- /dev/null +++ b/noao/onedspec/dispcor/t_disptrans.x @@ -0,0 +1,413 @@ +include +include +include +include +include + +define AIRVAC "|none|air2vac|vac2air|" +define NONE 1 # No correction +define AIR2VAC 2 # Correct air to vacuum +define VAC2AIR 3 # Correct vacuum to air + + +# T_DISPTRANS -- Tranform dispersion systems and apply air-vac conversion. +# This task uses the UNITS package to convert the input dispersion +# coordinates to the desired output coordinates. An air to vacuum or +# vacuum to air correction is made. Since the input and output units +# may not be linearly related and the MWCS supports only polynomial +# representations a cubic splines are fit to the desired output coordinates +# until an error tolerance is reached. The user may then select to +# store the new WCS as either the spline approximation or to linearize +# the coordinates by resampling the data. Note that if the input and +# output units ARE linearly related and there is no air/vacuum conversion +# then linearization or storing of a nonlinear dispersion function is +# skipped. The operations are done in double precision. + +procedure t_disptrans () + +int inlist # List of input spectra +int outlist # List of output spectra +pointer units # Output dispersion units +double maxerr # Maximum error (in pixels) +bool linearize # Linearize ouptut dispersion? +bool verbose # Verbose? + +int air # Air-vacuum conversion? +double t # Temperture in degrees C +double p # Pressure in mmHg +double f # Water vapour pressure in mmHg + +int i, j, n, nw, format, dtype, dtype1, axis[2] +double err, w1, dw +pointer ptr, in, out, mwin, mwout, ctin, ctout, sh, cv, inbuf, outbuf +pointer sp, input, output, title, coeff, x, y, w, nx + +bool clgetb(), streq() +int clgwrd(), imtopenp(), imtgetim() +double clgetd(), shdr_lw(), dcveval() +pointer immap(), smw_openim(), smw_sctran(), mw_open(), imgl3r(), impl3r() +errchk immap, impl3r +errchk smw_openim, smw_gwattrs, shdr_open, mw_open +errchk dt_airvac, dt_cvfit, dt_setwcs, dispcor + +data axis/1,2/ + +begin + call smark (sp) + call salloc (input, SZ_FNAME, TY_CHAR) + call salloc (output, SZ_FNAME, TY_CHAR) + call salloc (units, SZ_FNAME, TY_CHAR) + call salloc (title, SZ_LINE, TY_CHAR) + coeff = NULL + + # Parameters + inlist = imtopenp ("input") + outlist = imtopenp ("output") + call clgstr ("units", Memc[units], SZ_FNAME) + maxerr = clgetd ("error") + linearize = clgetb ("linearize") + verbose = clgetb ("verbose") + air = clgwrd ("air", Memc[input], SZ_FNAME, AIRVAC) + t = clgetd ("t") + p = clgetd ("p") + f = clgetd ("f") + + # Loop over input images. + while (imtgetim (inlist, Memc[input], SZ_FNAME) != EOF) { + if (imtgetim (outlist, Memc[output], SZ_FNAME) == EOF) + call strcpy (Memc[input], Memc[output], SZ_FNAME) + + iferr { + in = NULL + out = NULL + mwin = NULL + mwout = NULL + ctin = NULL + ctout = NULL + sh = NULL + cv = NULL + + # Open input and output images and wcs. + if (streq (Memc[input], Memc[output])) + ptr = immap (Memc[input], READ_WRITE, 0) + else + ptr = immap (Memc[input], READ_ONLY, 0) + in = ptr + + if (streq (Memc[input], Memc[output])) + ptr = in + else + ptr = immap (Memc[output], NEW_COPY, in) + out = ptr + + ptr = smw_openim (in); mwin = ptr + format = SMW_FORMAT(mwin) + switch (format) { + case SMW_ND: + call error (1, + "DISPTRANS does not apply to 2D and 3D images") + case SMW_ES: + call smw_esms (mwin) + } + + if (IM_NDIM(out) == 3 && IM_LEN(out,3) == 1) + IM_NDIM(out) = 2 + i = max (2, IM_NDIM(out)) + ptr = mw_open (NULL, i); mwout = ptr + call mw_newsystem (mwout, "multispec", i) + call mw_swtype (mwout, axis, 2, "multispec", "") + if (i == 3) + call mw_swtype (mwout, 3, 1, "linear", "") + call smw_open (mwout, NULL, out) + + # Allocate and set arrays. + call malloc (x, SMW_LLEN(mwin,1), TY_DOUBLE) + call malloc (y, SMW_LLEN(mwin,1), TY_DOUBLE) + call malloc (w, SMW_LLEN(mwin,1), TY_DOUBLE) + call malloc (nx, SMW_NSPEC(mwin), TY_INT) + do i = 1, SMW_LLEN(mwin,1) + Memd[x+i-1] = i + + # Set the output MWCS dispersion function. + # Only compute new coordinates once if possible. + + dtype = DCLINEAR + do i = 1, SMW_NSPEC(mwin) { + if (format == SMW_MS || i == 1) { + call shdr_open (in, mwin, i, 1, INDEFI, SHDATA, sh) + call shdr_units (sh, Memc[units]) + n = SN(sh) + do j = 1, n + Memd[y+j-1] = shdr_lw (sh, Memd[x+j-1]) + call dt_airvac (sh, Memd[y], n, air, t, p, f) + + # Fit dispersion function. + dtype1 = DCLINEAR + call dt_cvfit (cv, CHEBYSHEV, 2, Memd[x], Memd[y], + Memd[w], n, err) + if (err > maxerr) { + dtype1 = DCFUNC + do j = 1, n-4 { + call dt_cvfit (cv, SPLINE3, j, Memd[x], + Memd[y], Memd[w], n, err) + if (err <= maxerr) + break + } + } + + w1 = dcveval (cv, 1D0) + dw = (dcveval (cv, double(n)) - w1) / (n - 1) + } + if (linearize) { + call dt_setwcs (cv, mwin, mwin, i, dtype1, w1, dw) + call dt_setwcs (cv, mwin, mwout, i, DCLINEAR, w1, dw) + if (dtype1 != DCLINEAR) + dtype = dtype1 + } else + call dt_setwcs (cv, mwin, mwout, i, dtype1, w1, dw) + Memi[nx+i-1] = n + } + call dcvfree (cv) + + # Set label and units. The check on unit class is done + # so that if not a velocity the dictionary expansion + # unit is used. However for velocity the units do not + # include the reference coordinate so the user string + # is used. + + call mw_swattrs (SMW_MW(mwout,0), 1, "label", LABEL(sh)) + if (UN_CLASS(UN(sh)) != UN_VEL) { + call mw_swattrs (SMW_MW(mwout,0), 1, "units", UNITS(sh)) + call mw_swattrs (SMW_MW(mwout,0), 1, "units_display", + UNITS(sh)) + } else { + call mw_swattrs (SMW_MW(mwout,0), 1, "units", Memc[units]) + call mw_swattrs (SMW_MW(mwout,0), 1, "units_display", + Memc[units]) + } + + # Linearize or copy the pixels as requested. + if (linearize && dtype != DCLINEAR) { + ptr = smw_sctran (mwin, "world", "logical", 3); ctin = ptr + ptr = smw_sctran (mwout, "logical", "world", 3); ctout = ptr + n = IM_LEN(in,1) + do j = 1, IM_LEN(out,3) { + do i = 1, IM_LEN(out,2) { + nw = Memi[nx+i-1] + inbuf = imgl3r (in, i, j) + outbuf = impl3r (out, i, j) + call dispcor (ctin, i, ctout, i, Memr[inbuf], n, + Memr[outbuf], nw, NO) + if (nw < n) + call amovkr (Memr[outbuf+nw-1], Memr[outbuf+nw], + n-nw) + } + } + call smw_ctfree (ctin) + call smw_ctfree (ctout) + } else if (in != out) { + n = IM_LEN(in,1) + do j = 1, IM_LEN(out,3) { + do i = 1, IM_LEN(out,2) { + inbuf = imgl3r (in, i, j) + outbuf = impl3r (out, i, j) + call amovr (Memr[inbuf], Memr[outbuf], n) + } + } + } + + # Verbose output + if (verbose) { + call printf ("%s: Dispersion transformed to %s") + call pargstr (Memc[output]) + call pargstr (UNITS(sh)) + switch (air) { + case 1: + call printf (".\n") + case 2: + call printf (" in vacuum with\n") + call printf ( + " t = %.4g C, p = %.6g mmHg, f = %.4g mmHg.\n") + call pargd (t) + call pargd (p) + call pargd (f) + case 3: + call printf (" in air with\n") + call printf ( + " t = %.4g C, p = %.6g mmHg, f = %.4g mmHg.\n") + call pargd (t) + call pargd (p) + call pargd (f) + } + call flush (STDOUT) + } + + } then { + if (out != NULL && out != in) { + call imunmap (out) + call imdelete (Memc[output]) + } + call erract (EA_WARN) + } + + # Finish up. + call mfree (x, TY_DOUBLE) + call mfree (y, TY_DOUBLE) + call mfree (w, TY_DOUBLE) + call mfree (nx, TY_INT) + if (mwout != NULL && out != NULL) + call smw_saveim (mwout, out) + if (sh != NULL) + call shdr_close (sh) + if (ctin != NULL) + call smw_ctfree (ctin) + if (ctout != NULL) + call smw_ctfree (ctout) + if (mwin != NULL) + call smw_close (mwin) + if (mwout != NULL) + call smw_close (mwout) + if (out != NULL && out != in) + call imunmap (out) + if (in != NULL) + call imunmap (in) + } + + call imtclose (inlist) + call imtclose (outlist) + call mfree (coeff, TY_CHAR) + call sfree (sp) +end + + +# DT_AIRVAC -- Convert dispersion coordinates to air or vacuum values. +# The coordinates are first transformed to microns since that is what +# the formulas expect. After correction they are transformed back to the +# original units. The index of refraction formulas used are from +# Allen's Astrophysical Quantities (1973). + +procedure dt_airvac (sh, x, n, air, t, p, f) + +pointer sh #I Spectrum pointer +double x[n] #U Dispersion vector +int n #I Number of pixels +int air #I Correction type +double t #I Temperture in deg C +double p #I Total pressure in mmHg +double f #I Water vapour pressure in mmHg + +int i +double x2, a +pointer un, un_open() +errchk un_open, un_ctrand + +begin + if (air == NONE) + return + + un = un_open ("microns") + call un_ctrand (UN(sh), un, x, x, n) + do i = 1, n { + x2 = 1 / x[i] **2 + a = 64.328 + 29498.1 / (146 - x2) + 255.4 / (41 - x2) + a = a * p * (1 + (1.049 - 0.0157 * t) * 1e-6 * p) / + (720.883 * (1 + 0.003661 * t)) + a = a - (0.0624 - 0.000680 * x2) / (1 + 0.003661 * t) * f + a = 1 + a / 1e6 + switch (air) { + case AIR2VAC: + x[i] = a * x[i] + case VAC2AIR: + x[i] = x[i] / a + } + } + call un_ctrand (un, UN(sh), x, x, n) + call un_close (un) +end + + +# DT_CVFIT -- Fit a dispersion function and return the curfit pointer and +# maximum error in pixels. + +procedure dt_cvfit (cv, func, order, x, y, w, n, maxerr) + +pointer cv #O Fitted dispersion function +int func #I Dispersion function type +int order #I Dispersion function order +double x[n] #I Pixel coordinates +double y[n] #I Desired world coordinates +double w[n] #O Errors in pixels +int n #I Number of pixels +double maxerr #O Maximum error + +int i +double minerr, dcveval() + +begin + if (cv != NULL) + call dcvfree (cv) + call dcvinit (cv, func, order, x[1], x[n]) + call dcvfit (cv, x, y, w, n, WTS_UNIFORM, i) + do i = 2, n-1 + w[i] = abs ((y[i] - dcveval (cv, x[i])) / ((y[i+1] - y[i-1]) / 2)) + w[1] = abs ((y[1] - dcveval (cv, x[1])) / (y[2] - y[1])) + w[n] = abs ((y[n] - dcveval (cv, x[n])) / (y[n] - y[n-1])) + call alimd (w, n, minerr, maxerr) +end + + +# DT_SETWCS -- Set the multispec WCS. If the type is nonlinear then +# the fitted function is stored. + +procedure dt_setwcs (cv, mwin, mwout, l, dtype, w1, dw) + +pointer cv #I Dispersion function +pointer mwin #I Input SMW pointer +pointer mwout #I Output, SMW pointer +int l #I Image line +int dtype #I Dispersion function type +double w1 #I Coordinate of first pixel +double dw #I Coordinate interval at first physical pixel + +int i, ap, bm, dt, nw, n, fd, dcvstati(), stropen() +double a, b, z, lw, up +pointer sp, title, coeff, coeffs + +begin + call smark (sp) + call salloc (title, SZ_LINE, TY_CHAR) + + coeff = NULL + call smw_gwattrs (mwin, l, 1, ap, bm, dt, a, b, nw, z, lw, up, coeff) + call smw_gapid (mwin, l, 1, Memc[title], SZ_LINE) + + switch (dtype) { + case DCFUNC: + n = dcvstati (cv, CVNSAVE) + call malloc (coeffs, n, TY_DOUBLE) + call dcvsave (cv, Memd[coeffs]) + call realloc (coeff, 20*(n+2), TY_CHAR) + fd = stropen (Memc[coeff], 20*(n+2), NEW_FILE) + call fprintf (fd, "1 0 %d %d") + call pargi (nint (Memd[coeffs])) + call pargi (nint (Memd[coeffs+1])) + do i = 2, n-1 { + call fprintf (fd, " %g") + call pargd (Memd[coeffs+i]) + } + call close (fd) + call mfree (coeffs, TY_DOUBLE) + default: + Memc[coeff] = EOS + } + dt = dtype + a = w1 + b = dw + z = 0. + call smw_swattrs (mwout, l, 1, ap, bm, dt, a, b, nw, z, lw, up, + Memc[coeff]) + call smw_sapid (mwout, l, 1, Memc[title]) + + call mfree (coeff, TY_CHAR) + call sfree (sp) +end diff --git a/noao/onedspec/dispcor1.par b/noao/onedspec/dispcor1.par new file mode 100644 index 00000000..633ae4ca --- /dev/null +++ b/noao/onedspec/dispcor1.par @@ -0,0 +1,5 @@ +change,s,q,,"yes|no|NO",," Change wavelength coordinate assignments?" +w1,r,q,,,," Starting wavelength" +w2,r,q,,,," Ending wavelength" +dw,r,q,,,," Wavelength interval per pixel" +nw,i,q,,,," Number of output pixels" diff --git a/noao/onedspec/disptrans.par b/noao/onedspec/disptrans.par new file mode 100644 index 00000000..1c40c895 --- /dev/null +++ b/noao/onedspec/disptrans.par @@ -0,0 +1,12 @@ +input,s,a,,,,Input spectra +output,s,a,,,,Output spectra +units,s,a,,,,Output dispersion units +error,r,h,0.01,1E-6,,Maximum output coordinate error in pixels +linearize,b,h,no,,,Resample the output to linear dispersion intervals? +verbose,b,h,yes,,,"Print log of transformations? + +# AIR/VACUUM CONVERSION" +air,s,h,"none","none|air2vac|vac2air",,Air-vacuum conversion? +t,r,h,15.,,,Temperture in degrees C +p,r,h,760,,,Pressure in mmHg +f,r,h,4,,,Water vapour pressure in mmHg diff --git a/noao/onedspec/doc/aidpars.hlp b/noao/onedspec/doc/aidpars.hlp new file mode 100644 index 00000000..be846306 --- /dev/null +++ b/noao/onedspec/doc/aidpars.hlp @@ -0,0 +1,563 @@ +.help aidpars Jan04 noao.onedspec +.ih +NAME +aidpars -- Automatic line identification parameters and algorithm +.ih +SUMMARY +The automatic line identification parameters and algorithm used in +\fBautoidentify\fR, \fBidentify\fR, and \fBreidentify\fR are described. +.ih +USAGE +aidpars +.ih +PARAMETERS +.ls reflist = "" +Optional reference coordinate list to use in the pattern matching algorithm +in place of the task coordinate list. This file is a simple text list of +dispersion coordinates. It would normally be a culled and limited list of +lines for the specific data being identified. +.le +.ls refspec = "" +Optional reference dispersion calibrated spectrum. This template spectrum +is used to select the prominent lines for the pattern matching algorithm. +It need not have the same dispersion increment or dispersion coverage as +the target spectrum. +.le +.ls crpix = "INDEF" +Coordinate reference pixel for the coordinate reference value specified by +the \fIcrval\fR parameter. This may be specified as a pixel coordinate +or an image header keyword name (with or without a '!' prefix). In the +latter case the value of the keyword in the image header of the spectrum +being identified is used. A value of INDEF translates to the middle of +the target spectrum. +.le +.ls crquad = INDEF +Quadratic correction to the detected pixel positions to "linearize" the +pattern of line spacings. The corrected positions x' are derived from +the measured positions x by + +.nf + x' = x + crquad * (x - crpix)**2 +.fi + +where crpix is the pixel reference point as defined by the \fIcrpix\fR +parameter. The measured and corrected positions may be examined by +using the 't' debug flag. The value may be a number or a header +keyword (with or without a '!' prefix). The default of INDEF translates +to zero; i.e. no quadratic correction. +.le +.ls cddir = "sign" (unknown|sign|increasing|decreasing) +The sense of the dispersion increment with respect to the pixel coordinates +in the input spectrum. The possible values are "increasing" or +"decreasing" if the dispersion coordinates increase or decrease with +increasing pixel coordinates, "sign" to use the sign of the dispersion +increment (positive is increasing and negative is decreasing), and +"unknown" if the sense is unknown and to be determined by the algorithm. +.le +.ls crsearch = "INDEF" +Coordinate reference value search radius. The value may be specified +as a numerical value or as an image header keyword (with or without +a '!' prefix) whose value is to be used. The algorithm will search +for a final coordinate reference value within this amount of the value +specified by \fIcrval\fR. If the value is positive the search radius is +the specified value. If the value is negative it is the absolute value +of this parameter times \fIcdelt\fR times the number of pixels in the +input spectrum; i.e. it is the fraction of dispersion range covered by the +target spectrum assuming a dispersion increment per pixel of \fIcdelt\fR. +A value of INDEF translates to -0.1 which corresponds to a search radius +of 10% of the estimated dispersion range. +.le +.ls cdsearch = "INDEF" +Dispersion coordinate increment search radius. The value may be specified +as a numerical value or as an image header keyword (with or without +a '!' prefix) whose value is to be used. The algorithm will search +for a dispersion coordinate increment within this amount of the value +specified by \fIcdelt\fR. If the value is positive the search radius is +the specified value. If the value is negative it is the absolute value of +this parameter times \fIcdelt\fR; i.e. it is a fraction of \fIcdelt\fR. +A value of INDEF translates to -0.1 which corresponds to a search radius +of 10% of \fIcdelt\fR. +.le +.ls ntarget = 100 +Number of spectral lines from the target spectrum to use in the pattern +matching. +.le +.ls npattern = 5 +Initial number of spectral lines in patterns to be matched. There is a +minimum of 3 and a maximum of 10. The algorithm starts with the specified +number and if no solution is found with that number it is iteratively +decreased by one to the minimum of 3. A larger number yields fewer +and more likely candidate matches and so will produce a result sooner. +But in order to be thorough the algorithm will try smaller patterns to +search more possiblities. +.le +.ls nneighbors = 10 +Number of neighbors to use in making patterns of lines. This parameter +restricts patterns to include lines which are near each other. +.le +.ls nbins = 6 +Maximum number of bins to divide the reference coordinate list or spectrum +in searching for a solution. When there are no weak dispersion constraints +the algorithm subdivides the full range of the coordinate list or reference +spectrum into one bin, two bins, etc. up to this maximum. Each bin is +searched for a solution. +.le +.ls ndmax = 1000 +Maximum number of candidate dispersions to examine. The algorithm ranks +candidate dispersions by how many candidate spectral lines are fit and the +the weights assigned by the pattern matching algorithm. Starting from +the highest rank it tests each candidate dispersion to see if it is +a satisfactory solution. This parameter determines how many candidate +dispersion in the ranked list are examined. +.le +.ls aidord = 3 (minimum of 2) +The order of the dispersion function fit by the automatic identification +algorithm. This is the number of polynomial coefficients so +a value of two is a linear function and a value of three is a quadratic +function. The order should be restricted to values of two or three. +Higher orders can lead to incorrect solutions because of the increased +degrees of freedom if finding incorrect line identifications. +.le +.ls maxnl = 0.02 +Maximum non-linearity allowed in any trial dispersion function. +The definition of the non-linearity test is + +.nf + maxnl > (w(0.5) - w(0)) / (w(1) - w(0)) - 0.5 +.fi + +where w(x) is the dispersion function value (e.g. wavelength) of the fit +and x is a normalized pixel positions where the endpoints of the spectrum +are [0,1]. If the test fails on a trial dispersion fit then a linear +function is determined. +.le +.ls nfound = 6 +Minimum number of identified spectral lines required in the final solution. +If a candidate solution has fewer identified lines it is rejected. +.le +.ls sigma = 0.05 +Sigma (uncertainty) in the line center estimates specified in pixels. +This is used to propagate uncertainties in the line spacings in +the observed patterns of lines. +.le +.ls minratio = 0.1 +Minimum spacing ratio used. Patterns of lines in which the ratio of +spacings between consecutive lines is less than this amount are excluded. +.le +.ls rms = 0.1 +RMS goal for a correct dispersion solution. This is the RMS in the +measured spectral lines relative to the expected positions from the +coordinate line list based on the coordinate dispersion solution. +The parameter is specified in terms of the line centering parameter +\fIfwidth\fR since for broader lines the pixel RMS would be expected +to be larger. A pixel-based RMS criterion is used to be independent of +the dispersion. The RMS will be small for a valid solution. +.le +.ls fmatch = 0.2 +Goal for the fraction of unidentified lines in a correct dispersion +solution. This is the fraction of the strong lines seen in the spectrum +which are not identified and also the fraction of all lines in the +coordinate line list, within the range of the dispersion solution, not +identified. Both fractions will be small for a valid solution. +.le +.ls debug = "" +Print or display debugging information. This is intended for the developer +and not the user. The parameter is specified as a string of characters +where each character displays some information. The characters are: + +.nf + a: Print candidate line assignments. + b: Print search limits. + c: Print list of line ratios. +* d: Graph dispersions. +* f: Print final result. +* l: Graph lines and spectra. + r: Print list of reference lines. +* s: Print search iterations. + t: Print list of target lines. + v: Print vote array. + w: Print wavelength bin limits. +.fi + +The items with an asterisk are the most useful. The graphs are exited +with 'q' or 'Q'. +.le +.ih +DESCRIPTION +The \fBaidpars\fR parameter set contains the parameters for the automatic +spectral line identification algorithm used in the task \fBautoidentify\fR, +\fBidentify\fR, and \fBreidentify\fR. These tasks include the parameter +\fIaidpars\fR which links to this parameters set. Typing \fBaidpars\fR +allows these parameters to be edited. When editing the parameters of the +other tasks with \fBeparam\fR one can edit the \fBaidpars\fR parameters by +type ":e" when pointing to the \fIaidpars\fR task parameter. The values of +the \fBaidpars\fR parameters may also be set on the command line for the +task. The discussion which follows describes the parameters and the +algorithm. + +The goal of the automatic spectral line identification algorithm is to +automate the identification of spectral lines so that given an observed +spectrum of a spectral line source (called the target spectrum) and a file +of known dispersion coordinates for the lines, the software will identify +the spectral lines and use these identifications to determine a +dispersion function. This algorithm is quite general so that the correct +identifications and dispersion function may be found even when there is +limited or no knowledge of the dispersion coverage and resolution of the +observation. + +However, when a general line list, including a large dispersion range and +many weak lines, is used and the observation covers a much smaller portion +of the coordinate list the algorithm may take a long to time or even fail +to find a solution. Thus, it is highly desirable to provide additional +input giving approximate dispersion parameters and their uncertainties. +When available, a dispersion calibrated reference spectrum (not necessarily +of the same resolution or wavelength coverage) also aids the algorithm by +indicating the relative strengths of the lines in the coordinate file. The +line strengths need not be very similar (due to different lamps or +detectors) but will still help separate the inherently weak and strong +lines. + + +The Input + +The primary inputs to the algorithm are the observed one dimensional target +spectrum in which the spectral lines are to be identified and a dispersion +function determined and a file of reference dispersion coordinates. These +inputs are provided in the tasks using the automatic line identification +algorithm. + +One way to limit the algorithm to a specific dispersion region and to the +important spectral lines is to use a limited coordinate list. One may do +this with the task coordinate list parameter (\fIcoordlist\fR). However, +it is desirable to use a standard master line list that includes all the +lines, both strong and weak. Therefore, one may specify a limited line +list with the parameter \fIreflist\fR. The coordinates in this list will +be used by the automatic identification algorithm to search for patterns +while using the primary coordinate list for adding weaker lines during the +dispersion function fitting. + +The tasks \fBautoidentify\fR and \fBidentify\fR also provide parameters to +limit the search range. These parameters specify a reference dispersion +coordinate (\fIcrval\fR) and a dispersion increment per pixel (\fIcdelt\fR). +When these parameters are INDEF this tells the algorithm to search for a +solution over the entire range of possibilities covering the coordinate +line list or reference spectrum. + +The reference dispersion coordinate refers to an approximate coordinate at +the reference pixel coordinate specified by the parameter \fIcrpix\fR. +The default value for the reference pixel coordinate is INDEF which +translates to the central pixel of the target spectrum. + +The parameters \fIcrsearch\fR and \fIcdsearch\fR specify the expected range +or uncertainty of the reference dispersion coordinate and dispersion +increment per pixel respectively. They may be specified as an absolute +value or as a fraction. When the values are positive they are used +as an absolute value; + +.nf + crval(final) = \fIcrval\fR +/- \fIcrsearch\fR + cdelt(final) = \fIcdelt\fR +/- \fIcdsearch\fR. +.fi + +When the values are negative they are used as a fraction of the dispersion +range or fraction of the dispersion increment; + +.nf + crval(final) = \fIcrval\fR +/- abs (\fIcrsearch\fR * \fIcdelt\fR) * N_pix + cdelt(final) = \fIcdelt\fR +/- abs (\fIcdsearch\fR * \fIcdelt\fR) +.fi + +where abs is the absolute value function and N_pix is the number of pixels +in the target spectrum. When the ranges are not given explicitly, that is +they are specified as INDEF, default values of -0.1 are used. + +The parameters \fIcrval\fR, \fIcdelt\fR, \fIcrpix\fR, \fIcrsearch\fR, +and \fIcdsearch\fR may be given explicit numerical values or may +be image header keyword names. In the latter case the values of the +indicated keywords are used. This feature allows the approximate +dispersion range information to be provided by the data acquisition +system; either by the instrumentation or by user input. + +Because sometimes only the approximate magnitude of the dispersion +increment is known and not the sign (i.e. whether the dispersion +coordinates increase or decrease with increasing pixel coordinates) +the parameter \fIcdsign\fR specifies if the dispersion direction is +"increasing", "decreasing", "unknown", or defined by the "sign" of the +approximate dispersion increment parameter (sign of \fIcdelt\fR). + +The above parameters defining the approximate dispersion of the target +spectrum apply to \fIautoidentify\fR and \fIidentify\fR. The task +\fBreidentify\fR does not use these parameters except that the \fIshift\fR +parameter corresponds to \fIcrsearch\fR if it is non-zero. This task +assumes that spectra to be reidentified are the same as a reference +spectrum except for a zero point dispersion offset; i.e. the approximate +dispersion parameters are the same as the reference spectrum. The +dispersion increment search range is set to be 5% and the sign of the +dispersion increment is the same as the reference spectrum. + +An optional input is a dispersion calibrated reference spectrum (referred to +as the reference spectrum in the discussion). This is specified either in +the coordinate line list file or by the parameter \fIrefspec\fR. To +specify a spectrum in the line list file the comment "# Spectrum " +is included where is the image filename of the reference spectrum. +Some of the standard line lists in linelists$ may include a reference +spectrum. The reference spectrum is used to select the strongest lines for +the pattern matching algorithm. + + +The Algorithm + +First a list of the pixel positions for the strong spectral lines in the +target spectrum is created. This is accomplished by finding the local +maxima, sorting them by pixel value, and then using a centering algorithm +(\fIcenter1d\fR) to accurately find the centers of the line profiles. Note +that task parameters \fIftype\fR, \fIfwidth\fR, \fIcradius\fR, +\fIthreshold\fR, and \fIminsep\fR are used for the centering. The number +of spectral lines selected is set by the parameter \fIntarget\fR. + +In order to insure that lines are selected across the entire spectrum +when all the strong lines are concentrated in only a part of the +spectrum, the spectrum is divided into five regions and approximately +a fifth of the requested number of lines is found in each region. + +A list of reference dispersion coordinates is selected from the coordinate +file (\fIcoordlist\fR or \fIreflist\fR). The number of reference +dispersion coordinates is set at twice the number of target lines found. +The reference coordinates are either selected uniformly from the coordinate +file or by locating the strong spectral lines (in the same way as for the +target spectrum) in a reference spectrum if one is provided. The selection +is limited to the expected range of the dispersion as specified by the +user. If no approximate dispersion information is provided the range of +the coordinate file or reference spectrum is used. + +The ratios of consecutive spacings (the lists are sorted in increasing +order) for N-tuples of coordinates are computed from both lists. The size +of the N-tuple pattern is set by the \fInpattern\fR parameter. Rather than +considering all possible combinations of lines only patterns of lines with +all members within \fInneighbors\fR in the lists are used; i.e. the first +and last members of a pattern must be within \fInneighbors\fR of each other +in the lists. The default case is to find all sets of five lines which are +within ten lines of each other and compute the three spacing ratios. +Because very small spacing ratios become uncertain, the line patterns are +limited to those with ratios greater than the minimum specified by the +\fIminratio\fR parameter. Note that if the direction of the dispersion is +unknown then one computes the ratios in the reference coordinates in both +directions. + +The basic idea is that similar patterns in the pixel list and the +dispersion list will have matching spacing ratios to within a tolerance +derived by the uncertainties in the line positions (\fIsigma\fR) from the +target spectrum. The reference dispersion coordinates are assumed to have +no uncertainty. All matches in the ratio space are found between patterns +in the two lists. When matches are made then the candidate identifications +(pixel, reference dispersion coordinate) between the elements of the +patterns are recorded. After finding all the matches in ratio space a +count is made of how often each possible candidate identification is +found. When there are a sufficient number of true pairs between the lists +(of order 25% of the shorter list) then true identifications will appear in +common in many different patterns. Thus the highest counts of candidate +identifications are the most likely to be true identifications. + +Because the relationship between the pixel positions of the lines in the +target spectrum and the line positions in the reference coordinate space +is generally non-linear the line spacing ratios are distorted and may +reduce the pattern matching. The line patterns are normally restricted +to be somewhat near each other by the \fInneighbors\fR so some degree of +distortion can be tolerated. But in order to provide the ability to remove +some of this distortion when it is known the parameter \fIcrquad\fR is +provided. This parameter applies a quadratic transformation to the measured +pixel positions to another set of "linearized" positions which are used +in the line ratio pattern matching. The form of the transformation is + +.nf + x' = x + crquad * (x - crpix)**2 +.fi + +where x is the measured position, x' is the transformed position, +crquad is the value of the distortion parameter, and crpix is the value +of the coordinate reference position. + +If approximate dispersion parameters and search ranges are defined then +candidate identifications which fall outside the range of dispersion +function possibilities are rejected. From the remaining candidate +identifications the highest vote getters are selected. The number selected +is three times the number of target lines. + +All linear dispersions functions, where dispersion and pixel coordinates +are related by a zero point and slope, are found that pass within two +pixels of two or more of the candidate identifications. The dispersion +functions are ranked primarily by the number of candidate identifications +fitting the dispersion and secondarily by the total votes in the +identifications. Only the highest ranking candidate linear dispersion +are kept. The number of candidate dispersions kept is set by the +parameter \fIndmax\fR. + +The candidate dispersions are evaluated in order of their ranking. Each +line in the coordinate file (\fIcoordlist\fR) is converted to a pixel +coordinate based on the dispersion function. The centering algorithm +attempts to find a line profile near that position as defined by the +\fImatch\fR parameter. This may be specified in pixel or dispersion +coordinates. All the lines found are used to fit a polynomial dispersion +function with \fIaidord\fR coefficients. The order should be linear or +quadratic because otherwise the increased degrees of freedom allow +unrealistic dispersion functions to appear to give a good result. A +quadratic function (\fIaidord\fR = 3) is allowed since this is the +approximate form of many dispersion functions. + +However, to avoid unrealistic dispersion functions a test is made that +the maximum amplitude deviation from a linear function is less than +an amount specified by the \fImaxnl\fR parameter. The definition of +the test is + +.nf + maxnl > (w(0.5) - w(0)) / (w(1) - w(0)) - 0.5 +.fi + +where w(x) is the dispersion function value (e.g. wavelength) of the fit +and x is a normalized pixel positions where the endpoints of the spectrum +are [0,1]. What this relation means is that the wavelength interval +between one end and the center relative to the entire wavelength interval +is within maxnl of one-half. If the test fails then a linear function +is fit. The process of adding lines based on the last dispersion function +and then refitting the dispersion function is iterated twice. At the end +of this step if fewer than the number of lines specified by the parameter +\fInfound\fR have been identified the candidate dispersion is eliminated. + +The quality of the line identifications and dispersion solution is +evaluated based on three criteria. The first one is the root-mean-square +of the residuals between the pixel coordinates derived from lines found +from the dispersion coordinate file based on the dispersion function and +the observed pixel coordinates. This pixel RMS is normalized by the target +RMS set with the \fIrms\fR parameter. Note that the \fIrms\fR parameter +is specified in units of the \fIfwidth\fR parameter. This is because if +the lines are broader, requiring a larger fwidth to obtain a centroid, +then the expected uncertainty would be larger. A good solution will have +a normalized rms value less than one. A pixel RMS criterion, as opposed +to a dispersion coordinate RMS, is used since this is independent of the +actual dispersion of the spectrum. + +The other two criteria are the fraction of strong lines from the target +spectrum list which were not identified with lines in the coordinate file +and the fraction of all the lines in the coordinate file (within the +dispersion range covered by the candidate dispersion) which were not +identified. These are normalized to a target value given by \fIfmatch\fR. +The default matching goal is 0.3 which means that less than 30% of +the lines should be unidentified or greater than 70% should be identified. +As with the RMS, a value of one or less corresponds to a good solution. + +The reason the fraction identified criteria are used is that the pixel RMS +can be minimized by finding solutions with large dispersion increment per +pixel. This puts all the lines in the coordinate file into a small range +of pixels and so (incorrect) lines with very small residuals can be found. +The strong line identification criterion is clearly a requirement that +humans use in evaluating a solution. The fraction of all lines identified, +as opposed to the number of lines identified, in the coordinate file is +included to reduce the case of a large dispersion increment per pixel +mapping a large number of lines (such as the entire list) into the range of +pixels in the target spectrum. This can give the appearance of finding a +large number of lines from the coordinate file. However, an incorrect +dispersion will also find a large number which are not matched. Hence the +fraction not matched will be high. + +The three criteria, all of which are normalized so that values less +than one are good, are combined to a single figure of merit by a weighted +average. Equal weights have been found to work well; i.e. each criterion +is one-third of the figure of merit. In testing it has been found that all +correct solutions over a wide range of resolutions and dispersion coverage +have figures of merit less than one and typically of order 0.2. All +incorrect candidate dispersion have values of order two to three. + +The search for the correct dispersion function terminates immediately, +but after checking the first five most likely candidates, when +a figure of merit less than one is found. The order in which the candidate +dispersions are tested, that is by rank, was chosen to try the most promising +first so that often the correct solution is found on the first attempt. + +When the approximate dispersion is not known or is imprecise it is +often the case that the pixel and coordinate lists will not overlap +enough to have a sufficient number true coordinate pairs. Thus, at a +higher level the above steps are iterated by partitioning the dispersion +space searched into bins of various sizes. The largest size is the +maximum dispersion range including allowance for the search radii. +The smallest size bin is obtained by dividing the dispersion range by +the number specified by the \fInbins\fR parameter. The actual number +of bins searched at each bin size is actually twice the number of +bins minus one because the bins are overlapped by 50%. + +The search is done starting with bins in the middle of the size range and +in the middle of the dispersion range and working outward towards larger +and smaller bins and larger and smaller dispersion ranges. This is done to +improved the chances of finding the correction dispersion function in the +smallest number of steps. + +Another iteration performed if no solution is found after trying all the +candidate dispersion and bins is to reduce the number of lines in the +pattern. So the parameter \fInpattern\fR is an initial maximum pattern. +A larger pattern gives fewer and higher quality candidate identifications +and so converges faster. However, if no solution is found the algorithm +tries more possible matches produced by a lower number of lines in +the pattern. The pattern groups are reduced to a minimum of three lines. + +When a set of line identifications and dispersion solution satisfying the +figure of merit criterion is found a final step is performed. +Up to this point only linear dispersion functions are used since higher order +function can be stretch in unrealistic ways to give good RMS values +and fit all the lines. The final step is to use the line identifications +to fit a dispersion function using all the parameters specified by the +user (such as function type, order, and rejection parameters). This +is iterated to add new lines from the coordinate list based on the +more general dispersion function and then obtain a final dispersion +function. The line identifications and dispersion function are then +returned to the task using this automatic line identification algorithm. + +If a satisfactory solution is not found after searching all the +possibilities the algorithm will inform the task using it and the task will +report this appropriately. +.ih +EXAMPLES +1. List the parameters. + +.nf + cl> lpar aidpars +.fi + +2. Edit the parameters with \fBeparam\fR. + +.nf + cl> aidpars +.fi + +3. Edit the \fBaidpars\fR parameters from within \fBautoidentify\fR. + +.nf + cl> epar autoid + [edit the parameters] + [move to the "aidpars" parameter and type :e] + [edit the aidpars parameters and type :q or EOF character] + [finish editing the autoidentify parameters] + [type :wq or the EOF character] +.fi + +4. Set one of the parameters on the command line. + +.nf + cl> autoidentify spec002 5400 2.5 crpix=1 +.fi +.ih +REVISIONS +.ls AIDPARS V2.12.2 +There were many changes made in the paramters and algorithm. New parameters +are "crquad" and "maxnl". Changed definitions are for "rms". Default +value changes are for "cddir", "ntarget", "ndmax", and "fmatch". The most +significant changes in the algorithm are to allow for more non-linear +dispersion with the "maxnl" parameter, to decrease the "npattern" value +if no solution is found with the specified value, and to search a larger +number of candidate dispersions. +.le +.ls AIDPARS V2.11 +This parameter set is new in this version. +.le +.ih +SEE ALSO +autoidentify, identify, reidentify, center1d +.endhelp diff --git a/noao/onedspec/doc/autoidentify.hlp b/noao/onedspec/doc/autoidentify.hlp new file mode 100644 index 00000000..a344031a --- /dev/null +++ b/noao/onedspec/doc/autoidentify.hlp @@ -0,0 +1,370 @@ +.help autoidentify Jan96 noao.onedspec +.ih +NAME +autoidentify -- Automatically identify lines and fit dispersion +.ih +SUMMARY +Spectral lines are automatically identified from a list of coordinates +by pattern matching. The identified lines are then used to fit a +dispersion function which is written to a database for later use +in dispersion calibration. After a solution is found the identified +lines and dispersion function may be examined interactively. +.ih +USAGE +autoidentify images crval cdelt +.ih +PARAMETERS +.ls images +List of images containing one dimensional spectra in which to identify +spectral lines and fit dispersion functions. For two and three dimensional +spectral and spatial data one may use an image section to select a one +dimensional spectral vector or use the \fIsection\fR parameter. +.le +.ls crval, cdelt +These parameters specify an approximate coordinate value and coordinate +interval per pixel. They may be specified as numerical values, INDEF, or +image header keyword names whose values are to be used. The coordinate +reference value is for the pixel specified by the parameter +\fIaidpars.crpix\fR. The default reference pixel is INDEF which means the +middle of the spectrum. By default only the magnitude of the coordinate +interval is used and the search will include both increasing and decreasing +coordinate values with increasing pixel values. If one or both of these +parameters are specified as INDEF the search for a solution will be slower +and more likely to fail. +.le +.ls coordlist = "" +Coordinate list consisting of an list of spectral line coordinates. +A comment line of the form "# units ", where is one of the +understood units names, defines the units of the coordinate list. If no units +are specified then Angstroms are assumed. +The line list is used for both the final identifications and for the set of +lines to use in the automatic search. A restricted search list may be +specified with the parameter \fIaidpars.reflist\fR. The line list may +contain a comment line of the form "# Spectrum ", where is a +filename containing a reference spectrum. The reference spectrum will be +used in selecting the strong lines for the automatic search. A reference +spectrum may also be specified with the parameter \fIaidpars.refspec\fR. + +Some standard line lists are available in the directory "linelists$". +See the help topic \fIlinelists\fR for the available line lists. +.le +.ls units = "" +The units to use if no database entry exists. The units are specified as +described in + +.nf + cl> help onedspec.package section=units +.fi + +If no units are specified and a coordinate list is used then the units of +the coordinate list are selected. If a database entry exists then the +units defined there override both this parameter and the coordinate list. +.le +.ls interactive = yes (no|yes|NO|YES) +After automatically identifying the spectral lines and dispersion function +review and modify the solution interactively? If "yes" a query is given +for each spectrum providing the choice of interactive review. The +query may be turned off during execution. If "YES" the interactive review +is entered automatically without a query. The interactive, graphical +review is the same as the task \fBidentify\fR with a few restriction. +.le +.ls aidpars = "" (parameter set) +Parameter set for the automatic line identification algorithm. The +parameters are described in the help topic \fBaidpars\fR. +.le + +For two and three dimensional spectral images the following parameters are +used to select a one dimensional spectrum. +.ls section = "middle line" +If an image is not one dimensional or specified as a one dimensional image +section then the image section given by this parameter is used. The +section defines a one dimensional spectrum. The dispersion direction is +derived from the vector direction. + +The section parameter may be specified directly as an image section or +in one of the following forms + +.nf +line|column|x|y|z first|middle|last|# [first|middle|last|#]] +first|middle|last|# [first|middle|last|#] line|column|x|y|z +.fi + +where each field can be one of the strings separated by | except for # +which is an integer number. The field in [] is a second designator which +is used with three dimensional data. Abbreviations are allowed though +beware that 'l' is not a sufficient abbreviation. +.le +.ls nsum = "1" +Number of lines, columns, or bands across the designated dispersion axis to +be summed when the image is a two or three dimensional image. +It does not apply to multispec format spectra. If the image is three +dimensional an optional second number can be specified for the higher +dimensional axis (the first number applies to the lower axis number and +the second to the higher axis number). If a second number is not specified +the first number is used for both axes. +.le + +The following parameters are used in finding spectral lines. +.ls ftype = "emission" +Type of spectral lines to be identified. The possibly abbreviated choices are +"emission" and "absorption". +.le +.ls fwidth = 4. +Full-width at the base (in pixels) of the spectral lines to be identified. +.le +.ls cradius = 5. +The maximum distance, in pixels, allowed between a line position +and the initial estimate when defining a new line. +.le +.ls threshold = 0. +In order for a line center to be determined the range of pixel intensities +around the line must exceed this threshold. +.le +.ls minsep = 2. +The minimum separation, in pixels, allowed between line positions +when defining a new line. +.le +.ls match = -3. +The maximum difference for a match between the line coordinate derived from +the dispersion function and a coordinate in the coordinate list. Positive +values are in user coordinate units and negative values are in units of +pixels. +.le + +The following parameters are used to fit a dispersion function to the user +coordinates. The \fBicfit\fR routines are used and further descriptions +about these parameters may be found under that topic. +.ls function = "spline3" +The function to be fit to user coordinates as a function of the pixel +coordinates. The choices are "chebyshev", "legendre", "spline1", or "spline3". +.le +.ls order = 1 +Order of the fitting function. The order is the number of polynomial +terms (coefficients) or the number of spline pieces. +.le +.ls sample = "*" +Sample regions for fitting specified in pixel coordinates. +.le +.ls niterate = 10 +Number of rejection iterations. +.le +.ls low_reject = 3.0, high_reject = 3.0 +Lower and upper residual rejection in terms of the RMS of the fit. +.le +.ls grow = 0 +Distance from a rejected point in which additional points are automatically +rejected regardless of their residuals. +.le + +The following parameters control the input and output. +.ls dbwrite = "yes" (no|yes|NO|YES) +Automatically write or update the database with the line identifications +and dispersion function? If "no" or "NO" then there is no database +output. If "YES" the results are automatically written to the database. +If "yes" a query is made allowing the user to reply with "no", "yes", "NO" +or "YES". The negative responses do not write to the database and the +affirmative ones do write to the database. The upper-case responses +suppress any further queries for any remaining spectra. +.le +.ls overwrite = yes +Overwrite previous solutions in the database? If there is a previous +solution for the spectrum being identified this parameter selects whether +to skip the spectrum ("no") or find a new solution ("yes"). In the later +case saving the solution to the database will overwrite the previous +solution. +.le +.ls database = "database" +Database for reading and writing the line identifications and +dispersion functions. +.le +.ls verbose = yes +Print results of the identification on the standard output? +.le +.ls logfile = "logfile" +Filename for recording log information about the identifications. +The null string, "", may be specified to skip recording the log information. +.le +.ls plotfile = "" +Filename for recording log plot information as IRAF metacode. A +null string, "", may be specified to skip recording the plot information. +(Plot output is currently not implemented.) +.le +.ls graphics = "stdgraph" +Graphics device for the interactive review. The default is the standard +graphics device which is generally a graphics terminal. +.le +.ls cursor = "" +Cursor input file for the interactive review. If a cursor file is not +given then the standard graphics cursor is read. +.le + +.ls query +Parameter used by the program to query the user. +.le +.ih +DESCRIPTION +\fBAutoidentify\fR automatically identifies spectral lines from a list of +spectral line coordinates (\fIcoordlist\fR) and determines a dispersion +function. The identified lines and the dispersion function may be reviewed +interactively (\fIinteractive\fR) and the final results are recorded in a +\fIdatabase\fR. + +Each image in the input list (\fIimages\fR) is considered in turn. If the +image is not one dimensional or a one dimensional section of an image then +the parameter \fIsection\fR is used to select a one dimensional +spectrum. It defines the dispersion direction and central spatial +coordinate(s). If the image is not one dimensional or a set of one +dimensional spectra n multispec format then the \fInsum\fR parameter +selects the number of neighboring lines, columns, and bands to sum. + +This task is not intended to be used on all spectra in an image since in +most cases the dispersion functions will be similar though possibly with a +zero point shift. Once one spectrum is identified the others may be +reidentified with \fBreidentify\fR. + +The coordinate list of spectral lines often covers a much larger dispersion +range than the spectra being identified. This is true of the standard line +lists available in the "linelists$" directory. While the algorithm for +identifying the lines will often succeed with a large line list it is not +guaranteed nor will it find the solution quickly without additional +information. Thus it is highly desirable to provide the algorithm with +approximate information about the spectra. Generally this information is +known by the observer or recorded in the image header. + +As implied in the previous paragraph, one may use a +limited coordinate line list that matches the dispersion coverage of the +spectra reasonably well (say within 100% of the dispersion range). +This may be done with the \fIcoordlist\fR parameter or a second +coordinate list used only for the automatic search may be specified +with the parameter \fIaidpars.reflist\fR. This allows using a smaller +culled list of lines for finding the matching patterns and a large list +with weaker lines for the final dispersion function fit. + +The alternative to a limited list is to use the parameters \fIcrval\fR and +\fIcdelt\fR to specify the approximate coordinate range and dispersion +interval per pixel. These parameters may be given explicitly or by +specifying image header keywords. The pixel to which \fIcrval\fR refers is +specified by the parameter \fIaidpars.crpix\fR. By default this is INDEF +which means use the center of the spectrum. The direction in which the +dispersion coordinates increase relative to the pixel coordinates may be +specified by the \fIaidpars.cddir\fR parameter. The default is "unknown" +to search in either direction. + +The algorithm used to automatically identify the spectral lines and +find a dispersion function is described under the help topic +\fBaidpars\fR. This topic also describes the various algorithm +parameters. The default parameters are adequate for most data. + +The characteristics of the spectral lines to be found and identified are +set by several parameters. The type of spectral lines, whether "emission" +or "absorption", is set by the parameter \fIftype\fR. For arc-line +calibration spectra this parameter is set to "emission". The full-width +(in pixels) at the base of the spectral lines is set by the parameter +\fIfwidth\fR. This is used by the centering algorithm to define the extent +of the line profile to be centered. The \fIthreshold\fR parameter defines +a minimum contrast (difference) between a line peak and the neighboring +continuum. This allows noise peaks to be ignored. Finding the center of a +possible line begins with an initial position estimate. This may be an +interactive cursor position or the expected position from the coordinate +line list. The centering algorithm then searches for a line of the +specified type, width, and threshold within a given distance, specified by +the \fIcradius\fR parameter. These parameters and the centering algorithm +are described by the help topic \fBcenter1d\fR. + +To avoid finding the same line multiple times, say when there are two lines +in the line list which are blended into a single in the observation, the +\fIminsep\fR parameter rejects any new line position found within that +distance of a previously defined line. + +The automatic identification of lines includes matching a line position in +the spectrum against the list of coordinates in the coordinate line list. +The \fImatch\fR parameter defines how close the measured line position must +be to a coordinate in the line list to be considered a possible +identification. This parameter may be specified either in user coordinate +units (those used in the line list) by using a positive value or in pixels +by using a negative value. In the former case the line position is +converted to user coordinates based on a dispersion function and in the +latter the line list coordinate is converted to pixels using the inverse of +the dispersion function. + +The dispersion function is determined by fitting a set of pixel positions +and user coordinate identifications by least squares to a specified +function type. The fitting requires a function type, \fIfunction\fR, and +the order (number of coefficients or spline pieces), \fIorder\fR. +In addition the fitting can be limited to specified regions, \fIsample\fR, +and provide for the rejection of points with large residuals. These +parameters are set in advance and used during the automatic dispersion +function determination. Later the fitting may be modified interactively. +For additional discussion of these parameters see \fBicfit\fR. + +The output of this program consists of log information, plot information, +and the line identifications and dispersion function. The log information +may be appended to the file specified by the \fIlogfile\fR parameter +and printed to the standard output (normally the terminal) by +setting the \fIverbose\fR parameter to yes. This information consists +of a banner line, a line of column labels, and results for each spectrum. +For each spectrum the spectrum name, the number of spectral lines found, +the dispersion coordinate at the middle of the spectrum, the dispersion +increment per pixel, and the root-mean-square (RMS) of the residuals for +the lines used in the dispersion function fit is recorded. The units of +the RMS are those of the user (line list) coordinates. If a solution is +not found the spectrum name and a message is printed. + +The line identifications and dispersion function are written to the +specified \fIdatabase\fR. The current format of the database is described +in the help for \fIidentify\fR. If a database entry is already present for +a spectrum and the parameter \fIoverwrite\fR is "no" then the spectrum is +skipped and a message is printed to the standard output. After a solution +is found and after any interactive review (see below) the results may be +written to the database. The \fIdbwrite\fR parameter may be specified as +"no" or "NO" to disable writing to the database (and no queries will be +made), as "yes" to query whether to or not to write to the database, or as +"YES" to automatically write the results to the database with no queries. +When a query is given the responses may be "no" or "yes" for an individual +spectrum or "NO" or "YES" for all remaining spectra without further +queries. + +After a solution is found one may review and modify the line +identifications and dispersion function using the graphical functions of +the \fBidentify\fR task (with the exception that a new spectrum may not be +selected). The review mode is selected with the \fIinteractive\fR +parameter. If the parameter is "no" or "NO" then no interactive review +will be provided and there will be no queries either. If the parameter is +"YES" then the graphical review mode will be entered after each solution is +found without any query. If the parameter is "yes" then a query will be +made after a solution is found and after any log information is written to +the terminal. One may respond to the query with "no" or "yes" for an +individual spectrum or "NO" or "YES" for all remaining spectra without +further queries. For "yes" or "YES" the \fIidentify\fR review mode is +entered. To exit type 'q'. +.ih +EXAMPLES +1. The following example finds a dispersion solution for the middle column +of a long slit spectrum of a He-Ne-Ar arc spectrum using all the +interactive options. + +.nf + cl> autoid arc0022 6000 6 coord=linelists$henear.dat sec="mid col" + AUTOIDENITFY: NOAO/IRAF IRAFX valdes@puppis Thu 15:50:31 25-Jan-96 + Spectrum # Found Midpoint Dispersion RMS + arc0022[50,*] 50 5790. 6.17 0.322 + arc0022[50,*]: Examine identifications interactively? (yes): + arc0022[50,*]: Write results to database? (yes): yes +.fi + +2. The next example shows a non-interactive mode with no queries for +the middle fiber of an extracted multispec image. + +.nf + cl> autoid.coordlist="linelists$henear.dat" + cl> autoid a0003 5300 3.2 interactive- verbose- dbwrite=YES +.fi +.ih +REVISIONS +.ls AUTOIDENTIFY V2.11 +This task is new in this version. +.le +.ih +SEE ALSO +identify, reidentify, aidpars, linelists, center1d, icfit, gtools +.endhelp diff --git a/noao/onedspec/doc/bplot.hlp b/noao/onedspec/doc/bplot.hlp new file mode 100644 index 00000000..f2214b94 --- /dev/null +++ b/noao/onedspec/doc/bplot.hlp @@ -0,0 +1,201 @@ +.help bplot Mar92 noao.onedspec +.ih +NAME +bplot -- Plot spectra noninteractively using SPLOT +.ih +USAGE +bplot images [records] +.ih +PARAMETERS +.ls images +List of images to be plotted. These may be one dimensional, multiaperture, +long slit, or nonspectral images. +.le +.ls records (imred.irs and imred.iids only) +List of records to be appended to the input image root names when +using record number extension format. The syntax of this list is comma +separated record numbers or ranges of record numbers. A range consists of +two numbers separated by a hyphen. A null list may be used if no record +number extensions are desired. +.le +.ls apertures = "" +List of apertures/lines/columns to be plotted in each image. If +\fIapertures\fR is null all of the apertures/lines/columns will be plotted. +.le +.ls band = 1 +The band or plane of a three dimensional image to be plotted in each image. +.le +.ls graphics = "stdgraph" +Output graphics device. This may be one of "stdgraph", "stdplot", +"stdvdm", or the actual device name. +.le +.ls cursor = "onedspec$gcurval.dat" +File(s) containing cursor commands for the SPLOT task. +The files will be cycled sequentially. If there is more than one file +usually the number of files will agree with the number of apertures +for each image since otherwise different cursor/aperture pairings will +occur. The default is a file containing only the (q)uit command. +.le + +The following parameters are used in response to particular keystrokes. +In \fBsplot\fR they are query parameters but in \fBbplot\fR they are hidden +parameters. +.ls next_image = "" +In response to 'g' (get next image) this parameter specifies the image. +.le +.ls new_image = "" +In response to 'i' (write current spectrum) this parameter specifies the +name of a new image to create or existing image to overwrite. +.le +.ls overwrite = yes +Overwrite an existing output image? If set to yes it is possible to write +back into the input spectrum or to some other existing image. Otherwise +the user is queried again for a new image name. +.le +.ls spec2 = "" +When adding, subtracting, multiplying, or dividing by a second spectrum +('+', '-', '*', '/' keys in the 'f' mode) this parameter is used to get +the name of the second spectrum. +.le +.ls constant = 0. +When adding or multiplying by a constant ('p' or 'm' keys in the 'f' mode) +the parameter is used to get the constant. +.le +.ls wavelength = 0. +This parameter is used to get a dispersion coordinate value during deblending or +when changing the dispersion coordinates with 'u'. +.le +.ls linelist = "" +During deblending this parameter is used to get a list of line positions +and widths. +.le +.ls wstart = 0., wend = 0., dw = 0. +In response to 'p' (convert to a linear wavelength scale) these parameter +specify the starting wavelength, ending wavelength, and wavelength per pixel. +.le +.ls boxsize = 2 +In response to 's' (smooth) this parameter specifies the box size in pixels +to be used for the boxcar smooth +.le +.ih +DESCRIPTION +The spectra in the input image list are successively processed by the task +\fBsplot\fR with input supplied by the cursor parameter and the output sent +to the specified graphics device. The range of apertures and bands +specified by \fIapertures\fR and \fIbands\fR will be processed for each +image. In the \fBiids/irs\fR packages the record extension syntax is used +with input root names and a record number list. The hidden parameters from +\fBsplot\fR apply to this task. + +The cursor file(s) consists of line(s) of the form: + + [x y 1] key [command] + +where x and y are the position of the cursor (may be zero or absent if the +cursor position is irrelevant) and key is one of the keystrokes understood +by \fBsplot\fR. If the key is ":" then the \fIcolon\fR command string follows. +The default cursor file consists of the single line: + + 0 0 1 q + +If more than one cursor file is specified they are sequentially assigned to +each aperture and the list is repeated as needed. This allows the aperture +to be manipulated in differing ways. +.ih +EXAMPLES +1. To plot all of apertures of the multiaperture spectra indicated by the file +"nite1.lst" on the default plotter and run in the background: + +.nf + cl> bplot @nite1.lst graphics=stdplot & +.fi + +2. To preview the plots: + +.nf + cl> bplot @nite1.lst graphics=stdgraph +.fi + +3. To produce a histogram type plot about Balmer alpha for aperture 5 of +each spectrum with the IRAF banner suppressed: + +.nf + cl> type curfile + 6555 0 1 a + 6570 0 1 a + q + cl> splot.options="auto hist nosysid" + cl> splot.xmin=6555 + cl> splot.xmax=6570 + cl> bplot @nite1.lst apertures=5 cursor=curfile +.fi + +4. To produce plots with four spectra per page: + +.nf + cl> bplot @nite1.lst ... >G nite1.mc + cl> gkimosaic nite1.mc dev=stdplot +.fi + +The first command redirects the output of the graphics to the metacode +file nite1.mc. The task \fBgkimosaic\fR is used to make multiple plots +per page. Other tasks in the \fBplot\fR package may be used to +manipulate and redisplay the contents of the metacode file. + +5. To plot a list of apertures with a different cursor file for each aperture: + +.nf + cl> bplot @nite1.lst apertures=3,9,14 cursor=@nite1.cur +.fi + +In this case the file "nite1.cur" is assumed to be a list of +individual cursor file names, for instance: + +.nf + cur.03 + cur.09 + cur.14 +.fi + +that are in one to one correspondence with the range of apertures. +.ih +REVISIONS +.ls BPLOT V2.10.3 +The query parameters from SPLOT were added as hidden parameters in BPLOT +to allow use of those keys in a batch way. +.le +.ls BPLOT V2.10 +The \fIapertures\fR and \fIband\fR parameters been added to select +apertures from multiple spectra and long slit images, and bands from 3D +images. Since the task is a script calling \fBsplot\fR, the many revisions +to that task also apply. The version in the \fBirs/iids\fR packages +selects spectra using the record number extension syntax. +.le +.ih +BUGS +The cursor file command keystrokes cannot include any of the cursor +mode (CAPITALIZED) keys. This results from the implementation of +the cursor mode commands as external to both BPLOT and SPLOT. + +When first entered, SPLOT will always display an initial plot. BPLOT +calls SPLOT once for each aperture in each image and thus produces +N(apertures)*N(images) initial plots. The plots are not optional because +of the possible confusion a blank screen might cause an inexperienced +user. If the initial plots are unwanted they must be edited out of the +graphics stream. This can be done as follows, by directing the +graphics output of BPLOT to a metacode file and then using GKIEXTRACT +to remove only the desired plots from the metacode file: + +.nf + cl> bplot @nite1.lst cursor=curfile >G nite1.mc + cl> gkiextract nite1.mc 2x2 | gkimosaic dev=stdplot +.fi + +This assumes that curfile is designed to produce only one plot in +addition to the non-optional initial plot. In this case there will be +two plots per aperture per image and we extract every other plot starting +with the second (as encoded in the range string: "2x2"). +.ih +SEE ALSO +splot, specplot, slist, gkiextract, gkimosaic, implot, graph, ranges +.endhelp diff --git a/noao/onedspec/doc/calibrate.hlp b/noao/onedspec/doc/calibrate.hlp new file mode 100644 index 00000000..cf68ac29 --- /dev/null +++ b/noao/onedspec/doc/calibrate.hlp @@ -0,0 +1,195 @@ +.help calibrate Mar93 noao.onedspec +.ih +NAME +calibrate -- Apply extinction corrections and flux calibrations +.ih +USAGE +calibrate input output [records] +.ih +PARAMETERS +.ls input +List of input spectra to be calibrated. When using record format +extensions the root names are specified, otherwise full image names +are used. +.le +.ls output +List of calibrated spectra. If no output list is specified or if the +output name is the same as the input name then the calibrated spectra +replace the input spectra. When using record format extensions the output +names consist of root names to which the appropriate record number +extension is added. The record number extension will be the same as the +input record number extension. The output spectra are coerced to have +real datatype pixels regardless of the pixel type. +.le +.ls records (imred.irs and imred.iids only) +The set of record number extensions to be applied to each input and output +root name when using record number extension format. The syntax consists +of comma separated numbers or ranges of numbers. A range consists of +two numbers separated by a hyphen. This parameter is not queried +when record number formats are not used. +.le +.ls extinct = yes +Apply extinction correction if a spectrum has not been previously +corrected? When applying an extinction correction, an extinction file +is required. +.le +.ls flux = yes +Apply a flux calibration if a spectrum has not been previously calibrated? +When applying a flux calibration, sensitivity spectra are required. +.le +.ls extinction = +Extinction file for the observation. Standard extinction files +are available in the "onedstds$" directory. +.le +.ls observatory = ")_.observatory" +Observatory at which the spectra were obtained if not specified in the +image header by the keyword OBSERVAT. The default is a redirection to the +package parameter of the same name. The observatory may be one of the +observatories in the observatory database, "observatory" to select the +observatory defined by the environment variable "observatory" or the +parameter \fBobservatory.observatory\fR, or "obspars" to select the current +parameters in the \fBobservatory\fR task. See \fBobservatory\fR for +additional information. +.le +.ls ignoreaps = no +Ignore aperture numbers and apply a single flux calibration to all +apertures? Normally multiaperture instruments have separate sensitivity +functions for each aperture while long slit or Fabry-Perot data use a +single sensitivity function where the apertures are to be ignored. The +sensitivity spectra are obtained by adding the aperture number as an +extension to the sensitivity spectrum root name. When apertures are +ignored the specified sensitivity spectrum name is used without adding an +extension and applied to all input apertures. +.le +.ls sensitivity = "sens" +The root name for the sensitivity spectra produced by \fBsensfunc\fR. +Normally with multiaperture instruments, \fBsensfunc\fR will produce a +spectrum appropriate to each aperture with an aperture number extension. +If the apertures are ignored (\fIignoreaps\fR = yes) then the sensitivity +spectrum specified is used for all apertures and no aperture number is +appended automatically. +.le +.ls fnu = no +The default calibration is into units of flux per unit wavelength (F-lambda). +If \fIfnu\fR = yes then the calibrated spectrum will be in units of +flux per unit frequency (F-nu). +.le +.ls airmass, exptime +If the airmass and exposure time are not in the header nor can they be +determined from other keywords in the header then these query parameters +are used to request the airmass and exposure time. The values are updated +in the input and output images. +.le +.ih +DESCRIPTION +The input spectra are corrected for extinction and calibrated to a flux +scale using sensitivity spectra produced by the task \fBsensfunc\fR. +One or both calibrations may be performed by selecting the appropriate +parameter flags. It is an error if no calibration is specified. Normally +the spectra should be extinction corrected if also flux calibrating. +The image header keywords DC-FLAG (or the dispersion type field in the +"multispec" world coordinate system), EX-FLAG, and CA-FLAG are checked for +dispersion solution (required), previous extinction correction, and +previous flux calibration. If previously calibrated the spectrum is +skipped and a new output image is not created. + +The input spectra are specified by a list of root names (when using record +extension format) or full image names. The output calibrated spectra may +replace the input spectra if no output spectra list is specified or if the +output name is the same as the input name. When using record number +extensions the output spectra will have the same extensions applied to the +root names as those used for the input spectra. + +When applying an extinction correction the AIRMASS keyword is sought. +If the keyword is not present then the airmass at the time defined +by the other header keywords is computed using the +latitude of the observatory and observation parameters in the image +header. The observatory is first determined from the image under the +keyword OBSERVAT. If absent the observatory specified by the task +parameter "observatory" is used. See \fBobservatory\fR for further +details of the observatory database. If the air mass cannot be +determined an error results. Currently a single airmass is used +and no correction for changing extinction during the observation is +made and adjustment to the middle of the exposure. The task +\fBsetairmass\fR provides a correction for the exposure time to compute +an effective air mass. Running this task before calibration is +recommended. + +If the airmass is not in the header and cannot be computed then +the user is queried for a value. The value entered is then +recorded in both the input and output image headers. Also if +the exposure time is not found then it is also queried and +recorded in the image headers. + +The extinction correction is given by the factor + + 10. ** (0.4 * airmass * extinction) + +where the extinction is the value interpolated from the specified +extinction file for the wavelength of each pixel. After extinction +correction the EX-FLAG is set to 0. + +When applying a flux calibration the spectra are divided by the +aperture sensitivity which is represented by a spectrum produced by +the task \fBsensfunc\fR. The sensitivity spectrum is in units of: + + 2.5 * Log10 [counts/sec/Ang / ergs/cm2/sec/Ang]. + +A new spectrum is created in "F-lambda" units - ergs/cm2/sec/Angstrom +or "F-nu" units - ergs/cm2/sec/Hz. The sensitivity must span the range of +wavelengths in the spectrum and interpolation is used if the wavelength +coordinates are not identical. If some pixels in the spectrum being +calibrated fall outside the wavelength range of the sensitivity function +spectrum a warning message giving the number of pixels outside the +range. In this case the sensitivity value for the nearest wavelength +in the sensitivity function is used. + +Multiaperture instruments typically have +a separate aperture sensitivity function for each aperture. The appropriate +sensitivity function for each input spectrum is selected based on the +spectrum's aperture by appending this number to the root sensitivity function +spectrum name. If the \fIignoreaps\fR flag is set, however, the aperture +number relation is ignored and the single sensitivity spectrum (without +extension) is applied. +.ih +EXAMPLES +1. To flux calibrates a series of spectra replacing the input spectra by +the calibrated spectra: + + cl> calibrate nite1 "" + +2. To only extinction correct echelle spectra: + + cl> calibrate ccd*.ec.imh new//ccd*.ec.imh flux- + +3. To flux calibrate a long slit spectrum: + +.nf + cl> dispaxis = 2 + cl> calibrate obj.imh fcobj.imh +.fi +.ih +REVISIONS +.ls CALIBRATE V2.10.3 +This task was revised to operate on 2D and 3D spatial spectra; i.e. long +slit and Fabry-Perot data cubes. This task now includes the functionality +previously found in \fBlongslit.extinction\fR and \fBlongslit.fluxcalib\fR. + +A query for the airmass and exposure time is now made if the information +is not in the header and cannot be computed from other header keywords. +.le +.ls CALIBRATE V2.10 +This task was revised to operate on nonlinear dispersion corrected spectra +and 3D images (the \fBapextract\fR "extras"). The aperture selection +parameter was eliminated (since the header structure does not allow mixing +calibrated and uncalibrated spectra) and the latitude parameter was +replaced by the observatory parameter. The observatory mechanism insures +that if the observatory latitude is needed for computing an airmass and the +observatory is specified in the image header the correct calibration will +be applied. The record format syntax is available in the \fBirs/iids\fR +packages. The output spectra are coerced to have real pixel datatype. +.le +.ih +SEE ALSO +setairmass, standard, sensfunc, observatory, continuum +.endhelp diff --git a/noao/onedspec/doc/continuum.hlp b/noao/onedspec/doc/continuum.hlp new file mode 100644 index 00000000..6bb4e05e --- /dev/null +++ b/noao/onedspec/doc/continuum.hlp @@ -0,0 +1,263 @@ +.help continuum Mar92 noao.onedspec +.ih +NAME +continuum -- Continuum normalize spectra +.ih +USAGE +continuum input output +.ih +PARAMETERS +.ls input +Input spectra to be continuum normalized. These may be any combination +of echelle, multiaperture, one dimensional, long slit, and spectral +cube images. +.le +.ls output +Output continuum normalized spectra. The number of output spectra must +match the number of input spectra. \fBOutput\fR may be omitted if +\fBlistonly\fR is yes. +.le +.ls lines = "*", bands = "1" +A range specifications for the image lines and bands to be fit. Unspecified +lines and bands will be copied from the original. If the value is "*", all of +the currently unprocessed lines or bands will be fit. A range consists of +a first line number and a last line number separated by a hyphen. A +single line number may also be a range and multiple ranges may be +separated by commas. +.le +.ls type = "ratio" +Type of output spectra. The choices are "fit" for the fitted function, +"ratio" for the ratio of the input spectra to the fit, "difference" for +the difference between the input spectra and the fit, and "data" for +the data minus any rejected points replaced by the fit. +.le +.ls replace = no +Replace rejected points by the fit in the difference, ratio, and +data output types? +.le +.ls wavescale = yes +Wavelength scale the X axis of the plot? This option requires that the +spectra be wavelength calibrated. If \fBwavescale\fR is no, the plots +will be in "channel" (pixel) space. +.le +.ls logscale = no +Take the log (base 10) of both axes? This can be used when \fBlistonly\fR +is yes to measure the exponent of the slope of the continuum. +.le +.ls override = no +Override previously normalized spectra? If \fBoverride\fR is yes and +\fBinteractive\fR is yes, the user will be prompted before each order is +refit. If \fBoverride\fR is no, previously fit spectra are silently +skipped. +.le +.ls listonly = no +Don't modify any images? If \fBlistonly\fR is yes, the \fBoutput\fR +image list may be skipped. +.le +.ls logfiles = "logfile" +List of log files to which to write the power series coefficients. If +\fBlogfiles\fR = NULL (""), the coefficients will not be calculated. +.le +.ls interactive = yes +Perform the fit interactively using the icfit commands? This will allow +the parameters for each spectrum to be adjusted independently. A separate +set of the fit parameters (below) will be used for each spectrum and any +interactive changes to the parameters for a specific spectrum will be +remembered when that spectrum is fit in the next image. +.le +.ls sample = "*" +The ranges of X values to be used in the continuum fits. The units will vary +depending on the setting of the \fBwavescale\fR and \fBlogscale\fR +parameters. The default units are in wavelength if the spectra have +been dispersion corrected. +.le +.ls naverage = 1 +Number of sample points to combined to create a fitting point. +A positive value specifies an average and a negative value specifies +a median. +.le +.ls function = spline3 +Function to be fit to the spectra. The functions are +"legendre" (legendre polynomial), "chebyshev" (chebyshev polynomial), +"spline1" (linear spline), and "spline3" (cubic spline). The functions +may be abbreviated. The power series coefficients can only be +calculated if \fBfunction\fR is "legendre" or "chebyshev". +.le +.ls order = 1 +The order of the polynomials or the number of spline pieces. +.le +.ls low_reject = 2., high_reject = 0. +Rejection limits below and above the fit in units of the residual sigma. +.le +.ls niterate = 10 +Number of rejection iterations. +.le +.ls grow = 1. +When a pixel is rejected, pixels within this distance of the rejected pixel +are also rejected. +.le +.ls markrej = yes +Mark rejected points? If there are many rejected points it might be +desired to not mark rejected points. +.le +.ls graphics = "stdgraph" +Graphics output device for interactive graphics. +.le +.ls cursor = "" +Graphics cursor input. +.le +.ih +DESCRIPTION +A one dimensional function is fit to the continuum of spectra in a list of +echelle, multispec, or onedspec format images and then divided into the +spectrum to produce continuum normalized spectra. The first two formats +will normalize the spectra or orders (i.e. the lines) in each image. In +this description the term "spectrum" will refer to a line (in whatever +band) of an image while "image" will refer to all spectra in an image. The +parameters of the fit may vary from spectrum to spectrum within images and +between images. The fitted function may be a legendre polynomial, +chebyshev polynomial, linear spline, or cubic spline of a given order or +number of spline pieces. The output image is of pixel type real. + +The line/band numbers (for two/three dimensional images) are written to a +list of previously processed lines in the header keywords \fISFIT\fR and +\fISFITB\fR of the output image. A subsequent invocation of SFIT will only +process those requested spectra that are not in this list. This ensures +that even if the output image is the same as the input image that no +spectra will be processed twice and permits an easy exit from the task in +the midst of processing many spectra without losing any work or requiring +detailed notes. + +The points to be fit in each spectrum are determined by +selecting a sample of X values specified by the parameter \fIsample\fR +and taking either the average or median of the number of points +specified by the parameter \fInaverage\fR. The type of averaging is +selected by the sign of the parameter with positive values indicating +averaging, and the number of points is selected by the absolute value +of the parameter. The sample units will vary depending on the settings +of the \fBwavescale\fR and the \fBlogscale\fR parameters. Note that a +sample that is specified in wavelength units may be entirely outside +the domain of the data (in pixels) if some of the spectra are not +dispersion corrected. The syntax of the sample specification is a comma +separated, colon delimited list similar to the image section notation. +For example, the \fBsample\fR, "6550:6555,6570:6575" might be used to +fit the continuum near H-alpha. + +If \fIlow_reject\fR and/or \fIhigh_reject\fR are greater than zero the +sigma of the residuals between the fitted points and the fitted +function is computed and those points whose residuals are less than +\fI-low_reject\fR * sigma and greater than \fIhigh_reject\fR * sigma +are excluded from the fit. Points within a distance of \fIgrow\fR +pixels of a rejected pixel are also excluded from the fit. The +function is then refit without the rejected points. This rejection +procedure may be iterated a number of times given by the parameter +\fIniterate\fR. This is how the continuum is determined. + +If \fIreplace\fR is set then any rejected points from the fitting +are replaced by the fit in the data before outputing the difference, +ratio, or data. For example with replacing the difference will +be zero at the rejected points and the data output will be cleaned +of deviant points. + +A range specification is used to select the \fIlines\fR and \fIbands\fR to be +fit. These parameters may either be specified with the same syntax as the +\fBsample\fR parameter, or with the "hyphen" syntax used elsewhere in +IRAF. Note that a NULL range for \fBlines/bands\fR expands to \fBno\fR +lines, not to all lines. An asterisk (*) should be used to represent a +range of all of the image lines/bands. The fitting parameters (\fIsample, +naverage, function, order, low_reject, high_reject, niterate, grow\fR) +may be adjusted interactively if the parameter \fIinteractive\fR is +yes. The fitting is performed with the \fBicfit\fR package. The +cursor mode commands for this package are described in a separate help +entry under "icfit". Separate copies of the fitting parameters are +maintained for each line so that interactive changes to the parameter +defaults will be remembered from image to image. +.ih +PROMPTS +If several images or lines/bands are specified, the user is asked whether +to perform an interactive fit for each spectrum. The response +may be \fByes, no, skip, YES, NO\fR or \fBSKIP\fR. The meaning of each +response is: + +.nf + yes - Fit the next spectrum interactively. + no - Fit the next spectrum non-interactively. + skip - Skip the next spectrum in this image. + + YES - Interactively fit all of the spectra of + all of the images with no further prompts. + NO Non-interactively fit all chosen spectra of all images. + SKIP - This will produce a second prompt, "Skip what?", + with the choices: + + spectrum - skip this spectrum in all images + image - skip the rest of the current image + all - \fBexit\fR the program + This will \fBunlearn\fR the fit parameters + for all spectra! + cancel - return to the main prompt +.fi +.ih +EXAMPLES +1. To normalize all orders of the echelle spectrum for hd221170 + + cl> continuum hd221170.ec nhd221170.ec type=ratio + +Each order of the spectrum is graphed and the interactive options for +setting and fitting the continuum are available. The important +parameters are low_rejection (for an absorption spectrum), the function +type, and the order of the function; these fit parameters are +originally set to the defaults in the \fBcontinuum\fR parameter file. A +'?' will display a menu of cursor key options. Exiting with 'q' will +update the output normalized order for the current image and proceed to +the next order or image. + +The parameters of the fit for each order are initialized to the current +values the first time that the order is fit. In subsequent images, the +parameters for a order are set to the values from the previous image. +The first time an order is fit, the sample region is reset to the +entire order. Deleted points are ALWAYS forgotten from order to order +and image to image. + +2. To do several images at the same time + + cl> continuum spec*.imh c//spec*.imh + +Note how the image template concatenation operator is used to construct +the output list of spectra. Alternatively: + + cl> continuum @inlist @outlist + +where the two list files could have been created with the sections +command or by editing. + +3. To measure the power law slope of the continuum (fluxed data) + + cl> continuum uv.* type=ratio logscale+ listonly+ fun=leg order=2 +.ih +REVISIONS +.ls CONTINUUM V2.10.4 +The task was expanded to include fitting specified bands in 3D multispec +spectra. + +The task was expanded to include long slit and spectral cube data. +.le +.ls CONTINUUM V2.10 +This task was changed from a script based on \fBimages.fit1d\fR to a +task based on \fBsfit\fR. This provides for individual independent +continuum fitting in multiple spectra images and for additional +flexibility and record keeping. The parameters have been largely +changed. +.le +.ih +BUGS +The errors are not listed for the power series coefficients. + +Spectra that are updated when \fBlogscale\fR is yes are written with a +linear wavelength scale, but with a log normalized data value. + +Selection by aperture number is not supported. +.ih +SEE ALSO +sfit, fit1d, icfit, ranges +.endhelp diff --git a/noao/onedspec/doc/deredden.hlp b/noao/onedspec/doc/deredden.hlp new file mode 100644 index 00000000..862c441c --- /dev/null +++ b/noao/onedspec/doc/deredden.hlp @@ -0,0 +1,201 @@ +.help deredden Feb94 noao.onedspec +.ih +NAME +deredden -- Apply interstellar reddening correction +.ih +USAGE +deredden input output [records] value +.ih +PARAMETERS +.ls input +List of input spectra to be dereddened. When using record +format extensions the root names are specified, otherwise full +image names are used. +.le +.ls output +List of derreddened spectra. If no output list is specified then +the input spectra are modified. Also the output name may be +the same as the input name to replace the input spectra by the +calibrated spectra. When using record format extensions the +output names consist of root names to which the appropriate +record number extension is added. The record number extension +will be the same as the input record number extension. +.le +.ls records (imred.irs and imred.iids only) +The set of record number extensions to be applied to each input +and output root name when using record number extension +format. The syntax consists of comma separated numbers or +ranges of numbers. A range consists of two numbers separated +by a hyphen. This parameter is not queried when record number +formats are not used. +.le +.ls value +Extinction parameter value as selected by the type parameter. +This value may be a visual extinction, A(V), the color excess between +B and V, E(B-V), or the logarithmic H beta extinction. +These quantities are discussed further below. +.le +.ls R = 3.1 +The ratio of extinction at V, A(V), to color excess between B and V, E(B-V). +.le +.ls type = "E(B-V)" +The type of extinction parameter used. The values may be: +.ls A(V) +The absolute extinction at the V band at 5550 Angstroms. +.le +.ls E(B-V) +The color excess between the B and V bands. +.le +.ls c +The logarithmic H beta extinction. +.le +.le +.ls apertures = "" +List of apertures to be selected from input one dimensional spectra +to be calibrated. If no list is specified then all apertures are +corrected. The syntax is the same as the record number +extensions. This parameter is ignored for N-dimensional spatial +spectra such as calibrated long slit and Fabry-Perot data. +.le +.ls override = no, uncorrect = yes +If a spectrum has been previously corrected it will contain the header +parameter DEREDDEN. If this parameter is present and the override +parameter is no then a warning will be issued and no further correction +will be applied. The override parameter permits overriding this check. If +overriding a previous correction the \fIuncorrect\fR parameter determines +whether the spectra are first uncorrected to the original values before +applying the new correction. If \fIuncorrect\fR is yes then the image +header DEREDDEN parameter will refer to a correction from the original data +while if it is no then the new correction is differential and the keyword +will only reflect the last correction. When correcting individual spectra +separately in a multispectra image with different extinction parameters the +uncorrect parameter should be no. +.le +.ih +DESCRIPTION +The input spectra are corrected for interstellar extinction, or +reddening, using the empirical selective extinction function of +Cardelli, Clayton, and Mathis, \fBApJ 345:245\fR, 1989, (CCM). +The function is defined over the range 0.3-10 inverse microns +or 100-3333 nanometers. If the input data extend outside this +range an error message will be produced. + +The extinction function requires two parameters, the absolute extinction at +5550A, A(V), and the ratio, R(V), of this extinction to the color excess +between 4350A and 5550A, E(B-V). + +One of the input task parameters is R(V). If it is not known one +may use the default value of 3.1 typical of the average +interstellar extinction. The second input parameter is chosen by +the parameter \fItype\fR which may take the values "A(V)", "E(B-V)", or +"c". The value of the parameter is specified by the parameter +\fIvalue\fR. + +If A(V) is used then the CCM function can be directly evaluated. If +E(B-V) is used then A(V) is derived by: + +.nf +(1) A(V) = R(V) * E(B-V) +.fi + +For planetary nebula studies the logarithmic extinction at H beta, +denoted as c, is often determined instead of E(B-V). If this type +of input is chosen then A(V) is derived by: + +.nf +(2) A(V) = R(V) * c * (0.61 + 0.024 * c). +.fi + +This relation is based on the relation betwen E(B-V) and c computed +by Kaler and Lutz, \fBPASP 97:700\fR, 1985 to include corrections between +the monochromatic parameter c and the broadband parameter E(B-V). +In particular the function is a least squares fit to the values of +c and E(B-V) in Table III of the form: + +.nf +(3) E(B-V) = c * (A + B * c) +.fi + +The input spectra are specified by a list of root names (when using record +extension format) or full image names. They are required to be dispersion +corrected (DC-FLAG >= 0) and not previously corrected (DEREDDEN absent). +Spectra not satisfying these requirements are skipped with a warning. The +DEREDDEN flag may be overridden with the \fIoverride\fR parameter. This +may be done if different extinction parameters are required for different +spectra in the same multiple spectrum image or if a new correction is +to be applied. The \fIuncorrect\fR parameter determines whether the +previous correction is removed so that the final correction is relative +to the original data or if the new correction is differential on the +previous correction. Note that if applying separate corrections to +different spectra in a single multispectral image then override should +be yes and uncorrect should be no. + +A subset of apertures to be corrected may be selected from one dimensional +spectra with the \fIapertures\fR parameter. Long slit or other higher +dimensional spatially sampled spectra are treated as a unit. The output +calibrated spectra may replace the input spectra if no output spectra list +is specified or if the output name is the same as the input name. When +using record number extensions the output spectra will have the same +extensions applied to the root names as those used for the input spectra. + +Note that by specifying a negative extinction parameter this task may +be used to add interstellar extinction. +.ih +EXAMPLES +1. To deredden a spectrum with an extinction of 1.2 magnitudes at V: + +.nf + cl> deredden obj1.ms drobj1.ms 1.2 type=A +.fi + +2. To deredden a spectrum in place with a color excess of 0.65 and +and R(V) value of 4.5: + +.nf + cl> deredden obj2.ms obj2.ms R=4.5 + E(B-V): .65 +.fi + +3. To deredden a series of IRS planetary nebula spectra using the +H beta extinction in the irs package: + +.nf + cl> deredden pn12 drpn12 1-5,12-14 type=c + c: 1.05 +.fi + +4. To redden a spectrum: + +.nf + cl> deredden artspec artspec -1.2 type=A +.fi + +5. To deredden a long slit or Fabry-Perot spectrum either DISPAXIS +must be in the image header or be specified in the package parameters. +The summing parameters are ignored. + +.nf + cl> deredden obj1 drobj1 1.2 type=A +.fi +.ih +REVISIONS +.ls DEREDDEN V2.10.3 +Extended to operate on two and three dimensional spatial spectra such as +calibrated long slit and Fabry-Perot data. + +An option was added to allow a previous correction to be undone in order +to keep the DEREDDEN information accurate relative to the original +data. +.le +.ls DEREDDEN V2.10 +This task is new. +.le +.ih +NOTES +Since there can be only one deredding flag in multispectral images +one needs to override the flag if different spectra require different +corrections and then only the last correction will be recorded. +.ih +SEE ALSO +calibrate +.endhelp diff --git a/noao/onedspec/doc/dispcor.hlp b/noao/onedspec/doc/dispcor.hlp new file mode 100644 index 00000000..9e916e70 --- /dev/null +++ b/noao/onedspec/doc/dispcor.hlp @@ -0,0 +1,497 @@ +.help dispcor Oct92 noao.onedspec +.ih +NAME +dispcor -- Dispersion correct and resample spectra +.ih +USAGE +dispcor input output [records] +.ih +PARAMETERS +.ls input +List of input spectra or root names to be dispersion corrected. These may +be echelle or non-echelle spectra, the task will determine which from the +database dispersion functions. When using the record number extension +format, record number extensions will be appended to each root name in the +list. +.le +.ls output +List of dispersion corrected output spectra or root names. When using the +record number extension format, record number extensions will be appended +to each root name in the list. The output extension will be the same as +the input extension. If "no" output list is specified then the output +spectrum will replace the input spectrum after dispersion correction. +.le +.ls records (imred.irs and imred.iids only) +List of records or ranges of records to be appended to the input and output +root names when using record number extension format. The syntax of this +list is comma separated record numbers or ranges of record numbers. A +range consists of two numbers separated by a hyphen. A null list may be +used if no record number extensions are desired. This is a positional +query parameter only if the record format is specified. +.le +.ls linearize = yes +Interpolate the spectra to a linear dispersion sampling? If yes, the +spectra will be interpolated to a linear or log linear sampling using +the linear dispersion parameters specified by other parameters. If +no, the nonlinear dispersion function(s) from the dispersion function +database are assigned to the input image world coordinate system +and the spectral data are not interpolated. +.le +.ls database = "database" +Database containing dispersion solutions created by \fBidentify\fR or +\fBecidentify\fR. If the spectra have been previous dispersion corrected +this parameter is ignored unless a new reference spectra are defined. +.le +.ls table = "" +Wavelength coordinate table or reference image. Elements in this optional +table or reference image override the wavelength coordinates given below +for specified apertures. See the DISCUSSION for additional information. +.le +.ls w1 = INDEF, w2 = INDEF, dw = INDEF, nw = INDEF +The starting wavelength, ending wavelength, wavelength interval per pixel, +and the number of pixels in the output spectra. Any combination of these +parameters may be used to restrict the wavelength coordinates of the output +spectra. If two or more have the value INDEF then suitable defaults based +on the number of input pixels and the wavelength range of the reference +dispersion solutions are used. These defaults may either come from all +spectra, all spectra of the same aperture, or individually for each +spectrum depending on the values of the \fIglobal\fR and \fIsamedisp\fR +parameters. Note that these parameters are specified in linear units even +if a logarithmic wavelength scale is selected. The conversion between +linear and logarithmic intervals between pixels is given below. These +values may be overridden for specified apertures by a wavelength table or +reference image. Otherwise these values apply to all apertures. +.le +.ls log = no +Transform to linear logarithmic wavelength coordinates? Linear logarithmic +wavelength coordinates have wavelength intervals which are constant +in the logarithm (base 10) of the wavelength. Note that if conserving flux +this will change the flux units to flux per log lambda interval. +Note that if the input spectra are in log sampling then \fIlog\fR=no will +resample back to linear sampling and \fIlog\fR=yes will resample keeping +the output spectra in log sampling. +.le +.ls flux = yes +Conserve the total flux during interpolation rather than the flux density? +If "no", the output spectrum is average of the input spectrum across each +output wavelength coordinate. This conserves flux density. If "yes" the +input spectrum is integrated over the extent of each output pixel. This +conserves the total flux. Note that in this case units of the flux will +change; for example rebinning to logarithmic wavelengths will produce flux +per log lambda. For flux calibrated data you most likely would not want to +conserve flux. +.le +.ls blank = 0. +Output value corresponding to points outside the range of the input +data. In other words, the out of bounds value. This only has an +effect when linearizing and the output spectral coordinates extend +beyond the input spectral range. +.le +.ls samedisp = no +Use the same dispersion parameters for all apertures? If yes then all +apertures in a single image will have the same dispersion parameters. +If the \fIglobal\fR parameter is all selected then all spectra in all +images will have the same dispersion paramters. This parameter +would not normally be used with echelle spectra where each order +has a different wavelength coverage. +.le +.ls global = no +Apply global wavelength defaults? Defaults for the INDEF wavelength +coordinate parameters are determined if two or less of the wavelength +parameters are specified. The defaults are based on the number of +pixels and the wavelengths of the first and last pixel as given by the +dispersion solution. If this parameter is "no" this is done +independently for each input spectrum. If this parameter is "yes" +then the maximum number of pixels and the minimum and maximum +wavelengths of all the input spectra or those of the same aperture are +used to provide defaults for the spectra. The parameter +\fIsamedisp\fR determines whether the global coordinates are over all +spectra or only those with the same aperture number. The global option +is used to have all the dispersion corrected spectra have the same +wavelength coordinates without actually specifying the wavelength +parameters. +.le +.ls ignoreaps = no +If a reference dispersion solution is not found for an aperture +use the first reference dispersion solution and ignore the aperture +number? If not ignoring the apertures all spectra must have a matching +aperture for the dispersion solution and the task aborts if this is +not the case. Ignoring the apertures avoids this abort and instead +the first dispersion solution is used. Note this parameter does not +mean ignore matches between reference and spectrum aperture numbers +but only ignore the aperture number if no matching reference is +found. + +Also if a reference table or image is given and \fIignoreaps\fR=yes +then the default dispersion parameters for any aperture not defined +by the table or image will be that of the first defined aperture. +This can still be overridden by giving explicit values for +\fIw1, w2, dw\fR and \fInw\fR. +.le +.ls confirm = no +Confirm the wavelength parameters for each spectrum? If \fIyes\fR +the wavelength parameters will be printed and the user will be asked +whether to accept them. If the parameters are not acceptable the +user will be queried for new values. The confirmation and parameter +changes are repeated until an acceptable set of parameters is obtained. +When the \fIglobal\fR parameter is \fIyes\fR changes to the wavelength +parameters will remain in effect until changed again. +.le +.ls listonly = no +List the dispersion coordinates only? If set then the dispersion coordinates +are listed but the spectra are not dispersion corrected. This may be used +to determine what the default wavelengths would be based on the dispersion +solutions. +.le +.ls verbose = yes +Print the dispersion function and coordinate assignments? +.le +.ls logfile = "" +Log file for recording the dispersion correction operations. If no file +name is given then no log information is recorded. +.le +.ih +DESCRIPTION +The dispersion coordinate systems of the input spectra are set or changed +in the output spectra. The output spectra may be the same as the input +spectra if no output spectra are specified or the output name is the +same as the input name. The input and output spectra are specified +by image templates or lists. In the \fBirs/iids\fR packages the +input and output spectra are specified as root names and the record +numbers are specified by the \fIrecord\fR parameter. The records are +given as a set of comma separate single numbers or ranges of hyphen +separated numbers. If no records are specified then the input and output +images are assumed to be full names. + +The dispersion coordinate system is defined either in the image header or +by dispersion functions in the specified database. To use reference +spectra dispersion functions they must first be assigned to the image with +\fBidentify (reidentify)\fR, \fBecidentify (ecreidentify)\fR, +\fBrefspectra\fR, or \fBhedit\fR. These tasks define the image header +keywords REFSPEC1, REFSPEC2, REFSHFT1, and REFSHFT2. The test which +determines whether to use the current dispersion coordinate system or +reference spectra dispersion solutions is the presence of the REFSPEC1 +keyword. Since it is an error to apply a dispersion function to data which +have already been dispersion corrected the any dispersion function keywords +are deleted after use and a record of them entered in sequential image +header keywords beginning with DCLOG. + +Dispersion functions are specified by one or both of the reference spectrum +image header keywords REFSPEC1 and REFSPEC2 containing the name of +calibration spectra with dispersion function solutions (either echelle +dispersion functions from \fBecidentify\fR or non-echelle dispersion +functions from \fBidentify\fR) in the database. There must be a dispersion +function for each aperture in the input spectrum unless the \fIignoreaps\fR +flag is set. If the flag is not set the task will abort if a matching +aperture is not found while if it is set spectra without a matching +aperture in the reference dispersion solutions will use the first +dispersion solution. Note that aperture number matching is done in both +cases and the \fIignoreaps\fR parameter only applies to non-matching +spectra. The common situation for using the \fIignoreaps\fR option is when +there is a single reference dispersion solution which is to be applied to a +number of spectra with different aperture numbers; hence effectively +ignoring the reference spectrum aperture number. + +If two reference spectra are specified the names may be followed by a +weighting factor (assumed to be 1 if missing). The wavelength of a pixel +is then the weighted averge of the wavelengths of the two dispersion +functions. The task \fBrefspectra\fR provides a number of ways to assign +reference spectra. Note, however, that these assignments may be made +directly using the task \fBhedit\fR or with some other task or script if +none of the methods are suitable. Also note that \fBidentify\fR and +\fBreidentify\fR add the REFSPEC1 keyword refering to the image itself +when a database entry is written. + +In addition to the one or two reference dispersion functions for each input +aperture there may also be image header keywords REFSHFT1 and REFSHFT2 +specifying reference spectra whose dispersion function zero point shifts +(the "shift" parameter in the database files) are to be applied to the +reference dispersion functions. The shifts from REFSHFT1 will be applied +to the dispersion functions from REFSPEC1 and similarly for the second +dispersion functions. The reference shifts need not be present for every +aperture in a multispectrum image. By default the mean shift from all the +reference apertures having a zero point shift is applied to all the +reference dispersion functions. If the REFSHFT keyword has the modifier +word "nearest" following the spectrum name then the shift from the nearest +aperture in spatial position (from the aperture extraction limits in the +original 2D spectrum as recorded in the 6th and 7th fields of the APNUM +keywords) is used for a particular input aperture. If the modifier word is +"interp" then the nearest two apertures are used to interpolate a zero +point shift spatially. + +The purpose of the reference shift keywords is to apply a wavelength zero +point correction to the reference dispersion functions determined from +separate arc calibration observations using a few apertures taken at the +same time as object observations. For example, consider multifiber +observations in which one or more fibers are assigned to arc lamps at the +same time the other fibers are used to observe various objects. The basic +dispersion reference, the REFSPEC keywords, will come from arc observations +taken through all the fibers. The arc fibers used during an object +observation are then calibrated against their corresponding fibers in the +arc calibration observations to determine a zero point shift. The REFSHFT +keywords will contain the name of the object spectrum itself and the shifts +from the simultaneous arc fibers will be interpolated spatially to the +nonarc object fibers and applied to the dispersion functions from the arc +calibrations for those fibers. + +The reference shift keywords are currently added with \fBhedit\fR and zero +point shifts computed with \fBidentify/reidentify\fR. The complexities of +this have been hidden in the multifiber \fBimred\fR instrument reduction +packages. The reference shift correction feature was added primarily for +use in those reduction packages. + +If the \fIlinearize\fR parameter is no the dispersion functions, weights, +and shifts are transferred from the database to the world coordinate system +keywords in the image header. Except for printing processing information +that is all that is done to the spectra. + +If the \fIlinearize\fR parameter is yes the spectra are interpolated to a +linear wavelength scale and the dispersion coordinate system in the header +is set apprpriately. A linear wavelength coordinate system is defined by a +starting wavelength, an ending wavelength, a wavelength interval per pixel, +and the number of pixels. These four parameters actually overspecify the +coordinate system and only three of these values are needed to define it. +The output coordinate system is specified by giving a set or subset of +these parameters using the parameters \fIw1\fR, \fIw2\fR, \fIdw\fR, and +\fInw\fR. + +When the \fIlog\fR option is used these parameters are still specified and +computed in non-log units but the effective interval per pixel is + +.nf + dw_log = (log10(w2) - log10(w1)) / (nw - 1) + dw_log = (log10(w1+dw*(nw-1)) - log10(w1)) / (nw - 1) +.fi + +In other words, the logarithmic interval divides the starting and ending +wavelength into the required number of pixels in log step. To avoid +confusion in this case it is best to specify the starting and ending +wavelengths (in non-log units) and the number of pixels. + +Note that if \fIlog\fR=yes the input spectra in either linear +or log sampling will be resampled to produces an output spectrum in +log sampling. Similarly, if \fIlog\fR=no the input spectra will +be resampled to linear sampling. This means that log sampled input +spectra will be resampled to linear sampling. + +Default values for any parameters which are not specified, by using the +value INDEF, are supplied based on the wavelengths of the first and last +pixel as given by the dispersion function and the number of pixels in the +input image. The defaults may either be determined separately for each +spectrum (\fIglobal\fR = \fIno\fR), from all spectra with the same aperture +(\fIglobal\fR = \fIyes\fR and \fIsamedisp\fR = \fIno\fR), or from all the +spectra (\fIglobal\fR = \fIyes\fR and \fIsamedisp\fR = \fIyes\fR). As +indicated, the parameter \fIsamedisp\fR determines whether defaults are +determined independently for each aperture or set the same for all +apertures. + +Another way to specify the wavelengths when there are many apertures is to +use a wavelength table or reference image. If an spectrum image name is +specified with the \fItable\fR parameter then the dispersion parameters for +each apertures are set to be the same as the reference spectrum. +Alternatively, a text file table consisting of lines containing an aperture +number, the starting wavelength, the ending wavelength, the wavelength +interval per pixel, and the number of output pixels may be specified. Any +of these values may be specified as INDEF (though usually the aperture +number is not). One way to view the wavelength table/reference spectrum is +that an entry in the wavelength table/reference spectrum overrides the +values of the parameters \fIw1\fR, \fIw2\fR, \fIdw\fR, and \fInw\fR, which +normally apply to all apertures, for the specified aperture. The +wavelength table is used to specify explicit independent values for +apertures. The global mechanism can supply independent values for the +INDEF parameters when the \fIsamedisp\fR parameter is no. + +If one wishes to verify and possibly change the defaults assigned, +either globally or individually, the \fIconfirm\fR flag may be set. The +user is asked whether to accept these values. By responding with no the +user is given the chance to change each parameter value. Then the new +parameters are printed and the user is again asked to confirm the +parameters. This is repeated until the desired parameters are set. When +the defaults are not global the changed parameters will not be used for the +next spectrum. When the global option is used any changes made are +retained (either for all apertures or independently for each aperture) +until changed again. + +When adjusting the wavelengths the user should specify which parameter is +free to change by entering INDEF. If none of the parameters are specified +as INDEF then those values which were not changed, i.e. by accepting the +current value, are the first to be changed. + +Once the wavelength scale has been defined the input spectrum is +interpolated for each output pixel. Output wavelengths outside the range +of the input spectrum are set to the value given by the \fIblank\fR parameter +value. The default interpolation function +is a 5th order polynomial. The choice of interpolation type is made +with the package parameter "interp". It may be set to "nearest", +"linear", "spline3", "poly5", or "sinc". Remember that this +applies to all tasks which might need to interpolate spectra in the +\fBonedspec\fR and associated packages. For a discussion of interpolation +types see \fBonedspec\fR. + +When it is desired to conserve total flux, particularly when the dispersion is +significantly reduced, the parameter \fIflux\fR is set to yes and the +output pixel value is obtained by integrating the interpolation function +across the wavelength limits of the output pixel. If it is set to no +then the flux density is conserved by averaging across the output pixel +limits. + +The input spectrum name, reference spectra, and the wavelength parameters +will be printed on the standard output if the \fIverbose\fR parameter is +set and printed to a log file if one is specified with the \fIlogfile\fR +parameter. If one wishes to only check what wavelengths will be determined +for the defaults without actually dispersion correcting the spectra the +\fIlistonly\fR flag may be set. + +Other tasks which may be used to change the dispersion coordinate system +are \fBscopy\fR, \fBspecshift\fR, and \fBsapertures\fR. +.ih +EXAMPLES +In the examples when the task is used in the IRS and IIDS packages, +shown with the "ir>" prompt the spectra have a record number extension +image name format and the records parameter must be specified. In +the other case shown with the "on>" prompt the records parameter is +not used. + +1. Dispersion correct spectra so that they have the same number of pixels +and the wavelengths limits are set by the reference spectra. + +.nf +ir> dispcor spec dcspec 9,10,447-448 +dcspec.0009: ap = 0, w1 = 5078.84, w2 = 6550.54, dw = 1.797, nw = 820 +dcspec.0010: ap = 1, w1 = 5078.71, w2 = 6552.81, dw = 1.800, nw = 820 +dcspec.0447: ap = 0, w1 = 5082.57, w2 = 6551.45, dw = 1.794, nw = 820 +dcspec.0448: ap = 1, w1 = 5082.03, w2 = 6553.66, dw = 1.797, nw = 820 + +on> dispcor allspec.ms dcallspec.ms +dcallspec.ms: ap = 1, w1 = 5078.84, w2 = 6550.54, dw = 1.797, nw = 820 +dcallspec.ms: ap = 2, w1 = 5078.71, w2 = 6552.81, dw = 1.800, nw = 820 +dcallspec.ms: ap = 3, w1 = 5082.57, w2 = 6551.45, dw = 1.794, nw = 820 +dcallspec.ms: ap = 4, w1 = 5082.03, w2 = 6553.66, dw = 1.797, nw = 820 +.fi + +2. Confirm and change assignments. + +.nf +on> dispcor spec* %spec%new%* confirm+ +new009: ap = 0, w1 = 5078.84, w2 = 6550.54, dw = 1.797, nw = 820 + Change wavelength coordinate assignments? (yes): + Starting wavelength (5078.8421234): 5070 + Ending wavelength (6550.535123): + Wavelength interval per pixel (1.79693812): + Number of output pixels (820): INDEF +new009: ap = 0, w1 = 5070., w2 = 6550.53, dw = 1.795, nw = 826 + Change wavelength coordinate assignments? (yes): no +new010: ap = 1, w1 = 5078.71, w2 = 6552.81, dw = 1.800, nw = 820 + Change wavelength coordinate assignments? (no): yes + Starting wavelength (5078.7071234): 5100 + Ending wavelength (6550.805123): 6500 + Wavelength interval per pixel (1.79987512): INDEF + Number of output pixels (820): INDEF +new010: ap = 1, w1 = 5100., w2 = 6500., dw = 1.797, nw = 780 + Change wavelength coordinate assignments? (yes): no +new447: ap = 0, w1 = 5082.57, w2 = 6551.45, dw = 1.793, nw = 820 + Change wavelength coordinate assignments? (yes): no +new448: ap = 1, w1 = 5082.03, w2 = 6553.66, dw = 1.797, nw = 820 + Change wavelength coordinate assignments? (no): +.fi + +3. Confirm global assignments and do dispersion correction in place. +record format. + +.nf +ir> dispcor irs "" 9,10,447,448 confirm+ global+ samedisp+ +irs.0009: ap = 0, w1 = 5078.71, w2 = 6553.66, dw = 1.801, nw = 820 + Change wavelength coordinate assignments? (yes): + Starting wavelength (5078.7071234): 5100 + Ending wavelength (6553.664123): 6500 + Wavelength interval per pixel (1.80092412): + Number of output pixels (820): +irs.0009: ap = 0, w1 = 5100., w2 = 6500., dw = 1.799, nw = 779 + Change wavelength coordinate assignments? (yes): no +irs.0010: ap = 1, w1 = 5100., w2 = 6500., dw = 1.799, nw = 779 + Change wavelength coordinate assignments? (no): +irs.0447: ap = 0, w1 = 5100., w2 = 6500., dw = 1.799, nw = 779 + Change wavelength coordinate assignments? (no): +irs.0448: ap = 1, w1 = 5100., w2 = 6500., dw = 1.799, nw = 779 + Change wavelength coordinate assignments? (no): +.fi + +4. Make a nonlinear dispersion correction in place. + +.nf +on> dispcor spec* "" linearize=no verbose- logfile=logfile +.fi + +5. Apply a single dispersion solution to a set of record number format +images. + +ir> dispcor nite101 dcnite101 "1-10" ignore+ confirm- + +.ih +REVISIONS +.ls DISPCOR V2.12.3 +Added the blank parameter value. +.le +.ls DISPCOR V2.11.3 +Long slit and data cubes can be used with this task to either resample +using the existing WCS or to use a single dispersion function from +IDENTIFY. It uses the first one found. +.le +.ls DISPCOR V2.10.3 +Provision was added for IDENTIFY dispersion solutions consisting of +only a shift (as produced by the 'g' key in IDENTIFY or the refit=no +flag in REIDENTIFY) to be applied to previously LINEARIZED spectra. +Thus it is possible to use IDENIFY/REIDENTIFY to automatically +compute a zero point shift based on 1 or more lines and then shift +all the spectra to that zero point. + +DISPCOR will now allow multiple uses of IDENTIFY dispersion solutions +in a simple way with but with continuing protection against accidental +multiple uses of the same dispersion solutions. When a spectrum is +first dispersion corrected using one or more reference spectra keywords +the dispersion flag is set and the reference spectra keywords are moved to +DCLOGn keywords. If DISPCOR is called again without setting new +reference spectra keywords then the spectra are resampled (rebinned) +using the current coordinate system. If new reference spectra are set +then DISPCOR will apply these new dispersion functions. Thus the user +now explicitly enables multiple dispersion functions by adding +reference spectra keywords and DISPCOR eliminates accidental multiple +uses of the same dispersion function by renaming the reference +spectra. The renamed keywords also provide a history. + +The flux conservation option now computes an average across the +output pixel rather than interpolating to the middle of the output +pixel when \fIflux\fR is no. This preserves the flux density and +includes all the data; i.e. a coarse resampling will not eliminate +features which don't fall at the output pixel coordinates. + +Some additional log and verbose output was added to better inform the +user about what is done. + +Better error information is now printed if a database dispersion function +is not found. +.le +.ls DISPCOR V2.10 +This is a new version with many differences. It replaces the previous +three tasks \fBdispcor, ecdispcor\fR and \fBmsdispcor\fR. It applies both +one dimensional and echelle dispersion functions. The new parameter +\fIlinearize\fR selects whether to interpolate the spectra to a uniform +linear dispersion (the only option available previously) or to assign a +nonlinear dispersion function to the image without any interpolation. The +interpolation function parameter has been eliminated and the package +parameter \fIinterp\fR is used to select the interpolation function. The +new interpolation type "sinc" may be used but care should be exercised. +The new task supports applying a secondary zero point shift spectrum to a +master dispersion function and a spatial interpolation of the shifts when +calibration spectra are taken at the same time on a different region of the +same 2D image. The optional wavelength table may now also be an image to +match dispersion parameters. The \fIapertures\fR and \fIrebin\fR +parameters have been eliminated. If an input spectrum has been previously +dispersion corrected it will be resampled as desired. Verbose and log file +parameters have been added to log the dispersion operations as desired. +The record format syntax is available in the \fBirs/iids\fR packages. +.le +.ih +SEE ALSO +package, refspectra, scopy, specshift, sapertures +.endhelp diff --git a/noao/onedspec/doc/disptrans.hlp b/noao/onedspec/doc/disptrans.hlp new file mode 100644 index 00000000..d73a4cb4 --- /dev/null +++ b/noao/onedspec/doc/disptrans.hlp @@ -0,0 +1,193 @@ +.help disptrans Aug94 noao.onedspec +.ih +NAME +disptrans -- Transform dispersion units and apply air correction +.ih +USAGE +disptrans input output units +.ih +PARAMETERS +.ls input +List of dispersion calibrated input spectra to be dispersion transformed. +.le +.ls output +List of output dispersion transformed spectra. If given the input names +(or a null list), each input spectrum will be replaced by the transformed +output spectrum. +.le +.ls units +Output dispersion units. A wide range of dispersion units may be +specified and they are described in the UNITS section. +.le +.ls error = 0.01 +Maximum error allowed in the output dispersion transformation expressed +as a pixel error; that is, the equivalent pixel shift in the output +dispersion function corresponding to the maximum difference between +the exact transformation and the dispersion function approximation. +The smaller the allowed error the higher the order of dispersion +function used. +.le +.ls linearize = no +Resample the spectrum data to linear increments in the output dispersion +system? If no then the output dispersion function is stored in the +spectrum header and if yes the spectrum is resampled into the same +number of pixels over the same dispersion range but in even steps +of the output dispersion units. +.le +.ls verbose = yes +Print a log of each spectrum transformed to the standard output? +.le + +.ls air = "none" (none|air2vac|vac2air) +Apply an air to vacuum or vacuum to air conversion? It is the +responsibility of the user to know whether the input dispersion +is in air or vacuum units and to select the appropriate conversion. +The conversion types are "none" for no conversion, "air2vac" to +convert from air to vacuum, and "vac2air" to convert from vacuum +to air. +.le +.ls t = 15, p = 760, f = 4 +Temperature t in degrees C, pressure p in mmHg, and water vapour pressure f +in mmHg for the air index of refraction. +.le + +OTHER PARAMETERS + +.ls interp = "poly5" (nearest|linear|poly3|poly5|spline3|sinc) +Spectrum interpolation type used when spectra are resampled. The choices are: + +.nf + nearest - nearest neighbor + linear - linear + poly3 - 3rd order polynomial + poly5 - 5th order polynomial + spline3 - cubic spline + sinc - sinc function +.fi +.le +.ih +DESCRIPTION +The dispersion function in the input spectra, y = f(x) where x is the +pixel coordinate and y is the input dispersion coordinate, is +transformed to y' = g(x) where y' is in the new dispersion units. This is done +by evaluating the input dispersion coordinate y at each pixel, applying an +air to vacuum or vacuum to air conversion if desired, and applying the +specified unit transformation y' = h(y). Since the transformations are +nonlinear functions and the output dispersion function must be expressed in +polynomial form, the function g(x) is determined by fitting a cubic spline +to the set of x and y' values. The lowest number of spline pieces is used +which satisfies the specified error. Note that this error is not a random +error but difference between the smooth fitted function and the smooth +dispersion function in the header. As a special case, the first +fit tried is a linear function. If this satisfies the error condition +then a simpler dispersion description is possible. Also this is +appropriate for dispersion units which are simply related by a +scale change such as Angstroms to nanometers or Hertz to Mev. + +The error condition is that the maximum difference between the exact or +analytic (the air/vacuum conversion is never exact) transformation and the +fitted function value at any pixel be less than the equivalent shift in +pixel coordinate evaluated at that point. The reason for using an error +condition in terms of pixels is that it is independent of the dispersion of +the spectra and the resolution of spectra is ultimately limited by the +pixel sampling. + +After the new dispersion function is determined the function is either +stored in the coordinate system description for the spectrum or used to +resample the pixels to linear increments in the output dispersion units. +The resampling is not done if the new dispersion function is already linear +as noted above. The sampling uses the mean value over the input spectrum +covered by an output spectrum pixel (it is flux per unit dispersion element +preserving as opposed to flux/counts preserving). The linear sampling +parameters are limited to producing the same number of output pixels as +input pixels over the same range of dispersion. If one wants to have more +control over the resampling then the \fIlinearize\fR parameter should be +set to no and the task \fBdispcor\fR used on the output spectrum. + +Note that an alternative to using this task is to do the original +dispersion calibration (based on calibration spectra) with IDENTIFY +and DISPCOR in the desired units. However, currently the standard +lines lists are in Angstroms. There are, however, linelists for +He-Ne-Ar, Th-Ar, and Th in vacuum wavelengths. +.ih +UNITS +The dispersion units are specified by strings having a unit type from the +list below along with the possible preceding modifiers, "inverse", to +select the inverse of the unit and "log" to select logarithmic units. For +example "log angstroms" to select the logarithm of wavelength in Angstroms +and "inv microns" to select inverse microns. The various identifiers may +be abbreviated as words but the syntax is not sophisticated enough to +recognized standard scientific abbreviations except for those given +explicitly below. + +.nf + angstroms - Wavelength in Angstroms + nanometers - Wavelength in nanometers + millimicrons - Wavelength in millimicrons + microns - Wavelength in microns + millimeters - Wavelength in millimeters + centimeter - Wavelength in centimeters + meters - Wavelength in meters + hertz - Frequency in hertz (cycles per second) + kilohertz - Frequency in kilohertz + megahertz - Frequency in megahertz + gigahertz - Frequency in gigahertz + m/s - Velocity in meters per second + km/s - Velocity in kilometers per second + ev - Energy in electron volts + kev - Energy in kilo electron volts + mev - Energy in mega electron volts + + nm - Wavelength in nanometers + mm - Wavelength in millimeters + cm - Wavelength in centimeters + m - Wavelength in meters + Hz - Frequency in hertz (cycles per second) + KHz - Frequency in kilohertz + MHz - Frequency in megahertz + GHz - Frequency in gigahertz + wn - Wave number (inverse centimeters) +.fi + +The velocity units require a trailing value and unit defining the +velocity zero point. For example to transform to velocity relative to +a wavelength of 1 micron the unit string would be: + +.nf + km/s 1 micron +.fi +.ih +AIR/VACUUM CONVERSION +The air to vacuum and vacuum to air conversions are obtained by multiplying +or dividing by the air index of refraction as computed from the +formulas in Allen's Astrophysical Quantities (p. 124 in 1973 edition). +These formulas include temperature, pressure, and water vapour terms +with the default values being the standard ones. +.ih +EXAMPLES +1. Convert a spectrum dispersion calibrated in Angstroms to electron +volts and resample to a linear sampling. + +.nf + cl> disptrans spec1 evspec1 ev linear+ + evspec1: Dispersion transformed to ev. +.fi + +2. Apply an air to vacuum correction to an echelle spectrum using the +default standard temperature and pressure. Don't resample but rather use +a nonlinear dispersion function. + +.nf + cl> disptrans highres.ec vac.ec angs air=air2vac + vac.ec: Dispersion transformed to angstroms in vacuum with + t = 15. C, p = 760. mmHg, f = 4. mmHg. +.fi +.ih +REVISIONS +.ls DISPTRANS V2.10.4 +New task with this release. +.le +.ih +SEE ALSO +dispcor, identify, scopy, dopcor +.endhelp diff --git a/noao/onedspec/doc/dopcor.hlp b/noao/onedspec/doc/dopcor.hlp new file mode 100644 index 00000000..6bcd0992 --- /dev/null +++ b/noao/onedspec/doc/dopcor.hlp @@ -0,0 +1,184 @@ +.help dopcor Jun94 noao.onedspec +.ih +NAME +dopcor -- Apply doppler correction +.ih +USAGE +dopcor input output redshift +.ih +PARAMETERS +.ls input +List of input spectra to be doppler corrected. +.le +.ls output +List of doppler corrected spectra. If no output list is specified then +the input spectra are modified. Also the output name may be +the same as the input name to replace the input spectra by the +calibrated spectra. +.le +.ls redshift +Redshift or radial velocity (km/s) to be removed? The spectra are corrected so +that the specified redshift is removed; i.e. spectra with a positive +velocity are shifted to shorter wavelengths and vice-versa. This parameter +may be either a number or an image header keyword with the desired redshift +or velocity value. An image header keyword may also have an initial minus +sign, '-', to specify the negative of a velocity or the redshift complement +(1/(1+z)-1) of a redshift. The choice between a redshift and a velocity is +made with the \fIisvelocity\fR parameter. +.le +.ls isvelocity = no +Is the value specified by the \fIredshift\fR parameter a velocity? If +no then the value is interpreted as a redshift and if it is yes then +it is interpreted as a physical velocity in kilometers per second. Note that +this is a relativistic velocity and not c*z! For nearby cosmological +velocities users should specify a redshift (z = v_cosmological / c). +.le +.ls add = no +Add doppler correction to existing correction in "multispec" spectra? +.le +.ls dispersion = yes +Apply a correction to the dispersion function? +.le +.ls flux = no +Apply a flux correction? +.le +.ls factor = 3 +Flux correction factor as a power of 1+z when applying a flux correction. +.le +.ls apertures = "" +List of apertures to be corrected. If none are specified then all apertures +are corrected. An aperture list consists of comma separated aperture +number or aperture number ranges. A range is hypen separated and may +include an interval step following the character 'x'. See \fBranges\fR +for further information. For N-dimensional spatial spectra such as +long slit and Fabry-Perot spectra this parameter is ignored. +.le +.ls verbose = no +Print corrections performed? The information includes the output image +name, the apertures, the redshift, and the flux correction factor. +.le +.ih +DESCRIPTION +The input spectra (as specified by the input image list and apertures) are +corrected by removing a specified doppler shift and written to the +specified output images. The correction is such that if the actual +shift of the observed object is specified then the corrected spectra +will be the rest spectra. The opposite sign for a velocity or the +redshift complement (1/(1+z)-1) may be used to add a doppler shift +to a spectrum. + +There are two common usages. One is to take spectra with high doppler +velocities, such as cosmological sources, and correct them to rest with +respect to the earth. In this case the measured redshift or velocity is +specified to "remove" this component. The other usage is to correct +spectra to heliocentric or local standard of rest. The heliocentric or LSR +velocities can be computed and entered in the image header with the task +\fBrvcorrect\fR. In this case it is tempting to again think you are +"removing" the velocity so that you specify the velocity as given in the +header. But actually what is needed is to "add" the computed standard of +rest velocity to the observed spectrum taken with respect to the telescope +to place the dispersion in the desired center of rest. Thus, in this case +you specify the opposite of the computed heliocentric or LSR velocity; i.e. +use a negative. + +The redshift or space velocity in km/s is specified either as a number or +as an image header keyword containing the velocity or redshift. If a +number is given it applies to all the input spectra while an image header +keyword may differ for each image. The latter method of specifying a +velocity is useful if velocity corrections are recorded in the image +header. See \fBrvcorrect\fR for example. + +The choice between a redshift and a space velocity for the \fIredshift\fR +parameter is made using the \fIisvelocity\fR parameter. If isvelocity=yes +then the header dispersion solution is modified according to the +relativistic Doppler correction: + + lambda_new = lamda_old * sqrt((1 + v/c)/(1 - v/c)) + +where v is the value of "redshift". If isvelocity=no, \fIredshift\fR is +interpreted as a cosmological redshift and the header dispersion solution +is modified to give: + + lambda_new = lamda_old * z + +where z is the value of "redshift" + +If the \fIadd\fR parameter is used and the image uses a "multispec" +format where the previous doppler factor is stored separately +then the new doppler factor is: + + znew = (1 + z) * (1 + zold) - 1 = z + zold + z * zold + +where z is the specified doppler factor, zold is the previous one, +and znew is the final doppler factor. If the \fIadd\fR parameter +is no then the previous correction is replaced by the new correction. +Note that for images using a linear or equispec coordinate system +the corrections are always additive since a record is not kept of +the previous correction. Also any flux correction is made based +on the specified doppler correction rather than znew. + +There are two corrections which may be made and the user selects one +or both of these. A correction to the dispersion function is selected +with the \fIdispersion\fR parameter. This correction is a term to be +applied to the dispersion coordinates defined for the image. \fIThe spectrum +is not resampled, only the dispersion coordinate function is affected\fR. +A correction to the flux, pixel values, is selected with the \fIflux\fR +parameter. This correction is only significant for cosmological redshifts. +As such the correction is dependent on a cosmological model as well as +whether a total flux or surface brightness is measured. To provide the +range of possible corrections the flux correction factor is defined by +the \fIfactor\fR parameter as the power of 1+z (where z is the +redshift) to be multiplied into the observed pixel values. + +A keyword DOPCORnn is added to the image header. The index starts from +01 and increments if multiple corrections are applied. The value of +the keywords gives the redshift applied, the flux factor if used, and +the apertures which were corrected. +.ih +EXAMPLES +1. To dispersion and flux correct a quasar spectrum with redshift of +3.2 to a rest frame: + +.nf + cl> dopcor qso001.ms qso001rest.ms 3.2 flux+ +.fi + +2. To correct a set of spectra (in place) to heliocentric rest the task +\fBrvcorrect\fR is used to set the VHELIO keyword using an observed +velocity of 0. Then: + +.nf + cl> dopcor *.imh "" -vhelio isvel+ +.fi + +3. To artificially add a redshift of 3.2 to a spectrum the complementary +redshift is computed: + +.nf + cl> = 1/(1+3.2)-1 + -0.76190476190476 + cl> dopcor artspec "" -0.762 flux+ +.fi +.ih +REVISIONS +.ls DOPCOR V2.10.3 +This task was extended to work on two and three dimensional spatial spectra +such as long slit and Fabry-Perot spectra. + +The \fIadd\fR parameter was added. +.le +.ls DOPCOR V2.10.3 +A keyword is added to log the correction applied. +.le +.ls DOPCOR V2.10.2 +A sign error in converting velocity to redshift was fixed. A validity +check on the velocities and redshifts was added. The documentation +was corrected and improved. +.le +.ls DOPCOR V2.10 +This task is new. +.le +.ih +SEE ALSO +ranges, rvcorrect +.endhelp diff --git a/noao/onedspec/doc/fitprofs.hlp b/noao/onedspec/doc/fitprofs.hlp new file mode 100644 index 00000000..ed21e7b1 --- /dev/null +++ b/noao/onedspec/doc/fitprofs.hlp @@ -0,0 +1,403 @@ +.help fitprofs Mar92 noao.onedspec +.ih +NAME +fitprofs -- Fit 1D profiles to features in image vectors +.ih +USAGE +fitprofs input +.ih +PARAMETERS +.ls input +List of input images to be fit. The images may be one dimensional +spectra (one or more spectra per image) or long slit spectra. Other +types of nonspectral images may also be used and for two dimensional +images the fitting direction will be determined from either the keyword +DISPAXIS in the image header or the \fIdispaxis\fR parameter. +.le +.ls lines = "" +List of lines, columns, or apertures to be selected from the input image +format. The default empty list, "", selects all vectors in the images. +The syntax is a list of comma separated numbers or ranges, where a range +is a pair of hyphen separated numbers. +.le +.ls bands = "" +List of bands for 3D images. The empty list, "", selects all bands. +.le +.ls dispaxis = ")_.dispaxis", nsum = ")_.nsum" +Parameters for defining vectors in 2D and 3D images. The +dispersion axis is 1 for line vectors, 2 for column vectors, and 3 for band +vectors. A DISPAXIS parameter in the image header has precedence over the +\fIdispaxis\fR parameter. The default values defer to the package +parameters of the same name. +.le + +The following are the fitting parameters. +.ls region = "" +Region of the input vectors to be fit specified as a pair of space +separated numbers. The coordinates are defined in terms of the linear +image header coordinate parameters. For dispersion corrected spectra this +is usually wavelength in Angstroms and for other data it is usually pixels. +A fitting region must be specified. +.le +.ls positions = "" +File of initial or fixed profile positions and (optional) peaks, profile +types, and widths. The +format consists of lines with one or more whitespace separated fields. +The fields are the position, peak relative to the continuum with +negative values being absorption, profile type of gaussian, lorentzian, +or voigt, and the gaussian and/or lorentzian full width at half maximum. +Trailing fields may be missing and fields to be set from default parameters +or the image data (the peak value) may be given as INDEF. +Comments and any additional columns are ignored. The positions and +widths are specified in the coordinate units of the image, usually +wavelength for dispersion corrected spectra and pixels otherwise. +.le +.ls background = "" +Background values defining the linear background. If not specified the +single pixel values nearest the fitting region endpoints are used. +Otherwise two whitespace separated values are expected. If a value is +a number then that is the background at the lower or upper end of the +fitting region (ordered in pixel space not wavelength). The special +values "avg(w1,w2,z)" or "med(w1,w2,z)" (note that there can be no +whitespace) may be specified, where w1 and w2 are dispersion values, and z +is a multiplier. This will take the average or median of pixels within the +specified range and multiply the result by the third argument. The +dispersion point used for that value in computing the linear background is +the average of the dispersion coordinates of the pixels used. +.le +.ls profile = "gaussian" (gaussian|lorentzian|voigt) +Default profile type to be fit when a profile type is not specified in +the positions file. The type are "gaussian", "lorentzian", or "voigt". +.le +.ls gfwhm = 20., lfwhm = 20. +Default gaussian and lorentzian full width at half maximum (FWHM). +These values are used for the initial and/or fixed width when they are +not specified in the position file. +.le +.ls fitbackground = yes +Fit the background? If "yes" a linear background across the fitting region +will be fit simultaneously with the profiles. If "no" the background will +be fixed. +.le +.ls fitpositions = "all" +Position fitting option. This may be "fixed" to fix all positions at their +initial values, "single" to fit a single shift to the positions while +keeping their separations fixed, or "all" to independently fit all the +positions. +.le +.ls fitgfwhm = "all", fitlfwhm = "all" +Profile width fitting options. These may be "fixed" to fix all widths +at their initial values, "single" to fit a single scale factor to the initial +widths, or "all" to independently fit all the widths. +.le + +The following parameters are used for error estimates as described +below in the ERROR ESTIMATES section. +.ls nerrsample = 0 +Number of samples for the error computation. A value less than 10 turns +off the error computation. A value of ~10 does a rough error analysis, a +value of ~50 does a reasonable error analysis, and a value >100 does a +detailed error analysis. The larger this value the longer the analysis +takes. +.le +.ls sigma0 = INDEF, invgain = INDEF +The pixel sigmas are modeled by the formula: + +.nf + sigma**2 = sigma0**2 + invgain * I +.fi + +where I is the pixel value and "**2" means the square of the quantity. If +either parameter is specified as INDEF or with a value less than zero then +no sigma estimates are made and so no error estimates for the measured +parameters is made. +.le + +The following parameters determine the output of the task. +.ls components = "" +All profiles defined by the position file are simultaneously fit but only +a subset of the fitted profiles may be selected for output. A profile +or component is identified by the order number in the position file; +i.e. the first entry in the position file is 1, the second is 2, etc. +The components to be output are specified by a range list. The empty +list, "", selects all profiles. +.le +.ls verbose = yes +Print fitting results and record of output images created on the +standard output (normally the terminal). +The fitting information is printed to the logfile so there is normally +no need to redirect this output. The output may be turned off when +the task is run as a background task. +.le +.ls logfile = "logfile" +Logfile for fitting results. If not specified the results will not be +logged. +.le +.ls plotfile = "plotfile" +File to contain plot output. The plots show the image vector with +overplots of the total fit, the individual components, and the residuals. +The plotfile may be examined and manipulated later with tools such as +\fBgkimosaic\fR. +.le +.ls output = "" +List of output images. If not specified then no output images are created. +If images are specified the list is matched with the input list. +.le +.ls option = "fit" (fit|difference) +Image output option. The choices are "fit" to output the fitted image +vector which is the sum of the fitted profiles (without a background), +or "difference" to output the data with the profiles subtracted. +.le +.ls clobber = no, merge = no +Clobber or modify any existing output images? If clobbering is not +enabled a warning is printed and any existing output images are not +modified. If clobbering is enabled then either new images are created +if merge is "no" or the new fits are merged with the existing images. +Merging is meaningful when only a subset of the input is fit such +as selected lines or apertures. +.le +.ih +DESCRIPTION +\fBFitprofs\fR fits one dimensional profile functions to image vectors +and outputs the fitting parameters, plots, and model or residual +image vectors. This is done noninteractively using a file of initial +profile positions and widths. Interactive profile fitting may be +done with the deblending option of \fBsplot\fR or +\fBstsdas.fitting.ngaussfit\fR. + +The input consists of images in a variety of formats. These include +all the spectral formats as well as standard images. For two dimensional +images (or the first 2D plane of higher dimensional images) either the +lines or columns may be fit with possible summing of adjacent lines or +columns to increase the signal-to-noise. A subset of the image apertures, +lines, or columns may be specified or all image vectors may be fit. + +The fitting parameters consist of a fitting region, a list of initial +positions, peaks, and widths, initial background endpoints, the fitting +function, and the parameters to be fit or constrained. The coordinates and +units used for the positions and widths are those defined by the standard +linear coordinate header parameters. For dispersion corrected spectra +these are generally wavelengths in Angstroms and otherwise they are +generally pixels. A fitting region must be specified by a pair of +numbers. + +The background parameter may be left empty to select the pixel values at +the endpoints of the fitting region for defining the initial linear +background. Or values at the endpoints of the fitting region may be given +explicitly in pixel space order (i.e. the first value is for the edge of +the fitting region which has smaller pixel coordinate0 Values can also be +computed from the data using the functions "avg(w1,w2)" or "med(w1,w2)" +where w1 and w2 are dispersion coordinates. The pixels in the specified +range are average or medianed and the dispersion point for the linear +background is the average of the dispersion coordinates of the pixels. + +The position list file consists of one or more columns. +The format of this file has +one or more columns. The columns are the wavelength, the peak value +(relative to the continuum with negative values being absorption), +the profile type (gaussian, lorentzian, or voigt), and the +gaussian and/or lorentzian FWHM. End columns may be missing +or INDEF values may be specified to use the default parameter +values (the profile and widths) or determine the peak from the data. +Below are examples of the file line formats + +.nf + wavelength + wavelength peak + wavelength peak (gaussian|lorenzian|voigt) + wavelength peak gaussian gfwhm + wavelength peak lorentzian lfwhm + wavelength peak voigt gfwhm + wavelength peak voigt gfwhm lfwhm + + 1234.5 <- Wavelength only + 1234.5 -100 <- Wavelength and peak + 1234.5 INDEF v <- Wavelength and profile type + 1234.5 INDEF g 12 <- Wavelength and gaussian FWHM +.fi + +where peak is the peak value, gfwhm is the gaussian FWHM, and lfwhm is +the lorentzian FWHM. This format is the same as used by \fBsplot\fR +and also by \fBartdata.mk1dspec\fR (except in the latter case the +peak is normalized to a continuum of 1). + +The profile parameters fit are the central position, the peak amplitude, +and the profile widths. The fitting may be constrained in number of ways. +The linear background may be fixed or simultaneously fit with the +profiles. The profile positions may be fixed, the relative separations +fixed but a single zero point shift fit, or all positions may be fit +simultaneously. The profile widths may also be fixed, the relative ratios +of the widths fixed while fitting a single scale factor, or all widths fit +simultaneously. The profile amplitudes are always fit. + +The fitting technique uses a nonlinear iterative Levenberg-Marquardt +algorithm to reduce the Chi-square of the fit. The execution time +increases rapidly with the number of profiles fit so there is an +effective limit to the number of profiles that can be fit at once. + +The output includes a number of formats. The fitted parameters are +recorded in a logfile (if specified) and printed on the standard +output (if the verbose flag is set). This output includes the date, +image vector, fitting parameters used, and a table of fitted or +derived quantities. The parameters included some quantities relevant to +spectral lines but others apply to any image data. The quantities are +the profile center, the background or continuum at the center of the +profile, the integral or flux of the profile (which is negative for +profiles below the background), the equivalent width, the profile peak +amplitude or core value, and the profile full width at half +maximum. Pure gaussian and lorentzian profiles will have one of +the widths set to zero while voigt profiles will have both values. + +Summary plots are recored in a plotfile (if specified). The plots +show the data with the total fit, individual profiles, and residuals +overplotted. The plotfile may be examined and printed using the +task \fBgkimosaic\fR as well as other tasks which interpret GKI metacode. + +The final output consists of images in the same format as the input. +The images may be of the total fit (sum of profiles without background) +or of the difference (residuals) of the data minus the model. +.ih +ERROR ESTIMATES +Error estimates may be computed for the fitted parameters. +This requires a model for the pixel sigmas. Currently this +model is based on a Poisson statistics model of the data. The model +parameters are a constant Gaussian sigma and an "inverse gain" as specified +by the parameters \fIsigma0\fR and \fIinvgain\fR. These parameters are +used to compute the pixel value sigma from the following formula: + +.nf + sigma**2 = sigma0**2 + invgain * I +.fi + +where I is the pixel value and "**2" means the square of the quantity. + +If either the constant sigma or the inverse gain are specified as INDEF or +with values less than zero then no noise model is applied and no error +estimates are computed. Also if the number of error samples is less than +10 then no error estimates are computed. Note that for processed spectra +this noise model will not generally be the same as the detector readout +noise and gain. These parameters would need to be estimated in some way +using the statistics of the spectrum. The use of an inverse gain rather +than a direct gain was choosed to allow a value of zero for this +parameters. This provides a model with constant uncertainties. + +The error estimates are computed by Monte-Carlo simulation. The model is +fit to the data (using the noise sigmas) and this model is used to describe +the noise-free spectrum. A number of simulations, given by the +\fInerrsample\fR, are created in which random Gaussian noise is added to +the noise-free spectrum based on the pixel sigmas from the noise model. +The model fitting is done for each simulation and the absolute deviation of +each fitted parameter to model parameter is recorded. The error estimate +for the each parameter is then the absolute deviation containing 68.3% of +the parameter estimates. This corresponds to one sigma if the distribution +of parameter estimates is Gaussian though this method does not assume +this. + +The Monte-Carlo technique automatically includes all effects of +parameter correlations and does not depend on any approximations. +However the computation of the errors does take a significant +amount of time. The amount of time and the accuracy of the +error estimates depend on how many simulations are done. A +small number of samples (of order 10) is fast but gives crude +estimates. A large number (greater than 100) is slow but gives +very good estimates. A compromise value of 50 is recommended +for many applications. + +.ih +EXAMPLES +1. The following example creates an artificial spectrum and fits it. +It requires the \fBartdata\fR and \fBproto\fR packages be loaded. + +.nf + cl> mk1dspec test slope=1 temp=0 lines=testlines nl=20 + cl> mknoise test rdnoise=10 poisson=yes + cl> fields testlines fields=1,3 > fitlines + cl> fitprofs test reg="4000 8000" pos=fitlines + # Jul 27 17:49 test - Ap 1: + # Nfit=20, background=YES, positions=all, gfwhm=all, lfwhm=all + # center cont flux eqw core gfwhm lfwhm + 6832.611 1363.188 -13461.8 9.875 -408.339 30.97 0. + 7963.674 1507.641 -8193.58 5.435 -395.207 19.48 0. + 5688.055 1217.01 -7075.11 5.814 -392.006 16.96 0. + 6831.3 1363.02 -7102.01 5.21 -456.463 14.62 0. + 7217.335 1412.323 -10110. 7.158 -427.797 22.2 0. + 6709.286 1347.437 -4985.06 3.7 -225.346 20.78 0. + 6434.317 1312.319 -7121.03 5.426 -342.849 19.51 0. + 6130.415 1273.506 -6164. 4.84 -224.146 25.83 0. + 4569.375 1074.138 -3904.6 3.635 -183.963 19.94 0. + 5656.645 1212.999 -8202.81 6.762 -303.617 25.38 0. + 4219.53 1029.458 -5161.64 5.014 -241.135 20.11 0. + 4551.424 1071.845 -3802.61 3.548 -139.39 25.63 0. + 4604.649 1078.643 -5539.15 5.135 -264.654 19.66 0. + 6966.557 1380.294 -11717.5 8.489 -600.581 18.33 0. + 4259.019 1034.501 -4280.38 4.138 -213.446 18.84 0. + 5952.958 1250.843 -8006.98 6.401 -318.313 23.63 0. + 4531.89 1069.351 -712.598 0.6664 -155.197 4.313 0. + 7814.418 1488.579 -2926.49 1.966 -164.891 16.67 0. + 5310.929 1168.846 -10132.2 8.669 -487.502 19.53 0. + 5022.948 1132.066 -7532.8 6.654 -325.594 21.73 0. + +.fi + +2. Suppose there is no obvious continuum level near the fitting +region but you want to specify a flat continuum level as the average +of pixels in a specified wavelength region. The background region +would be specified as + +.nf + background = "avg(4250,4425.3) avg(4250,4425.3)" +.fi + +Note that the value must be given twice to get a flat continuum. +.ih +REVISIONS +.ls FITPROFS V2.11.3 +Modified to allow a more general specification of the background. +.le +.ls FITPROFS V2.11 +Modified to include lorentzian and voigt profiles. The parameters and +positions file format have changed in this version. A new parameter +controls the number of Monte-Carlo samples used in the error estimates. +.le +.ls FITPROFS V2.10.3 +Error estimates based on a simple noise model are now computed. +.le +.ls FITPROFS V2.10 +This task is new. +.le +.ih +TIME REQUIREMENTS +The following CPU times were obtained with a Sun Sparcstation I. The +number of pixels in the fitting region and the number of lines fit +were varied. The worst case of fitting all parameters and a background +was considered as well as the constrained case of fitting line positions +and a single width with fixed background. + +.nf + Npixels Nprofs Fitbkg Fitpos Fitsig CPU(sec) + 100 5 yes all all 1.9 + 100 10 yes all all 3.3 + 100 15 yes all all 5.6 + 100 20 yes all all 9.0 + 512 5 yes all all 4.7 + 512 10 yes all all 10.0 + 512 15 yes all all 17.6 + 512 20 yes all all 27.8 + 1000 5 yes all all 8.0 + 1000 10 yes all all 18.0 + 1000 15 yes all all 31.8 + 1000 20 yes all all 50.2 + 1000 25 yes all all 72.8 + 1000 30 yes all all 100.2 + 512 5 no all single 2.8 + 512 10 no all single 5.3 + 512 15 no all single 8.6 + 512 20 no all single 12.8 +.fi + +Crudely this implies CPU time goes as the 1.4 power of the number of profiles +and the 0.75 power of the number of pixels. +.ih +SEE ALSO +splot, stsdas.fitting.ngaussfit +.endhelp diff --git a/noao/onedspec/doc/identify.hlp b/noao/onedspec/doc/identify.hlp new file mode 100644 index 00000000..fea7086c --- /dev/null +++ b/noao/onedspec/doc/identify.hlp @@ -0,0 +1,810 @@ +.help identify Jan96 noao.onedspec +.ih +NAME +identify -- Identify features in one dimensional image vectors +.ih +SUMMARY +Features are interactively marked in one dimensional image vectors. +The features may be spectral lines when the vector is a spectrum +or profile positions when the vector is a spatial cut. A function +may be fit to the user coordinates as a function of pixel coordinates. +This is primarily used to find dispersion functions for spectra +such as arc-line calibration spectra. The profile position measurements +are generally used for geometric calibrations. +.ih +USAGE +identify images +.ih +PARAMETERS +.ls images +List of images in which to identify features and fit coordinate functions. +.le +.ls section = "middle line" +If an image is not one dimensional or specified as a one dimensional image +section then the image section given by this parameter is used. The +section defines a one dimensional vector. The image is still considered to +be two or three dimensional. It is possible to change the data vector +within the program. + +The section parameter may be specified directly as an image section or +in one of the following forms + +.nf +line|column|x|y|z first|middle|last|# [first|middle|last|#]] +first|middle|last|# [first|middle|last|#] line|column|x|y|z +.fi + +where each field can be one of the strings separated by | except for # +which is an integer number. The field in [] is a second designator +which is used with three dimensional data. See the example section for +examples of this syntax. Abbreviations are allowed though beware that 'l' +is not a sufficient abbreviation. +.le +.ls database = "database" +Database in which the feature data and coordinate functions are recorded. +.le +.ls coordlist = "linelists$idhenear.dat" +User coordinate list consisting of an list of line coordinates. A +comment line of the form "# units ", where is one of the +understood units names, defines the units of the line list. If no units +are specified then Angstroms are assumed. Some standard line lists are +available in the directory "linelists$". The standard line lists are +described under the topic \fIlinelists\fR. +.le +.ls units = "" +The units to use if no database entry exists. The units are specified as +described in + +.nf + cl> help onedspec.package section=units +.fi + +If no units are specified and a coordinate list is used then the units of +the coordinate list are selected. If a database entry exists then the +units defined there override both this parameter and the coordinate list. +.le +.ls nsum = "10" +Number of lines, columns, or bands across the designated vector axis to be +summed when the image is a two or three dimensional spatial spectrum. +It does not apply to multispec format spectra. If the image is three +dimensional an optional second number can be specified for the higher +dimensional axis (the first number applies to the lower axis number and +the second to the higher axis number). If a second number is not specified +the first number is used for both axes. +.le +.ls match = -3. +The maximum difference for a match between the feature coordinate function +value and a coordinate in the coordinate list. Positive values +are in user coordinate units and negative values are in units of pixels. +.le +.ls maxfeatures = 50 +Maximum number of the strongest features to be selected automatically from +the coordinate list (function 'l') or from the image data (function 'y'). +.le +.ls zwidth = 100. +Width of graphs, in user coordinates, when in zoom mode (function 'z'). +.le + +The following parameters are used in determining feature positions. +.ls ftype = "emission" +Type of features to be identified. The possibly abbreviated choices are +"emission" and "absorption". +.le +.ls fwidth = 4. +Full-width at the base (in pixels) of features to be identified. +.le +.ls cradius = 5. +The maximum distance, in pixels, allowed between a feature position +and the initial estimate when defining a new feature. +.le +.ls threshold = 0. +In order for a feature center to be determined the range of pixel intensities +around the feature must exceed this threshold. +.le +.ls minsep = 2. +The minimum separation, in pixels, allowed between feature positions +when defining a new feature. +.le + +The following parameters are used to fit a function to the user coordinates. +The \fBicfit\fR package is used and further descriptions about these parameters +may be found under that package. +.ls function = "spline3" +The function to be fit to the user coordinates as a function of the pixel +coordinate. The choices are "chebyshev", "legendre", "spline1", or "spline3". +.le +.ls order = 1 +Order of the fitting function. The order is the number of polynomial terms +or number of spline pieces. +.le +.ls sample = "*" +Sample regions for fitting. This is in pixel coordinates and not the user +coordinates. +.le +.ls niterate = 0 +Number of rejection iterations. +.le +.ls low_reject = 3.0, high_reject = 3.0 +Lower and upper residual rejection in terms of the RMS of the fit. +.le +.ls grow = 0 +Distance from a rejected point in which additional points are automatically +rejected regardless of their residuals. +.le + +The following parameters control the input and output. +.ls autowrite = no +Automatically write or update the database? If "no" then when exiting the +program a query is given if the feature data and fit have been modified. +The query is answered with "yes" or "no" to save or not save the results. +If \fIautowrite\fR is "yes" exiting the program automatically updates the +database. +.le +.ls graphics = "stdgraph" +Graphics device. The default is the standard graphics device which is +generally a graphics terminal. +.le +.ls cursor = "" +Cursor input file. If a cursor file is not given then the standard graphics +cursor is read. +.le + +The following parameters are queried when the 'b' key is used. +.ls crval, cdelt +These parameters specify an approximate coordinate value and coordinate +interval per pixel when the automatic line identification +algorithm ('b' key) is used. The coordinate value is for the +pixel specified by the \fIcrpix\fR parameter in the \fBaidpars\fR +parameter set. The default value of \fIcrpix\fR is INDEF which then +refers the coordinate value to the middle of the spectrum. By default +only the magnitude of the coordinate interval is used. Either value +may be given as INDEF. In this case the search for a solution will +be slower and more likely to fail. The values may also be given as +keywords in the image header whose values are to be used. +.le +.ls aidpars = "" (parameter set) +This parameter points to a parameter set for the automatic line +identification algorithm. See \fIaidpars\fR for further information. +.le +.ih +CURSOR KEYS +.ls ? +Clear the screen and print a menu of options. +.le +.ls a +Apply next (c)enter or (d)elete operation to (a)ll features +.le +.ls b +Identify features and find a dispersion function automatically using +the coordinate line list and approximate values for the dispersion. +.le +.ls c +(C)enter the feature nearest the cursor. Used when changing the position +finding parameters or when features are defined from a previous feature list. +.le +.ls d +(D)elete the feature nearest the cursor. (D)elete all features when preceded +by the (a)ll key. This does not affect the dispersion function. +.le +.ls e +Find features from a coordinate list without doing any fitting. This is +like the 'l' key without any fitting. +.le +.ls f +(F)it a function of the pixel coordinates to the user coordinates. This enters +the interactive function fitting package. +.le +.ls g +Fit a zero point shift to the user coordinates by minimizing the difference +between the user and fitted coordinates. The coordinate function is +not changed. +.le +.ls i +(I)nitialize (delete features and coordinate fit). +.le +.ls j +Go to the preceding line, column, or band in a 2D/3D or multispec image. +.le +.ls k +Go to the next line, column, or band in a 2D/3D or multispec image. +.le +.ls l +(L)ocate features in the coordinate list. A coordinate function must be +defined or at least two features must have user coordinates from which a +coordinate function can be determined. If there are features an +initial fit is done, then features are added from the coordinate list, +and then a final fit is done. +.le +.ls m +(M)ark a new feature using the cursor position as the initial position +estimate. +.le +.ls n +Move the cursor or zoom window to the (n)ext feature (same as +). +.le +.ls o +Go to the specified line, column, or band in a 2D/3D or multispec image. +For 3D images two numbers are specified. +.le +.ls p +(P)an to the original window after (z)ooming on a feature. +.le +.ls q +(Q)uit and continue with next image. +.le +.ls r +(R)edraw the graph. +.le +.ls s +(S)hift the fit coordinates relative to the pixel coordinates. The +user specifies the desired fit coordinate at the position of the cursor +and a zero point shift to the fit coordinates is applied. If features +are defined then they are recentered and the shift is the average shift. +The shift in pixels, user coordinates, and z (fractional shift) is printed. +.le +.ls t +Reset the current feature to the position of the cursor. The feature +is \fInot\fR recentered. This is used to mark an arbitrary position. +.le +.ls u +Enter a new (u)ser coordinate for the current feature. +When (m)arking a new feature the user coordinate is also requested. +.le +.ls v +Modify the fitting weight of the current feature. The weights are +integers with the lowest weight being the default of 1. +.le +.ls w +(W)indow the graph. A window prompt is given and a number of windowing +options may be given. For more help type '?' to the window prompt or +see help under \fIgtools\fR. +.le +.ls x +Find a zero point shift for the current dispersion function. This is used +by starting with the dispersion solution and features from a different +spectrum. The mean shift in user coordinates, mean shift in pixels, and +the fractional shift in user coordinates is printed. +.le +.ls y +Up to \fImaxfeatures\fR emission peaks are found automatically (in order of +peak intensity) and, if a dispersion solution is defined, the peaks are +identified from the coordinate list. +.le +.ls z +(Z)oom on the feature nearest the cursor. The width of the zoom window +is determined by the parameter \fIzwidth\fR. +.le +.ls . +Move the cursor or zoom window to the feature nearest the cursor. +.le +.ls 4 + +Move the cursor or zoom window to the (n)ext feature. +.le +.ls 4 - +Move the cursor or zoom window to the previous feature. +.le + +Parameters are shown or set with the following "colon commands", which may be +abbreviated. To show the value of a parameter type the parameter name alone +and to set a new value follow the parameter name by the value. +.ls :show file +Show the values of all the parameters. If a file name is given then the +output is appended to that file. If no file is given then the terminal +is cleared and the output is sent to the terminal. +.le +.ls :features file +Print the feature list and the fit rms. If a file name is given then the +output is appended to that file. If no file is given then the terminal +is cleared and the output is sent to the terminal. +.le +.ls :coordlist file +Set or show the coordinate list file. +.le +.ls :cradius value +Set or show the centering radius in pixels. +.le +.ls :threshold value +Set or show the detection threshold for centering. +.le +.ls :database name +Set or show the database for recording feature records. +.le +.ls :ftype value +Set or show the feature type (emission or absorption). +.le +.ls :fwidth value +Set or show the feature width in pixels. +.le +.ls :image imagename +Set a new image or show the current image. +.le +.ls :labels value +Set or show the feature label type (none, index, pixel, coord, user, or both). +None produces no labeling, index labels the features sequentially in order +of pixel position, pixel labels the features by their pixel coordinates, +coord labels the features by their user coordinates (such as wavelength), +user labels the features by the user or line list supplied string, and +both labels the features by both the user coordinates and user strings. +.le +.ls :match value +Set or show the coordinate list matching distance. +.le +.ls :maxfeatures value +Set or show the maximum number of features automatically found. +.le +.ls :minsep value +Set or show the minimum separation allowed between features. +.le +.ls :read name ap +Read a record from the database. The record name defaults to the image name +and, for 1D spectra, the aperture number defaults to aperture of +the current image. +.le +.ls :write name ap +Write a record to the database. The record name defaults to the image name +and, for 1D spectra, the aperture number defaults to aperture of +the current image. +.le +.ls :add name ap +Add features from a database record. The record name defaults to the image name +and, for 1D spectra, the aperture number defaults to aperture of +the current image. Only the features are added to any existing list +of features. The dispersion function is not read. +.le +.ls :zwidth value +Set or show the zoom width in user units. +.le +.ls :/help +Print additional help for formatting graphs. See help under "gtools". +.le +.ih +DESCRIPTION +Features in the input images are identified interactively and assigned +user coordinates. A "coordinate function" mapping pixel coordinates to +user coordinates may be determined from the identified features. A +user coordinate list may be defined to automatically identify additional +features. This task is used to measure positions of features, +determine dispersion solutions for spectra, and to identify features in +two and three dimensional images for mapping a two or three dimensional +coordinate transformation. Because of this dual use the terms vector +and feature are used rather than spectrum and spectral line. + +Each image in the input list is considered in turn. If the image is +not one dimensional or a one dimensional section of an image +then the image section given by the parameter +\fIsection\fR is used. This parameter may be specified in several ways as +described in the PARAMETERS and EXAMPLES sections. The image section is used +to select a starting vector and image axis. + +If the image is not one dimensional or in multispec format then the number +of lines, columns, or bands given by the parameter \fInsum\fR are summed. +The one dimensional image vector is graphed. The initial feature list and +coordinate function are read from the database if an entry exists. The +features are marked on the graph. The image coordinates are in pixels +unless a coordinate function is defined, in which case they are in user +coordinate units. The pixel coordinate, coordinate function value, and +user coordinate for the current feature are printed. + +The graphics cursor is used to select features and perform various +functions. A menu of the keystroke options and functions is printed +with the key '?'. The cursor keys and their functions are defined in +the CURSOR KEYS section and described further below. The standard +cursor mode keys are also available to window and redraw the graph and +to produce hardcopy "snaps". + +There are a number of ways of defining features. They fall into +two categories; interactively defining features with the cursor +and using automatic algorithms. + +The 'm' key is the principle interactive feature marking method. Typing +'m' near the position of a feature applies a feature centering algorithm +(see \fBcenter1d\fR) and, if a center is found, the feature is entered in +the feature list and marked on the spectrum. If the new position is within +a distance given by the parameter \fIminsep\fR of a previous feature it is +considered to be the same feature and replaces the old feature. Normally +the position of a new feature will be exactly the same as the original +feature. The coordinate list is searched for a match between the +coordinate function value (when defined) and a user coordinate in the +list. If a match is found it becomes the default user coordinate which the +user may override. The new feature is marked on the graph and it becomes +the current feature. The redefinition of a feature which is within the +minimum separation may be used to set the user coordinate from the +coordinate list. The 't' key allows setting the position of a feature to +other than that found by the centering algorithm. + +The principle automatic feature identification algorithm is executed +with the 'b' key. The user is queried for an approximate coordinate +value and coordinate interval per pixel. The coordinate value +is for the center of the spectrum by default though this may be changed +with the \fBaidpars\fR parameters. Only the magnitude of the +coordinate interval per pixel is used by default though this also +may be changed. Either value may be given as INDEF to do an unconstrained +search, however, this will be much slower and more likely to fail. +The algorithm searches for matches between the strong lines in the +spectrum and lines in the coordinate list. The algorithm is described +in the documentation for \fBaidpars\fR. + +The 'b' key works with no predefined dispersion solution or features. If +two or more features are identified, with 'm', spanning the range of the +data or if a coordinate function is defined, from a previous solution, then +the 'e', 'l', and 'y' keys may be used to identify additional features from +a coordinate list. The 'e' key only adds features at the coordinates of +the line lists if the centering algorithm finds a feature at that +wavelength (as described below). The 'y' key works in reverse by finding +the prominent features using a peak finding algorithm and then looking in +the coordinate list for entries near the estimated position. Up to a +maximum number of features (\fImaxfeatures\fR) will be selected. If there +are more peaks only the strongest are kept. In either of these cases there +is no automatic fitting and refitting of the dispersion function. + +The 'l' key combines automatic fits with locating lines from the coordinate +list. If two or more features are defined an initial fit is made. Then +for each coordinate value in the coordinate list the pixel coordinate is +determined and a search for a feature at that point is made. If a feature +is found (based on the parameters \fIftype, fwidth\fR, \fIcradius\fR, and +\fBthreshold\fR) its user coordinate value based on the coordinate function +is determined. If the coordinate function value matches the user +coordinate from the coordinate list within the error limit set by the +parameter \fImatch\fR then the new feature is entered in the feature list. +Up to a maximum number of features, set by the parameter \fImaxfeatures\fR, +may be defined in this way. A new user coordinate function is fit to all +the located features. Finally, the graph is redrawn in user coordinates +with the additional features found from the coordinate list marked. + +A minimum of two features must be defined for the 'l' key algorithm to +work. However, three or more features are preferable to determine changes +in the dispersion as a function of position. + +The 'f' key fits a function of the pixel coordinates to the user +coordinates. The type of function, order and other fitting parameters +are initially set with the parameters \fIfunction, order, sample, +niterate, low_reject, high_reject\fR and \fIgrow\fR.. The value of the +function for a particular pixel coordinate is called the function +coordinate and each feature in the feature list has a function +coordinate value. The fitted function also is used to convert pixel +coordinates to user coordinates in the graph. The fitting is done +within the interactive curve fitting package which has its own set of +interactive commands. For further information on this package see the +help material under \fBicfit\fR. + +If a zero point shift is desired without changing the coordinate function +the user may specify the coordinate of a point in the spectrum with +the 's' key from which a shift is determined. The 'g' key also +determines a shift by minimizing the difference between the user +coordinates and the fitted coordinates. This is used when a previously +determined coordinate function is applied to a new spectrum having +fewer or poorer lines and only a zero point shift can reasonably be +determined. Note that the zero point shift is in user coordinates. +This is only an approximate correction for shifts in the raw spectra +since these shifts are in pixels and the coordinate function should +also be appropriately shifted. + +One a set of features is defined one may select features for various +operations. To select feature as the current feature the keys '.', 'n', +'+', and '-' are used. The '.' selects the feature nearest the cursor, the +'n' and '+' select the next feature, and the '-' selects the previous +feature relative to the current feature in the feature list as ordered by +pixel coordinate. These keys are useful when redefining the user +coordinate with the 'u' key, changing the fitting weight of a feature with +'v', and when examining features in zoom mode. + +Features may be deleted with the key 'd'. All features are deleted +when the 'a' key immediately precedes the delete key. Deleting the +features does not delete the coordinate function. Features deleted in the +curve fitting package also are removed from the feature list upon +exiting the curve fitting package. + +It is common to transfer the feature identifications and coordinate function +from one image to another. When a new image without a database entry +is examined, such as when going to the next image in the input list, +changing image lines or columns with 'j', 'k' and 'o', or selecting +a new image with the ":image" command, the current feature list and coordinate +function are kept. Alternatively, a database record from a different +image may be read with the ":read" command. When transferring feature +identifications between images the feature coordinates will not agree exactly +with the new image feature positions and several options are available to +reregister the feature positions. The key 'c' centers the feature nearest +the cursor using the current position as the starting point. When preceded +with the 'a' key all the features are recentered (the user must refit +the coordinate function if desired). As an aside, the recentering +function is also useful when the parameters governing the feature +centering algorithm are changed. An additional options is the ":add" +command to add features from a database record. This does not overwrite +previous features (or the fitting functions) as does ":read". + +The (c)entering function is applicable when the shift between the current +and true feature positions is small. Larger shifts may be determined +automatically with the 's' or 'x' keys. + +A zero point shift is specified interactively with the 's' key by using the +cursor to indicate the coordinate of a point in the spectrum. If there are +no features then the shift is exactly as marked by the cursor. If there +are features the specified shift is applied, the features are recentered, +and the mean shift for all the features is determined. + +The 'x' key uses the automatic line identification algorithm (see +\fBaidpars\fR) with the constraint that the dispersion is nearly the +same and the is primarily a shift in the coordinate zero point. If +features are defined, normally by inheritance from another spectrum, then a +first pass is done to identify those features in the spectrum. Since this +only works when the shifts are significantly less than the dispersion range +of the spectrum (i.e. a significant number of features are in common) a +second pass using the full coordinate line list is performed if a shift +based on the features is not found. After a shift is found any features +remaining from the original list are recentered and a mean shift is +computed. + +In addition to the single keystroke commands there are commands initiated +by the key ':' (colon commands). As with the keystroke commands there are +a number of standard graphics features available beginning with ":." +(type ":.help" for these commands). The identify colon commands +allow the task parameter values to be listed and to be reset +within the task. A parameter is listed by typing its name. The colon command +":show" lists all the parameters. A parameter value is reset by +typing the parameter name followed by the new value; for example +":match 10". Other colon commands display the feature list (:features), +control reading and writing records to the database (:read and :write), +and set the graph display format. + +The feature identification process for an image is completed by typing +'q' to quit. Attempting to quit an image without explicitly +recording changes in the feature database produces a warning message +unless the \fIautowrite\fR parameter is set. If this parameter is +not set a prompt is given asking whether to save the results otherwise +the results are automatically saved. Also +the reference spectrum keyword REFSPEC is added to the image header at +this time. This is used by \fBrefspectra\fR and \fBdispcor\fR. +As an immediate exit the 'I' interrupt key may be used. This does not save +the feature information and may leave the graphics in a confused state. +.ih +DATABASE RECORDS +The database specified by the parameter \fIdatabase\fR is a directory of +simple text files. The text files have names beginning with 'id' followed +by the entry name, usually the name of the image. The database text files +consist of a number of records. A record begins with a line starting with the +keyword "begin". The rest of the line is the record identifier. Records +read and written by \fBidentify\fR have "identify" as the first word of the +identifier. Following this is a name which may be specified following the +":read" or ":write" commands. If no name is specified then the image name +is used. For 1D spectra the database entry includes the aperture number +and so to read a solution from a aperture different than the current image +and aperture number must be specified. For 2D/3D images the entry name +has the 1D image section which is what is specified to read the entry. +The lines following the record identifier contain +the feature information and dispersion function coefficients. + +The dispersion function is saved in the database as a series of +coefficients. The section containing the coefficients starts with the +keyword "coefficients" and the number of coefficients. + +The first four coefficients define the type of function, the order +or number of spline pieces, and the range of the independent variable +(the line or column coordinate along the dispersion). The first +coefficient is the function type code with values: + +.nf + Code Type + 1 Chebyshev polynomial + 2 Legendre polynomial + 3 Cubic spline + 4 Linear spline +.fi + +The second coefficient is the order (actually the number of terms) of +the polynomial or the number of pieces in the spline. + +The next two coefficients are the range of the independent variable over +which the function is defined. These values are used to normalize the +input variable to the range -1 to 1 in the polynomial functions. If the +independent variable is x and the normalized variable is n, then + +.nf + n = (2 * x - (xmax + xmin)) / (xmax - xmin) +.fi + +where xmin and xmax are the two coefficients. + +The spline functions divide the range into the specified number of +pieces. A spline coordinate s and the nearest integer below s, +denoted as j, are defined by + +.nf + s = (x - xmin) / (xmax - xmin) * npieces + j = integer part of s +.fi + +where npieces are the number of pieces. + +The remaining coefficients are those for the appropriate function. +The number of coefficients is either the same as the function order +for the polynomials, npieces+1 for the linear spline, or npieces + 3 +for the cubic spline. + +1. Chebyshev Polynomial + +The polynomial can be expressed as the sum + +.nf + y = sum from i=1 to order {c_i * z_i} +.fi + +where the c_i are the coefficients and the z_i are defined +interactively as: + +.nf + z_1 = 1 + z_2 = n + z_i = 2 * n * z_{i-1} - z_{i-2} +.fi + +2. Legendre Polynomial + +The polynomial can be expressed as the sum + +.nf + y = sum from i=1 to order {c_i * z_i} +.fi + +where the c_i are the coefficients and the z_i are defined +interactively as: + +.nf + z_1 = 1 + z_2 = n + z_i = ((2*i-3) * n * z_{i-1} - (i-2) * z_{i-2}) / (i-1) +.fi + +3. Linear Spline + +The linear spline is evaluated as + +.nf + y = c_j * a + c_{j+1} * b +.fi + +where j is as defined earlier and a and b are fractional difference +between s and the nearest integers above and below + +.nf + a = (j + 1) - s + b = s - j +.fi + +4. Cubic Spline + +The cubic spline is evaluated as + +.nf + y = sum from i=0 to 3 {c_{i+j} * z_i} +.fi + +where j is as defined earlier. The term z_i are computed from +a and b, as defined earlier, as follows + +.nf + z_0 = a**3 + z_1 = 1 + 3 * a * (1 + a * b) + z_2 = 1 + 3 * b * (1 + a * b) + z_3 = b**3 +.fi +.ih +EXAMPLES +1. Because this task is interactive and has many possible applications +it is difficult to provide actual examples. Instead some uses of the task +are described. + +.ls o +For defining distortions in the slit dimension as a function of +wavelength the positions of objects are marked at some wavelength. +The task \fBreidentify\fR is then used to trace the features to other +wavelengths. +.le +.ls o +For determining dispersion solutions in a one dimensional +spectrum an arc calibration is used. Three emission features are marked +and the (l)ocate key is used to find additional features from a +coordinate list of arc lines. The dispersion solution is fit interactively +and badly determined or misidentified lines are deleted. The +solution may be written to the database or transferred to the object +spectrum by reading the object image and deleting all the features. +Deleting the features does not delete the coordinate function. +.le +.ls o +For determining a two or three dimensional coordinate transformation a +dispersion solution is determined at one slit position in a long slit arc +spectrum or one spatial position in a Fabry-Perot spectrum as in the +previous example. The features are then traced to other positions with the +task \fBreidentify\fR. +.le + +2. For images which are two or three dimensional it is necessary to +specify the image axis for the data vector and the number of pixels at each +point across the vector direction to sum. One way specify a vector is to +use an image section to define a vector. For example, to select column +20: + +.nf + cl> identify obj[20,*] +.fi + +The alternative is to use the section parameter. Below are some examples +of the section parameter syntax for an image "im2d" which is 100x200 +and "im3d" which is 100x200x50. On the left is the section string syntax +and on the right is the image section + +.nf + Section parameter | Image section | Description + ------------------|---------------------|--------------------- + first line | im2d[*,1] | First image line + middle column | im2d[50,*] | Middle image column + last z | im3d[100,200,*] | Last image z vector + middle last y | im3d[50,*,50] | Image y vector + line 20 | im2d[*,20] | Line 20 + column 20 | im2d[20,*] | Column 20 + x 20 | im2d[*,20] | Line 20 + y 20 | im2d[20,*] | Column 20 + y 20 30 | im2d[20,*,30] | Column 20 + z 20 30 | im3d[20,30,*] | Image z vector + x middle | im3d[*,100,25] | Middle of image + y middle | im3d[50,*,25] | Middle of image + z middle | im3d[50,100,*] | Middle of image +.fi + +The most common usage should be "middle line", "middle column" or "middle z". + +The summing factors apply to the axes across the specified vector. For +3D images there may be one or two values. The following shows which axes +are summed, the second and third columns, when the vector axis is that shown +in the first column. + +.nf + Vector axis | Sum axis in 2D | Sum axes in 3D + ------------------|---------------------|-------------------- + 1 | 2 | 2 3 + 2 | 1 | 1 3 + 3 | - | 1 2 +.fi + +.ih +REVISIONS +.ls IDENTIFY V2.11 +The dispersion units are now determined from a user parameter, +the coordinate list, or the database entry. + +A new key, 'e', has been added to add features from a line list without +doing any fits. This is like the 'l' but without the automatic +fitting before and after adding new features. + +A new key, 'b', has been added to apply an automatic line identification +algorithm. + +The 'x' key has been changed to use the automatic line identification +algorithm. The allows finding much larger shifts. + +The match parameter may now be specified either in user coordinates or +in pixels. The default is now 3 pixels. + +The default threshold value has been changed to 0. +.le +.ls IDENTIFY V2.10.3 +The section and nsum parameter syntax was extended to apply to 3D +images. The previous values and defaults may still be used. + +The 'v' key was added to allow assigning weights to features. +.le +.ls IDENTIFY V2.10 +The principle revision is to allow multiple aperture images and long slit +spectra to be treated as a unit. New keystrokes allow jumping or scrolling +within multiple spectra in a single image. For aperture spectra the +database entries are referenced by image name and aperture number and not +with image sections. Thus, IDENTIFY solutions are not tied to specific +image lines in this case. There is a new autowrite parameter which may +be set to eliminate the save to database query upon exiting. The new +colon command "add" may be used to add features based on some other +spectrum or arc type and then apply the fit to the combined set of features. +.le +.ih +SEE ALSO +autoidentify, reidentify, aidpars, center1d, linelists, fitcoords, icfit, +gtools +.endhelp diff --git a/noao/onedspec/doc/lcalib.hlp b/noao/onedspec/doc/lcalib.hlp new file mode 100644 index 00000000..cc327217 --- /dev/null +++ b/noao/onedspec/doc/lcalib.hlp @@ -0,0 +1,125 @@ +.help lcalib Mar92 noao.onedspec +.ih +NAME +lcalib -- List information about the spectral calibration data +.ih +USAGE +lcalib option star_name +.ih +PARAMETERS +.ls option +Chooses calibration data to be listed. Option +may be: "bands" to list the bandpasses at each wavelength, "ext" to +list the extinction at each wavelength, "mags", "fnu", or "flam" +to list the magnitude, or flux of +the star (selected by the star_name parameter) at each wavelength, or +"stars" to list the star names available in the calibration directory. +.le +.ls star_name +Selects which star's magnitude list is chosen if the option parameter +is "mags", "fnu", "flam", or "bands". Also if '?' a list of available +stars in the specified calibration directory is given. +.le + +The following three queried parameters apply if the selected calibration +file is for a blackbody. See \fBstandard\fR for further details. +.ls mag +The magnitude of the observed star in the band given by the +\fImagband\fR parameter. If the magnitude is not in the same band as +the blackbody calibration file then the magnitude may be converted to +the calibration band provided the "params.dat" file containing relative +magnitudes between the two bands is in the calibration directory +.le +.ls magband +The standard band name for the input magnitude. This should generally +be the same band as the blackbody calibration file. If it is +not the magnitude will be converted to the calibration band. +.le +.ls teff +The effective temperature (deg K) or the spectral type of the star being +calibrated. If a spectral type is specified a "params.dat" file must exist +in the calibration directory. The spectral types are specified in the same +form as in the "params.dat" file. For the standard blackbody calibration +directory the spectral types are specified as A0I, A0III, or A0V, where A +can be any letter OBAFGKM, the single digit subclass is between 0 and 9, +and the luminousity class is one of I, III, or V. If no luminousity class +is given it defaults to dwarf. +.le + +.ls extinction +Extinction file. The current standard extinction files: +.nf + onedstds$kpnoextinct.dat - KPNO standard extinction + onedstds$ctioextinct.dat - CTIO standard extinction +.fi +.le +.ls caldir +Calibration directory containing standard star data. The directory name +must end with /. The current calibration directories available in the +onedstds$ may be listed with the command: + +.nf + cl> page onedstds$README +.fi +.le +.ls fnuzero = 3.68e-20 +The absolute flux per unit frequency at a magnitude of zero. This is used +to convert the calibration magnitudes to absolute flux by the formula + + Flux = fnuzero * 10. ** (-0.4 * magnitude) + +The flux units are also determined by this parameter. However, the +frequency to wavelength interval conversion assumes frequency in hertz. +The default value is based on a calibration of Vega at 5556 Angstroms of +3.52e-20 ergs/cm2/s/hz for a magnitude of 0.048. This default value +is that used in earlier versions of this task which did not allow the +user to change this calibration. +.le +.ih +DESCRIPTION +LCALIB provides a means of checking the flux calibration data. The calibration +data consists of extinction, bandpasses, and stellar magnitudes. + +The extinction is given in an extinction file consisting of lines with +wavelength and extinction. The wavelengths must be order in increasing +wavelength and the wavelengths must be in Angstroms. There are two +standard extinction files currently available, "onedstds$kpnoextinct.dat", +and "onedstds$ctioextinct.dat". + +The standard star data are in files in a calibration +directory specified with the parameter \fIcaldir\fR. A standard star +file is selected by taking the star name given, by the parameter +\fIstar_name\fR, removing blanks, +'s and -'s, appending ".dat", and converting +to lower case. This file name is appended to the specified calibration +directory. A calibration file consists of lines containing a wavelength, +a stellar magnitude, and a bandpass full width. The wavelengths are in +Angstroms. Comment lines beginning with # may be included in the file. +The star names printed by this task are just the first line of each file +in the calibration directory with the first character (#) removed. +The calibration files may be typed, copied, and printed. \fBLcalib\fR +may also be used to list data from the calibration files. +.ih +EXAMPLES + +.nf + # List the extinction table + cl> lcalib ext + # Plot the extinction table + cl> lcalib ext | graph + # Plot the energy distribution + cl> lcalib mags "bd+28 4211" | graph + # List the names of all the stars + cl> lcalib stars caldir=onedstds$irscal/ + # As above but for IIDS file + cl> lcalib stars calib_file=onedstds$iidscal/ +.fi +.ih +REVISIONS +.ls LCALIB V2.10 +This task has a more compact listing for the "stars" option and allows +paging a list of stars when the star name query is not recognized. +.le +.ih +SEE ALSO +standard, sensfunc, onedstds$README +.endhelp diff --git a/noao/onedspec/doc/mkspec.hlp b/noao/onedspec/doc/mkspec.hlp new file mode 100644 index 00000000..96efd726 --- /dev/null +++ b/noao/onedspec/doc/mkspec.hlp @@ -0,0 +1,86 @@ +.help mkspec Mar92 noao.onedspec +.ih +NAME +mkspec -- generate an artificial spectrum or image (obsolete) +.ih +USAGE +mkspec image_name image_title ncols nlines function +.ih +PARAMETERS +.ls image_name +The name to be given to the image file +.le +.ls image_title +A character string to be used to describe the image +.le +.ls ncols +The number of pixels in the spectrum (the length of the image). +.le +.ls nlines +The number or lines (rows) in the image. +.le +.ls function +An indicator specifying the form of the spectrum: 1 - a constant, +2 - a ramp running from start_level to end_level, 3 - a black body +extending in wavelength (Angstroms) from start_wave to end_wave +at a given temperature (in degrees K). +.le +.ls constant +The value to be assigned to the spectrum if function=1 (constant). +.le +.ls start_level +The starting value to be assigned to the spectrum at pixel 1 if +function=2 (ramp). +.le +.ls end_level +The ending value of the spectrum assigned at pixel=ncols if function=2. +.le +.ls start_wave +The wavelength (Angstroms) assigned to pixel 1 if function=3 (Black Body). +.le +.ls end_wave +The wavelength (Angstroms) assigned to the last pixel if function=3. +.le +.ls temperature +The black body temperature (degrees K) for which the spectrum +is to be created if function=3. +.le +.ih +DESCRIPTION +An artificial image is created with the specified name and length. +The image may have a constant value (function=1), or may be a ramp +with either positive or negative slope (function=2), or may be +a black body curve (function=3). + +Only those parameters specific to the functional form of the image +need be specified. In all cases the parameters image_name, image_title, +ncols, nlines, and function are required. If function=1, parameter constant +is required; if function=2, start_level and end_level are required; +if function=3, start_wave, end_wave, and temperature are required. + +All black body functions are normalized to 1.0 at their peak +intensity which may occur at a wavelength beyond the extent of +the generated spectrum. + +NOTE THAT THIS TASK IS OBSOLETE AND ARTDATA.MK1DSPEC SHOULD BE USED. +In particular this task does not set the header dispersion coordinate +system. +.ih +EXAMPLES + +.nf + cl> mkspec allones "Spectrum of 1.0" 1024 1 1 constant=1.0 + cl> mkspec ramp "From 100.0 to 0.0" 1024 64 2 start=100 \ + >>> end=0.0 + cl> mkspec bb5000 "5000 deg black body" 512 1 3 start=3000 \ + >>> end=8000 temp=5000 +.fi +.ih +REVISIONS +.ls MKSPEC V2.10 +This task is unchanged. +.le +.ih +SEE ALSO +artdata.mk1dspec, artdata.mk2dspec, artdata.mkechelle +.endhelp diff --git a/noao/onedspec/doc/names.hlp b/noao/onedspec/doc/names.hlp new file mode 100644 index 00000000..9004b20e --- /dev/null +++ b/noao/onedspec/doc/names.hlp @@ -0,0 +1,67 @@ +.help names Mar92 noao.onedspec +.ih +NAME +names -- Generate image names from a root and a range descriptor +.ih +USAGE +names input records +.ih +PARAMETERS +.ls input +The root file name for the input records to be calibrated. +.le +.ls records +The range of spectra to be included in the calibration operation. +Each range item will be appended to the root name to form an +image file name. +.le +.ls append = "" +If not a null string, this character string will be appended to +all the generated image names. This allows for a specification of +image sections. +.le +.ls check = no +If set to yes, a check is made that each name implied by the range +specification has at least an image header. The pixel file is not +checked. If set to no, then all possible image names are generated +even if no image exists. +.le +.ih +DESCRIPTION +A sequence of image names is generated from the input root file name +and the range description by appending the possible range values to +the root in the form "root.nnnn". At least four digits will follow the +root. + +If an append string is specified, this is added to the image name as well. + +The generated image names are written to STDOUT, but may be redirected +to a file for further use. +.ih +EXAMPLES +The following will generate names of the form nite1.0001, nite1.0002 ... +nite1.0010 and place the list in the file nite1.lst. + +.nf + cl> names nite1 1-10 >nite1.lst +.fi + +The next example uses the append option to specify that only the +first 512 pixels of each image (spectrum) are to used in the image name. + +.nf + cl> names nite1 1-10 append="[1:512]" >nite1.lst +.fi +.ih +REVISIONS +.ls NAMES V2.10 +This task is unchanged. +.le +.ih +.ih +BUGS +The append option is only useful for adding image sections since it is +added after the ONEDSPEC name is generated. Appending other strings +produces names such as root.0012str which are not recognized by +the package. +.endhelp diff --git a/noao/onedspec/doc/ndprep.hlp b/noao/onedspec/doc/ndprep.hlp new file mode 100644 index 00000000..6f59ba4b --- /dev/null +++ b/noao/onedspec/doc/ndprep.hlp @@ -0,0 +1,115 @@ +.help ndprep Mar92 noao.onedspec +.ih +NAME +ndprep -- Make a neutral density filter calibration image +.ih +USAGE +ndprep filter_curve output +.ih +PARAMETERS +.ls filter_curve +Neutral density filter curve. The directory specified by the parameter +\fIdirectory\fR is prepended to this name so if a directory is specified +then it should not be given here. If '?' a list of filter curves +in the specified directory is typed. +.le +.ls output +Output neutral density filter image. +.le +.ls w0 +Starting wavelength for the output image in Angstroms. +.le +.ls dw +Wavelength increment for the output image in Angstroms. +.le +.ls nw +Number of wavelength points for the output image (i.e. the size of the +output image). +.le +.ls nspace = 0 +Number of spatial points for a two dimensional image. If the value is +zero then a one dimensional image is created. +.le +.ls logarithm = no +Use logarithmic wavelengths and intervals? If yes then the wavelengths +will have the same starting and ending points and number of pixels but +the wavelength intervals will be logarithmic. +.le +.ls flux = yes +Conserve flux when rebinning to logarithmic wavelength intervals? +.le +.ls dispaxis = 1 +Dispersion axis for two dimensional images. Dispersion along the lines +is 1 and dispersion along the columns is 2. +.le +.ls directory = "onedstds$ctio/" +Directory containing neutral density filter curves. This directory is +prepended to the specified fiter curve file (and so must end with '/' +or '$'). +.le +.ih +DESCRIPTION +A neutral density (ND) filter curve is converted to a calibration image +with the same size and wavelength range as the images to be calibrated. +A list of standard neutral density curves is typed if the filter +curve name is given as '?'. The ND curves are text files containing +wavelength and filter transmission pairs. Comments begin with '#'. +A plot of the ND curve can be obtained using \fBgraph\fR. + +The ND curve is first interpolated to a one dimensional image of +\fInw\fR wavelength points with starting wavelength \fIwO\fR and +wavelength increment \fIdw\fR using the task \fBsinterp\fR. The +wavelength parameters must be in the same units as the filter curves +(currently Angstroms) even if the final calibration image is to be in +logarithmic wavelength intervals. If logarithmic wavelength format +is specified the image is rebinned over the same wavelength range with +the same number of points using the task \fBdispcor\fR. The rebinning +may include flux conservation to account for the changing size of +pixels or simply interpolate. Note that flux conservation will +change the apparent shape of the ND curve. + +If the number of points across the dispersion, \fInspace\fR is zero then +the final calibration image is one dimensional. If it is greater than +zero the one dimensional ND image is expanded to the specified number +of spatial points with the dispersion axis specified by the parameter +\fIdispaxis\fR (1 = dispersion along the lines, 2 = dispersion along +the columns). +.ih +EXAMPLES +To get a list of standard ND filter curves: + + cl> ndprep ? + +To graph the ND filter curve: + + cl> graph onedstds$ctio/nd1m.100mag.dat + +Naturally, if a calibration image is made then the image plotting tasks +such as \fBgraph\fR, \fBimplot\fR, and \fBsplot\fR may also be used. + +To make a one dimensional ND calibration spectrum: + +.nf + cl> ndprep w0=4000 dw=1.2 nw=512 + Input ND filter curve: onedstds$ctio/nd1m.100mag.dat + Output calibration image: NDimage +.fi + +To make a two dimensional ND calibration spectrum in logarithmic wavelength: + +.nf + cl> ndprep w0=4000 dw=1.2 nw=512 nspace=200 log+ + Input ND filter curve: onedstds$ctio/nd4m.u000mag.dat + Output calibration image: NDimage +.fi +.ih +REVISIONS +.ls NDPREP V2.10 +This task was moved from the \fBproto\fR package. It was originally +written at CTIO for CTIO data. It's functionality is largely unchanged +though it has been updated for changes in the \fBonedspec\fR package. +.le +.ih +SEE ALSO +sinterp, dispcor +.endhelp diff --git a/noao/onedspec/doc/odcombine.hlp b/noao/onedspec/doc/odcombine.hlp new file mode 100644 index 00000000..11ddffe5 --- /dev/null +++ b/noao/onedspec/doc/odcombine.hlp @@ -0,0 +1,480 @@ +.help odcombine Apr04 onedspec +.ih +NAME +odcombine -- Combine spectra using various algorithms +.ih +USAGE +odcombine input output +.ih +PARAMETERS +.ls input +List of input images containing spectra to be combined. The spectra +in the images to be combined are selected with the \fIapertures\fR and +\fIgroup\fR parameters. Only the primary spectrum is combined and +the associated band spectra are ignored. This task does not work on +higher dimensional spectra data. To apply it first use a task to +extract it to 1D spectra. The simplest method is \fBscopy\fR. +.le +.ls output +List of output images to be created containing the combined spectra. If +the grouping option is "all" then only one output image is created with the +specified name. If the grouping option is "images" then there will be one +output image for each input image and the output list must match the input +list in number. If the grouping option is "apertures" then only one output +root name is specified and there will be one output image for each selected +aperture. In this case the output images will have a name formed from the +root name and a four digit aperture number extension. In all cases the +output images contain a single 1D spectrum. Other tasks, such as +\fBscopy\fR, may be used to pack the spectra into a single file. +.le + + +There are a number of additional optional output files that may be produced. +The lists are handled in the same was as for the primary output; i.e. +depending on the grouping a single name, root name, or a matching list +is specified. +.ls headers = "" (optional) +Optional output multiextension FITS file(s). The extensions are dataless +headers from each input image. +.le +.ls bpmasks = "" (optional) +Optional output bad pixel mask(s) with good values of 0 and bad values of +1. Output pixels are marked as bad when no input pixels contributed to the +output pixel. The file name is also added to the output image header under +the keyword BPM. +.le +.ls rejmask = "" (optional) +Optional output mask file(s) identifying rejected or excluded pixels. The +pixel mask is the size of the output image but there is one extra dimension +with length equal to the number of input images. Each element of the +highest dimension is a mask corresponding to an input image with values of +1 for rejected or excluded pixels and values of 0 for pixels which were +used. The order of the masks is the order of the input images and image +header keywords, indexed by the pixel coordinate of the highest dimension +identify the input images. Note that the pixel positions are in the output +pixel coordinate system. +.le +.ls nrejmasks = "" (optional) +Optional output pixel mask(s) giving the number of input pixels rejected or +excluded from the input images. +.le +.ls expmasks = "" (optional) +Optional output exposure mask(s) giving the sum of the exposure values of +the input images with non-zero weights that contributed to that pixel. +Since masks are integer, the exposure values may be scaled to preserve +dynamic range and fractional significance. The scaling values are given in +the header under the keywords MASKSCAL and MASKZERO. Exposure values are +computed from the mask values by scale * value + zero where scale is the +value of the MASKSCAL keyword and zero is the value of the MASKZERO +keyword. +.le +.ls sigma = "" (optional) +Optional output sigma image(s). The sigma is the standard deviation, +corrected for a finite population, of the input pixel values (excluding +rejected pixels) about the output combined pixel values. +.le +.ls logfile = "STDOUT" (optional) +Optional output log file. If no file is specified then no log information is +produced. The special filename "STDOUT" prints log information to the +terminal. +.le + + +.ce +Grouping Parameters +.ls apertures = "" +List of apertures to be selected for combining. If none is specified +then all apertures are selected. The syntax is a blank or comma separated +list of aperture numbers or hypen separated aperture ranges. +.le +.ls group = "apertures" (all|images|apertures) +Option for grouping input spectra for combining (after selection by aperture) +from one or more input images. The options are: +.ls "all" +Combine all spectra from all images in the input list into a single output +spectrum. +.le +.ls "images" +Combine all spectra in each input image into a single spectrum in +separate output images. +.le +.ls "apertures" +Combine all spectra of the same aperture from all input images and put it +into an output image with specified root name and a four digit aperture +number extension. +.le +.le + + +.ce +Dispersion Matching Parameters +.ls first = no +Use the first input spectrum of each set to be combined to define the +dispersion coordinates for combining and output? If yes then all other +spectra to be combined will be interpolated to the dispersion of this +spectrum and that dispersion defines the dispersion of the +output spectrum. If no, then all the spectra are interpolated to a linear +dispersion as determined by the following parameters. The interpolation +type is set by the package parameter \fIinterp\fR. +.le +.ls w1 = INDEF, w2=INDEF, dw = INDEF, nw = INDEF, log = no +The output linear or log linear wavelength scale if the dispersion of the +first spectrum is not used. INDEF values are filled in from the maximum +wavelength range and minimum dispersion of the spectra to be combined. The +parameters are aways specified in linear wavelength even when the log +parameter is set to produce constant pixel increments in the log of the +wavelength. The dispersion is interpreted in that case as the difference +in the log of the endpoints divided by the number of pixel. +.le + + +.ce +Combining Parameters +.ls combine = "average" (average|median|sum) +Type of combining operation performed on the final set of pixels (after +offsetting, masking, thresholding, and rejection). The choices are +"average", "median", or "sum". The median uses the average of the two central +values when the number of pixels is even. For the average and sum, the +pixel values are multiplied by the weights (1 if no weighting is used) +and summed. The average is computed by dividing by the sum of the weights. +If the sum of the weights is zero then the unweighted average is used. +.le +.ls reject = "none" (none|minmax|ccdclip|crreject|sigclip|avsigclip|pclip) +Type of rejection operation performed on the pixels remaining after offsetting, +masking and thresholding. The algorithms are described in the +help page for \fBimcombine\fR. The rejection choices are: + +.nf + none - No rejection + minmax - Reject the nlow and nhigh pixels + ccdclip - Reject pixels using CCD noise parameters + crreject - Reject only positive pixels using CCD noise parameters + sigclip - Reject pixels using a sigma clipping algorithm + avsigclip - Reject pixels using an averaged sigma clipping algorithm + pclip - Reject pixels using sigma based on percentiles +.fi + +.le +.ls outtype = "real" (none|short|ushort|integer|long|real|double) +Output image pixel datatype. The pixel datatypes are "double", "real", +"long", "integer", unsigned short "ushort", and "short" with highest +precedence first. If "none" is specified then the highest precedence +datatype of the input images is used. When there is a mixture of +short and unsigned short images the highest precedence become integer. +The datatypes may be abbreviated to a single character. +.le +.ls outlimits = "" +Output region limits specified as a pair of whitespace separated pixel +values. +.le + + +.ce +Masking Parameters +.ls smaskformat = "bpmspectrum" (bpmspectrum|bpmpixel) +When a mask is applied it must be matched to the input spectrum. If the +value of this parameter is "bpmspectrum" the mask file is assumed to have a +spectral file structure with aperture and dispersion information. The mask +spectrum is matched to the input spectrum by aperture number and is +rebinned from its dispersion to match the rebinned dispersion of the input +spectrum. If the value is "bpmpixel" the mask file is assumed to have +minimal header information and the pixel information is matched to the +input image pixels. This means the mask pixels are extracted from the same +line as the input spectrum and the mask pixels are resampled in the same +way as the input spectrum pixels. +.le +.ls smasktype = "none" (none|goodvalue|badvalue|goodbits|badbit) +Type of pixel masking to use. If "none" or "" then no pixel masking is +done even if an image has an associated pixel mask. The other choices are +to select the value in the pixel mask to be treated as good (goodvalue) or +bad (badvalue) or the bits (specified as a value) to be treated as good +(goodbits) or bad (badbits). The pixel mask filename is specified by the +image header keyword "BPM". Note that if the input image contains +multiple spectra then the mask file must also contain at least the +selected apertures if the mask format is "bpmspectrum" or matching +image dimensions if the mask format is "bpmpixel". +.le +.ls maskvalue = 0 +Mask value used with the \fImasktype\fR parameter. If the mask type +selects good or bad bits the value may be specified using IRAF notation +for decimal, octal, or hexadecimal; i.e 12, 14b, 0cx to select bits 3 +and 4. +.le +.ls blank = 0. +Output value to be used when there are no pixels. +.le + + +.ce +Scaling/Weighting Parameters + +The following scaling and weighting parameters have the following behavior +and constraints, which are particularly relevant to multispec formats where +multiple spectra are contained in an image with a single image header. +When using image statistics these are calculated from the rebinned spectra +being combined as expected. When using header keywords the values will be +the same for all spectra from the same input file. + +When using a file then the list will be applied repeatedly to each +group being combined. If the grouping is by aperture then the values will +be matched in the order of the input images. Note that if an image does +not contain a specified aperture the ordering will be wrong. If the +grouping is by image then the file will be matched to the spectra in the +order of the apertures in the image. And if the grouping is "all" then the +list is matched in the order of the images and apertures within the +images with the apertures in an image varying first. + +.ls scale = "none" (none|mode|median|mean|exposure|@|!) +Multiplicative image scaling to be applied. The choices are none, multiply +by the reciprocal of the mode, median, or mean of the specified statistics +section, multiply by the reciprocal of the exposure time in the image header, +multiply by the values in a specified file, or multiply by a specified +image header keyword. When specified in a file the scales must be one per +line in the order of the input images. +.le +.ls zero = "none" (none|mode|median|mean|@|!) +Additive zero level image shifts to be applied. The choices are none, add +the negative of the mode, median, or mean of the specified statistics +section, add the values given in a file, or add the values given by an +image header keyword. When specified in a file the zero values must be one +per line in the order of the input images. File or keyword zero offset +values do not allow a correction to the weights. +.le +.ls weight = "none" (none|mode|median|mean|exposure|@|!) +Weights to be applied during the final averaging. The choices are none, +the mode, median, or mean of the specified statistics section, the exposure +time, values given in a file, or values given by an image header keyword. +When specified in a file the weights must be one per line in the order of +the input images and the only adjustment made by the task is for the number of +images previously combined. In this case the weights should be those +appropriate for the scaled images which would normally be the inverse +of the variance in the scaled image. +.le +.ls statsec = "" +Section of images to use in computing image statistics for scaling and +weighting. If no section is given then the entire region of the input is +sampled (for efficiency the images are sampled if they are big enough). +When the images are offset relative to each other one can precede the image +section with one of the modifiers "input", "output", "overlap". The first +interprets the section relative to the input image (which is equivalent to +not specifying a modifier), the second interprets the section relative to +the output image, and the last selects the common overlap and any following +section is ignored. +.le +.ls expname = "" +Image header keyword to be used with the exposure scaling and weighting +options. Also if an exposure keyword is specified that keyword will be +added to the output image using a weighted average of the input exposure +values. +.le + + +.ce +Algorithm Parameters +.ls lthreshold = INDEF, hthreshold = INDEF +Low and high thresholds to be applied to the input pixels. This is done +before any scaling, rejection, and combining. If INDEF the thresholds +are not used. +.le +.ls nlow = 1, nhigh = 1 (minmax) +The number of low and high pixels to be rejected by the "minmax" algorithm. +These numbers are converted to fractions of the total number of input images +so that if no rejections have taken place the specified number of pixels +are rejected while if pixels have been rejected by masking, thresholding, +or nonoverlap, then the fraction of the remaining pixels, truncated +to an integer, is used. +.le +.ls nkeep = 1 +The minimum number of pixels to retain or the maximum number to reject +when using the clipping algorithms (ccdclip, crreject, sigclip, +avsigclip, or pclip). When given as a positive value this is the minimum +number to keep. When given as a negative value the absolute value is +the maximum number to reject. The latter is in addition to pixels +missing due to non-overlapping offsets, bad pixel masks, or thresholds. +.le +.ls mclip = yes (ccdclip, crreject, sigclip, avsigcliip) +Use the median as the estimate for the true intensity rather than the +average with high and low values excluded in the "ccdclip", "crreject", +"sigclip", and "avsigclip" algorithms? The median is a better estimator +in the presence of data which one wants to reject than the average. +However, computing the median is slower than the average. +.le +.ls lsigma = 3., hsigma = 3. (ccdclip, crreject, sigclip, avsigclip, pclip) +Low and high sigma clipping factors for the "ccdclip", "crreject", "sigclip", +"avsigclip", and "pclip" algorithms. They multiply a "sigma" factor +produced by the algorithm to select a point below and above the average or +median value for rejecting pixels. The lower sigma is ignored for the +"crreject" algorithm. +.le +.ls rdnoise = "0.", gain = "1.", snoise = "0." (ccdclip, crreject) +CCD readout noise in electrons, gain in electrons/DN, and sensitivity noise +as a fraction. These parameters are used with the "ccdclip" and "crreject" +algorithms. The values may be either numeric or an image header keyword +which contains the value. The noise model for a pixel is: + +.nf + variance in DN = (rdnoise/gain)^2 + DN/gain + (snoise*DN)^2 + variance in e- = (rdnoise)^2 + (gain*DN) + (snoise*(gain*DN))^2 + = rdnoise^2 + Ne + (snoise * Ne)^2 +.fi + +where DN is the data number and Ne is the number of electrons. Sensitivity +noise typically comes from noise introduced during flat fielding. +.le +.ls sigscale = 0.1 (ccdclip, crreject, sigclip, avsigclip) +This parameter determines when poisson corrections are made to the +computation of a sigma for images with different scale factors. If all +relative scales are within this value of unity and all relative zero level +offsets are within this fraction of the mean then no correction is made. +The idea is that if the images are all similarly though not identically +scaled, the extra computations involved in making poisson corrections for +variations in the sigmas can be skipped. A value of zero will apply the +corrections except in the case of equal images and a large value can be +used if the sigmas of pixels in the images are independent of scale and +zero level. +.le +.ls pclip = -0.5 (pclip) +Percentile clipping algorithm parameter. If greater than +one in absolute value then it specifies a number of pixels above or +below the median to use for computing the clipping sigma. If less +than one in absolute value then it specifies the fraction of the pixels +above or below the median to use. A positive value selects a point +above the median and a negative value selects a point below the median. +The default of -0.5 selects approximately the quartile point. +See the DESCRIPTION section for further details. +.le +.ls grow = 0. +Radius in pixels for additional pixel to be rejected in an image with a +rejected pixel from one of the rejection algorithms. This applies only to +pixels rejected by one of the rejection algorithms and not the masked or +threshold rejected pixels. +.le + +The following parameters are internal to the task and not user parameters: + +.nf + offsets, masktype, maskvalue +.fi + +.ce +Environment Variables + +.ls .interp +When the spectra have to be interpolated to a common pixel sampling +the "interp" parameter from the package from which ODCOMBINE is used +will be used. +.le +.ih +DESCRIPTION +\fBOdcombine\fR combines input spectra by interpolating them (if necessary) +to a common dispersion sampling, rejecting pixels exceeding specified low +and high thresholds or identified as bad in a bad pixel mask, scaling them +in various ways, applying a rejection algorithm based on known or empirical +noise statistics, and computing the sum, weighted average, or median of the +remaining pixels. Note that the "sum" option is the direct summation of +the pixels and does not perform any rejection or scaling of the data +regardless of the parameter settings. + +The input spectra are specified using an image list in which each image +may contain multiple spectra. The set of spectra may be restricted +by the \fIaperture\fR parameter to specific apertures. The set of input +spectra may then be grouped using the \fIgroup\fR parameter and each +group combined separately into final output spectra. The grouping +options are to select all the input spectra regardless of the input +image or aperture number, select all spectra of the same aperture, +or select all the spectra from the same input image. + +The output consists of one image for each combined group. The output +images and combined spectra inherit the header parameters from the first +spectrum in the combined group. There are a number of additional optional +outputs provided. The optional logfile lists parameters, the spectra +combined for each group, scaling, weights, etc., and the output names. + +The spectral combining is done using pixels at common dispersion +coordinates rather than physical or logical pixel coordinates. If the +spectra to be combined do not have identical dispersion coordinates then +the spectra are interpolated to a common dispersion sampling before +combining. The interpolation conserves pixel values rather pixel fluxes. +This means that flux calibrated data is treated correctly and that +spectra in counts are not corrected in the interpolation for changes in +pixel widths. The default interpolation function is a 5th order +polynomial. The choice of interpolation type is made with the package +parameter "interp". It may be set to "nearest", "linear", "spline3", +"poly5", or "sinc". Remember that this applies to all tasks which might +need to interpolate spectra in the \fBonedspec\fR and associated packages. +For a discussion of interpolation types see \fBonedspec\fR. + +There are two choices for the common dispersion coordinate sampling. If the +\fIfirst\fR parameter is set then the dispersion sampling of the first +spectrum is used. If this dispersion is nonlinear then the end points and +number of pixels are preserved and a linear dispersion is applied between +the endpoints. If the parameter is not set then the user specified linear +or log linear dispersion system is used. Any combination of starting +wavelength, ending wavelength, wavelength per pixel, and number of output +pixels may be specified. Unspecified values will default to reasonable +values based on the minimum or maximum wavelengths of all spectra, the +minimum dispersion, and the number of pixels needed to satisfy the other +parameters. If the parameters overspecify the linear system then the +ending wavelength is adjusted based on the other parameters. Note that for +a log linear system the wavelengths are still specified in nonlog units and +the dispersion is finally recalculated using the difference of the log +wavelength endpoints divided by the number pixel intervals (the number of +pixels minus one). + +This task is layered on top of the \fBimcombine\fR task. What happens +is that the spectra for each group to be combined is extracted from +the input, resampled to a common dispersion, and the resulting spectra +written to temporary images, one per spectrum. The temporary images +are written to the current working directory with names begining with +"tmp". The same is done with any bad pixel masks. Then the list of +images are combined using the IMCOMBINE algorithms. When the combining +is completed the temporary images are removed. If ODCOMBINE aborts +for some reason these file may be left behind and the user may delete +them. Details of what IMCOMBINE does are presented separate under the +help topic for the IMCOMBINE task. + +.ih +EXAMPLES +1. Combine orders of echelle images. + +.nf + cl> odcombine *.ec *%.ec%% group=images combine=sum +.fi + +2. Combine all spectra using range syntax and scale by the exposure times. + +.nf + cl> names irs 10-42 > irs.dat + cl> odcombine @irs.dat irscombine group=all scale=exptime +.fi + +3. Combine spectra by apertures using exposure time scaling and weighting. + +.nf + cl> odcombine *.ms comb1d \\ + >>> group=apertures scale=exptime weights=exptime + cl> scopy comb1d.* comb.ms format="multispec" + cl> imdel comb1d.* +.fi +.ih +REVISIONS +.ls ODCOMBINE V2.12.3 +This is a new version that incorporates most of the features of +IMCOMBINE. + +In addition to the many new features, including application of pixel +masks, the following functional differences from the old SCOMBINE +are noted. + +.ls 1 +The output is always a single spectrum per image. +.le +.ls 2 +The "first" option does not allow rebinning to a non-linear dispersion. +Instead, it rebins to the nearest linear dispersion matching the first +spectrum. +.le +.ih +SEE ALSO +imcombine, scombine, scopy, sarith, lscombine +.endhelp diff --git a/noao/onedspec/doc/onedspec.hlp b/noao/onedspec/doc/onedspec.hlp new file mode 100644 index 00000000..a1c06ab9 --- /dev/null +++ b/noao/onedspec/doc/onedspec.hlp @@ -0,0 +1,293 @@ +.help package Nov94 noao.onedspec +.ih +NAME +onedspec -- generic 1D spectral reduction and analysis package +.ih +USAGE +onedspec +.ih +PARAMETERS +.ls observatory = "observatory" +Observatory at which the spectra were obtained if not specified in the +image header by the keyword OBSERVAT. This parameter is used by several +tasks in the package through parameter redirection so this parameter may be +used to affect all these tasks at the same time. The observatory may be +one of the observatories in the observatory database, "observatory" to +select the observatory defined by the environment variable "observatory" or +the parameter \fBobservatory.observatory\fR, or "obspars" to select the +current parameters set in the \fBobservatory\fR task. See help for +\fBobservatory\fR for additional information. +.le +.ls caldir = "" +Calibration directory containing standard star data. This parameter +is used by several tasks in the package through redirection. A list of +standard calibration directories may be obtained by listing the file +"onedstds$README"; for example: + + cl> page onedstds$README + +The user may copy or create their own calibration files and specify +the directory. The directory "" refers to the current working directory. +.le +.ls interp = "poly5" (nearest|linear|poly3|poly5|spline3|sinc) +Spectrum interpolation type used when spectra are resampled. The choices are: + +.nf + nearest - nearest neighbor + linear - linear + poly3 - 3rd order polynomial + poly5 - 5th order polynomial + spline3 - cubic spline + sinc - sinc function +.fi +.le + +The following parameters apply to two and three dimensional images +such as long slit or Fabry-Perot spectra. They allow selection of +a line or column as the spectrum "aperture" and summing of neighboring +elements to form a one dimensional spectrum as the tasks in the +ONEDSPEC package expect. + +.ls dispaxis = 1 +The image axis corresponding to the dispersion. If there is an image +header keyword DISPAXIS then the value of the keyword will be used +otherwise this package parameter is used. The dispersion coordinates +are a function of column, line, or band when this parameter is 1, 2 +or 3. +.le +.ls nsum = "1" +The number of neighboring elements to sum. This is a string parameter +that can have one or two numbers. For two dimensional images only +one number is needed and specifies the number of lines or columns +to sum depending on the dispersion axis. For three dimensional +images two numbers may be given (if only one is given it defaults +to the same value for both spatial axes) to specify the summing of +the two spatial axes. The order is the lower dimensional spatial +axis first. + +For an even value the elements summed are the central specified +"aperture", nsum / 2 - 1 below, and nsum /2 above; i.e the +central value is closer to the lower element than the upper. +For example, for nsum=4 and an aperture of 10 for a dispersion +axis of 1 in a two dimensional image the spectrum used will be +the sum of lines 9 to 12. +.le + +.ls records = "" +This is a dummy parameter. It is applicable only in the \fBimred.irs\fR +and \fBimred.iids\fR packages. +.le +.ls version = "ONEDSPEC V3: November 1991" +Package version identification. +.le +.ih +DESCRIPTION +The \fBonedspec\fR package contains generic tasks for the reduction, +analysis, and display of one dimensional spectra. The specifics of +individual tasks may be found in their IRAF "help" pages. This document +describes the general and common features of the tasks. + +The functions provided in the \fBonedspec\fR package with applicable tasks +are summarized in Table 1. + +.ce +Table 1: Functions provided in the \fBonedspec\fR package + +.nf +1. Graphical display of spectra + bplot - Batch plots of spectra + identify - Identify features and fit dispersion functions + specplot - Stack and plot multiple spectra + splot - Interactive spectral plot/analysis + +2. Determining and applying dispersion calibrations + dispcor - Dispersion correct spectra + dopcor - Apply doppler corrections + identify - Identify features and fit dispersion functions + refspectra - Assign reference spectra to other spectra + reidentify - Automatically identify features in spectra + specshift - Shift spectral dispersion coordinate system + +3. Determining and applying flux calibrations + calibrate - Apply extinction and flux calibrations to spectra + deredden - Apply interstellar extinction correction + dopcor - Apply doppler corrections + lcalib - List calibration file data + sensfunc - Create sensitivity function + standard - Tabulate standard star data + +4. Fitting spectral features and continua + continuum - Fit the continuum in spectra + fitprofs - Fit gaussian profiles + sfit - Fit spectra and output fit, ratio, or difference + splot - Interactive spectral plot/analysis + +5. Arithmetic and combining of spectra + sarith - Spectrum arithmetic + scombine - Combine spectra + splot - Interactive spectral plot/analysis + +6. Miscellaneous functions + mkspec - Generate an artificial spectrum + names - Generate a list of image names from a string + sapertures - Set or change aperture header information + scopy - Select and copy spectra + sinterp - Interpolate a table of x,y to create a spectrum + slist - List spectrum header parameters + splot - Interactive spectral plot/analysis +.fi + +There are other packages which provide additional functions or specialized +tasks for spectra. Radial velocity measurements are available in the +\fBnoao.rv\fR package. The \fBnoao.imred\fR package contains a number +of packages for specific types of data or instruments. These packages +are listed in Table 2. + +.ce +Table 2: \fBImred\fR spectroscopy packages + +.nf + argus - CTIO ARGUS reduction package + ctioslit - CTIO spectrophotometric reduction package + echelle - Echelle spectral reductions (slit and FOE) + hydra - KPNO HYDRA (and NESSIE) reduction package + iids - KPNO IIDS spectral reductions + irs - KPNO IRS spectral reductions + kpnocoude - KPNO coude reduction package (slit and 3 fiber) + kpnoslit - KPNO low/moderate dispersion slits (Goldcam, RCspec, Whitecam) + specred - Generic slit and fiber spectral reduction package +.fi + +Finally, there are non-NOAO packages which may contain generally useful +software for spectra. Currently available packages are \fBstsdas\fR +and \fBxray\fR. +.ih +SPECTRUM IMAGE FORMATS AND COORDINATE SYSTEMS +See the separate help topic \fIspecwcs\fR. +.ih +INTERPOLATION +Changing the dispersion sampling of spectra, such as when converting to a +constant sampling interval per pixel or a common sampling for combining or +doing arithmetic on spectra, requires interpolation. The tasks which +reinterpolate spectra, if needed, are \fBdispcor, sarith, scombine,\fR and +\fBsplot\fR. + +The interpolation type is set by the package parameter \fIinterp\fR. +The available interpolation types are: + +.nf + nearest - nearest neighbor + linear - linear + poly3 - 3rd order polynomial + poly5 - 5th order polynomial + spline3 - cubic spline + sinc - sinc function +.fi + +The default interpolation type is a 5th order polynomial. + +The choice of interpolation type depends on the type of data, smooth +verses strong, sharp, undersampled features, and the requirements of +the user. The "nearest" and "linear" interpolation are somewhat +crude and simple but they avoid "ringing" near sharp features. The +polynomial interpolations are smoother but have noticible ringing +near sharp features. They are, unlike the sinc function described +below, localized. + +In V2.10 a "sinc" interpolation option is available. This function +has advantages and disadvantages. It is important to realize that +there are disadvantages! Sinc interpolation approximates applying a phase +shift to the fourier transform of the spectrum. Thus, repeated +interpolations do not accumulate errors (or nearly so) and, in particular, +a forward and reverse interpolation will recover the original spectrum +much more closely than other interpolation types. However, for +undersampled, strong features, such as cosmic rays or narrow emission or +absorption lines, the ringing can be more severe than the polynomial +interpolations. The ringing is especially a concern because it extends +a long way from the feature causing the ringing; 30 pixels with the +truncated algorithm used. Note that it is not the truncation of the +interpolation function which is at fault! + +Because of the problems seen with sinc interpolation it should be used with +care. Specifically, if there are no undersampled, narrow features it is a +good choice but when there are such features the contamination of the +spectrum by ringing is much more severe than with other interpolation +types. +.ih +UNITS +In versions of the NOAO spectroscopy packages prior to V2.10 the dispersion +units used were restricted to Angstroms. In V2.10 the first, +experimental, step of generalizing to other units was taken by +allowing the two principle spectral plotting tasks, \fBsplot\fR and +\fBspecplot\fR, to plot in various units. Dispersion functions are still +assumed to be in Angstroms but in the future the generalization will be +completed to all the NOAO spectroscopy tasks. + +The dispersion units capability of the plotting tasks allows specifying +the units with the "units" task parameter and interactively changing the +units with the ":units" command. In addition the 'v' key allows plotting +in velocity units with the zero point velocity defined by the cursor +position. + +The units are specified by strings having a unit type from the list below +along with the possible preceding modifiers, "inverse", to select the +inverse of the unit and "log" to select logarithmic units. For example "log +angstroms" to plot the logarithm of wavelength in Angstroms and "inv +microns" to plot inverse microns. The various identifiers may be +abbreviated as words but the syntax is not sophisticated enough to +recognized standard scientific abbreviations except as noted below. + +.nf + Table 1: Unit Types + + angstroms - Wavelength in Angstroms + nanometers - Wavelength in nanometers + millimicrons - Wavelength in millimicrons + microns - Wavelength in microns + millimeters - Wavelength in millimeters + centimeter - Wavelength in centimeters + meters - Wavelength in meters + hertz - Frequency in hertz (cycles per second) + kilohertz - Frequency in kilohertz + megahertz - Frequency in megahertz + gigahertz - Frequency in gigahertz + m/s - Velocity in meters per second + km/s - Velocity in kilometers per second + ev - Energy in electron volts + kev - Energy in kilo electron volts + mev - Energy in mega electron volts + z - Redshift + + nm - Wavelength in nanometers + mm - Wavelength in millimeters + cm - Wavelength in centimeters + m - Wavelength in meters + Hz - Frequency in hertz (cycles per second) + KHz - Frequency in kilohertz + MHz - Frequency in megahertz + GHz - Frequency in gigahertz + wn - Wave number (inverse centimeters) +.fi + +The velocity and redshift units require a trailing value and unit defining the +velocity zero point. For example to plot velocity relative to +a wavelength of 1 micron the unit string would be: + +.nf + km/s 1 micron +.fi + +Some additional examples of units strings are: + +.nf + milliang + megahertz + inv mic + log hertz + m/s 3 inv mic + z 5015 ang +.fi +.ih +SEE ALSO +apextract, longslit, rv, imred, specwcs +.endhelp diff --git a/noao/onedspec/doc/refspectra.hlp b/noao/onedspec/doc/refspectra.hlp new file mode 100644 index 00000000..01cfab30 --- /dev/null +++ b/noao/onedspec/doc/refspectra.hlp @@ -0,0 +1,413 @@ +.help refspectra Mar92 noao.onedspec +.ih +NAME +refspectra -- Assign reference spectra +.ih +USAGE +refspectra input [records] +.ih +PARAMETERS +.ls input +List of input spectra or root names to be assigned reference spectra. +When using the record number extension format, record number extensions +will be appended to each root name in the list. +.le +.ls records (imred.irs and imred.iids packages only) +List of records or ranges of records to be appended to the input root +names when using record number extension format. The syntax of this +list is comma separated record numbers or ranges of record numbers. A +range consists of two numbers separated by a hyphen. An example of this +syntax is "1-5,13,17-19". A null list ("") may +be used if no record number extensions are desired. This is a +positional query parameter only if the record format is specified with +the \fIrecformat\fR parameter. +.le +.ls references = "*.imh" +List of reference spectra to be assigned or a "reference spectra assignment +table" (see DESCRIPTION section). +.le +.ls apertures = "" +List of apertures to be SELECTED from the input list of spectra. If no list +is specified then all apertures are selected. The syntax is the same as the +record number extensions. +.le +.ls refaps = "" +List of reference spectra apertures to be SELECTED. If no list is specified +then all apertures are selected. The syntax is the same as the record number +extensions. +.le +.ls ignoreaps = yes +Ignore the input and reference apertures when ASSIGNING reference spectra. +If the aperture numbers are not ignored then only the reference spectra with +the same aperture number as a particular input spectra are used when assigning +reference spectra. Otherwise all the reference spectra are used. This does +not apply to the "match" and "average" options which always ignore the aperture +numbers. Note that this parameter applies to relating reference spectra to +input spectra and does not override the aperture selections on the input +spectra and reference spectra. +.le +.ls select = "interp" +Selection method for assigning reference spectra. The methods are: +.ls average +Average two reference spectra without regard to any aperture, +sort, or group parameters. +If only one reference spectrum is specified then it is assigned with a +warning. If more than two reference spectra are specified then only the +first two are used and a warning is given. There is no checking of the +aperture numbers or group values. +.le +.ls following +Select the nearest following spectrum in the reference list based on the +sort and group parameters. If there is no following spectrum use the +nearest preceding spectrum. +.le +.ls interp +Interpolate between the preceding and following spectra in the reference +list based on the sort and group parameters. If there is no preceding and +following spectrum use the nearest spectrum. The interpolation is weighted +by the relative distances of the sorting parameter (see cautions in +DESCRIPTION section). +.le +.ls match +Match each input spectrum with the reference spectrum list in order. +This overrides any aperture or group values. +.le +.ls nearest +Select the nearest spectrum in the reference list based on the sort and +group parameters. +.le +.ls preceding +Select the nearest preceding spectrum in the reference list based on the +sort and group parameters. If there is no preceding spectrum use the +nearest following spectrum. +.le +.le +.ls sort = "jd" +Image header keyword to be used as the sorting parameter for selection +based on order. The header parameter must be numeric but otherwise may +be anything. Common sorting parameters are times or positions. +A null string, "", or the word "none" may be use to disable the sorting +parameter. +.le +.ls group = "ljd" +Image header keyword to be used to group spectra. For those selection +methods which use the group parameter the reference and object spectra must +have identical values for this keyword. This can be anything but it must +be constant within a group. Common grouping parameters are the date of +observation "date-obs" (provided it does not change over a night) or the +local Julian day number. A null string, "", or the word "none" may be use +to disable the grouping parameter. +.le +.ls time = no, timewrap = 17. +Is the sorting parameter a 24 hour time? If so then the time orgin +for the sorting is specified by the timewrap parameter. This time +should precede the first observation and follow the last observation +in a 24 hour cycle. +.le +.ls override = no +Override previous assignments? If an input spectrum has reference +spectra assigned previously the assignment will not be changed unless +this flag is set. +.le +.ls confirm = yes +Confirm reference spectrum assignments? If \fIyes\fR then the reference +spectra assignments for each input spectrum are printed and the user may +either accept the assignment or not. Rejected assignments leave the +input spectrum unchanged. +.le +.ls assign = yes +Assign the reference spectrum by entering it in the image header? +The input spectra are only modified if this parameter is \fIyes\fR. +This parameter may be set to \fIno\fR to get a list of assignments +without actually entering the assignments in the image headers. +.le +.ls logfiles = "STDOUT,logfile" +List of log files for recording reference spectra assignments. +The file STDOUT prints to the standard output. If not specified ("") +then no logs will be recorded. +.le +.ls verbose = yes +Verbose log output? This prints additional information about the input +and reference spectra. This is useful for diagnosing why certain spectra +are ignored or not assigned as intended. +.le +.ih +DESCRIPTION +This task allows the user to define which reference spectra are to be +used in the calculation of the dispersion solution of object spectra. +The assignment of reference spectra to object spectra is often +a complex task because of the number of spectra, the use of many distinct +apertures, and different modes of observing such as interspersed arc +calibration spectra or just one calibration for a night. This task +provides a number of methods to cover many of the common cases. + +A reference spectrum is defined to be a spectrum that has been used to +calculate a wavelength solution with the tasks IDENTIFY or REIDENTIFY. +These tasks have set the keyword REFSPEC1 in the image header +equal to the spectrum's own name. + +Wavelength reference spectra are assigned to input spectra by entering +the reference spectrum name or pair of names in the image +header under the keywords REFSPEC1 and REFSPEC2. When two reference +spectra are assigned, the spectrum names may be followed by a weighting +factor (assumed to be 1 if missing). The wavelength of a pixel is +then the weighted average of the wavelengths from the reference +spectra dispersion solutions. The weighting factors are calculated +by choosing an appropriate selection method, ie average, interpolation, +etc. Note, however, that these assignments may be made directly using +the task \fBhedit\fR or with some other task or script if none of the +methods are suitable. + +The spectra to be assigned references are specified by an input list. +Optional numeric record format extensions may be appended to each name +(used as a root name) in the input list in the \fBiids/irs\fR packages. +The input spectra may be restricted to a particular set of aperture numbers +by the parameter \fIapertures\fR; the spectra not in the list of apertures +are skipped. If the aperture list is null (i.e. specified as "") then all +apertures are selected. One further selection may be made on the input +spectra. If the parameter \fIoverride\fR is no then input spectra which +have existing reference spectra assignments (which includes the reference +spectra) are skipped. + +The reference spectra parameter \fIreferences\fR may take two forms. +It may be an image list of spectra or a text file containing +a "reference spectrum assignment table". The table consists of pairs +of strings/lists with the first string being a list of object spectra +and the second string being a list of reference spectra. If this +table is used, then only those object spectra in the table that are also +listed in the input parameter list are processed. The example below +illustrates the reference spectrum assignment table: + +.nf + spec1 spec2,spec3,spec4 + spec5 + spec6,spec7 spect8,spec9 + spec10 spec11 + spec12 spec13 + spec14 spec15 +.fi + +As a convenience, if a reference list in the table is missing, the preceding +reference list is implied. This table may be used to make arbitrary assignments. + +The reference spectra in the specified list may also be restricted to a +subset of aperture numbers. However, in the case of averaging, the +reference aperture selection is ignored. In the case of matching, if +a reference spectrum is not selected then the matching input spectrum +is also skipped (in order to maintain a one-to-one correspondence). +Spectra in the reference list which are not reference spectra (as +defined earlier) are also ignored and a warning is printed. Note that +no check is made that a dispersion solution actually exists in the +dispersion solution database. + +There may be cases where there are only reference spectra for some +apertures and it is desired to apply these reference spectra to the +other apertures. The \fIignoreaps\fR flag may be used to force an +assignment between reference and object spectra with different +aperture numbers. Note that this flag is applied after the input and +reference list aperture number selections are made; in other words this +applies only to the assignments and not the input selection process. + +Once the appropriate reference spectra from the reference list have been +determined for an input spectrum they are assigned using one of the +methods selected by the parameter \fIselect\fR. The "match" method +simply pairs each element of the input spectrum list with each element +in the reference spectrum list. If a reference assignment table +is used with "match", then only the first spectrum in the reference +list for each input spectrum is assigned. + +The "average" method assigns the first two spectra in the reference list +ignoring aperture numbers or groups. The spectra are averaged by assigning +equal weights. There is no weighting based on any sort parameter. If +there are more than two spectra in the reference list then only the first +two spectra are used and the remainder are ignored. If a reference +assignment table is used only the first two reference spectra listed for +each object in the table are averaged. + +The remaining selection methods group the spectra using a header keyword +which must be constant within a group. If no group parameter is specfied +(the null string "" or the word "none") +then grouping does not occur. Only reference spectra with the same +group header value as the object are assigned to an object spectrum. +One likely group parameter is the "date-obs" keyword. This is usually +constant over a night at CTIO and KPNO. At other sites this may not +be the case. Therefore, the task \fBsetjd\fR may be used to set a +local Julian day number which is constant over a night at any +observatory. + +Within a group the spectra are ordered based on a numeric image header +parameter specified by the \fIsort\fR parameter. A null string "" or the +word "null" may be used to select no sort parameter. Parameters which are +times, as indicated by the \fItime\fR parameter, are assumed to be cyclic +with a period of 24 hours. The time wrap parameter defines the origin of a +cycle and should precede the first observation and follow the last +observation in a 24 hour period; i.e. for nighttime observations this +parameter value should bee sometime during the day. Particularly with +interpolating or choosing the nearest reference spectrum it is important +that the sorting parameter refer to the middle of the exposure. A Julian +date at the middle of an exposure may be calculated with the task +\fBsetjd\fR or a middle UT time may be computed with the task +\fBsetairmass\fR. + +The selection methods may choose the "nearest", "preceding", or "following" +reference spectrum. Alternatively, the reference wavelengths may be +interpolated between the preceding and following reference spectra with +weights given by the relative distances measured by the sorting parameter. +In the cases where a preceding or following spectrum is required and one is +not found then the nearest reference spectrum is used. These methods are +used for observing sequences where the reference spectra are taken either +nearby in time or space. + +The option "interp" should not be used without some thought as to the +nature of the interpolation. If the sorting parameter is a time (a 24 hour +cyclic parameter as opposed to a continuous parameter such as a Julian +date) then the user must be aware of when these times were recorded in the +header. For example, let us assume that the sort parameter is "ut" and +that this time was recorded in the header at the beginning of the +exposure. If the object spectrum exposure time is longer than the +reference spectra exposure times, then interpolation will weight the +preceding reference spectrum too heavily. This problem can be circumvented +by using the "average" selection method along with the reference assignment +table. Or the sort time parameter in the headers of the spectra can be +changes with \fIsetjd\fR or \fIsetairmass\fR or edited to reflect the +values at mid-exposure (see EXAMPLES). + +Once the reference spectrum or spectra for a input spectrum have been +identified the user may also chose to override any previous reference +assignments, to accept or not accept the current reference assignments +(in the case of not accepting the reference assignment the image header +is not updated), to only list the current reference assignments and not +update any image headers, as well as to record the reference assignments +to log files. These options are separately controlled by the remaining +task parameters. +.ih +KEYWORDS +This task uses the header keyword BEAM-NUM to sort the apertures. It +has an integer value. If the keyword does not exist then all apertures +are assumed to be 1. + +The keyword REFSPEC1 is used to search for reference spectra. This +keyword can be previously created by the tasks IDENTIFY and REIDENTIFY. + +The two keywords REFSPEC1 and optionally REFSPEC2 are created by the +task when the assign parameter is set to yes. They take the form: + +.nf + REFSPEC1='d1.0001' or + + REFSPEC1='d5.0001 0.756' + REFSPEC2='d5.0002 0.244' +.fi + +.ih +EXAMPLES +1. Compute a Julian date at the midpoint of the exposure for sorting +and a local Julian day number for grouping and then assign spectra +using interpolation. + +.nf + cl> setjd *.imh jd=jd ljd=ljd + cl> refspec *.imh sort=jd group=ljd select=interp +.fi + +2. Specifically assign reference spectra to input spectra. + +.nf + cl> refspectra spec1,spec3 refe=spec2,spec4 select=match +.fi + +3. Use a reference assignment table to assign reference spectra to input +spectra using the "average" option. First a table is created using an +editor. + +.nf + cl> type reftable + spec1 spec2,spec3,spec4 + spec5 + spec6,spec7 spect8,spec9 + spec10 spec11 + spec12 spec13 + spec14 spec15 + cl> refspec spec*.imh recfor- select=average refe=reftable +.fi + +4. Assign the nearest reference spectrum in zenith distance using +wildcard lists. By default the aperture numbers must match. + + cl> refspec *.imh "" sort=zd select=nearest time- + +5. Assign a specific reference spectrum to all apertures. + + cl> refspec *.imh "" refer=refnite1 ignoreaps+ + +6. Confirm assignments. + +.nf + cl> hselect irs.*.imh "$I,beam-num,ut,refspec1" yes + irs.0009.imh 0 0:22:55 irs.0009 + irs.0010.imh 1 0:22:53 irs.0010 + irs.0100.imh 0 8:22:55 + irs.0101.imh 1 8:22:53 + irs.0447.imh 0 13:00:07 irs.0447 + irs.0448.imh 1 13:00:05 irs.0448 + cl> refspec irs 100-101 refer=irs.*.imh conf+ ver+ select=nearest\ + >>> ignoreaps- + [irs.0100] Not a reference spectrum + [irs.0101] Not a reference spectrum + [irs.0100] refspec1='irs.0447' Accept assignment (yes)? + [irs.0101] refspec1='irs.0448' Accept assignment (yes)? +.fi + +Because the reference spectrum list includes all spectra the +warning messages "Not a reference spectrum" are printed with verbose +output. Remember a reference spectrum is any spectrum which has a +reference spectrum assigned which refers to itself. + +7. Assign reference spectra with weights using interpolation. In this +example we want to sort by "ut" but this keyword value was +recorded at the beginning of the integration. So we first create an +new keyword and then compute its value to be that of mid-exposure. The +new keyword is then used as the sorting parameter. + +.nf + cl> hedit *.imh utmid 0. add+ ver- show- + cl> hedit *.imh utmid "(ut)" ver- show- + cl> hedit *.imh utmid "(mod(utmid+exptime/7200.,24.))" ver- show- + cl> refspec *.imh refer=*.imh recfor- select=interp sort=utmid +.fi + +8. Assign reference spectra using the "average" option and the reference +assignment table with data with record number extensions. First edit +the file reftable: + +.nf + cl> type reftable + spec.0001 arc1.0001,arc2.0001 + spec.0002 arc1.0002,arc2.0002 + spec.0003 arc1.0003,arc2.0003 + spec.0004 arc1.0004,arc2.0004 + cl> refspec spec.*.imh recfor- refer=reftable select=average +.fi + +9. Assign a reference spectrum for aperture 1 to the object spectra +for apertures 2 thru 5. + +.nf + cl> refspec spec 2-5 recfor+ refer=arc.*.imh refaps=1 ignoreaps+ +.fi +.ih +REVISIONS +.ls REFSPECTRA V2.10.3 +If no reference spectrum is found in the interp, nearest, following, +preceding methods then a list of the reference spectra is given +showing why each was not acceptable. +.le +.ls REFSPECTRA V2.10 +A group parameter was added to allow restricting assignments by observing +period; for example by night. The record format option was removed and +the record format syntax is available in the \fBirs/iids\fR packages. +.le +.ih +SEE ALSO +identify, reidentify, dispcor, setjd, setairmass +.endhelp diff --git a/noao/onedspec/doc/reidentify.hlp b/noao/onedspec/doc/reidentify.hlp new file mode 100644 index 00000000..07eb2238 --- /dev/null +++ b/noao/onedspec/doc/reidentify.hlp @@ -0,0 +1,516 @@ +.help reidentify Jan96 noao.onedspec +.ih +NAME +reidentify -- Reidentify features +.ih +SUMMARY +Given a reference vector with identified features and (optionally) a +coordinate function find the same features in other elements of the +reference image and fit a new dispersion function or determine a +zero point shift. After all vectors of the reference image are +reidentified use the reference vectors to reidentify corresponding +vectors in other images. This task is used for transferring dispersion +solutions in arc calibration spectra and for mapping geometric and +dispersion distortion in two and three dimensional images. +.ih +USAGE +reidentify reference images +.ih +PARAMETERS +.ls reference +Image with previously identified features to be used as features reference for +other images. If there are multiple apertures, lines, or columns in the +image a master reference is defined by the \fIsection\fR parameter. +The other apertures in multispec images or other lines, or columns +(selected by \fIstep\fR) are reidentified as needed. +.le +.ls images +List of images in which the features in the reference image are to be +reidentified. In two and three dimensional images the reidentifications are +done by matching apertures, lines, columns, or bands with those in the reference +image. +.le +.ls interactive = no +Examine and fit features interactively? If the task is run interactively a +query (which may be turned off during execution) will be given for each +vector reidentified after printing the results of the automatic fit and the +user may chose to enter the interactive \fBidentify\fR task. +.le +.ls section = "middle line" +If the reference image is not one dimensional or specified as a one dimensional +image section then this parameter selects the master reference image +vector. The master reference is used when reidentifying other vectors in +the reference image or when other images contain apertures not present in +the reference image. This parameter also defines the direction +(columns, lines, or z) of the image vectors to be reidentified. + +The section parameter may be specified directly as an image section or +in one of the following forms + +.nf +line|column|x|y|z first|middle|last|# [first|middle|last|#]] +first|middle|last|# [first|middle|last|#] line|column|x|y|z +.fi + +where each field can be one of the strings separated by | except for # +which is an integer number. The field in [] is a second designator which +is used with three dimensional data. See the example section for +\fBidentify\fR for examples of this syntax. Abbreviations are allowed +though beware that 'l' is not a sufficient abbreviation. +.le +.ls newaps = yes +Reidentify new apertures in the images which are not in the reference +image? If no, only apertures found in the reference image will be +reidentified in the other images. If yes, the master reference spectrum +is used to reidentify features in the new aperture and then the +new aperture solution will be added to the reference apertures. All +further identifications of the new aperture will then use this solution. +.le +.ls override = no +Override previous solutions? If there are previous solutions for a +particular image vector being identified, because of a previous +\fBidentify\fR or \fBreidentify\fR, this parameter selects whether +to simply skip the reidentification or do a reidentification and +overwrite the solution in the database. +.le +.ls refit = yes +Refit the coordinate function? If yes and there is more than one feature +and a coordinate function was defined in the reference image database then a new +coordinate function of the same type as in the reference is fit +using the new pixel positions. Otherwise only a zero point shift is +determined for the revised coordinates without changing the +form of the coordinate function. +.le + +The following parameters are used for selecting and reidentifying additional +lines, columns, or apertures in two dimensional formats. +.ls trace = no +There are two methods for defining additional reference lines, columns, or +bands in two and three dimensional format images as selected by the +\fIstep\fR parameter. When \fItrace\fR is no the master reference line or +column is used for each new reference vector. When this parameter is yes +then as the reidentifications step across the image the last reidentified +features are used as the reference. This "tracing" is useful if there is a +coherent shift in the features such as with long slit spectra. However, +any features lost during the tracing will be lost for all subsequent lines +or columns while not using tracing always starts with the initial set of +reference features. +.le +.ls step = "10" +The step from the reference line, column, or band used for selecting and/or +reidentifying additional lines, columns, or bands in a two or three +dimensional reference image. For three dimensional images there may be two +numbers to allow independent steps along different axes. If the step is +zero then only the reference aperture, line, column, or band is used. For +multiaperture images if the step is zero then only the requested aperture +is reidentified and if it is non-zero (the value does not matter) then all +spectra are reidentified. For long slit or Fabry-Perot images the step is +used to sample the image and the step should be large enough to map any +significant changes in the feature positions. +.le +.ls nsum = "10" +Number of lines, columns, or bands across the designated vector axis to be +summed when the image is a two or three dimensional spatial spectrum. +It does not apply to multispec format spectra. If the image is three +dimensional an optional second number can be specified for the higher +dimensional axis (the first number applies to the lower axis number and +the second to the higher axis number). If a second number is not specified +the first number is used for both axes. This parameter is not used for +multispec type images. +.le +.ls shift = "0" +Shift in user coordinates to be added to the reference features before +centering. If the image is three dimensional then two numbers may be +specified for the two axes. Generally no shift is used by setting the +value to zero. When stepping to other lines, columns, or bands in the +reference image the shift is added to the primary reference spectrum if not +tracing. When tracing the shift is added to last spectrum when stepping to +higher lines and subtracted when stepping to lower lines. If a value +if INDEF is specified then an automatic algorithm is applied to find +a shift. +.le +.ls search = 0. +If the \fIshift\fR parameter is specified as INDEF then an automatic +search for a shift is made. There are two algorithms. If the search +value is INDEF then a cross-correlation of line peaks is done. Otherwise +if a non-zero value is given then a pattern matching algorithm (see +\fIautoidentify\fR) is used. A positive value specifies the search radius in +dispersion units and a negative value specifies a search radius as a +fraction of the reference dispersion range. +.le +.ls nlost = 0 +When reidentifying features by tracing, if the number of features not found +in the new image vector exceeds this number then the reidentification +record is not written to the database and the trace is terminated. A +warning is printed in the log and in the verbose output. +.le + +The following parameters define the finding and recentering of features. +See also \fBcenter1d\fR. +.ls cradius = 5. +Centering radius in pixels. If a reidentified feature falls further +than this distance from the previous line or column when tracing or +from the reference feature position when reidentifying a new image +then the feature is not reidentified. +.le +.ls threshold = 0. +In order for a feature center to be determined, the range of pixel +intensities around the feature must exceed this threshold. This parameter +is used to exclude noise peaks and terminate tracing when the signal +disappears. However, failure to properly set this parameter, particularly +when the data values are very small due to normalization or flux +calibration, is a common error leading to failure of the task. +.le + +The following parameters select and control the automatic addition of +new features during reidentification. +.ls addfeatures = no +Add new features from a line list during each reidentification? If +yes then the following parameters are used. This function can be used +to compensate for lost features from the reference solution, particularly +when tracing. Care should be exercised that misidentified features +are not introduced. +.le +.ls coordlist = "linelists$idhenear.dat" +User coordinate list consisting of a list of line coordinates. +Some standard line lists are available in the directory "linelists$". +The standard line lists are described under the topic \fIlinelists\fR. +.le +.ls match = -3. +The maximum difference for a match between the feature coordinate function +value and a coordinate in the coordinate list. Positive values +are in user coordinate units and negative values are in units of pixels. +.le +.ls maxfeatures = 50 +Maximum number of the strongest features to be selected automatically from +the coordinate list. +.le +.ls minsep = 2. +The minimum separation, in pixels, allowed between feature positions +when defining a new feature. +.le + +The following parameters determine the input and output of the task. +.ls database = "database" +Database containing the feature data for the reference image and in which +the features for the reidentified images are recorded. +.le +.ls logfiles = "logfile" +List of files in which to keep a processing log. If a null file, "", +is given then no log is kept. +.le +.ls plotfile = "" +Optional file to contain metacode plots of the residuals. +.le +.ls verbose = no +Print reidentification information on the standard output? +.le +.ls graphics = "stdgraph" +Graphics device. The default is the standard graphics device which is +generally a graphics terminal. +.le +.ls cursor = "" +Cursor input file. If a cursor file is not given then the standard graphics +cursor is read. +.le + +The following parameters are queried when the 'b' key is used in the +interactive review. +.ls crval, cdelt +These parameters specify an approximate coordinate value and coordinate +interval per pixel when the automatic line identification +algorithm ('b' key) is used. The coordinate value is for the +pixel specified by the \fIcrpix\fR parameter in the \fBaidpars\fR +parameter set. The default value of \fIcrpix\fR is INDEF which then +refers the coordinate value to the middle of the spectrum. By default +only the magnitude of the coordinate interval is used. Either value +may be given as INDEF. In this case the search for a solution will +be slower and more likely to fail. The values may also be given as +keywords in the image header whose values are to be used. +.le +.ls aidpars = "" (parameter set) +This parameter points to a parameter set for the automatic line +identification algorithm. See \fIaidpars\fR for further information. +.le +.ih +DESCRIPTION +Features (spectral lines, cross-dispersion profiles, etc.) identified in a +single reference vector (using the tasks \fBidentify\fR or +\fBautoidentify\fR) are reidentified in other reference vectors and the set +of reference vectors are reidentified in other images with the same type of +vectors. A vector may be a single one dimensional (1D) vector in a two or +three dimensional (2D or 3D) image, the sum of neighboring vectors to form +a 1D vector of higher signal, or 1D spectra in multiaperture images. The +number of vectors summed in 2D and 3D images is specified by the parameter +\fInsum\fR. This parameter does not apply to multiaperture images. + +As the previous paragraph indicates, there are two stages in this task. +The first stage is to identify the same features from a single reference +vector to a set of related reference vectors. This generally consists +of other vectors in the same reference image such as other lines or +columns in a long slit spectrum or the set of 1D aperture spectra in +a multiaperture image. In these cases the vectors are identified by +a line, column, band, or aperture number. The second stage is to +reidentify the features from the reference vectors in the matching +vectors of other images. For example the same lines in the reference +image and another image or the same apertures in several multiaperture +images. For multiaperture images the reference vector and target vector +will have the same aperture number but may be found in different image +lines. The first stage may be skipped if all the reference vectors +have been identified. + +If the images are 2D or 3D or multiaperture format and a \fIstep\fR greater +than zero is specified then additional vectors (lines/columns/bands) in the +reference image will be reidentified from the initial master reference +vector (as defined by an image section or \fIsection\fR parameter) provided +they have not been reidentified previously or the \fIoverride\fR flag is +set. For multiple aperture spectral images, called multiaperture, a step +size of zero means don't reidentify any other aperture and any other step +size reidentifies all apertures. For two and three dimensional images, +such as long slit and Fabry-Perot spectra, the step(s) should be large +enough to minimize execution time and storage requirements but small enough +to follow shifts in the features (see the discussion below on tracing). + +The reidentification of features in other reference image vectors +may be done in two ways selected by the parameter \fItrace\fR. If not +tracing, the initial reference vector is applied to the other selected +vectors. If tracing, the reidentifications are made with respect to the +last set of identifications as successive steps away from the reference +vector are made. The tracing method is appropriate for two and three +dimensional spatial images, such as long slit and Fabry-Perot spectra, in +which the positions of features traced vary smoothly. This allows +following large displacements from the initial reference by using suitably +small steps. It has the disadvantage that features lost during the +reidentifications will not propagate (unless the \fIaddfeatures\fR option +is used). By not tracing, the original set of features is used for every +other vector in the reference image. + +When tracing, the parameter \fInlost\fR is used to terminate the +tracing whenever this number of features has been lost. This parameter, +in conjunction with the other centering parameters which define +when a feature is not found, may be useful for tracing features +which disappear before reaching the limits of the image. + +When reidentifying features in other images, the reference +features are those from the same aperture, line, column, or band of the +reference image. However, if the \fInewaps\fR parameter is set +apertures in multiaperture spectra which are not in the reference +image may be reidentified against the master reference aperture and +added to the list of apertures to be reidentified in other images. +This is useful when spectra with different aperture numbers are +stored as one dimensional images. + +The reidentification of features between a reference vector and +a target vector is done as follows. First a mean shift between +the two vectors is determined. After correcting for the shift +the estimated pixel position of each reference feature in the +target vector is used as the starting point for determining +a feature center near this position. The centering fails the +feature is dropped and a check against the \fInlost\fR is made. +If it succeeds it is added to the list of features found in the +target spectrum. A zero point shift or new dispersion +function may be determined. New features may then be added from +a coordinate list. The details are given below. + +There may be a large shift between the two vectors such that the same +feature in the target vector is many pixels away from the pixel position in +the reference spectrum. A shift must then be determined. The \fIshift\fR +parameter may be used to specify a shift. The shift is in user coordinates +and is added to the reference user coordinates before trying to center +on a feature. For example if the reference spectrum has a feature at +5015A but in the new spectrum the feature is at 5025A when the reference +dispersion function is applied then the shift would be +10. Thus +a reference feature at 5015A would have the shift added to get 5025A, +then the centering would find the feature some pixel value and that +pixel value would be used with the true user coordinate of 5015A in the +new dispersion solution. + +When tracing a 2D/3D reference spectrum the shift is applied to the +previous reidentified spectrum rather than the initial reference spectrum. +The shift is added for increasing line or column values and subtracted for +decreasing line or column values. This allows "tracing" when there is a +rotation or tilt of the 2D or 3D spectrum. When not tracing the shift is +always added to the reference spectrum features as described previously. + +When reidentify other images with the reference spectrum the shift +parameter is always just added to the reference dispersion solution +matching the aperture, line, or column being reidentified. + +If the \fIshift\fR parameter is given as INDEF then an automatic +search algorithm is applied. There are two algorithms that may be +used. If the \fIsearch\fR parameter is INDEF then a cross-correlation +of the features list with the peaks found in the target spectrum is +performed. This algorithm can only find small shifts since otherwise +many lines may be missing off either end of the spectrum relative to +the reference spectrum. + +If the search parameter is non-zero then the pattern matching algorithm +described in \fIaidpars\fR is used. The search parameter specified a +search radius from the reference solution. If the value is positive the +search radius is a distance in dispersion units. If the value is negative +then the absolute value is used as a fraction of the dispersion range in +the reference solution. For example, a value of -0.1 applied to reference +dispersion solution with a range of 1000A would search for a new solution +within 100A of the reference dispersion solution. + +The pattern matching algorithm has to stages. First if there are +more than 10 features in the reference the pattern matching tries +to match the lines in the target spectrum to those features with +a dispersion per pixel having the same sign and a value within 2%. +If no solution is found then the \fIlinelist\fR is used to match +against the lines in the target spectrum, again with the dispersion +per pixel having the same sign and a value within 5%. The first +stage works when the set of features is nearly the same while the +second stage works when the shifts are large enough that many features +in the reference and target spectra are different. + +The centering algorithm is described under the topic \fIcenter1d\fR and +also in \fBidentify\fR. If a feature positions shifts by more than the +amount set by the parameter \fIcradius\fR from the starting position +(possibly after adding a shift) or the feature strength (peak to valley) is +less than the detection \fIthreshold\fR then the new feature is discarded. +The \fIcradius\fR parameter should be set large enough to find the correct +peak in the presence of any shifts but small enough to minimize incorrect +identifications. The \fIthreshold\fR parameter is used to eliminate +identifications with noise. Failure to set this parameter properly for the +data (say if data values are very small due to a calibration or +normalization operation) is the most common source of problems in using +this task. + +If a fitting function is defined for the features in the reference image, +say a dispersion function in arc lamp spectra, then the function is refit +at each reidentified line or column if the parameter \fIrefit\fR is yes. +If refitting is not selected then a zero point shift in the user +coordinates is determined without changing the form of the fitting +function. The latter may be desirable for tracking detector shifts through +a sequence of observation using low quality calibration spectra. When +refitting, the fitting parameters from the reference are used including +iterative rejection parameters to eliminate misidentifications. + +If the parameter \fIaddfeatures\fR is set additional features may be added +from a line list. If there are reference features then the new features +are added AFTER the initial reidentification and function fit. If the +reference consists only of a dispersion function, that is it has no +features, then new features will be added followed by a function fit and +then another pass of adding new features. A maximum number of added +features, a matching distance in user coordinates, and a minimum separation +from other features are additional parameters. This option is similar to +that available in \fBidentify\fR and is described more fully in the help +for that task. + +A statistics line is generated for each reidentified vector. The line +contains the name of the image being reidentified (which for two +dimensional images includes the image section and for multiaperture +spectra includes the aperture number), the number of features found +relative to the number of features in the reference, the number of +features used in the function fit relative to the number found, the +mean pixel, user coordinate, and fractional user coordinate shifts +relative to the reference coordinates, and the RMS relative to the +final coordinate system (whether refit or simply shifted) excluding any +iteratively rejected features from the calculation. + +If the task is run with the \fIinteractive\fR flag the statistics line +is printed to the standard output (the terminal) and a query is +made whether to examine and/or refit the features. A response +of yes or YES will put the user in the interactive graphical mode +of \fBidentify\fR. See the description of this task for more +information. The idea is that one can monitor the statistics information, +particularly the RMS if refitting, and select only those which may be +questionable to examine interactively. A response of no or NO will +continue on to the next reidentification. The capitalized responses +turn off the query and act as permanent response for all other +reidentifications. + +This statistics line, including headers, is written to any specified +log files. The log information includes the image being +reidentified and the reference image, and the initial shift. + +If an accessible file name is given for the plot file then a residual plot +of the reidentified lines is recorded in this file. The plot file can +be viewed with \fBgkimosaic, stdgraph\fR or reading the file +with ".read" when in cursor mode (for example with "=gcur"). + +The reidentification results for this task are recorded in a +\fIdatabase\fR. Currently the database is a directory and entries +in the database are text files with filenames formed by adding +the prefix "id" to the image name without an image extension. +.ih +EXAMPLES +1. Arc lines and a dispersion solution were defined for the middle +aperture in the multispec for arc spectrum a042.ms. To reidentify the +other apertures in the reference image and then another arc image: + +.nf + cl> reiden a042.ms a045.ms inter+ step=1 ver+ + REIDENTIFY: NOAO/IRAF V2.9 valdes@puppis Fri 29-Jun-90 + Reference image = a042.ms.imh, New image = a042.ms, Refit = yes + Image Data Found Fit Pix Shift User Shift RMS + a042.ms - Ap 24 48/48 47/48 -2.38E-4 -3.75E-6 0.699 + Fit dispersion function interactively? (no|yes|NO|YES) (yes): y + a042.ms - Ap 24 48/48 47/48 -2.38E-4 -3.75E-6 0.699 + a042.ms - Ap 23 48/48 47/48 0.216 1.32 0.754 + Fit dispersion function interactively? (no|yes|NO|YES) (yes): n + a042.ms - Ap 22 48/48 47/48 0.0627 0.383 0.749 + Fit dispersion function interactively? (no|yes|NO|YES) (yes): n + a042.ms - Ap 21 48/48 47/48 0.337 2.06 0.815 + + Reference image = a042.ms.imh, New image = a045.ms, Refit = yes + Image Data Found Fit Pix Shift User Shift RMS + a045.ms - Ap 24 48/48 47/48 -2.38E-4 -3.75E-6 0.699 + Fit dispersion function interactively? (no|yes|NO|YES) (yes): y + a045.ms - Ap 24 48/48 47/48 -2.38E-4 -3.75E-6 0.699 + a045.ms - Ap 23 48/48 47/48 0.216 1.32 0.754 + Fit dispersion function interactively? (no|yes|NO|YES) (yes): N + a045.ms - Ap 22 48/48 47/48 0.0627 0.383 0.749 + a042.ms - Ap 21 48/48 47/48 0.337 2.06 0.815 + a042.ms - Ap 20 48/48 47/48 -0.293 -1.79 0.726 + a042.ms - Ap 19 48/48 48/48 0.472 2.88 0.912 +.fi + +This example is verbose and includes interactive review of reidentifications. +The statistics lines have been shortened. + +2. To trace a stellar profile and arc lines in long slit images for the +purpose of making a distortion correction: + +.nf + cl> reiden rog022[135,*] "" trace+ + cl> reiden rog023 "" sec="mid line" trace+ +.fi +.ih +REVISIONS +.ls REIDENTIFY V2.11 +The \fIsearch\fR parameter and new searching algorithm has been added. + +The task will now work with only a warning if the reference image is absent; +i.e. it is possible to reidentify given only the database. + +The \fIaddfeatures\fR function will now add features before a fit if there +are no reference database features. Previously features could only be +added after an initial fit using the reference features and, so, required +the reference database to contain features for reidentification. This +new feature is useful if one wants to uses a dispersion function from one +type of calibration but wants to add features for a different kind of +calibration. +.le +.ls REIDENTIFY V2.10.3 +The section, nsum, step, and shift parameter syntax was extended to apply to 3D +images. The previous values and defaults may still be used. + +For multiaperture data a step of zero selects only the reference aperture +to be reidentified and any other step selects reidentifying all apertures. +.le +.ls REIDENTIFY V2.10 +This task is a new version with many new features. The new features +include an interactive options for reviewing identifications, iterative +rejection of features during fitting, automatic addition of new features +from a line list, and the choice of tracing or using a single master +reference when reidentifying features in other vectors of a reference +spectrum. Reidentifications from a reference image to another image is +done by matching apertures rather than tracing. New apertures not present +in the reference image may be added. +.le +.ih +SEE ALSO +autoidentify, identify, aidpars, center1d, linelists, fitcoords +.endhelp diff --git a/noao/onedspec/doc/rspectext.hlp b/noao/onedspec/doc/rspectext.hlp new file mode 100644 index 00000000..2973f552 --- /dev/null +++ b/noao/onedspec/doc/rspectext.hlp @@ -0,0 +1,138 @@ +.help rspectext Oct93 onedspec +.ih +NAME +rspectext -- convert 1D ascii text spectra to IRAF image spectra +.ih +USAGE +rspectext input output +.ih +PARAMETERS +.ls input +Input list of ascii text spectra. These may have a optional FITS header +at the beginning and then two columns of wavelength and flux. +.le +.ls output +Output list of IRAF spectra image names. The list must match the +input list. +.le + + +The following parameters are only used if there is no FITS header +with the data. +.ls title = "" +Title to be assigned to the spectra. +.le +.ls flux = no +Are the flux values flux calibrated? If so then header keywords are +inserted to identify this for the IRAF spectral software. +.le +.ls dtype = "linear" (none|linear|log|nonlinear|interp) +Type of dispersion to assign to the spectra. The options are: +.ls none +No dispersion function and nothing is added to the image header. +.le +.ls linear +Store the linear dispersion parameters \fBcrval1\fR and \fBcdelt1\fR +in the image header. The wavelength values are ignored. This may +be used if the wavelength values are known to be linear but one wants +to avoid possible roundoff and resampling errors introduced by the +"interp" option. +.le +.ls log +Store the log-linear dispersion parameters \fBcrval1\fR and \fBcdelt1\fR in +the image header. The wavelength values are ignored. This may be used if +the wavelength values are known to be linear in the log of the wavelength +but one wants to avoid possible roundoff and resampling errors introduced +by the "interp" option. +.le +.ls nonlinear +Store the wavelength values in the image header as a lookup table. +The flux values are not resampled. The wavelength values need not +be evenly sampled. +.le +.ls interp +Use the wavelength values to resample to a linear dispersion between +the first and last wavelength values. The dispersion per pixel is +determined by the number of pixels and the endpoint wavelengths. +.le +.le +.ls crval1 = 1., cdelt1 = 1. +The wavelength coordinate of the first pixel and the wavelength interval +per pixel to be used with the linear and log dispersion types. +.le +.ih +DESCRIPTION +Ascii text files consisting of an optional FITS header (usually produced +by \fBwspectext\fR) and a two column list of wavelengths and fluxes +are converted to IRAF image spectra. If a header is included then +the header information is assumed to describe the spectra including +any dispersion function. If no header is given then the minimal +information for describing spectra in IRAF is added. The dispersion +function can be set either a linear or log-linear based on two +keywords (ignoring the wavelength values) or from the wavelength +values. The latter may be stored in the header as a lookup table +allowing for nonlinear dispersions or resample to a linear dispersion. +This task is a script based on \fBrtextimage\fR for the creating +the image and entering the flux values, \fBhedit\fR to set some +of the header keywords, and \fBdispcor\fR to handle the nonlinear +or resampled dispersion functions. +.ih +EXAMPLES +1. Create spectrum from a text file originally produced by \fBwspectext\fR. + +.nf + cl> type text001 + BITPIX = 8 / 8-bit ASCII characters + NAXIS = 1 / Number of Image Dimensions + NAXIS1 = 100 / Length of axis + ORIGIN = 'NOAO-IRAF: WTEXTIMAGE' / + IRAF-MAX= 0. / Max image pixel (out of date) + IRAF-MIN= 0. / Min image pixel (out of date) + IRAF-B/P= 32 / Image bits per pixel + IRAFTYPE= 'REAL FLOATING ' / Image datatype + OBJECT = 'TITLE ' / + FILENAME= 'TEST ' / IRAF filename + FORMAT = '5G14.7 ' / Text line format + APNUM1 = '1 1 ' + DC-FLAG = 0 + WCSDIM = 1 + CTYPE1 = 'LINEAR ' + CRVAL1 = 4000. + CRPIX1 = 1. + CDELT1 = 10.1010101010101 + CD1_1 = 10.1010101010101 + LTM1_1 = 1. + WAT0_001= 'system=equispec ' + WAT1_001= 'wtype=linear label=Wavelength units=Angstroms ' + END + + 4000.00 1000. + 4010.10 1005.54 + 4020.20 1011.05 + ... + cl> rspectext text001 spec001 +.fi + +2. Create a spectrum with a nonlinear dispersion using the wavelength +values as a lookup table. + +.nf + cl> type text002 + 4000.00 1000. + 4010.10 1005.54 + 4020.20 1011.05 + ... + cl> rspectext text002 spec002 title="HH12" dtype=nonlinear +.fi +.ih +REVISIONS +.ls RSPECTEXT V2.11 +The task now automatically senses the presence of a header. +.le +.ls RSPECTEXT V2.10.3 +This is a new task with this version. +.le +.ih +SEE ALSO +wspectext, rtextimage, dispcor, mkms, imspec, sinterp +.endhelp diff --git a/noao/onedspec/doc/sapertures.hlp b/noao/onedspec/doc/sapertures.hlp new file mode 100644 index 00000000..37398d6a --- /dev/null +++ b/noao/onedspec/doc/sapertures.hlp @@ -0,0 +1,217 @@ +.help sapertures Jul95 noao.onedspec +.ih +NAME +sapertures -- Set or change aperture header information +.ih +USAGE +sapertures input +.ih +PARAMETERS +.ls input +List of spectral images to be modified. +.le +.ls apertures = "" +List of apertures to be modified. The null list +selects all apertures. A list consists of comma separated +numbers and ranges of numbers. A range is specified by a hyphen. An +optional step size may be given by using the 'x' followed by a number. +See \fBxtools.ranges\fR for more information. +.le +.ls apidtable = "" +Aperture table. This may be either a text file or an image. +A text file consisting of lines with an aperture number, +beam number, dispersion type code, coordinate of the first physical +pixel, coordinate interval per physical pixel, redshift factor, +lower extraction aperture position, upper extraction aperture position, +and aperture title or identification. An image will contain the +keywords SLFIBnnn with string value consisting of aperture number, +beam number, optional right ascension and declination, and aperture title. +Any field except the aperture number may be given the value INDEF to +indicate that the value is not to be changed from the current value. Any +apertures not in this table are assigned the values given by the task +parameters described below. + +As a special case a file having just the aperture number, beam number, and +spectrum aperture identification may be used. This file format as well as +use of an image header is the same as that in the \fBapextract\fR package. +.le +.ls wcsreset = no +Reset the world coordinate system (WCS) of the selected apertures to +uncorrected pixels. If this parameter is set the \fIapidtable\fR and task +aperture parameters are ignored. This option sets the dispersion type flag +to -1, the starting coordinate value to 1, the interval per pixel to 1, and +no redshift factor and leaves the other parameters unchanged. The option +is useful when it is desired to apply a second dispersion correction using +\fBidentify\fR and \fBdispcor\fR. +.le +.ls verbose = no +Print a record of each aperture modified? Only those apertures +in which the beam number or label are changed are printed. +.le + +If no aperture table is specified or if there is not an aperture +entry in the table for a selected aperture the following parameter +values are used. A value of INDEF will leave the corresponding +parameter unchanged. +.ls beam = INDEF +Beam number. +.le +.ls dtype = INDEF +Dispersion type. The dispersion types are: + +.nf + -1 Linear with dispersion correction flag off + 0 Linear with dispersion correction flag on + 1 Log-linear with dispersion correction flag on +.fi + +.le +.ls w1 = INDEF +Coordinate of the first physical pixel. Note that it is possible +that the physical pixels are not the same as the logical pixels if +an image section has been extracted. +.le +.ls dw = INDEF +Coordinate interval per physical pixel. Note that it is possible +that the physical pixels intervals are not the same as the logical pixels +intervals if an image section has been extracted. +.le +.ls z = INDEF +Redshift factor. This is usually set with the task \fBdopcor\fR. +Coordinates are divided by one plus the redshift factor (1+z). +.le +.ls aplow = INDEF, aphigh = INDEF +The aperture extraction limits. These are set when the \fBapextract\fR +package is used and it is unlikely that one would use this task to +change them. +.le +.ls title = INDEF +Aperture title or identification string. +.le +.ih +DESCRIPTION +This task sets or changes any of the aperture specific parameters except +the aperture number and the number of valid pixels. It is particularly +useful for images which use the "multispec" world coordinate system +attribute strings which are not readily accessible with other header +editors. A list of images and a list of apertures is used to select which +spectra are to be modified. The default empty string for the apertures +selects all apertures. The new values are specified either in an aperture +table file or with task parameters. The aperture table is used to give +different values to specific apertures. If all apertures are to have the +same values this file need not be used. + +The aperture parameters which may be modified are the beam number, the +dispersion type, the coordinate of the first physical pixel, the coordinate +interval per physical pixel, the redshift factor, the aperture extraction +limits, and the title. The task has parameters for each of these and the +aperture table consists of lines starting with an aperture number followed +by the above parameters in the list order and separated by whitespace. As +a special case the aperture table may be a file abbreviated to aperture +number, beam number, and title or an image with keywords SLFIBnnn +containing the aperture number, beam number, optional right ascension and +declination, and title. These special cases allow use of the same file +orimage used in the \fBapextract\fR package. If any of the parameters are +specified as INDEF then the value will be unchanged. + +If the \fIwcsreset\fR parameter is set then the aperture table and +task aperture parameters are ignored and the selected apertures are +reset to have a dispersion type of -1, a starting coordinate of 1, +a coordinate interval of 1, and a redshift factor of 0. This other +parameters are not changed. These choice of parameters has the effect +of resetting the spectrum to physical pixel coordinates and flagging +the spectra as not being dispersion calibrated. One use of this option +is to allow the \fBdispcor\fR task to be reapplied to previously +dispersion calibrated spectra. + +The \fIverbose\fR parameter lists the old and new values when there is +a change. If there are no changes there will be no output. +.ih +EXAMPLES +1. To add titles to a multifiber extraction and change one of the +beam numbers: + +.nf + cl> type m33aps + 36 2 Henear + 37 0 Sky + 38 1 New title + 39 1 Another title + 41 0 Sky + 42 1 Yet another title + 43 1 YAT + 44 1 Was a sky but actually has an object + 45 1 Wow + 46 1 Important new discovery + 47 0 Sky + 48 2 Henear + cl> saper m33.ms apid=m33aps v+ + demoobj1.ms: + Aperture 37: --> Sky + Aperture 38: --> New title + Aperture 39: --> Another title + Aperture 41: --> Sky + Aperture 42: --> Yet another title + Aperture 43: --> YAT + Aperture 44: beam 0 --> beam 1 + Aperture 44: --> Was a sky but actually has an object + Aperture 45: --> Wow + Aperture 46: --> Important new discovery + Aperture 47: --> Sky +.fi + +2. To reset a dispersion calibrated multifiber spectrum: + +.nf + cl> saper test.ms wcsreset+ verbose+ + test.ms: + Aperture 1: + w1 4321. --> 1. + dw 1.23 --> 1. + Aperture 2: + w1 4321. --> 1. + dw 1.23 --> 1. + +.fi + +3. To set a constant wavelength length scale (with the default parameters): + +.nf + cl> saper test.ms dtype=0 w1=4321 dw=1.23 v+ + test.ms: + Aperture 1: + w1 1. --> 4321. + dw 1. --> 1.23 + Aperture 2: + w1 1. --> 4321. + dw 1. --> 1.23 + +.fi + +4. To reset the wavelengths and title of only aperture 3: + +.nf + cl> saper test.ms aper=3 w1=4325 dw=1.22 title=HD12345 v+ + test.ms: + Aperture 3: + w1 4321. --> 4325. + dw 1.23 --> 1.22 + apid --> HD12345 +.fi +.ih +REVISIONS +.ls SAPERTURES V2.11 +This task has been modified to allow use of image header keywords +as done in the APEXTRACT package. +.le +.ls SAPERTURES V2.10.3 +This task has been greatly expanded to allow changing any of the WCS +parameters as well as the beam number and aperture title. +.le +.ls SAPERTURES V2.10 +This task is new. +.le +.ih +SEE ALSO +specshift, imcoords.wcsreset, hedit, ranges, onedspec.package +.endhelp diff --git a/noao/onedspec/doc/sarith.hlp b/noao/onedspec/doc/sarith.hlp new file mode 100644 index 00000000..a7e7cf87 --- /dev/null +++ b/noao/onedspec/doc/sarith.hlp @@ -0,0 +1,571 @@ +.help sarith Mar93 noao.onedspec +.ih +NAME +sarith -- Spectrum arithmetic +.ih +USAGE +sarith input1 op input2 output +.ih +PARAMETERS +.ls input1 +List of input images to be used as operands. +.le +.ls op +Operator to be applied to the first operand or to both operands. The +unary or single operand operators are: + +.nf + abs - absolute value + copy - copy (see also \fBscopy\fR) + dex - decimal exponentiation (antilog of base 10 logarithm) + exp - base e exponentiation (antilog of natural logarithm) + flam - convert F-nu to F-lambda + fnu - convert F-lambda to F-nu + inv - inverse + ln - natural logarithm + log - base 10 logarithm + lum - convert magnitude to luminosity + mag - convert luminosity to magnitude + sqrt - square root +.fi + +The binary or two operand operators are: + +.nf + replace - replace first operand values by second operand values + + - addition + - - subtraction + * - multiplication + / - division + ^ - exponentiation +.fi +.le +.ls input2 +Lists of input spectra or constants to be used as second operands for +binary operations. If a single value is specified it applies +to all the first operand input images otherwise the list must match +the first operand list in number. +.le +.ls output +List of resultant output images or root names. Image +sections are ignored and if the output format is "onedspec" then any record +extensions are stripped to form the root name. If no output list is +specified then the input list is used and the input images are replaced by +the resultant spectra. If a single output name is specified then all +resultant spectra are written to the same output image or image root +name. This allows packing or merging multiple spectra and requires +properly setting the \fIclobber\fR, \fImerge\fR, \fIrenumber\fR and +\fIoffset\fR parameters to achieve the desired output. If more than one +output image is specified then it must match the input image list in +number. +.le +.ls w1 = INDEF, w2 = INDEF +Starting and ending wavelengths to be copied. If \fIw1\fR is not specified +then the wavelength of the starting edge of the first pixel is used +(wavelength at pixel coordinate 0.5) and if \fIw2\fR is not specified then +the wavelength of the ending edge of the last pixel is used (wavelength of +the last pixel plus 0.5). If both are not specified, that is set to INDEF, +then the whole spectrum is copied and the \fIrebin\fR parameter is +ignored. Note that by specifying both endpoints the copied region can be +set to have increasing or decreasing wavelength per pixel. If the spectrum +only partially covers the specified range only that portion of the spectrum +within the range is copied. It is an error if the range is entirely +outside that of a spectrum. +.le +.ls apertures = "", beams = "" +List of apertures and beams to be selected from the input spectra. The +logical intersection of the two lists is selected. The null list +selects all apertures or beams. A list consists of comma separated +numbers and ranges of numbers. A range is specified by a hyphen. An +optional step size may be given by 'x' followed by a number. +See \fBxtools.ranges\fR for more information. If the first character +is "!" then the apertures/beams not in the list are selected. Note +that a "!" in either of the lists complements the intersection of the +two lists. +For longslit input spectra the aperture numbers +selects the lines or columns to be extracted. For 3D Fabry-Perot +spectra the aperture numbers select the first spatial axis. +.le +.ls bands = "" +List of bands in 3D multispec. +For 3D spatial spectra the band parameter applies to the second +spatial axis. +The null list selects all bands. The syntax is as described above. +.le +.ls apmodulus = 0 +Modulus to be applied to the input aperture numbers before matching against +the aperture list. If zero then no modulus is used. This is used to +select apertures which are related by the same modulus, typically a +factor of 10; for example, 10, 1010, and 2010 with a modulus of 1000 are +related. +.le +.ls reverse = no +Reverse the order of the operands in a binary operation? Because the first +operand is used as the image header template, dispersion coordinate +template, and output image in the case of a null output list it must be an +image and not a constant. To allow certain operations, for +example subtracting a spectra from a constant or using the subtractand as +the dispersion coordinate template, the reverse option is used to reverse +the order of the operands in a binary operation. +.le +.ls ignoreaps = no +Ignore aperture numbers in the second operand? Normally, spectra in +binary operations must have matching aperture numbers, otherwise an +error is printed. If this parameter is yes then the spectra are matched +by line number with the last line being used if the second operand spectrum +has fewer lines than the first operand spectrum. This is generally +used to allow using a single spectrum with multiple aperture spectra. +.le +.ls format = "multispec" (multispec|onedspec) +Output image format and name syntax. The "multispec" format consists of +one or more spectra in the same image file. The "onedspec" format consists +of a single spectrum per image with names having a root name and a four +digit aperture number extension. Note that converting to "onedspec" format +from three dimensional images where the third dimension contains associated +spectra will not include data from the extra dimension. Image sections may +be used in this case. +.le +.ls renumber = no +Renumber the output aperture numbers? If set the output aperture +numbers, including any preexisting spectra when merging, are renumbered +beginning with 1. The \fIoffset\fR parameter may be used to +change the starting number. +.le +.ls offset = 0 +Offset to be added to the input or renumbered aperture number to form +the final output aperture number. +.le +.ls clobber = no +Modify an existing output image either by overwriting or merging? +.le +.ls merge = no +Merge apertures into existing spectra? This +requires that the \fIclobber\fR parameter be set. If not merging +then the selected spectra entirely replace those in existing output images. +If merging then the input spectra replace those in the output image +with the same aperture number and new apertures are added if not present. +.le +.ls rebin = yes +Rebin the spectrum to the exact wavelength range specified by the \fIw1\fR +and \fIw2\fR parameters? If the range is given as INDEF for both endpoints +this parameter does not apply. If a range is given and this parameter is +not set then the pixels in the specified range (using the nearest pixels to +the endpoint wavelengths) are copied without rebinning. In this case the +wavelength of the first pixel may not be exactly that specified by \fIw1\fR +and the dispersion, including non-linear dispersions, is unchanged. If +this parameter is set the spectra are interpolated to have the first and +last pixels at exactly the specified endpoint wavelengths while preserving +the same number of pixels in the interval. Linear and log-linear +dispersion types are maintained while non-linear dispersions are +linearized. +.le +.ls errval = 0. +Value for resultant pixel if an arithmetic error occurs such as dividing +by zero or the square root of a negative number. +.le +.ls verbose = no +Print a record of each operation? +.le +.ih +DESCRIPTION +\fBSarith\fR performs arithmetic operations on spectra. It is +distinguished from \fBimarith\fR in that it includes unary operators, like +\fBimfunction\fR but with some specific to astronomical spectra, and binary +operations between two spectra are performed in dispersion coordinate space +(typically wavelength) rather than logical pixel space. In the latter case +the spectra are checked for matching dispersion functions (which are not +necessarily linear) and, if they don't match, the second operand is +interpolated without flux conservation. (If flux conservation is desired +then the task \fBdispcor\fR should be used first.) Thus, the spectra may +have different dispersion functions but the arithmetic is done at matching +wavelengths. The default interpolation function is a 5th order +polynomial. The choice of interpolation type is made with the package +parameter "interp". It may be set to "nearest", "linear", "spline3", +"poly5", or "sinc". Remember that this applies to all tasks which might +need to interpolate spectra in the \fBonedspec\fR and associated packages. +For a discussion of interpolation types see \fBonedspec\fR. + +The unary operators operate on the spectra in the first operand list to +produce the specified output spectra, which may be the same as the +input spectra. The operators include: + +.nf + abs - absolute value + copy - copy (see also \fBscopy\fR) + dex - decimal exponentiation (antilog of base 10 logarithm) + exp - base e exponentiation (antilog of natural logarithm) + flam - convert F-nu to F-lambda + fnu - convert F-lambda to F-nu + inv - inverse + ln - natural logarithm + log - base 10 logarithm + lum - convert magnitude to luminosity + mag - convert luminosity to magnitude + sqrt - square root +.fi + +The luminosity to magnitude and magnitude to luminosity operators are +based on the standard relation: + +.nf + mag = -2.5 * log (lum) +.fi + +where the log is base 10. The F-nu to F-lambda and F-lambda to F-nu +operators are based on the relation: + +.nf + F-nu = F-lambda * lambda / nu +.fi + +where lambda is wavelength and nu is frequency (currently the wavelength +is assumed to be Angstroms and so F-lambda is in units of per Angstrom +and F-nu is in units of per Hertz). In all the operators it is the +responsibility of user as to the appropriateness of the operator to +the input. + +The binary operators operate on the spectra in the first operand list +and the spectra or numerical constants in the second operand. Numeric +constants are equivalent to spectra having the specified value at all +pixels. The binary operators are the standard arithmetic ones plus +exponentiation and replacement: + +.nf + replace - replace first operand values by second operand values + + - addition + - - subtraction + * - multiplication + / - division + ^ - exponentiation +.fi + +If the second operand is a spectrum, as mentioned previously, it is +interpolated, without flux conservation, to the dispersion +function of the first operand spectrum if necessary. + +There is a distinctions between the first operand and the second operand. +The first operand must always be a spectrum. It supplies the dispersion +function to be matched by the second operand spectrum. It also supplies +a copy of it's image header when a new output spectrum is created. +In cases where it is desired to have the second operand be the +dispersion/header reference and/or the first operand be a constant +the \fIreverse\fR parameter is used. For example to subtract a +spectrum from the constant 1: + +.nf + cl> sarith 1 - spec invspec reverse+ +.fi + +or to subtract two spectra using the subtractand as the dispersion +reference: + +.nf + cl> sarith spec1 - spec2 diff reverse+ +.fi + +When a binary operation on a pair of spectra is performed the aperture +numbers may be required to be the same if \fIignoreaps\fR is no. For +images containing multiple spectra the apertures need not be in the +same order but only that matching apertures exist. If this parameter +is set to yes then aperture numbers are ignored when the operation is +performed. For multiple spectra images the second operand spectra +are matched by image line number rather than by aperture. If the +second operand image has fewer lines, often just one line, then the +last line is used repeatedly. This feature allows multiple spectra +in the primary operand list to be operated upon by a single spectrum; +for example to subtract one spectrum from all spectra in the +in a multiple spectrum image. + +If it is an error to perform an operation on certain data values, for +example division by zero or the square root of a negative number, +then the output value is given the value specified by the parameter +\fIerrval\fR. + +A log of the operations performed may be printed to the standard +output, which may then be redirected if desired, if the \fIverbose\fR +parameter is set. In the output the last bracketed number is the +aperture number of the spectrum. + +INPUT/OUTPUT + +The arithmetic part of \fBsarith\fR is fairly straightforward and +intuitive. The selection of input spectra from input images and +the placing of output spectra in output images can be more confusing +because there are many possibilities. This section concentrates +on the topics of the input and output. Since the concepts apply to all +of the operators it simplifies things to think in terms of copying +input spectra to output spectra; the "copy" operator. Note that the +task \fBscopy\fR is actually just this case of \fBsarith\fR with +parameters set for copying. While the discussion here is similar +to that in the help for \fBscopy\fR, the examples for that task +are more focused for illustrating this topic than the \fBsarith\fR +examples which concentrate more on the arithmetic aspects of +the task. + +Input spectra are specified by an image list which may include explicit +image names, wildcard templates and @files containing image names. +The image names may also include image sections such as to select portions of +the wavelength coverage. The input images may be either one or two +dimensional spectra. One dimensional spectra may be stored in +individual one dimensional images or as lines in two (or three) +dimensional images. The one dimensional spectra are identified by +an aperture number, which must be unique within an image, and a beam number. +Two dimensional long slit and three dimensional Fabry-Perot spectra are +treated, for the purpose of this +task, as a collection of spectra with dispersion either along any axis +specified by the DISPAXIS image header parameter +or the \fIdispaxis\fR package parameter. The aperture and band +parameters specify a spatial position. A number of adjacent +lines, columns, and bands, specified by the \fInsum\fR package parameter, +will be summed to form an aperture spectrum. If number is odd then the +aperture/band number refers to the middle and if it is even it refers to the +lower of the two middle lines or columns. + +In the case of many spectra each stored in separate one dimensional +images, the image names may be such that they have a common root name +and a four digit aperture number extension. This name syntax is +called "onedspec" format. Including such spectra in an +input list may be accomplished either with wildcard templates such as + +.nf + name* + name.????.imh +.fi + +where the image type extension ".imh" must be given to complete the +template but the actual extension could also be that for an STF type +image, or using an @file prepared with the task \fBnames\fR. +To generate this syntax for output images the \fIformat\fR parameter +is set to "onedspec" (this will be discussed further later). + +From the input images one may select a range of wavelengths with the +\fIw1\fR and \fIw2\fR parameters and a subset of spectra based on aperture and +beam numbers using the \fIaperture\fR and \fIbeam\fR parameters. +If the wavelength range is specified as INDEF the full spectra are +used without any resampling. If the aperture and beam lists are not +specified, an empty list, then all apertures and beams are selected. The +lists may be those spectra desired or the complement obtained by prefixing +the list with '!'. Only the selected wavelength range and spectra will +be operated upon and passed on to the output images. + +Specifying a wavelength range is fairly obvious except for the question +of pixel sampling. Either the pixels in the specified range are used +without resampling or the pixels are resampled to correspond eactly +to the requested range. The choice is made with the \fIrebin\fR parameter. +In the first case the nearest pixels to the specified wavelength +endpoints are determined and those pixels and all those in between +are used. The dispersion relation is unchanged. In the second case +the spectra are reinterpolated to have the specified starting and +ending wavelengths with the same number of pixels between those points +as in the original spectrum. The reinterpolation is done in either +linear or log-linear dispersion. The non-linear dispersion functions +are interpolated to a linear dispersion. + +Using \fBsarith\fR with long slit and Fabry-Perot images provides a quick +and simple type of extraction as opposed to using the \fBapextract\fR +package. When summing it is often desired to start each aperture after the +number of lines summed. To do this specify a step size in the aperture/band +list. For example to extract columns 3 to 23 summing every 5 columns you +would use an aperture list of "3-23x5" and an \fInsum\fR of 5. If you do +not use the step in the aperture list you would extract the sum of columns +1 to 5, then columns 2 to 6, and so on. + +In the special case of subapertures extracted by \fBapextract\fR, related +apertures are numbered using a modulus; for example apertures +5, 1005, 2005. To allow selecting all related apertures using a single +aperture number the \fIapmodulus\fR parameter is used to specify the +modulus factor; 1000 in the above example. This is a very specialized +feature which should be ignored by most users. + +The output list of images may consist of an empty list, a single image, +or a list of images matching the input list in number. Note that it +is the number of image names that matters and not the number of spectra +since there may be any number of spectra in an image. The empty list +converts to the same list as the input and is shorthand for replacing +the input image with the output image upon completion; therefore it +is equivalent to the case of a matching list. If the input +consists of just one image then the distinction between a single +output and a matching list is moot. The interesting distinction is +when there is an input list of two or more images. The two cases +are then a mapping of many-to-many or many-to-one. Note that it is +possible to have more complex mappings by repeating the same output +name in a matching list provided clobbering, merging, and possibly +renumbering is enabled. + +In the case of a matching list, spectra from different input images +will go to different output images. In the case of a single output +image all spectra will go to the same output image. Note that in +this discussion an output image when "onedspec" format is specified +is actually a root name for possibly many images. However, +it should be thought of as a single image from the point of view +of image lists. + +When mapping many spectra to a single output image, which may have existing +spectra if merging, there may be a conflict with repeated aperture +numbers. One option is to consecutively renumber the aperture numbers, +including any previous spectra in the output image when merging and then +continuing with the input spectra in the order in which they are selected. +This is specified with the \fIrenumber\fR parameter which renumbers +beginning with 1. + +Another options which may be used independently of renumbering or in +conjunction with it is to add an offset as specified by the \fIoffset\fR +parameter. This is last step in determining the output aperture +numbers so that if used with the renumber option the final aperture +numbers begin with one plus the offset. + +It has been mentioned that it is possible to write and add to +existing images. If an output image exists an error will be +printed unless the \fIclobber\fR parameter is set. If clobbering +is allowed then the existing output image will be replaced by the +new output. Rather than replacing an output image sometimes one +wants to replace certain spectra or add new spectra. This is +done by selecting the \fImerge\fR option. In this case if the output +has a spectrum with the same aperture number as the input spectrum +it is replaced by the input spectrum. If the input spectrum aperture +number is not in the output then the spectrum is added to the output +image. To add spectra with the same aperture number and not +replace the one in the output use the \fIrenumber\fR or +\fIoffset\fR options. +.ih +EXAMPLES +In addition to the examples in this section there are many examples +in the help for \fBscopy\fR which illustrate aspects of selecting +input spectra and producing various types of output. Those examples +are equivalent to using the "copy" operator. The same examples will +also apply with other operators where the input spectra are modified +arithmetically before being copied to the output images. + +I. SIMPLE EXAMPLES + +The simple examples use only a single input image and create a new +output image. + +1. Examples of unary operations: + +.nf + cl> sarith example1 mag "" magexample + cl> sarith magexample lum "" example2 + cl> sarith example1 log "" logexample +.fi + +Note that a place holder for the second operand is required on the command +line which will be ignored. + +2. Examples of binary operations using constants: + +.nf + cl> sarith example1 + 1000 example2 + cl> sarith example1 - 1000 example2 reverse+ + cl> sarith example1 / 1000 example2 + cl> sarith example1 ** 2 example2 +.fi + +3. Examples of binary operations between spectra with matching apertures: + +.nf + cl> sarith example1 + example2 example3 + cl> sarith example1 - example2 example3 +.fi + +4. Example of binary operations between spectra with the second image +consisting of a single spectrum: + +.nf + cl> sarith example1 / flatspec flatexample1 ignore+ errval=1 +.fi + +II. MORE COMPLEX EXAMPLES + +5. Unary and constant operations on a list of images: + +.nf + cl> sarith example* fnu "" %example%fnu% + cl> sarith example* + 1000 %example%fnu% +.fi + +6. Binary operations on a list of images using a single second operand +with matching apertures: + +.nf + cl> sarith example* - skyspec %example%skysub%* +.fi + +7. Selecting apertures to operate upon: + +.nf + cl> sarith example* - skyspec %example%skysub%* aper=1,5,9 +.fi + +8. Extract the sum of each 10 columns in a long slit spectrum and normalize +by the central spectrum: + +.nf + cl> nsum = "10" + cl> sarith longslit copy "" longslit.ms aper=5-500x10 + longslit[5] --> longslit.ms[5] + longslit[15] --> longslit.ms[15] + longslit[25] --> longslit.ms[25] + ... + cl> sarith longslit.ms / longslit.ms[*,25] norm ignore+ + longslit.ms[5] / longslit.ms[*,25][245] --> norm[5] + longslit.ms[15] / longslit.ms[*,25][245] --> norm[15] + longslit.ms[25] / longslit.ms[*,25][245] --> norm[25] + ... +.fi + +9. In place operations: + +.nf + cl> sarith example* + 1000 example* clobber+ + example1[1] + 1000. --> example1[1] + example1[2] + 1000. --> example1[2] + ... + example2[1] + 1000. --> example2[1] + example2[2] + 1000. --> example2[2] + ... + cl> sarith example* flam "" example* clobber+ + example1[1] -- flam --> example1[1] + example1[2] -- flam --> example1[2] + ... + example2[1] -- flam --> example2[1] + example2[2] -- flam --> example2[2] + ... + cl> sarith example* - skyspec "" clobber+ ignore+ + example1[1] + skyspec[1] --> example1[1] + example1[2] + skyspec[1] --> example1[2] + ... + example2[1] + skyspec[1] --> example2[1] + example2[2] + skyspec[1] --> example2[2] + ... +.fi + +10. Merging existing spectra with the results of operations: + +.nf + cl> sarith example* / flat "" clobber+ merge+ renum+ ignor+ +.fi +.ih +REVISIONS +.ls SARITH V2.11 +Previously both w1 and w2 had to be specified to select a range to +be used. Now if only one is specified the second endpoint defaults +to the first or last pixel. + +The noise band in multispec data is only copied from the primary +spectrum and not modified. This is a kludge until the noise is +handled properly. +.le +.ls SARITH V2.10.3 +Additional support for 3D multispec/equispec or spatial spectra has been +added. The "bands" parameter allows selecting specific bands and +the onedspec output format creates separate images for each selected +aperture and band. +.le +.ls SARITH V2.10 +This task is new. +.le +.ih +SEE ALSO +scopy, splot, imarith, imfunction +.endhelp diff --git a/noao/onedspec/doc/sbands.hlp b/noao/onedspec/doc/sbands.hlp new file mode 100644 index 00000000..0bde52ac --- /dev/null +++ b/noao/onedspec/doc/sbands.hlp @@ -0,0 +1,209 @@ +.help sbands Nov93 onedspec +.ih +NAME +sbands -- bandpass spectrophotometry of spectra +.ih +USAGE +sbands input output bands +.ih +PARAMETERS +.ls input +Input list of spectra to be measured. These may be one dimensional +spectra in individual or "multispec" format or calibrated spatial spectra such +as long slit or Fabry-Perot images. The dispersion axis and summing +parameters are specified by package parameters for the spatial spectra. +.le +.ls output +Output file for the results. This may be a filename or "STDOUT" to +write to the terminal. +.le +.ls bands +Bandpass file consisting of lines with one, two, or three bandpasses per +line. A bandpass is specified by an identification string (quoted if it is +null or contains whitespace), the central wavelength, the width of the +bandpass in wavelength, and a filter filename with the special value "none" +if there is no filter (a flat unit response). This format is described +further in the description section. +.le +.ls apertures = "" +List of apertures to select from the input spectra. For one dimensional +spectra this is the aperture number and for spatial spectra it is +the column or line. If the null string is specified all apertures are +selected. The aperture list syntax is a range list which includes +intervals and steps (see \fBranges\fR). +.le +.ls normalize = yes +Normalize the bandpass fluxes by the bandpass response? If no then +the results will depend on the bandpass widths and filter function +values. If yes then fluxes will be comparable to an average pixel +value. When computing indices and equivalent widths the flux must +either be normalized or the bandpasses and filter response functions +must be the same. +.le +.ls mag = no, magzero = 0. +Output the bandpass fluxes as magnitudes with specified magnitude +zero point? +.le +.ls verbose = yes +Include a verbose header giving a banner, the parameters used, +the bandpasses, and column headings? +.le +.ih +DESCRIPTION +\fBSbands\fR performs bandpass spectrophotometry with one or more bandpasses +on one or more spectra. A list of input spectra is specified. The spectra +may be of any type acceptable in the \fBnoao.onedspec\fR package including +multispec format with nonlinear dispersion, long slit spectra, and even +3D cubes with one dispersion axis. The \fIapertures\fR parameter allows +selecting a subset of the spectra by aperture number. + +The bandpasses are specified in a text file. A bandpass consists of four +fields; an identification name, the wavelength of the bandpass center, a +bandpass width, and a filename for a filter. The identification is a +string which must be quoted if a null name or a name with whitespace is +desired. The identification could be given as the central wavelength if +nothing else is appropriate. The filter field is a filename for a text +file containing the filter values. A filter file consists of a wavelength +ordered list of wavelength and relative response. Extrapolation uses the +end point values and interpolation is linear. The special name "none" is +used if there is no filter. This is equivalent to unit response at all +wavelengths. + +In the bandpass file there may be one, two, or three bandpasses on +a line. Below are some examples of the three cases: + +.nf + alpha 5000 10 myalpha.dat + beta1 4000 100 none beta2 4100 100 none + line 4500 100 none red 4000 200 none blue 5000 200 none +.fi + +The flux in each bandpass is measured by summing each pixel in the interval +multiplied by the interpolated filter response at that pixel. At the edges +of the bandpass the fraction of the pixel in the bandpass is used. If the +bandpass goes outside the range of the data an INDEF value will be reported. +If the \fInormalize\fR option is yes then the total flux is divided by +the sum of the filter response values. If the \fImag\fR option is +yes the flux will be converted to a magnitude (provided it is positive) +using the formula + +.nf + magnitude = magzero - 2.5 * log10 (flux) +.fi + +where \fImagzero\fR is a parameter for the zero point magnitude and log10 +is the base 10 logarithm. Note that there is no attempt to deal with the +pixel flux units. This is the responsibility of the user. + +If there is only one bandpass (on one line of the band file) then only +the band flux or magnitude is reported. If there are two bandpasses +the fluxes or magnitudes for the two bands are reported as well as a +band index, the flux ratio or magnitude difference (depending on the \fImag\fR) +flag, and an equivalent width using the second band as the continuum. +If there are three bandpasses then a continuum bandpass flux is computed +as the interpolation between the bandpass centers to the center of the +first bandpass. The special bandpass identification "cont" will +be reported. + +The equivalent width is obtained from the two bandpasses by the +formula + +.nf + eq. width = (1 - flux1 / flux2) * width1 +.fi + +where flux1 and flux2 are the two bandpass fluxes and width1 is the +width of the first bandpass. Note that for this to be meaningful +the bandpasses should be normalized or have the same width/response. + +The results of measuring each bandpass in each spectrum are written +to the specified output file. This file may be given as "STDOUT" to +write the results to the terminal. The output file contains lines +with the spectrum name and aperture, the band identifications and +fluxes or magnitudes, and the band index and equivalent width (if +appropriate). The \fIverbose\fR option allows creating a more +documented output by including a commented header with the task +name and parameters, the bandpass definitions, and column labels. +The examples below show the form of the output. +.ih +EXAMPLES +The following examples use artificial data and arbitrary bands. + +1. Show example results with one, two, and three bandpass entries in +the bandpass file. + +.nf + cl> type bands + test 6125 50 none red 6025 100 none blue 6225 100 none + test 6125 50 none red 6025 100 none + test 6125 50 none blue 6225 100 none + test 6125 50 none + cl> sbands oned STDOUT bands + + # SBANDS: NOAO/IRAF IRAFX valdes@puppis Mon 15:31:45 01-Nov-93 + # bands = bands, norm = yes, mag = no + # band filter wavelength width + # test none 6125. 50. + # red none 6025. 100. + # blue none 6225. 100. + # test none 6125. 50. + # red none 6025. 100. + # test none 6125. 50. + # blue none 6225. 100. + # test none 6125. 50. + # + # spectrum band flux band flux index eqwidth + oned(1) test 44.33 cont 97.97 0.45 27.37 + oned(1) test 44.33 red 95.89 0.46 26.89 + oned(1) test 44.33 blue 100.04 0.44 27.84 + oned(1) test 44.33 +.fi + +2. This example shows measurements on a long slit spectrum with an +aperture selection and magnitude output. + +.nf + cl> type lsbands.dat + band1 4500 40 none + band2 4600 40 none + band3 4700 40 none + cl> nsum=5 + cl> sbands ls STDOUT lsbands.dat apertures=40-60x5 mag+ magzero=10.1 + + # SBANDS: NOAO/IRAF IRAFX valdes@puppis Mon 15:37:18 01-Nov-93 + # bands = lsbands.dat, norm = yes, mag = yes, magzero = 10.10 + # band filter wavelength width + # band1 none 4500. 40. + # band2 none 4600. 40. + # band3 none 4700. 40. + # + # spectrum band mag + ls[38:42,*](40) band1 3.14 + ls[38:42,*](40) band2 3.19 + ls[38:42,*](40) band3 3.15 + ls[43:47,*](45) band1 3.13 + ls[43:47,*](45) band2 3.15 + ls[43:47,*](45) band3 3.14 + ls[48:52,*](50) band1 2.34 + ls[48:52,*](50) band2 2.43 + ls[48:52,*](50) band3 2.43 + ls[53:57,*](55) band1 3.10 + ls[53:57,*](55) band2 3.15 + ls[53:57,*](55) band3 3.12 + ls[58:62,*](60) band1 3.14 + ls[58:62,*](60) band2 3.19 + ls[58:62,*](60) band3 3.15 +.fi +.ih +REVISIONS +.ls SBANDS V2.10.4 +The flux column is now printed to 6 digits of precision with possible +exponential format to permit flux calibrated spectra to print properly. +.le +.ls SBANDS V2.10.3 +The task is new in this release +.le +.ih +SEE ALSO +splot +.endhelp diff --git a/noao/onedspec/doc/scombine.hlp b/noao/onedspec/doc/scombine.hlp new file mode 100644 index 00000000..06e63003 --- /dev/null +++ b/noao/onedspec/doc/scombine.hlp @@ -0,0 +1,765 @@ +.help scombine Sep97 noao.onedspec +.ih +NAME +scombine -- Combine spectra +.ih +USAGE +scombine input output +.ih +PARAMETERS +.ls input +List of input images containing spectra to be combined. The spectra +in the images to be combined are selected with the \fIapertures\fR and +\fIgroup\fR parameters. Only the primary spectrum is combined and +the associated band spectra are ignored. +.le +.ls output +List of output images to be created containing the combined spectra. +If the grouping option is "all" +or "apertures" then only one output image will be created. In the +first case the image will contain only one spectrum and in the latter case +there will be a spectrum for each selected aperture. +If the grouping option is "images" then there will be one +output spectrum per input spectrum. +.le +.ls noutput = "" +List of output images to be created containing the number of spectra combined. +The number of images required is the same as the \fIoutput\fR list. +Any or all image names may be given as a null string, i.e. "", in which +case no output image is created. +.le +.ls logfile = "STDOUT" +File name for recording log information about the combining operation. +The file name "STDOUT" is used to write the information to the terminal. +If the null string is specified then no log information is printed or +recorded. +.le + +.ls apertures = "" +List of apertures to be selected for combining. If none is specified +then all apertures are selected. The syntax is a blank or comma separated +list of aperture numbers or aperture ranges separated by a hyphen. +.le +.ls group = "apertures" (all|images|apertures) +Option for grouping input spectra for combining (after selection by aperture) +from one or more input images. The options are: +.ls "all" +Combine all spectra from all images in the input list into a single output +spectrum. +.le +.ls "images" +Combine all spectra in each input image into a single spectrum in +separate output images. +.le +.ls "apertures" +Combine all spectra of the same aperture from all input images and put it +into a single output image with the other selected apertures. +.le +.le +.ls combine = "average" (average|median|sum) +Option for combining pixels at the same dispersion coordinate. after any +rejection operation. The options are to compute the "average", "median", +or "sum" of the pixels. The first two are applied after any pixel +rejection. The sum option ignores the rejection and scaling parameters and +no rejection is performed. In other words, the "sum" option is simply the +direct summation of the pixels. The median uses the average of the two +central values when the number of pixels is even. +.le +.ls reject = "none" (none|minmax|ccdclip|crreject|sigclip|avsigclip|pclip) +Type of rejection operation performed on the pixels which overlap at each +dispersion coordinate. The algorithms are discussed in the +DESCRIPTION section. The rejection choices are: + +.nf + none - No rejection + minmax - Reject the nlow and nhigh pixels + sigclip - Reject pixels using a sigma clipping algorithm + avsigclip - Reject pixels using an averaged sigma clipping algorithm + ccdclip - Reject pixels using CCD noise parameters + crreject - Reject only positive pixels using CCD noise parameters + pclip - Reject pixels using sigma based on percentiles +.fi + +.le + +.ls first = no +Use the first input spectrum of each set to be combined to define the +dispersion coordinates for combining and output? If yes then all other +spectra to be combined will be interpolated to the dispersion of this +reference spectrum and that dispersion defines the dispersion of the +output spectrum. If no, then all the spectra are interpolated to a linear +dispersion as determined by the following parameters. The interpolation +type is set by the package parameter \fIinterp\fR. +.le +.ls w1 = INDEF, w2=INDEF, dw = INDEF, nw = INDEF, log = no +The output linear or log linear wavelength scale if the dispersion of the +first spectrum is not used. INDEF values are filled in from the maximum +wavelength range and minimum dispersion of the spectra to be combined. The +parameters are aways specified in linear wavelength even when the log +parameter is set to produce constant pixel increments in the log of the +wavelength. The dispersion is interpreted in that case as the difference +in the log of the endpoints divided by the number of pixel increments. +.le + +.ls scale = "none" (none|mode|median|mean|exposure|@|!) +Multiplicative image scaling to be applied. The choices are none, +multiply by the reciprocal of the mode , median, or mean of the specified +statistics section, scale by the exposure time in the image header, multiply +by the values in a specified file, or multiply by a specified image header +keyword. When specified in a file the scales must be one per line in the +order of the input spectra. +.le +.ls zero = "none" (none|mode|median|mean|@|!) +Additive zero level image shifts to be applied. The choices are none, +add the negative of the mode, median, or mean of the specified statistics +section, add the values given in a file, or add values given by an +image header keyword. When specified in a file the zero values must be one +per line in the order of the input spectra. File or keyword zero offset +values do not allow a correction to the weights. +.le +.ls weight = "none" (none|mode|median|mean|exposure|@|!) +Weights to be applied during the final averaging. The choices are none, +the mode, median, or mean of the specified statistics section, the exposure +time, values given in a file, or values given by an image header keyword. +When specified in a file the weights must be one per line in the order of +the input spectra. +.le +.ls sample = "" +Wavelength sample regions to use in computing spectrum statistics for +scaling and weighting. If no sample regions are given then the entire +input spectrum is used. The syntax is colon separated wavelengths +or a file containing colon separated wavelengths preceded by the +@ character; i.e. @. +.le + +.ce +Algorithm Parameters +.ls lthreshold = INDEF, hthreshold = INDEF +Low and high thresholds to be applied to the input pixels. This is done +before any scaling, rejection, and combining. If INDEF the thresholds +are not used. +.le +.ls nlow = 1, nhigh = 1 (minmax) +The number of low and high pixels to be rejected by the "minmax" algorithm. +These numbers are converted to fractions of the total number of input spectra +so that if no rejections have taken place the specified number of pixels +are rejected while if pixels have been rejected by thresholding +or nonoverlap, then the fraction of the remaining pixels, truncated +to an integer, is used. +.le +.ls nkeep = 1 +The minimum number of pixels to retain or the maximum number to reject +when using the clipping algorithms (ccdclip, crreject, sigclip, +avsigclip, or pclip). When given as a positive value this is the minimum +number to keep. When given as a negative value the absolute value is +the maximum number to reject. This is actually converted to a number +to keep by adding it to the number of images. +.le +.ls mclip = yes (ccdclip, crreject, sigclip, avsigcliip) +Use the median as the estimate for the true intensity rather than the +average with high and low values excluded in the "ccdclip", "crreject", +"sigclip", and "avsigclip" algorithms? The median is a better estimator +in the presence of data which one wants to reject than the average. +However, computing the median is slower than the average. +.le +.ls lsigma = 3., hsigma = 3. (ccdclip, crreject, sigclip, avsigclip, pclip) +Low and high sigma clipping factors for the "ccdclip", "crreject", "sigclip", +"avsigclip", and "pclip" algorithms. They multiply a "sigma" factor +produced by the algorithm to select a point below and above the average or +median value for rejecting pixels. The lower sigma is ignored for the +"crreject" algorithm. +.le +.ls rdnoise = "0.", gain = "1.", snoise = "0." (ccdclip, crreject) +Effective CCD readout noise in electrons, gain in electrons/DN, and +sensitivity noise as a fraction. These parameters are used with the +"ccdclip" and "crreject" algorithms. The values may be either numeric or +an image header keyword which contains the value. Note that if the spectra +have been extracted from a 2D CCD image then the noise parameters must be +adjusted for background and the aperture summing. +.le +.ls sigscale = 0.1 (ccdclip, crreject, sigclip, avsigclip) +This parameter determines when poisson corrections are made to the +computation of a sigma for images with different scale factors. If all +relative scales are within this value of unity and all relative zero level +offsets are within this fraction of the mean then no correction is made. +The idea is that if the images are all similarly though not identically +scaled, the extra computations involved in making poisson corrections for +variations in the sigmas can be skipped. A value of zero will apply the +corrections except in the case of equal images and a large value can be +used if the sigmas of pixels in the images are independent of scale and +zero level. +.le +.ls pclip = -0.5 (pclip) +Percentile clipping algorithm parameter. If greater than +one in absolute value then it specifies a number of pixels above or +below the median to use for computing the clipping sigma. If less +than one in absolute value then it specifies the fraction of the pixels +above or below the median to use. A positive value selects a point +above the median and a negative value selects a point below the median. +The default of -0.5 selects approximately the quartile point. +See the DESCRIPTION section for further details. +.le +.ls grow = 0 +Number of pixels to either side of a rejected pixel +to also be rejected. This applies only to pixels rejected by one of +the rejection algorithms and not the threshold rejected pixels. +.le +.ls blank = 0. +Value to use when there are no input pixels to combine for an output pixel. +.le +.ih +DESCRIPTION +\fBScombine\fR combines input spectra by interpolating them (if necessary) +to a common dispersion sampling, rejecting pixels exceeding specified low +and high thresholds, scaling them in various ways, applying a rejection +algorithm based on known or empirical noise statistics, and computing the +sum, weighted average, or median of the remaining pixels. Note that +the "sum" option is the direct summation of the pixels and does not +perform any rejection or scaling of the data regardless of the parameter +settings. + +The input spectra are specified using an image list in which each image +may contain multiple spectra. The set of spectra may be restricted +by the \fIaperture\fR parameter to specific apertures. The set of input +spectra may then be grouped using the \fIgroup\fR parameter and each +group combined separately into a final output spectrum. The grouping +options are to select all the input spectra regardless of the input +image or aperture number, select all spectra of the same aperture, +or select all the spectra from the same input image. + +The output consists of either a single image with one spectrum for each +combined group or, when grouping by image, an image with the single +combined spectra from each input image. The output images and +combined spectra inherit the header parameters from the first spectrum +of the combined group. In addition to the combined spectrum an associated +integer spectrum containing the number of pixels combined +and logfile listing the combined spectra, scaling, weights, etc, may +be produced. + +The spectral combining is done using pixels at common dispersion +coordinates rather than physical or logical pixel coordinates. If the +spectra to be combined do not have identical dispersion coordinates then +the spectra are interpolated to a common dispersion sampling before +combining. The interpolation conserves pixel values rather pixel fluxes. +This means that flux calibrated data is treated correctly and that +spectra in counts are not corrected in the interpolation for changes +in pixel widths. +The default interpolation function is a 5th order polynomial. The +choice of interpolation type is made with the package parameter "interp". +It may be set to "nearest", "linear", "spline3", "poly5", or "sinc". +Remember that this applies to all tasks which might need to interpolate +spectra in the \fBonedspec\fR and associated packages. For a discussion of +interpolation types see \fBonedspec\fR. + +There are two choices for the common dispersion coordinate sampling. If the +\fIfirst\fR parameter is set then the dispersion sampling of the first +spectrum is used. This dispersion system may be nonlinear. If the +parameter is not set then the user specified linear or log linear +dispersion system is used. Any combination of starting wavelength, ending +wavelength, wavelength per pixel, and number of output pixels may be +specified. Unspecified values will default to reasonable values based on +the minimum or maximum wavelengths of all spectra, the minimum dispersion, +and the number of pixels needed to satisfy the other parameters. If the +parameters overspecify the linear system then the ending wavelength is +adjusted based on the other parameters. Note that for a log linear system +the wavelengths are still specified in nonlog units and the dispersion is +finally recalculated using the difference of the log wavelength endpoints +divided by the number pixel intervals (the number of pixels minus one). + +There are several stages to combining a selected group of spectra. The +first is interpolation to a common dispersion sampling as discussed +above. The second stage is to eliminate any pixels outside the specified +thresholds. Note that the thresholds apply to the interpolated +spectra. Scaling and zero offset factors are computed and applied to the +spectra if desire. The computation of these factors as well as weights is +discussed in the following section. Next there is a choice of rejection +algorithms to identify and eliminate deviant pixels. Some of these are +based on order statistics and some relative to the distance from an initial +median or average using a noise model cutoff. A growing factor may be +applied to neighbors of rejected pixels to reject additional pixels. The +various algorithms are described in detail in a following section. +Finally, the remaining pixels are combined by summing (which may not be +appropriate when pixels are rejected), computing a median, or computing a +weighted or unweighted average. The combined spectrum is written to an +output image as well the number of pixels used in the final combining. + +SCALES AND WEIGHTS + +In order to combine spectra with rejection of pixels based on deviations +from some average or median they must be scaled to a common level. There +are two types of scaling available, a multiplicative intensity scale and an +additive zero point shift. The intensity scaling is defined by the +\fIscale\fR parameter and the zero point shift by the \fIzero\fR +parameter. These parameters may take the values "none" for no scaling, +"mode", "median", or "mean" to scale by statistics of the spectrum pixels, +"exposure" (for intensity scaling only) to scale by the exposure time +keyword in the image header, any other image header keyword specified by +the keyword name prefixed by the character '!', and the name of a file +containing the scale factors for the input image prefixed by the +character '@'. + +Examples of the possible parameter values are shown below where +"myval" is the name of an image header keyword and "scales.dat" is +a text file containing a list of scale factors. + +.nf + scale = none No scaling + zero = mean Intensity offset by the mean + scale = exposure Scale by the exposure time + zero = !myval Intensity offset by an image keyword + scale = @scales.dat Scales specified in a file +.fi + +The spectrum statistics factors are computed within specified sample +regions given as a series of colon separated wavelengths. If no +regions are specified then all pixels are used. If the +wavelength sample list is too long the regions can be defined in a file and +specified in the \fIsample\fR parameter using the syntax @ where file +is the filename. + +The statistics are as indicated by their names. In particular, the +mode is a true mode using a bin size which is a fraction of the +range of the pixels and is not based on a relationship between the +mode, median, and mean. Also thresholded pixels are excluded from the +computations as well as during the rejection and combining operations. + +The "exposure" option in the intensity scaling uses the value of the image +header keyword (EXPTIME, EXPOSURE, or ITIME). Note that the exposure +keyword is also updated in the final image as the weighted average of the +input values. If one wants to use a nonexposure time keyword and keep the +exposure time updating feature the image header keyword syntax is +available; i.e. !. + +Scaling values may be defined as a list of values in a text file. The file +name is specified by the standard @file syntax. The list consists of one +value per line. The order of the list is assumed to be the same as the +order of the input spectra. It is a fatal error if the list is incomplete +and a warning if the list appears longer than the number of input spectra. +Consideration of the grouping parameter must be included in +generating this list since spectra may come from different images, +some apertures may be missing, and, when there are multiple output spectra +or images, the same list will be repeatedly used. + +If both an intensity scaling and zero point shift are selected the +multiplicative scaling is done first. Use of both makes sense for images +if the intensity scaling is the exposure time to correct for +different exposure times and with the zero point shift allowing for +sky brightness changes. This is less relevant for spectra but the option +is available. + +The spectrum statistics and scale factors are recorded in the log file +unless they are all equal, which is equivalent to no scaling. The +intensity scale factors are normalized to a unit mean and the zero +point shifts are adjusted to a zero mean. When scal factors +or zero point shifts are specified by the user in an @file or by an +image header keyword, no normalization is done. + +Scaling affects not only the mean values between spectra but also the +relative pixel uncertainties. For example scaling an spectrum by a +factor of 0.5 will reduce the effective noise sigma of the spectrum +at each pixel by the square root of 0.5. Changes in the zero +point also changes the noise sigma if the spectrum noise characteristics +are Poissonian. In the various rejection algorithms based on +identifying a noise sigma and clipping large deviations relative to +the scaled median or mean, one may need to account for the scaling induced +changes in the spectrum noise characteristics. + +In those algorithms it is possible to eliminate the "sigma correction" +while still using scaling. The reasons this might be desirable are 1) if +the scalings are similar the corrections in computing the mean or median +are important but the sigma corrections may not be important and 2) the +spectrum statistics may not be Poissonian, either inherently or because the +spectra have been processed in some way that changes the statistics. In the +first case because computing square roots and making corrections to every +pixel during the iterative rejection operation may be a significant +computational speed limit the parameter \fIsigscale\fR selects how +dissimilar the scalings must be to require the sigma corrections. This +parameter is a fractional deviation which, since the scale factors are +normalized to unity, is the actual minimum deviation in the scale factors. +For the zero point shifts the shifts are normalized by the mean shift +before adjusting the shifts to a zero mean. To always use sigma scaling +corrections the parameter is set to zero and to eliminate the correction in +all cases it is set to a very large number. + +If the final combining operation is "average" then the spectra may be +weighted during the averaging. The weights are specified in the same way +as the scale factors. The weights, scaled to a unit sum, are printed in +the log output. + +The weights are only used for the final weighted average and sigma image +output. They are not used to form averages in the various rejection +algorithms. For weights in the case of no scaling or only multiplicative +scaling the weights are used as given or determined so that images +with lower signal levels will have lower weights. However, for +cases in which zero level scaling is used the weights are computed +from the initial weights (the exposure time, image statistics, or +input values) using the formula: + +.nf + weight_final = weight_initial / (scale * zero) +.fi + +where the zero values are those before adjustment to zero mean over +all images. The reasoning is that if the zero level is high the sky +brightness is high and so the S/N is lower and the weight should be lower. + + +THRESHOLD REJECTION + +There is an initial threshold rejection step which may be applied. The +thresholds are given by the parameters \fIlthreshold\fR and +\fIhthreshold\fR. Values of INDEF mean that no threshold value is +applied. Threshold rejection may be used to exclude very bad pixel values +or as a way of masking images. The former case is useful to exclude very +bright cosmic rays. Some of the rejection algorithms, such as "avsigclip", +can perform poorly if very strong cosmic rays are present. For masking one +can use a task like \fBimedit\fR or \fBimreplace\fR to set parts of the +spectra to be excluded to some very low or high magic value. + + +REJECTION ALGORITHMS + +The \fIreject\fR parameter selects a type of rejection operation to +be applied to pixels not thresholded. If no rejection +operation is desired the value "none" is specified. This task is +closely related to the image combining task \fBimcombine\fR and, in +particular, has the same rejection algorithms. +Some the algorithms are more appropriate to images but are available +in this task also for completeness. + +MINMAX +.in 4 +A specified fraction of the highest and lowest pixels are rejected. +The fraction is specified as the number of high and low pixels, the +\fInhigh\fR and \fInlow\fR parameters, when data from all the input spectra +are used. If pixels are missing where there is no overlap or have been +rejected by thresholding then a matching fraction of the remaining pixels, +truncated to an integer, are used. Thus, + +.nf + nl = n * nlow/nspectra + 0.001 + nh = n * nhigh/nspectra + 0.001 +.fi + +where n is the number of pixels to be combined, nspectra is the number +of input spectra, nlow and nhigh +are task parameters and nl and nh are the final number of low and +high pixels rejected by the algorithm. The factor of 0.001 is to +adjust for rounding of the ratio. + +As an example with 10 input spectra and specifying one low and two high +pixels to be rejected the fractions to be rejected are 0.1 and 0.2 +and the number rejected as a function of n is: + +.nf + n 0 1 2 3 4 5 6 7 8 9 10 + nl 0 0 0 0 0 1 1 1 1 1 2 + nh 0 0 0 0 0 0 0 0 0 0 1 +.fi +.in -4 +CCDCLIP +.in 4 +If the noise characteristics of the spectra can be described by fixed +gaussian noise, a poissonian noise which scales with the square root of +the intensity, and a sensitivity noise which scales with the intensity, +the sigma in data values at a pixel with true value , +as approximated by the median or average with the lowest and highest value +excluded, is given as: + +.nf + sigma = ((rn / g) ** 2 + / g + (s * ) ** 2) ** 1/2 +.fi + +where rn is the read out noise in electrons, g is the gain in +electrons per data value, s is a sensitivity noise given as a fraction, +and ** is the exponentiation operator. Often the sensitivity noise, +due to uncertainties in the pixel sensitivities (for example from the +flat field), is not known in which case a value of zero can be used. + +This model is typically valid for CCD images. During extraction of +spectra from CCD images the noise parameters of the spectrum pixels +will be changed from those of the CCD pixels. Currently it is up to +the user to determine the proper modifications of the CCD read noise +gain, and sensitivity noise. + +The read out noise is specified by the \fIrdnoise\fR parameter. The value +may be a numeric value to be applied to all the input spectra or an image +header keyword containing the value for spectra from each image. +Similarly, the parameter \fIgain\fR specifies the gain as either a value or +image header keyword and the parameter \fIsnoise\fR specifies the +sensitivity noise parameter as either a value or image header keyword. + +The algorithm operates on each output pixel independently. It starts by +taking the median or unweighted average (excluding the minimum and maximum) +of the unrejected pixels provided there are at least two input pixels. The +expected sigma is computed from the CCD noise parameters and pixels more +that \fIlsigma\fR times this sigma below or \fIhsigma\fR times this sigma +above the median or average are rejected. The process is then iterated +until no further pixels are rejected. If the average is used as the +estimator of the true value then after the first round of rejections the +highest and lowest values are no longer excluded. Note that it is possible +to reject all pixels if the average is used and is sufficiently skewed by +bad pixels such as cosmic rays. + +If there are different CCD noise parameters for the input images +(as might occur using the image header keyword specification) then +the sigmas are computed for each pixel from each image using the +same estimated true value. + +If the images are scaled and shifted and the \fIsigscale\fR threshold +is exceedd then a sigma is computed for each pixel based on the +spectrum scale parameters; i.e. the median or average is scaled to that of the +original image before computing the sigma and residuals. + +After rejection the number of retained pixels is checked against the +\fInkeep\fR parameter. If there are fewer pixels retained than specified +by this parameter the pixels with the smallest residuals in absolute +value are added back. If there is more than one pixel with the same +absolute residual (for example the two pixels about an average +or median of two will have the same residuals) they are all added +back even if this means more than \fInkeep\fR pixels are retained. +Note that the \fInkeep\fR parameter only applies to the pixels used +by the clipping rejection algorithm and does not apply to threshold +or bad pixel mask rejection. + +This is the best clipping algorithm to use if the CCD noise parameters are +adequately known. The parameters affecting this algorithm are \fIreject\fR +to select this algorithm, \fImclip\fR to select the median or average for +the center of the clipping, \fInkeep\fR to limit the number of pixels +rejected, the CCD noise parameters \fIrdnoise, gain\fR and \fIsnoise\fR, +\fIlsigma\fR and \fIhsigma\fR to select the clipping thresholds, +and \fIsigscale\fR to set the threshold for making corrections to the sigma +calculation for different image scale factors. + +.in -4 +CRREJECT +.in 4 +This algorithm is identical to "ccdclip" except that only pixels above +the average are rejected based on the \fIhsigma\fR parameter. This +is appropriate for rejecting cosmic ray events and works even with +two spectra. + +.in -4 +SIGCLIP +.in 4 +The sigma clipping algorithm computes at each output pixel the median or +average excluding the high and low values and the sigma about this +estimate. There must be at least three input pixels, though for this method +to work well there should be at least 10 pixels. Values deviating by more +than the specified sigma threshold factors are rejected. These steps are +repeated, except that after the first time the average includes all values, +until no further pixels are rejected or there are fewer than three pixels. + +After rejection the number of retained pixels is checked against the +\fInkeep\fR parameter. If there are fewer pixels retained than specified +by this parameter the pixels with the smallest residuals in absolute +value are added back. If there is more than one pixel with the same +absolute residual (for example the two pixels about an average +or median of two will have the same residuals) they are all added +back even if this means more than \fInkeep\fR pixels are retained. +Note that the \fInkeep\fR parameter only applies to the pixels used +by the clipping rejection algorithm and does not apply to threshold +rejection. + +The parameters affecting this algorithm are \fIreject\fR to select +this algorithm, \fImclip\fR to select the median or average for the +center of the clipping, \fInkeep\fR to limit the number of pixels +rejected, \fIlsigma\fR and \fIhsigma\fR to select the +clipping thresholds, and \fIsigscale\fR to set the threshold for +making corrections to the sigma calculation for different spectrum scale +factors. + +.in -4 +AVSIGCLIP +.in 4 +The averaged sigma clipping algorithm assumes that the sigma about the +median or mean (average excluding the low and high values) is proportional +to the square root of the median or mean at each point. This is +described by the equation: + +.nf + sigma(column,line) = sqrt (gain(line) * signal(column,line)) +.fi + +where the \fIestimated\fR signal is the mean or median (hopefully excluding +any bad pixels) and the gain is the \fIestimated\fR proportionality +constant having units of photons/data number. + +This noise model is valid for spectra whose values are proportional to the +number of photons recorded. In effect this algorithm estimates a +photon per data value gain for each spectrum. +The gain proportionality factor is computed +independently for each output spectrum by averaging the square of the residuals +(at points having three or more input values) scaled by the median or +mean. + +Once the proportionality factor is determined, deviant pixels exceeding the +specified thresholds are rejected at each point by estimating the sigma +from the median or mean. If any values are rejected the median or mean +(this time not excluding the extreme values) is recomputed and further +values rejected. This is repeated until there are no further pixels +rejected or the number of remaining input values falls below three. Note +that the proportionality factor is not recomputed after rejections. + +If the spectra are scaled differently and the sigma scaling correction +threshold is exceedd then a correction is made in the sigma +calculations for these differences, again under the assumption that +the noise in an spectra scales as the square root of the mean intensity. + +After rejection the number of retained pixels is checked against the +\fInkeep\fR parameter. If there are fewer pixels retained than specified +by this parameter the pixels with the smallest residuals in absolute +value are added back. If there is more than one pixel with the same +absolute residual (for example the two pixels about an average +or median of two will have the same residuals) they are all added +back even if this means more than \fInkeep\fR pixels are retained. +Note that the \fInkeep\fR parameter only applies to the pixels used +by the clipping rejection algorithm and does not apply to threshold +rejection. + +This algorithm works well for even a few input spectra. It works better if +the median is used though this is slower than using the average. Note that +if the spectra have a known read out noise and gain (the proportionality +factor above) then the "ccdclip" algorithm is superior. However, currently +the CCD noise characteristics are not well propagated during extraction so +this empirical algorithm is the one most likely to be useful. The two +algorithms are related in that the average sigma proportionality factor is +an estimate of the gain. + +The parameters affecting this algorithm are \fIreject\fR to select +this algorithm, \fImclip\fR to select the median or average for the +center of the clipping, \fInkeep\fR to limit the number of pixels +rejected, \fIlsigma\fR and \fIhsigma\fR to select the +clipping thresholds, and \fIsigscale\fR to set the threshold for +making corrections to the sigma calculation for different image scale +factors. + +.in -4 +PCLIP +.in 4 +The percentile clipping algorithm is similar to sigma clipping using the +median as the center of the distribution except that, instead of computing +the sigma of the pixels from the CCD noise parameters or from the data +values, the width of the distribution is characterized by the difference +between the median value and a specified "percentile" pixel value. This +width is then multipled by the scale factors \fIlsigma\fR and \fIhsigma\fR +to define the clipping thresholds above and below the median. The clipping +is not iterated. + +The pixel values at each output point are ordered in magnitude and the +median is determined. In the case of an even number of pixels the average +of the two middle values is used as the median value and the lower or upper +of the two is the median pixel when counting from the median pixel to +selecting the percentile pixel. The parameter \fIpclip\fR selects the +percentile pixel as the number (if the absolute value is greater +than unity) or fraction of the pixels from the median in the ordered set. +The direction of the percentile pixel from the median is set by the sign of +the \fIpclip\fR parameter with a negative value signifying pixels with +values less than the median. Fractional values are internally converted to +the appropriate number of pixels for the number of input spectra. A minimum +of one pixel and a maximum corresponding to the extreme pixels from the +median are enforced. The value used is reported in the log output. Note +that the same percentile pixel is used even if pixels have been rejected by +nonoverlap or thresholding; for example, if the 3nd pixel below +the median is specified then the 3rd pixel will be used whether there are +10 pixels or 5 pixels remaining after the preliminary steps. + +After rejection the number of retained pixels is checked against the +\fInkeep\fR parameter. If there are fewer pixels retained than specified +by this parameter the pixels with the smallest residuals in absolute +value are added back. If there is more than one pixel with the same +absolute residual (for example the two pixels about an average +or median of two will have the same residuals) they are all added +back even if this means more than \fInkeep\fR pixels are retained. +Note that the \fInkeep\fR parameter only applies to the pixels used +by the clipping rejection algorithm and does not apply to threshold +or bad pixel mask rejection. + +Some examples help clarify the definition of the percentile pixel. In the +examples assume 10 pixels. The median is then the average of the +5th and 6th pixels. A \fIpclip\fR value of 2 selects the 2nd pixel +above the median (6th) pixel which is the 8th pixel. A \fIpclip\fR +value of -0.5 selects the point halfway between the median and the +lowest pixel. In this case there are 4 pixels below the median, +half of that is 2 pixels which makes the percentile pixel the 3rd pixel. + +The percentile clipping algorithm is most useful for clipping small +excursions, such as the wings of bright lines when combining +disregistered observations, that are missed when using +the pixel values to compute a sigma. It is not as powerful, however, as +using the CCD noise parameters (provided they are accurately known) to clip +about the median. This algorithm is primarily used with direct images +but remains available for spectra. + +The parameters affecting this algorithm are \fIreject\fR to select this +algorithm, \fIpclip\fR to select the percentile pixel, \fInkeep\fR to limit +the number of pixels rejected, and \fIlsigma\fR and \fIhsigma\fR to select +the clipping thresholds. + + +.in -4 +GROW REJECTION + +Neighbors of pixels rejected by the rejection algorithms +may also be rejected. The number of neighbors to be rejected on either +side is specified by the \fIgrow\fR parameter. + +This rejection step is also checked against the \fInkeep\fR parameter +and only as many pixels as would not violate this parameter are +rejected. Unlike it's application in the rejection algorithms at +this stage there is no checking on the magnitude of the residuals +and the pixels retained which would otherwise be rejected are randomly +selected. + + +COMBINING + +After all the steps of offsetting the input images, masking pixels, +threshold rejection, scaling, and applying a rejection algorithms the +remaining pixels are combined and output. The pixels may be combined +by computing the median or by computing a weighted average. +.ih +EXAMPLES +1. Combine orders of echelle images. + +.nf + cl> scombine *.ec *%.ec%% group=images combine=sum +.fi + +2. Combine all spectra using range syntax and scale by the exposure times. + +.nf + cl> names irs 10-42 > irs.dat + cl> scombine @irs.dat irscombine group=all scale=exptime +.fi + +3. Combine spectra by apertures using exposure time scaling and weighting. + +.nf + cl> scombine *.ms combine.ms nout=ncombine.ms \\ + >>> group=apertures scale=exptime weights=exptime +.fi +.ih +REVISIONS +.ls SCOMBINE V2.10.3 +The weighting was changed from using the square root of the exposure time +or spectrum statistics to using the values directly. This corresponds +to variance weighting. Other options for specifying the scaling and +weighting factors were added; namely from a file or from a different +image header keyword. The \fInkeep\fR parameter was added to allow +controlling the maximum number of pixels to be rejected by the clipping +algorithms. The \fIsnoise\fR parameter was added to include a sensitivity +or scale noise component to the noise model. +.le +.ls SCOMBINE V2.10 +This task is new. +.le +.ih +NOTES +The pixel uncertainties and CCD noise model are not well propagated. In +particular it would be desirable to propagate the pixel uncertainties +and CCD noise parameters from the initial CCD images. +.ih +SEE ALSO +imcombine, odcombine, lscombine +.endhelp diff --git a/noao/onedspec/doc/scoords.hlp b/noao/onedspec/doc/scoords.hlp new file mode 100644 index 00000000..9a529ffa --- /dev/null +++ b/noao/onedspec/doc/scoords.hlp @@ -0,0 +1,83 @@ +.help scoords May97 onedspec +.ih +NAME +scoords -- set spectrum coordinates from a pixel array (1D only) +.ih +USAGE +scoords images coords +.ih +PARAMETERS +.ls images +List of one dimensional spectrum image names. +.le +.ls coords +List of file names containing the coordinate values. There may be +one file which applies to all input images or a matching list +of one coordinate file for each input image. The coordinate files +are a list of coordinate values with one coordinate per line. +The coordinates must be ordered in increasing or decreasing value. +The number of coordinates must match the number of pixels in the image. +.le +.ls label = "" +Optional coordinate axis label. A typical value is "Wavelength" +for wavelength coordinates. +.le +.ls units = "" +Optional coordinate axis units. A typical value is "Angstroms". In +order to allow coordinate conversions by other IRAF spectra tasks +the value should be specified as one of the known units +(see units description in \fBonedspec.package\fR). +.le +.ls verbose = yes +Print a line as each spectrum is processed? +.le +.ih +DESCRIPTION +\fBScoords\fR sets spectral coordinates in one dimensional spectral +images as a list of coordinates in the image header. The +coordinate file(s) consists of coordinate values given one per line. +Each coordinate value is assigned to an image pixel in the order given +and so the number of coordinate values must match the number of pixels +in the spectrum. Also the coordinates must be monotonically increasing +or decreasing. + +When multiple spectra are to be set a matching list of coordinates can +be specified or a single coordinate file for all images may be used. + +The coordinate system set in the header is an example of the "multispec" +world coordinate system. This is understood by all the standard +IRAF tasks. It is described under the help topic "onedspec.specwcs". +Once the coordinates are set one may resample the spectrum to a +more compact linear description using the task \fBdispcor\fR. + +Since the coordinate values are stored in the header (double +precision numbers) the header can become quite large if the spectrum +is long. Be sure the environment variable "min_lenuserarea" which +defines the maximum size of the image header in number of characters +is large enough to hold all the coordinates. +.ih +EXAMPLES +1. Set the coordinates for a spectrum. + +.nf + cl> type coords.dat + 4000. + 4010.123 + 4020.246 + 4031.7 + + cl> scoords spec coords.dat label=Wavelength units=Angstroms + cl> listpix spec wcs=world + 4000. 124. + 4010.123 543 + +.fi +.ih +REVISIONS +.ls SCOORDS V2.11 +This is a new task with this version. +.le +.ih +SEE ALSO +rtextimage, dispcor, specwcs, onedspec.package +.endhelp diff --git a/noao/onedspec/doc/scopy.hlp b/noao/onedspec/doc/scopy.hlp new file mode 100644 index 00000000..d0863687 --- /dev/null +++ b/noao/onedspec/doc/scopy.hlp @@ -0,0 +1,541 @@ +.help scopy Mar93 noao.onedspec +.ih +NAME +scopy -- Select and copy spectra +.ih +USAGE +scopy input output +.ih +PARAMETERS +.ls input +List of input images containing spectra to be copied. +.le +.ls output +List of output image names or root names. Image +sections are ignored and if the output format is "onedspec" then any record +extensions are stripped to form the root name. If no output list is +specified then the input list is used and the input images are replaced by +the copied output spectra. If a single output name is specified then all +copied spectra are written to the same output image or image root +name. This allows packing or merging multiple spectra and requires +properly setting the \fIclobber\fR, \fImerge\fR, \fIrenumber\fR and +\fIoffset\fR parameters to achieve the desired output. If more than one +output image is specified then it must match the input image list in +number. +.le +.ls w1 = INDEF, w2 = INDEF +Starting and ending wavelengths to be copied. If \fIw1\fR is not specified +then the wavelength of the starting edge of the first pixel is used +(wavelength at pixel coordinate 0.5) and if \fIw2\fR is not specified then +the wavelength of the ending edge of the last pixel is used (wavelength of +the last pixel plus 0.5). If both are not specified, that is set to INDEF, +then the whole spectrum is copied and the \fIrebin\fR parameter is +ignored. Note that by specifying both endpoints the copied region can be +set to have increasing or decreasing wavelength per pixel. If the spectrum +only partially covers the specified range only that portion of the spectrum +within the range is copied. It is an error if the range is entirely +outside that of a spectrum. +.le +.ls apertures = "", beams = "" +List of apertures and beams to be selected from the input spectra. The +logical intersection of the two lists is selected. The null list +selects all apertures or beams. A list consists of comma separated +numbers and ranges of numbers. A range is specified by a hyphen. An +optional step size may be given by 'x' followed by a number. +See \fBxtools.ranges\fR for more information. If the first character +is "!" then the apertures/beams not in the list are selected. Note +that a "!" in either of the lists complements the intersection of the +two lists. For longslit input spectra the aperture numbers +selects the lines or columns to be extracted. For 3D Fabry-Perot +spectra the aperture numbers select the first spatial axis. +.le +.ls bands = "" +List of bands in 3D multispec. +For 3D spatial spectra the band parameter applies to the second +spatial axis. +The null list selects all bands. The syntax is as described above. +.le +.ls apmodulus = 0 +Modulus to be applied to the input aperture numbers before matching against +the aperture list. If zero then no modulus is used. This is allows +selecting apertures which are related by the same modulus, typically a +factor of 10; for example, 10, 1010 and 2010 with a modulus of 1000 are +related. +.le +.ls format = "multispec" (multispec|onedspec) +Output image format and name syntax. The "multispec" format consists of +one or more spectra in the same image file. The "onedspec" format consists +of a single spectrum per image with names having a root name and a four +digit aperture number extension. Note that converting to "onedspec" format +from three dimensional images where the third dimension contains associated +spectra will not include data from the extra dimension. Image sections may +be used in that case. +.le +.ls renumber = no +Renumber the output aperture numbers? If set the output aperture +numbers, including any preexisting spectra when merging, are renumbered +beginning with 1. The \fIoffset\fR parameter may be used to +change the starting number. +.le +.ls offset = 0 +Offset to be added to the input or renumbered aperture number to form +the final output aperture number. +.le +.ls clobber = no +Modify an existing output image either by overwriting or merging? +.le +.ls merge = no +Merge apertures into existing spectra? This +requires that the \fIclobber\fR parameter be set. If not merging +then the selected spectra entirely replace those in existing output images. +If merging then the input spectra replace those in the output image +with the same aperture number and new apertures are added if not present. +.le +.ls rebin = yes +Rebin the spectrum to the exact wavelength range specified by the \fIw1\fR +and \fIw2\fR parameters? If the range is given as INDEF for both endpoints +this parameter does not apply. If a range is given and this parameter is +not set then the pixels in the specified range (using the nearest pixels to +the endpoint wavelengths) are copied without rebinning. In this case the +wavelength of the first pixel may not be exactly that specified by \fIw1\fR +and the dispersion, including non-linear dispersions, is unchanged. If +this parameter is set the spectra are interpolated to have the first and +last pixels at exactly the specified endpoint wavelengths while preserving +the same number of pixels in the interval. Linear and log-linear +dispersion types are maintained while non-linear dispersions are +linearized. +.le +.ls verbose = no +Print a record of each aperture copied? +.le +.ih +DESCRIPTION +\fBScopy\fR selects regions of spectra from an input list of spectral +images and copies them to output images. This task can be used to extract +aperture spectra from long slit and Fabry-Perot images and to select, +reorganize, merge, renumber, pack, and unpack spectra in many ways. Below +is a list of some of the uses and many examples are given in the EXAMPLES +section. + +.nf + o Pack many spectra into individual images into a single image + o Unpack images with multiple spectra into separate images + o Extract a set of lines or columns from long slit spectra + o Extract a set of spatial positions from Fabry-Perot spectra + o Extract specific wavelength regions + o Select a subset of spectra to create a new image + o Merge a subset of spectra into an existing image + o Combine spectra from different images into one image + o Renumber apertures +.fi + +Input spectra are specified by an image list which may include explicit +image names, wildcard templates and @files containing image names. +The image names may also include image sections such as to select portions of +the wavelength coverage. The input images may be either one or two +dimensional spectra. One dimensional spectra may be stored in +individual one dimensional images or as lines in two (or three) +dimensional images. The one dimensional spectra are identified by +an aperture number, which must be unique within an image, and a beam number. +Two dimensional long slit and three dimensional Fabry-Perot spectra are +treated, for the purpose of this +task, as a collection of spectra with dispersion either along any axis +specified by the DISPAXIS image header parameter +or the \fIdispaxis\fR package parameter. The aperture and band +parameters specify a spatial position. A number of adjacent +lines, columns, and bands, specified by the \fInsum\fR package parameter, +will be summed to form an aperture spectrum. If number is odd then the +aperture/band number refers to the middle and if it is even it refers to the +lower of the two middle lines or columns. + +In the case of many spectra each stored in separate one dimensional +images, the image names may be such that they have a common root name +and a four digit aperture number extension. This name syntax is +called "onedspec" format. Including such spectra in an +input list may be accomplished either with wildcard templates such as + +.nf + name* + name.????.imh +.fi + +where the image type extension ".imh" must be given to complete the +template but the actual extension could also be that for an STF type +image, or using an @file prepared with the task \fBnames\fR. +To generate this syntax for output images the \fIformat\fR parameter +is set to "onedspec" (this will be discussed further later). + +From the input images one may select a range of wavelengths with the +\fIw1\fR and \fIw2\fR parameters and a subset of spectra based on aperture and +beam numbers using the \fIaperture\fR and \fIbeam\fR parameters. +If the wavelength range is specified as INDEF the full spectra are +copied without any resampling. If the aperture and beam lists are not +specified, an empty list, then all apertures and beams are selected. The +lists may be those spectra desired or the complement obtained by prefixing +the list with '!'. Only the selected wavelength range and spectra will +be operated upon and passed on to the output images. + +Specifying a wavelength range is fairly obvious except for the question +of pixel sampling. Either the pixels in the specified range are copied +without resampling or the pixels are resampled to correspond eactly +to the requested range. The choice is made with the \fIrebin\fR parameter. +In the first case the nearest pixels to the specified wavelength +endpoints are determined and those pixels and all those in between +are copied. The dispersion relation is unchanged. In the second case +the spectra are reinterpolated to have the specified starting and +ending wavelengths with the same number of pixels between those points +as in the original spectrum. The reinterpolation is done in either +linear or log-linear dispersion. The non-linear dispersion functions +are interpolated to a linear dispersion. + +Using \fBscopy\fR with long slit or Fabry-Perot images provides a quick and +simple type of extraction as opposed to using the \fBapextract\fR package. +When summing it is often desired to start each aperture after the number of +lines summed. To do this specify a step size in the aperture/band list. For +example to extract columns 3 to 23 summing every 5 columns you would use an +aperture list of "3-23x5" and an \fInsum\fR of 5. If you do not use the +step in the aperture list you would extract the sum of columns 1 to 5, then +columns 2 to 6, and so on. + +In the special case of subapertures extracted by \fBapextract\fR, related +apertures are numbered using a modulus; for example apertures +5, 1005, 2005. To allow selecting all related apertures using a single +aperture number the \fIapmodulus\fR parameter is used to specify the +modulus factor; 1000 in the above example. This is a very specialized +feature which should be ignored by most users. + +The output list of images may consist of an empty list, a single image, +or a list of images matching the input list in number. Note that it +is the number of image names that matters and not the number of spectra +since there may be any number of spectra in an image. The empty list +converts to the same list as the input and is shorthand for replacing +the input image with the output image upon completion; therefore it +is equivalent to the case of a matching list. If the input +consists of just one image then the distinction between a single +output and a matching list is moot. The interesting distinction is +when there is an input list of two or more images. The two cases +are then a mapping of many-to-many or many-to-one. Note that it is +possible to have more complex mappings by repeating the same output +name in a matching list provided clobbering, merging, and possibly +renumbering is enabled. + +In the case of a matching list, spectra from different input images +will go to different output images. In the case of a single output +image all spectra will go to the same output image. Note that in +this discussion an output image when "onedspec" format is specified +is actually a root name for possibly many images. However, +it should be thought of as a single image from the point of view +of image lists. + +When mapping many spectra to a single output image, which may have existing +spectra if merging, there may be a conflict with repeated aperture +numbers. One option is to consecutively renumber the aperture numbers, +including any previous spectra in the output image when merging and then +continuing with the input spectra in the order in which they are selected. +This is specified with the \fIrenumber\fR parameter which renumbers +beginning with 1. + +Another options which may be used independently of renumbering or in +conjunction with it is to add an offset as specified by the \fIoffset\fR +parameter. This is last step in determining the output aperture +numbers so that if used with the renumber option the final aperture +numbers begin with one plus the offset. + +It has been mentioned that it is possible to write and add to +existing images. If an output image exists an error will be +printed unless the \fIclobber\fR parameter is set. If clobbering +is allowed then the existing output image will be replaced by the +new output. Rather than replacing an output image sometimes one +wants to replace certain spectra or add new spectra. This is +done by selecting the \fImerge\fR option. In this case if the output +has a spectrum with the same aperture number as the input spectrum +it is replaced by the input spectrum. If the input spectrum aperture +number is not in the output then the spectrum is added to the output +image. To add spectra with the same aperture number and not +replace the one in the output use the \fIrenumber\fR or +\fIoffset\fR options. + +To print a record as each input spectrum is copied the \fIverbose\fR +parameter may be set. The syntax is the input image name followed +by the aperture number in []. An arrow then points to the output +image name with the final aperture number also in [], except for +"onedspec" format where the image name extension gives the aperture +number. It is important to remember that it is the aperture numbers +which are shown and not the image lines; there is not necessarily any +relation between image lines and aperture numbers though often they +are the same. +.ih +EXAMPLES +Because there are so many possiblities there are many examples. To +help find examples close to those of interest they are divided into +three sections; examples involving standard multispec images only, examples +with onedspec format images, and examples with long slit and Fabry-Perot +images. In the examples the verbose flag is set to yes and the output is +shown. + +I. MULTISPEC IMAGES + +The examples in this section deal with the default spectral format of +one or more spectra in an image. Note that the difference between +a "onedspec" image and a "multispec" image with one spectrum is purely +the image naming syntax. + +1. Select a single spectrum (aperture 3): + +.nf + cl> scopy example1 ap3 aperture=3 + example1[3] --> ap3[3] +.fi + +2. Select a wavelength region from a single spectrum: + +.nf + cl> scopy example1 ap3 aperture=3 w1=5500 w2=6500 + example1[3] --> ap3[3] +.fi + +3. Select a subset of spectra (apertures 1, 2, 4, 6, and 9): + +.nf + cl> scopy example1 subset apertures="1-2,4,6-9x3" + example1[1] --> subset[1] + example1[2] --> subset[2] + example1[4] --> subset[4] + example1[6] --> subset[6] + example1[9] --> subset[9] +.fi + +This example shows various features of the aperture list syntax. + +4. Select the same apertures (1 and 3) from multiple spectra and in the +same wavelength region: + +.nf + cl> scopy example* %example%subset%* apertures=1,3 w1=5500 w2=6500 + example1[1] --> subset1[1] + example1[3] --> subset1[3] + example2[1] --> subset2[1] + example2[3] --> subset2[3] + ... +.fi + +The output list uses the pattern substitution feature of image templates. + +5. Select the same aperture from multiple spectra and pack them in a +a single image: + +.nf + cl> scopy example* ap2 aperture=2 renumber+ + example1[2] --> ap2[1] + example2[2] --> ap2[2] + example3[2] --> ap2[3] + ... +.fi + +6. To renumber the apertures sequentially starting with 11: + +.nf + cl> scopy example1 renum renumber+ + example1[1] --> renum[11] + example1[5] --> renum[12] + example1[9] --> renum[13] + ... +.fi + +7. To replace apertures (2) in one image with that from another: + +.nf + cl> scopy example1 example2 aperture=2 clobber+ merge+ + example1[2] --> example2[2] +.fi + +8. To merge two sets of spectra with different aperture numbers into + one image: + +.nf + cl> scopy example![12]* merge + example1[1] -> merge[1] + example1[3] -> merge[3] + ... + example2[2] -> merge[2] + example2[4] -> merge[4] + ... +.fi + +The input list uses the ![] character substitution syntax of image templates. + +9. To merge a set of spectra with the same aperture numbers into another +existing image: + +.nf + cl> scopy example2 example1 clobber+ merge+ renumber+ + example1[5] --> example1[2] + example1[9] --> example1[3] + example2[1] --> example1[4] + example2[5] --> example1[5] + example2[9] --> example1[6] +.fi + +Both images contained apertures 1, 5, and 9. The listing does not show +the renumbering of the aperture 1 from example1 since the aperture number +was not changed. + +10. Select parts of a 3D image where the first band is the +variance weighted extraction, band 2 is nonweighted extraction, +band 3 is the sky, and band 4 is the sigma: + +.nf + cl> scopy example3d.ms[*,*,1] var1.ms + example3d.ms[*,*,1][1] --> var1.ms[1] + example3d.ms[*,*,1][2] --> var1.ms[2] + ... + cl> scopy example3d.ms[10:400,3,3] skyap3 + example3d.ms[10:400,3,3][3] --> skyap3[3] + cl> scopy example3d.ms[*,*,1] "" clobber+ + example3d.ms[*,*,1][1] --> example3d.ms[1] + example3d.ms[*,*,1][2] --> example3d.ms[2] + ... +.fi + +Note that this could also be done with \fBimcopy\fR. The last example +is done in place; i.e. replacing the input image by the output image +with the other bands eliminatated; i.e. the output image is two dimensional. + +II. ONEDSPEC IMAGES + +1. Expand a multi-spectrum image to individual single spectrum images: + +.nf + cl> scopy example1 record format=onedspec + example1[1] --> record.0001 + example1[5] --> record.0005 + example1[9] --> record.0009 + ... +.fi + +2. Pack a set of individual 1D spectra into a single image: + +.nf + cl> scopy record.????.imh record.ms + record.0001[1] --> record.ms[1] + record.0005[5] --> record.ms[5] + record.0009[9] --> record.ms[9] + ... +.fi + +3. Copy a set of record syntax spectra to a different rootname and renumber: + +.nf + cl> scopy record.????.imh newroot format=onedspec + record.0001[1] --> newroot.0001 + record.0005[5] --> newroot.0002 + record.0009[9] --> newroot.0003 + ... +.fi + +III. LONG SLIT IMAGES + +To define the dispersion axis either the image header parameter DISPAXIS +must be set (using HEDIT for example) or a the package \fIdispaxis\fR +parameter must be set. In these examples the output is the default +multispec format. + +1. To extract column 250 into a spectrum: + +.nf + cl> scopy longslit1 c250 aperture=250 + longslit1[250] --> c250[250] +.fi + +2. To sum and extract every set of 10 columns: + +.nf + cl> nsum = 10 (or epar the package parameters) + cl> scopy longslit1 sum10 apertures=5-500x10 + longslit1[5] --> sum10[5] + longslit1[15] --> sum10[15] + longslit1[25] --> sum10[25] + ... +.fi + +3. To extract the sum of 10 columns centered on column 250 from a set +of 2D images: + +.nf + cl> nsum = 10 (or epar the package parameters) + cl> scopy longslit* %longslit%c250.%* aperture=250 + longslit1[250] --> c250.1[250] + longslit2[250] --> c250.2[250] + longslit3[250] --> c250.3[250] + ... +.fi + +4. To extract the sum of 10 columns centered on column 250 from a set of +2D images and merge them into a single, renumbered output image: + +.nf + cl> nsum = 10 (or epar the package parameters) + cl> scopy longslit* c250 aperture=250 renum+ + longslit1[250] --> c250[1] + longslit2[250] --> c250[2] + longslit3[250] --> c250[3] + ... +.fi + +IV. FABRY-PEROT IMAGES + +To define the dispersion axis either the image header parameter DISPAXIS +must be set (using HEDIT for example) or a the package \fIdispaxis\fR +parameter must be set. In these examples the output is the default +multispec format. + +1. To extract a spectrum from the spatial position (250,250) where +dispaxis=3: + +.nf + cl> scopy fp1 a250 aperture=250 band=250 + longslit1[250] --> a250[250] +.fi + +2. To sum and extract every set of 10 lines and bands (dispaxis=1): + +.nf + cl> nsum = "10" + cl> scopy fp1 sum10 apertures=5-500x10 bands=5-500x10 + longslit1[5] --> sum10[5] + longslit1[15] --> sum10[15] + longslit1[25] --> sum10[25] + ... +.fi + +3. To extract the sum of 10 columns and 20 lines centered on column 250 and +line 100 from a set of 3D images with dispaxis=3: + +.nf + cl> nsum = "10 20" + cl> scopy longslit* %longslit%c250.%* aperture=250 band=100 + longslit1[250] --> c250.1[250] + longslit2[250] --> c250.2[250] + longslit3[250] --> c250.3[250] + ... +.fi +.ih +REVISIONS +.ls SCOPY V2.11 +Previously both w1 and w2 had to be specified to select a range to +copy. Now if only one is specified the second endpoint defaults +to the first or last pixel. +.le +.ls SCOPY V2.10.3 +Additional support for 3D multispec/equispec or spatial spectra has been +added. The "bands" parameter allows selecting specific bands and +the onedspec output format creates separate images for each selected +aperture and band. +.le +.ls SCOPY V2.10 +This task is new. +.le +.ih +SEE ALSO +ranges, sarith, imcopy, dispcor, specshift +.endhelp diff --git a/noao/onedspec/doc/sensfunc.hlp b/noao/onedspec/doc/sensfunc.hlp new file mode 100644 index 00000000..1ebd7e24 --- /dev/null +++ b/noao/onedspec/doc/sensfunc.hlp @@ -0,0 +1,447 @@ +.help sensfunc Mar93 noao.onedspec +.ih +NAME +sensfunc -- Determine sensitivity and extinction functions +.ih +USAGE +sensfunc standards sensitivity +.ih +PARAMETERS +.ls standards = "std" +Input standard star data file created by the task \fBstandard\fR. +.le +.ls sensitivity = "sens" +Output sensitivity function image name or rootname. Generally each +aperture results in an independent sensitivity function with the +aperture number appended to the rootname. If the parameter \fIignoreaps\fR +is set, however, the aperture numbers are ignored and a single sensitivity +function is determined with the output image having the specified name +with no extension. +.le +.ls apertures = "" +List of apertures to be selected from the input file. All other apertures +are ignored. If no list is specified then all apertures are selected. +See \fBranges\fR for the syntax. +.le +.ls ignoreaps = no +Ignore aperture numbers and create a single sensitivity function? Normally +each aperture produces an independent sensitivity function. If the +apertures are ignored then all the observations are combined into +a single sensitivity function. +.le +.ls logfile = "logfile" +Output log filename for statistical information about the stars used +and the sensitivity function and extinction function. +If no filename is given then no file is written. +.le +.ls extinction = +Input extinction file. Any extinction determination made will be +relative to this extinction. If no file is given then no extinction +correction is applied and any extinction determination from the +standard star data will be an absolute determination of the +extinction. The default value is redirected to the package parameter +of the same name. The extinction file is generally one of the standard +extinctions in the calibration directory "onedstds$". + +If extinction corrected spectra were used as input to \fBstandard\fR +then it is important that the same extinction file be used here. +This includes using no extinction file in both tasks. +.le +.ls newextinction = "extinct.dat" +Output revised extinction file. If the extinction is revised and an +output filename is given then a revised extinction file is written. It +has the same format as the standard extinction files. +.le +.ls observatory = ")_.observatory" +Observatory at which the spectra were obtained if not specified in the +image header by the keyword OBSERVAT. The default is a redirection to look +in the parameters for the parent package for a value. This is only used +when graphing flux calibrated data of spectra which do not include the +airmass in the image header. The observatory may be one of the +observatories in the observatory database, "observatory" to select the +observatory defined by the environment variable "observatory" or the +parameter \fBobservatory.observatory\fR, or "obspars" to select the current +parameters set in the \fBobservatory\fR task. See help for +\fBobservatory\fR for additional information. +.le +.ls function = "spline3" +Function used to fit the sensitivity data. The function types are +"chebyshev" polynomial, "legendre" polynomial, "spline3" cubic spline, +and "spline1" linear spline. The default value may be changed interactively. +.le +.ls order = 6 +Order of the sensitivity fitting function. The value corresponds to the +number of polynomial terms or the number of spline pieces. The default +value may be changed interactively. +.le +.ls interactive = yes +Determine the sensitivity function interactively? If yes the user +graphically interacts with the data, modifies data and parameters +affecting the sensitivity function, and determines a residual extinction. +.le +.ls graphs = "sr" +Graphs to be displayed per frame. From one to four graphs may be displayed +per frame. The graph types are selected by single characters and are: + +.nf +a - residual sensitivity vs airmass +c - composite residual sensitivity and error bars vs wavelength +e - input extinction and revised extinction vs wavelength +i - Flux calibrated spectrum vs wavelength +r - residual sensitivity vs wavelength +s - sensitivity vs wavelength +.fi + +All other characters including whitespace and commas are ignored. The order +and number of graphs determines the positions of the graphs. +.le +.ls marks = "plus cross box" +Symbols used to mark included, deleted, and added data respectively. +The available mark types are point, box, plus, cross, diamond, hline +(horizontal line), vline (vertical line), hebar (horizontal error bar), +vebar (vertical error bar), and circle. +.le +.ls colors = "2 1 3 4" +Colors to use for "lines", "marks", "deleted" data, and "added" data. +The colors associated with the numbers is graphics device dependent. +For example in XGTERM they are defined by resources while on other +devices that don't support colors only one color will appear. +.le +.ls cursor = "" +Graphics cursor input list. If not specified as a file then standard +graphics cursor is read. +.le +.ls device = "stdgraph" +Graphics output device. +.le +.ls answer +Query parameter for selecting whether to fit apertures interactively. +.le +.ih +CURSOR COMMANDS + +.nf +? Print help +a Add a point at the cursor position +c Toggle use of composite points +d Delete point, star, or wavelength nearest the cursor +e Toggle residual extinction correction +f Fit data with a sensitivity function and overplot +g Fit data with a sensitivity function and redraw the graph(s) +i Print information about point nearest the cursor +m Move point, star, wavelength nearest the cursor to new sensitivity +o Reset to original data +q Quit and write sensitivity function for current aperture +r Redraw graph(s) +s Toggle shift of standard stars to eliminate mean deviations +u Undelete point, star, or wavelength nearest the cursor +w Change weights of point, star, or wavelength nearest the cursor + +:flux [min] [max] Limits for flux calibrated graphs (INDEF for autoscale) +:function [type] Function to be fit to sensitivity data: + chebyshev - Chebyshev polynomial + legendre - Legendre polynomial + spline1 - Linear spline + spline3 - Cubic spline +:graphs [types] Graphs to be displayed (up to four): + a - Residual sensitivity vs airmass + c - Composite residuals and error bars vs wavelength + e - Extinction (and revised extinction) vs wavelength + i - Flux calibrated image vs wavelength + l - Log of flux calibrated image vs wavelength + r - Residual sensitivity vs wavelength + s - Sensitivity vs wavelength +:images [images] Images to flux calibrate and plot (up to four) +:marks marks Mark types to use for included, delete, and added points: + point, box, plus, cross, diamond, hline, + vline, hebar, vebar, circle +:order [order] Order of function +:skys [images] Sky images for flux calibration (up to four) +:stats [file] Statistics about stars and sensitivity fit +:vstats [file] Verbose statistics about sensitivity fit +.fi +.ih +DESCRIPTION +Standard star calibration measurements are used to determine the system +sensitivity as a function of wavelength for each independent aperture. +If the parameter \fIignoreaps\fR is set then the aperture numbers are +ignored and a single sensitivity function is determined from all the +observations. Using measurements spanning a range of airmass it is +also possible to derive an adjustment to the standard extinction curve +or even an absolute determination. Extinction determination requires +that the observations span a good range of airmass during photometric +conditions. When conditions are poor and standard star observations +are obtained during periods of variable transparency, the entire +sensitivity curve may vary by a constant factor, assuming that the +cause of the variations has no color effect. This is often the case +during periods of thin clouds. In this case the mean sensitivity of +each observation may be shifted to match the observation of greatest +sensitivity. This allows for the possibility of deriving correct +absolute fluxes if one observation of a standard was obtained during a +clear period. + +The input data is a file of calibration information produced by the +task \fBstandard\fR. The data consists of a spectrum identification +line containing the spectrum image name, the sky image name if beam +switching, the aperture number, the length of the spectrum, the +exposure time, airmass, wavelength range, and title. Following the +identification line are calibration lines consisting of the central +bandpass wavelengths, the tabulated fluxes in the bandpasses, the +bandpass widths, and the observed counts in the bandpasses. The +spectrum identification and calibration lines repeat for each standard +star observation. The parameter \fIapertures\fR may be used to select +only specific apertures from the input data. This parameter is in the +form of a range list (see help for \fBranges\fR) and if no list is +given (specified by the null string "") then all apertures are selected. + +An input extinction file may also be specified. Any extinction +determinations are then residuals to this input extinction table. +The format of this table is described in \fBlcalib\fR. + +The calibration factor at each point is computed as + + (1) C = 2.5 log (O / (T B F)) + A E + +where O is the observed counts in a bandpass of an observation, +T is the exposure time of the observation, B is the bandpass width, +F is the flux per Angstrom at the bandpass for the standard star, +A is the airmass of the observation, and E is the extinction +at the bandpass. Thus, C is the ratio of the observed count rate per +Angstrom corrected to some extinction curve to the expected flux +expressed in magnitudes. The goal of the task is to fit the observations +to the relation + + (2) C = S(W) + AE(W) + +where W is wavelength, S(W) is the sensitivity function, and E(W) is +a residual extinction function relative to the extinction used in (1). +In later discussion we will also refer to the residual sensitivity which +is defined by + + (3) R = C - S(W) - AE(W) + +The sensitivity function S(W) is output as an one dimensional image +much like the spectra. The sensitivities are in magnitude units to +better judge the variations and because the interpolation is smoother +in the logarithmic space (mags = 2.5 log10[sensitivity]). There is one +sensitivity function for each aperture unless the parameter +\fIignoreaps\fR is set. In the first case the image names are formed +from the specified rootname with the aperture number as a four digit +numerical extension. In the latter case a single sensitivity function +is determined from all data, ignoring the aperture numbers, and the +specified output image is created without an extension. These images +are used by \fBcalibrate\fR to correct observations to a relative of +absolute flux scale. If no sensitivity function image rootname is +specified then the sensitivity curves are not output. + +If a revised extinction function E(W) has been determined for one or +more of the apertures then the functions are averaged over all +apertures, added to the original extinction, and written to the +specified extinction table. The format of this table is the same as +the standard extinction tables and are, thus, interchangeable. If no +new extinction filename is specified then no extinction table is +recorded. + +If a log filename is given then statistical information about the +sensitivity function determinations are recorded. This includes the +names of the input standard star observations and the tabulated +sensitivity, extinction, and error information. + +Some points to note are that if no input extinction is given then the +E in (1) are zero and the E determined in (2) is the absolute extinction. +If the data are not good enough to determine extinction then using one +of the standard extinction curves the problem reduces to fitting + + (4) C = S(W) + +The sensitivity and extinction functions are determined as fitted +curves. The curves are defined by a function type and order. There +are four function types and the order specifies either the number of +terms in the polynomial or the number of pieces in the spline. The +order is automatically reduced to the largest +value which produces a nonsingular result. In this case the function +will attempt to pass through every calibration point. Lower orders +provide for a smoother representation of the function. The latter +is generally more appropriate for a detector. The initial function +type and order for the sensitivity function is specified by the +parameters \fIfunction\fR and \fIorder\fR. + +If the \fIinteractive\fR flag is no then the default function and order +is fit to equation (4) (i.e. there is no residual extinction determination +or manipulation of the data). The sensitivity functions are output +if an image rootname is given and the log information is output if a +log filename is given. + +When the sensitivity is determined interactively a query is given for +each aperture. The responses "no" and "yes" select fitting the sensitivity +interactively or not for the specified aperture. The responses "NO" and +"YES" apply to all apertures and no further queries will be given. +When interactive fitting is selected the data are graphed +on the specified graphics device and input is through the specified +cursor list. The graphics output consists of from one to four graphs. +The user selects how many and which types of graphs to display. The +graph types and their single character code used to select them are: + +.nf + a - residual sensitivity vs airmass + c - composite residual sensitivity and error bars vs wavelength + e - input extinction and revised extinction vs wavelength + i - Flux calibrated spectrum vs wavelength + r - residual sensitivity vs wavelength + s - sensitivity vs wavelength +.fi + +The initial graphs are selected with the parameter \fBgraphs\fR and changed +interactively with the colon command ':graphs \fItypes\fR'. The ability +to view a variety of graphs allows evaluating the effects of the +sensitivity curve and extinction in various ways. The flux calibrated +spectrum graph uses the current sensitivity function and checks for +possible wiggles in the sensitivity curve which affect the shape of the +continuum. The choice of graphs also allows the +user to trade off plotting speed and resolution against the amount of +information available simultaneously. Thus, with some graphics devices +or over a slow line one can reduce the number of graphs for greater speed +while on very fast devices with large screens one can look at more +data. The parameter \fImarks\fR and the associated colon command +':marks \fItypes\fR' also let the user define the symbols used to mark +included, deleted, and added data points. + +The list of interactive commands in given in the section on CURSOR COMMANDS. +The commands include deleting, undeleting, adding, moving, and identifying +individual data points, whole stars, or all points at the same wavelength. +Some other commands include 'c' to create composite points by averaging +all points at the same wavelength (this requires exact overlap in the +bandpasses) which then replace the individual data points in the fit. +This is different than the composite point graph which displays the +residual in the mean sensitivity +and error \fIin the mean\fR but uses the input data in the fitting. +The 's' command shifts the data so that the mean sensitivity of each +star is the same as the star with the greatest mean sensitivity. +This compensates for variable grey extinction due to clouds. Note +that delete points are excluded from the shift calculation and a +deleted star will not be used as the star of greatest sensitivity. +Another useful command is 'o' to recover the original data. This cancels +all changes made due to shifting, extinction corrections, deleting points, +creating composite points, etc. + +The 'e' command attempts to compute a residual extinction by finding +correlations between the sensitivity points at different airmass. +Note that this is not iterative so that repeating this after having +added an extinction correction simply redetermines the correction. +At each wavelength or wavelength regions having multiple observations at +different airmass a slope with airmass is determined. This slope is +the residual extinction at that wavelength. A plot of the residual +extinctions at each wavelength is made using the ICFIT procedure. +The user may then examine and fit a curve through the residual extinction +estimates as a function of wavelength (see \fBicfit\fR for a description +of the commands). The user must decide how much wavelength dependence +is derivable from the data. In many cases only a constant fit +to a "gray extinction" or possibly a linear fit is realistic. +The fitting is exited by the key 'q'. + +To help evaluate how important the residual extinction determination +is a t-statistic significance is computed. This statistic is defined by + + (5) t = sqrt (r**2 * (N - 2) / (1 - r**2)) + +where the correlation coefficient + + (6) r = RMS with correction / RMS without correction + +is the fractional improvement in the RMS due to the added extinction +correction and N is the number of wavelength points. For large +N this approaches a gaussian sigma but a more precise significance +requires the t-distribution for N-2 degrees of freedom. Basically this +asks, was the improvement in the RMS significantly more than would +occur with random errors? A value greater than 3 is good while +a value less than 1 is not significant. The user may then accept the +revised extinction and apply it to the data. + +Note that when there are multiple apertures used each aperture has an +independent system sensitivity but the residual extinction is the same. +Therefore, the residual extinctions from each aperture are averaged at +the end. If one determines a new extinction then one may replace the +original input extinction by the new extinction and rederive the +sensitivity. +.ih +EXAMPLES +1. The following command generates sensitivity spectra + + cl> sensfunc std sens + +This command uses the data from the \fBstandard\fR output +file "std" to create sensitivity functions with rootname "sens". +If not interactive the task will produce the output with some +progress messages being printed. If it is interactive the graphics +device will be used to display the data and the fit and user can +change the function and order of the fit, delete bad points, shift +data to correct for clouds or bandpass errors, and possibly determine +a revised extinction function. The statistics of the +sensitivity determination are written to the logfile ("logfile" by +default). + +2. The following examples illustrate the colon command syntax. Generally +if no argument is given the current value is displayed. For the statistics +commands an optional output file may be given to record the information. + +.nf +:flux 1e-12 INDEF Set lower limit for flux plots +:flux INDEF INDEF Restore autoscaling in flux plots +:func spline3 Select cubic spline function +:g srae Graph sensitivity, residuals, airmass, + and extinction +:g sii Graph sensitivity and two images +:i n1.0004 n1.0008 Set first two images to graph (the defaults + are taken from the standard star list) +:skys n1.0005 Subtract this sky image from first image + for flux calibrated spectrum +:m plus Change the mark type for included points and + don't change the deleted or added point mark type +:stats Print statistics to terminal +:vstats stdstats Print verbose statistics to file +.fi +.ih +REVISIONS +.ls SENSFUNC V2.10.3+ +Deleted points and stars are now ignored from the grey shift calculation. +.le +.ls SENSFUNC V2.10.3 +A color parameter was added for graphics terminals supporting color. +.le +.ls SENSFUNC V2.10 +The latitude parameter has been replaced by the observatory parameter. +The 'i' flux calibrated graph type now shows flux in linear scaling +while the new graph type 'l' shows flux in log scaling. A new colon +command allows fixing the flux limits for the flux calibrated graphs. +.le +.ls SENSFUNC V2.8 +This task has been completely rewritten from that of versions 2.5 and +earlier. + +.nf +1. The input standard data format is different. +2. Extinction corrections beyond a grey term are now supported. +3. Weighting by the counts is not supported. +4. Tabular input is not supported. +5. The data which can be displayed is greatly improved. +6. The fitting options have been greatly enhanced. +7. The fitting function types available have been extended. +8. One or more flux calibrated images may be displayed using the + current sensitivity function. +9. Additional flexibility is provided for treating apertures. +.fi +.le +.ih +BUGS +If the flux points do not span the wavelength range, set by the +standard star observations, then the fitting may fail at some maximum +order. When it fails there is no message but the highest order which +can be successfully fit is used. To work around this one can either +add fake points, truncate the wavelength range in the first line of each +tabulated object in the file produced by \fBstandard\fR, or exclude the +part of the image data which cannot be uncalibrated (using +\fBscopy\fR or \fBdispcor\fR). +.ih +SEE ALSO +standard, lcalib, calibrate, observatory, icfit, ranges, scopy, dispcor +.endhelp diff --git a/noao/onedspec/doc/sfit.hlp b/noao/onedspec/doc/sfit.hlp new file mode 100644 index 00000000..0416c622 --- /dev/null +++ b/noao/onedspec/doc/sfit.hlp @@ -0,0 +1,262 @@ +.help sfit Mar92 noao.onedspec +.ih +NAME +sfit -- Fit spectra +.ih +USAGE +sfit input output +.ih +PARAMETERS +.ls input +Input spectra to be fit. These may be any combination of echelle, +multispec, onedspec, long slit, and spectral cube format images. +.le +.ls output +Output fitted spectra. The number of output spectra must +match the number of input spectra. \fBOutput\fR may be omitted if +\fBlistonly\fR is yes. +.le +.ls lines = "*", bands = "1" +A range specifications for the image lines and bands to be fit. Unspecified +lines and bands will be copied from the original. If the value is "*", all of +the currently unprocessed lines or bands will be fit. A range consists of +a first line number and a last line number separated by a hyphen. A +single line number may also be a range and multiple ranges may be +separated by commas. +.le +.ls type = "fit" +Type of output spectra. The choices are "fit" for the fitted function, +"ratio" for the ratio of the input spectra to the fit, "difference" for +the difference between the input spectra and the fit, and "data" for +the data minus any rejected points replaced by the fit. +.le +.ls replace = no +Replace rejected points by the fit in the difference, ratio, and +data output types? +.le +.ls wavescale = yes +Wavelength scale the X axis of the plot? This option requires that the +spectra be wavelength calibrated. If \fBwavescale\fR is no, the plots +will be in "channel" (pixel) space. +.le +.ls logscale = no +Take the log (base 10) of both axes? This can be used when \fBlistonly\fR +is yes to measure the exponent of the slope of the continuum. +.le +.ls override = no +Override previously fit spectra? If \fBoverride\fR is yes and +\fBinteractive\fR is yes, the user will be prompted before each order is +refit. If \fBoverride\fR is no, previously fit spectra are silently +skipped. +.le +.ls listonly = no +Don't modify any images? If \fBlistonly\fR is yes, the \fBoutput\fR +image list may be skipped. +.le +.ls logfiles = "logfile" +List of log files to which to write the power series coefficients. If +\fBlogfiles\fR = NULL (""), the coefficients will not be calculated. +.le +.ls interactive = yes +Perform the fit interactively using the icfit commands? This will allow +the parameters for each spectrum to be adjusted independently. A separate +set of the fit parameters (below) will be used for each spectrum and any +interactive changes to the parameters for a specific spectrum will be +remembered when that spectrum is fit in the next image. +.le +.ls sample = "*" +The ranges of X values to be used in the fits. The units will vary +depending on the setting of the \fBwavescale\fR and \fBlogscale\fR +parameters. The default units are in wavelength if the spectra have +been dispersion corrected. The sample range syntax consists of +pairs of values separated by colons and multiple ranges can be +given separated by commas. +.le +.ls naverage = 1 +Number of sample points to combined to create a fitting point. +A positive value specifies an average and a negative value specifies +a median. +.le +.ls function = spline3 +Function to be fit to the spectra. The functions are +"legendre" (legendre polynomial), "chebyshev" (chebyshev polynomial), +"spline1" (linear spline), and "spline3" (cubic spline). The functions +may be abbreviated. The power series coefficients can only be +calculated if \fBfunction\fR is "legendre" or "chebyshev". +.le +.ls order = 1 +The order of the polynomials or the number of spline pieces. +.le +.ls low_reject = 3., high_reject = 3. +Rejection limits below and above the fit in units of the residual sigma. +.le +.ls niterate = 0 +Number of rejection iterations. +.le +.ls grow = 1. +When a pixel is rejected, pixels within this distance of the rejected pixel +are also rejected. +.le +.ls markrej = yes +Mark rejected points? If there are many rejected points it might be +desired to not mark rejected points. +.le +.ls graphics = "stdgraph" +Graphics output device for interactive graphics. +.le +.ls cursor = "" +Graphics cursor input. +.le +.ih +DESCRIPTION +A one dimensional function is fit to spectra in a list of echelle, +multispec, or onedspec format images. The first two formats will +fit the spectra or orders (i.e. the lines) in each image. +In this description the term "spectrum" will refer to a line of +an image while "image" will refer to all spectra in an image. +The parameters of the fit may vary from spectrum to spectrum within +images and between images. The fitted function may +be a legendre polynomial, chebyshev polynomial, linear spline, or cubic +spline of a given order or number of spline pieces. The output spectra +are formed from the fit, the ratio between the pixel values and the fit, +the difference of the spectra to the fit, and the original data with +rejected points possibly replaced. The output image is of pixel type real. + +The line/band numbers (for two/three dimensional images) are written to a +list of previously processed lines in the header keywords \fISFIT\fR and +\fISFITB\fR of the output image. A subsequent invocation of SFIT will only +process those requested spectra that are not in this list. This ensures +that even if the output image is the same as the input image that no +spectra will be processed twice and permits an easy exit from the task in +the midst of processing many spectra without losing any work or requiring +detailed notes. + +The points to be fit in each spectrum are determined by +selecting a sample of X values specified by the parameter \fIsample\fR +and taking either the average or median of the number of points +specified by the parameter \fInaverage\fR. The type of averaging is +selected by the sign of the parameter with positive values indicating +averaging, and the number of points is selected by the absolute value +of the parameter. The sample units will vary depending on the settings +of the \fBwavescale\fR and the \fBlogscale\fR parameters. Note that a +sample that is specified in wavelength units may be entirely outside +the domain of the data (in pixels) if some of the spectra are not +dispersion corrected. The syntax of the sample specification is a comma +separated, colon delimited list similar to the image section notation. +For example, the \fBsample\fR, "6550:6555,6570:6575" might be used to +fit the continuum near H-alpha. + +If \fIlow_reject\fR and/or \fIhigh_reject\fR are greater than zero the +sigma of the residuals between the fitted points and the fitted +function is computed and those points whose residuals are less than +\fI-low_reject\fR * sigma and greater than \fIhigh_reject\fR * sigma +are excluded from the fit. Points within a distance of \fIgrow\fR +pixels of a rejected pixel are also excluded from the fit. The +function is then refit without the rejected points. This rejection +procedure may be iterated a number of times given by the parameter +\fIniterate\fR. + +If \fIreplace\fR is set then any rejected points from the fitting +are replaced by the fit in the data before outputing the difference, +ratio, or data. For example with replacing the difference will +be zero at the rejected points and the data output will be cleaned +of deviant points. + +A range specification is used to select the \fIlines\fR and \fIbands\fR to be +fit. These parameters may either be specified with the same syntax as the +\fBsample\fR parameter, or with the "hyphen" syntax used elsewhere in +IRAF. Note that a NULL range for \fBlines/bands\fR expands to \fBno\fR +lines, not to all lines. An asterisk (*) should be used to represent a +range of all of the image lines/bands. The fitting parameters (\fIsample, +naverage, function, order, low_reject, high_reject, niterate, grow\fR) +may be adjusted interactively if the parameter \fIinteractive\fR is +yes. The fitting is performed with the \fBicfit\fR package. The +cursor mode commands for this package are described in a separate help +entry under "icfit". Separate copies of the fitting parameters are +maintained for each line so that interactive changes to the parameter +defaults will be remembered from image to image. +.ih +PROMPTS +If several images or lines are specified, the user is asked whether +to perform an interactive fit for each spectrum. The response +may be \fByes, no, skip, YES, NO\fR or \fBSKIP\fR. The meaning of each +response is: + +.nf + yes - Fit the next spectrum interactively. + no - Fit the next spectrum non-interactively. + skip - Skip the next spectrum in this image. + + YES - Interactively fit all of the spectra of + all of the images with no further prompts. + NO Non-interactively fit all chosen spectra of all images. + SKIP - This will produce a second prompt, "Skip what?", + with the choices: + + spectrum - skip this spectrum in all images + image - skip the rest of the current image + all - \fBexit\fR the program + This will \fBunlearn\fR the fit parameters + for all spectra! + cancel - return to the main prompt +.fi +.ih +EXAMPLES +1. To normalize all orders of the echelle spectrum for hd221170 + + cl> sfit hd221170.ec nhd221170.ec type=ratio + +Each order of the spectrum is graphed and the interactive options for +setting and fitting the continuum are available. The important +parameters are low_rejection (for an absorption spectrum), the function +type, and the order of the function; these fit parameters are +originally set to the defaults in the SFIT parameter file. A +'?' will display a menu of cursor key options. Exiting with 'q' will +update the output normalized order for the current image and proceed to +the next order or image. + +The parameters of the fit for each order are initialized to the current +values the first time that the order is fit. In subsequent images, the +parameters for a order are set to the values from the previous image. +The first time an order is fit, the sample region is reset to the +entire order. Deleted points are ALWAYS forgotten from order to order +and image to image. + +2. To do several images at the same time + + cl> sfit spec*.imh c//spec*.imh + +Note how the image template concatenation operator is used to construct +the output list of spectra. Alternatively: + + cl> sfit @inlist @outlist + +where the two list files could have been created with the sections +command or by editing. + +3. To measure the power law slope of the continuum (fluxed data) + + cl> sfit uv.* type=ratio logscale+ listonly+ fun=leg order=2 +.ih +REVISIONS +.ls SFIT V2.10.4 +The task was expanded to include fitting specified bands in 3D multispec +spectra. + +The task was expanded to include long slit and spectral cube data. +.le +.ls SFIT V2.10 +This task is new. +.le +.ih +BUGS +The errors are not listed for the power series coefficients. + +Spectra that are updated when \fBlogscale\fR is yes are written with a +linear wavelength scale, but with a log normalized data value. + +Selection by aperture number is not supported. +.ih +SEE ALSO +continuum, fit1d, icfit, ranges +.endhelp diff --git a/noao/onedspec/doc/sflip.hlp b/noao/onedspec/doc/sflip.hlp new file mode 100644 index 00000000..66790e4e --- /dev/null +++ b/noao/onedspec/doc/sflip.hlp @@ -0,0 +1,114 @@ +.help sflip Jul94 noao.onedspec +.ih +NAME +sflip -- Flip data and/or dispersion coordinates in spectra +.ih +USAGE +sflip input output +.ih +PARAMETERS +.ls input +List of input images containing spectra to be flipped. +.le +.ls output +Matching list of output image names for flipped spectra. +If no list is specified then the flipped spectra will replace the input +spectra. If the output image name matching an input image name is the +same then the flipped spectrum will replace the original spectrum. +.le +.ls coord_flip = no +Flip the dispersion coordinates? If yes then the relationship between the +logical pixel coordinates and the dispersion coordinates will be reversed so +that the dispersion coordinate of the first pixel of the output image will +correspond to the coordinate of the last pixel in the input image and +vice-versa for the other endpoint pixel. The physical coordinates +will also be flipped. Only the coordinate system along the dispersion +axis is flipped. +.le +.ls data_flip = yes +Flip the order of the data pixels as they are stored in the image along +the dispersion axis? If yes then the first pixel in the input spectrum +becomes the last pixel in the output spectrum along the dispersion +axis of the image. +.le +.ih +DESCRIPTION +The dispersion coordinate system and/or the data in the spectra specified +by the input list of images are flipped and stored in the matching output +image given in the output list of images. If the output image list is left +blank or an output image name is the same as an input image name then the +operation is done so that the flipped spectra in the image replace the +original spectra. All of the supported spectrum types are allowed; one +dimensional images, collections of spectra in multispec format, and two and +three dimensional spatial spectra in which one axis is dispersion. In all +cases the flipping affects only the dispersion axis of the image as +specified by the DISPAXIS header keyword or the "dispaxis" parameter. The +parameters \fIcoord_flip\fR and \fIdata_flip\fR select whether the +coordinate system and data are flipped. If neither operation is selected +then the output spectra will simply be copies of the input spectra. + +Flipping of the coordinate system means that the relation between +"logical" pixel coordinates (the index system of the image array) +and the dispersion and physical coordinate systems is reversed. +The dispersion coordinate of the first pixel in the flipped spectrum +will be the same as the dispersion coordinate of the last pixel +in the original spectrum and vice-versa for the other endpoint. + +Flipping of the data means that the order in which the pixels are stored +in the image file is reversed along the image axis corresponding to +the dispersion. + +While flipping spectra seems simple there are some subtleties. If +both the coordinate system and the data are flipped then plots of +the spectra in which the dispersion coordinates are shown will appear +the same as in the original spectra. In particular the coordinate +of a feature in the spectrum will remain unchanged. In contrast +flipping either the coordinate system or the data will cause features +in the spectrum to move to opposite ends of the spectrum relative +to the dispersion coordinates. + +Since plotting programs often plot the dispersion axis in some standard way +such as increasing from left to right, flipping both the dispersion +coordinates and the data will produce plots that look identical even though +the order of the points plotted will be reversed. Only if the spectra are +plotted against logical pixel coordinates will a change be evident. Note +also that the plotting programs themselves have options to reverse the +displayed graph. So if all one wants is to reverse the direction of +increasing dispersion in a plot then physically flipping of the spectra is +not generally necessary. + +Flipping of both the coordinate system and the data is also equivalent +to using an image section with a reversed axis. For example +a one dimensional spectrum can be flipped in both dispersion coordinates +and data pixel order by + +.nf + cl> imcopy spec1[-*] spec2 +.fi + +Higher dimensional spectra need appropriate dimensions in the image +sections. One advantage of \fBsflip\fR is that it will determine the +appropriate dispersion axis itself. +.ih +EXAMPLES +In the following the spectra can be one dimensional, multispec, +long slit, or spectral data cubes. + +.nf + cl> sflip spec1 spec1f # Flip data to new image + cl> sflip spec1 spec1 # Flip data to same image + cl> sflip spec1 spec1f coord+ data- # Flip coordinates and not data + cl> sflip spec1 spec1f coord+ # Flip both coordinates and data + cl> sflip spec* f//spec* # Flip a list of images +.fi +.ih +REVISIONS +.ls SFLIP V2.10.4 +New in this release. Note that the V2.9 SFLIP was different in that +it was script which simply flipped the data. Coordinate systems were +not handled in the same way. +.le +.ih +SEE ALSO +imcopy, scopy, dispcor, sapertures +.endhelp diff --git a/noao/onedspec/doc/sinterp.hlp b/noao/onedspec/doc/sinterp.hlp new file mode 100644 index 00000000..b983beba --- /dev/null +++ b/noao/onedspec/doc/sinterp.hlp @@ -0,0 +1,146 @@ +.help sinterp Mar92 noao.onedspec +.ih +NAME +sinterp -- Interpolate a tables of x,y pairs to produce a spectrum +.ih +USAGE +sinterp tbl_file +.ih +PARAMETERS +.ls tbl_file +The name of a file which contains the x,y pairs to be used as +the basis for interpolation. The pairs must be in order of +increasing x. +.le + +The following parameters may or may not be necessary, depending +on the options selected. + +.ls input +If a few single elements are desired, rather than a full +array of elements, the user may enter a sequence of x values +from the terminal or a file to be used to interpolate into +the x,y table (parameter curve_gen=no). +.le +.ls image +If parameter make_image=yes, then an image file name is needed +.le +.ls order = 5 +If the interpolator is a polynomial fit or spline (interp_mode= +chebyshev, legnedre, spline3, spline1), the order of the fit +is required. +.le +.ls x1 +If parameter curve_gen=yes, this is the starting x value to +begin the curve generation. +.le + +Of the following three parameters, two must be specified, and the +third will be derived. + +.ls x2 = 0.0 +As above, but x2 determines the endpoint of the curve. +.le +.ls dx = 0.0 +As above, but dx determines the pixel-to-pixel increment +to be used during the curves generation. +.le +.ls npts = 0 +As above, but this determines the number of pixels to be generated. +.le + +.ls curve_gen = no +If this parameter is set to yes, then parameters x1, and two of +the three x2, dx, npts are required. The output is in the form +of new x,y pairs and may be redirected to a text file. +But if parameter make_image is also yes, the output is +in the form of an IRAF image file having the name given by +the parameter image. If curve_gen=no, the user must supply +a set of x values and interpolation is performed on those values. +.le +.ls make_image = no +If set to yes, then curve_gen=yes is implied and an image file name +is requied. A one dimensional IRAF image is created. +.le +.ls tbl_size = 1024 +This parameter defines the maximum size to be set aside for +memory storage of the input x,y pairs. +.le +.ls interp_mode = "chebyshev" +This parameter controls the method of interpolation. The linear +and curve options are true interpolators, while chebyshev, +legendre, spline3, and splin1 are fits to the data. +.le +.ih +DESCRIPTION +The specified file is read assuming it is a text file containing +pairs of x,y values in the form: xxx yyy. The table is used +to define the function y(x). The pairs must be entered in the file +in increasing order of x. + +The user specifies either specific x values for which the function +is to be evaluated, or specifies that a sequence of values beginning +with x1 are to be generated. In the former case, the explicit x values +may come either from the keyboard or from a file. In the latter case +the user must also specify the sequence by defining the increment, dx, +the endpoint, x2, and the number of points to generate in the sequence. +Then y(x) is evaluated at x1, x1+dx, x1+2*dx, ... , x1+(n-2)*dx, x2. +Only 2 of the 3 parameters (x2, dx, npts) are needed to fully +specify the sequence. + +The output of the function evaluation is either new x,y pairs written +to STDOUT, or an IRAF image. + +The function used to evaluated the tabular data may be any of the following +forms: + +.ls (1) +Linear interpolation between points. +.le +.ls (2) +Smooth interpolation between points. +.le +.ls (3) +A polynomial fit of either Legendre or Chebyshev types. +.le +.ls (4) +A cubic or linear spline. +.le + +If the table of x,y pairs is very large, the parameter tbl_size +should be set to the number of pairs. For example, if a spectrum +is available as a text file of x,y pairs (such as might be +obtained from IUE), and the number of pairs is 4096, then tbl_size +should be set to 4096. This provides for sufficient memory to +contain the table. + +.ih +EXAMPLES +The following shows how a text file may be used to generate a spectrum: + +.nf + cl> sinterp textfile make+ x1=4000 x2=5000 npts=1024 \ + >>> image=testimage interp_mode=curve +.fi + +The following sequence shows how to generate a spectrum of an IRS +standard star using the calibration file data as the source. + +.nf + cl> lcalib flam feige34 caldir=onedstds$irscal/ >textfile + cl> sinterp textfile make+ x1=3550 dx=1.242 npts=1024 \ + >>> interp_mode=linear image=feige34 +.fi +.ih +REVISIONS +.ls SINTERP V2.10.3+ +The image header dispersion coordinate system has been updated to the +current system. +.le +.ls SINTERP V2.10 +This task is unchanged. +.le +.ih +SEE ALSO +lcalib +.endhelp diff --git a/noao/onedspec/doc/skytweak.hlp b/noao/onedspec/doc/skytweak.hlp new file mode 100644 index 00000000..857e4380 --- /dev/null +++ b/noao/onedspec/doc/skytweak.hlp @@ -0,0 +1,311 @@ +.help skytweak Mar97 noao.onedspec +.ih +NAME +skytweak -- sky subtract 1D spectra after tweaking sky spectra +.ih +SUMMARY +Sky spectra are shifted and scaled to best subtract sky features from data +spectra. This may be done non-interactively to minimize the RMS in some +region or regions of the data spectra and interactively with a graphically +search. +.ih +USAGE +skytweak input output cal +.ih +PARAMETERS +.ls input +List of input data images containing one dimensional spectra to be +corrected. All spectra in each image are corrected. The spectra need not +be wavelength calibrated. +.le +.ls output +List of output corrected images. The list must either match the input list +or be an empty list. If an empty list is specified the input spectra will +be replaced by the corrected spectra. The input spectra will also be +replaced if the input and output image names are the same. Any other image +name must be for a new image otherwise a warning message will be given and +the task will proceed to the next input image. +.le +.ls cal +List of sky calibration images. If a single image is specified it +will apply to all the input images. Otherwise the list of calibration +images must match the list of input images. +.le +.ls ignoreaps = no +Ignore aperture numbers between the input spectra and the calibration +spectra? If "no" then the calibration image must contain a spectrum +with the same aperture number as each spectrum in the input image. +Otherwise the first spectrum in the calibration image will be used +for all spectra in the input image. +.le +.ls xcorr = yes +Cross-correlate each input spectrum with the calibration spectrum to +determine an shift for the calibration spectrum? Only regions specified by +the sample regions parameter will be used in the cross-correlation. +.le +.ls tweakrms = yes +Search for the minimum RMS in the corrected spectrum by adjusting the +shifts and scales between the input spectrum and the calibration spectrum? +The RMS is minimized in the specified sample regions. +.le +.ls interactive = yes +Enter an interactive graphical mode to search for the best shift +and scale between the input spectra and calibration spectra? This +is done after the optional automatic cross-correlation and RMS minimization +step. A query is made for each input spectrum so that the interactive +step may be skipped during the execution of the task. +.le +.ls sample = "*" +Sample regions to use for cross-correlation, automatic RMS minimization, +and RMS values. The sample regions are specified by a list of comma +separated ranges. The ranges are colon separate coordinate values. +For dispersion calibrated spectra the coordinate values are in the +dispersion units otherwise they are in pixel coordinates. The string "*" +selects the entire spectrum. The sample regions may be changed +interactively either with the cursor or with a colon command. +.le +.ls lag = 10 +The cross-correlation lag to use when \fIxcorr\fR = yes. The lag +is given in pixels. This is the distance to either side of the +initial shift over which the cross-correlation profile is computed. +If a value of zero is given then the cross-correlation step is not done. +.le +.ls shift = 0., dshift = 1. +The initial shift and shift step in pixels. This initializes the shift +search parameters for the first spectrum. If \fIdshift\fR is zero then +there will be no search for a new shift and the 'x' interactive function is +disabled. These parameters may be changed interactively. After the +first spectrum subsequent spectra begin with the values from the last +spectrum. +.le +.ls scale = 1., dscale = 0.2 +The initial scale and scale step. This initializes the scale +search parameters for the first spectrum. If \fIdscale\fR is zero then +there will be no search for a new scale and the 'y' interactive function is +disabled. These parameters may be changed interactively. After the +first spectrum subsequent spectra begin with the values from the last +spectrum. +.le +.ls offset = 1. +The interactive search displays three candidate corrected spectra which +have been normalized to a mean of one. The offset is added and subtracted +to separate the three candidates. The value may be changed interactively. +.le +.ls smooth = 1 +The displayed candidate corrected spectra are smoothed by a moving +boxcar average with a box size specified by this parameter. The smoothing +only applies to the displayed spectra and does not affect the measured +RMS or the output corrected spectra. The value may be changed interactively. +.le +.ls cursor = "" +Input cursor for the interactive graphics. A null value selects the +graphics cursor otherwise a file of cursor values may be specified. +.le +.ls answer +Query parameter for responding to the interactive question. This parameter +should not be specified on the command line. +.le +.ls interp = poly5 +The \fBpackage\fR parameter specifying the interpolation function for shifting +the calibration spectra to match the input spectra. +.le +.ih +DESCRIPTION +Input one dimensional spectra are corrected to remove sky features by +subtracting a shifted and scaled sky calibration spectra. +The shifting +allows for possible small shifts or errors in the dispersion zeropoints. + +The following describes the correction. Let J(x_i) be the calibration +spectrum at a set of pixels x_i. An interpolation function is fit to this +spectrum to give J(x). The shifted and scaled calibration function +is then + +.nf + (1) J'(x) = J(x+dx) *scale +.fi + +where dx is the pixel shift parameter and +scale is the scale parameter. +The output corrected spectrum is then computed as + +.nf + (2) I'(x_i) = I(x_i) - J'(x_i) +.fi + +where I' is the corrected spectrum and I is the input spectrum. If the +spectra are dispersion calibrated, possibly with different dispersion +parameters, then the x values in (2) from the input spectrum are converted +to matching pixels in the calibration spectrum using the dispersion +functions of the two spectra. + +The purpose of this task is to determine the best values of the +shift and scale parameters dx and scale. There +are automatic and interactive methods provided. The automatic +methods are cross-correlation of the calibration and input spectra +to find a shift and an iterative search for the in both +shift and scale that minimizes the RMS of I' in some region. +The automatic methods are performed first, if selected, followed +by the interactive, graphical step. The following describes +the steps in the order in which they occur. + +The initial values of the shift and scale are set by the parameters +\fIshift\fR and \fIscale\fR for the first spectrum. After that the values +determined for the previous spectrum, those actually applied to correcting +that spectrum, are used as the initial values for the next spectrum. The +search steps and sample regions are also initialized by task parameters but +may be modified during the interactive step and the modified values apply +to subsequent spectra. + +If the \fIxcorr\fR parameter is yes and the \fIlag\fR parameter is +not zero the calibration spectrum is cross-correlated against the input +spectrum. Each spectrum is prepared as follows. A large scale continuum +is fit by a quadratic chebyshev using 5 iterations of sigma clipping with a +clipping factor of 3 sigma below the fit and 1 sigma above the fit and +rejecting the deviant points along with one pixel on either side. This +attempts to eliminate the effects of absorption lines. The continuum fit +is subtracted from the spectrum and the spectrum is extended and tapered by +a cosine function of length given by the \fIlag\fR parameter. + +The prepared spectra are then cross-correlated by shifting the calibration +spectrum plus and minus the specified \fIlag\fR amount about the current +shift value. Only the regions in the input spectrum specified by the +sample regions parameter are used in the correlation. This produces a +correlation profile whose peak defines the relative shift between the two +spectra. The current shift value is updated. This method assumes the +common telluric features dominate within the specified sample regions. The +lag size should be roughly the profile widths of the telluric features. + +If the \fItweakrms\fR parameter is yes and \fIdshift\fR is greater than +zero trial corrections at the current shift value and plus and minus one +shift step with the scale value fixed at its current value are made and the +RMS in the sample regions computed. If the RMS is smallest at the current +shift value the shift step is divided in half otherwise the current shift +value is set to the shift with the lowest RMS. The process is then +repeated with the new shift and shift step values. This continues until +either the shift step is less than 0.01 pixels or the shift is more than +two pixels from the initial shift. In the latter case the final shift is +reset to the original shift. + +The scale factor is then varied if \fIdscale\fR is greater than zero by the +scale step at a fixed shift in the same way as above to search for a +smaller RMS in the sample regions. This search terminates when the scale +step is less than 0.01 or if the scale value has departed by 100% of the +initial value. In the latter case the scale value is left unchanged. + +The search over the shifts and scales is repeated a second time after which +the tweak algorithm terminates. + +After the optional cross-correlation and tweak steps the interactive search +mode may be entered. This occurs if \fIinteractive\fR = yes. A query is +asking whether to search interactively. The answers may be "no", "yes", +"NO", or "YES". The lower case answers apply to the current spectrum and +the upper case answers apply to all subsequent spectra. This means that if +an answer of "NO" or "YES" is given then there will be no further queries +for the remaining input spectra. + +If the interactive step is selected a graph of three candidate corrections +for the input spectrum is displayed. There also may be a graph of the +calibration or input spectrum shown for reference. Initially the +calibration spectrum is displayed. The additional graph may be toggled off +and on and between the input and calibration spectra with the 'c' and 'd' +keys. The three candidate corrected spectra will be with the current shift +and scale in the middle and plus or minus one step in either the shift or +scale. Initially the spectra will be at different scale values. +Information about the current shift and scale and the step used is given in +the graph title. + +One may toggle between shift steps and scale steps with the 'x' (for shift) +or 'y' (for scale) keys. The RMS in the title is the RMS within the +currently defined sample regions. If one of the step values is zero then a +display of different values of that parameter will not be selected. The +step size will need to be set with a colon command to search in that +parameter. + +If 'x' is typed when the three spectra are at different shifts then the +nearest spectrum to the y cursor at the x cursor position will be +selected. If the central spectrum is selected the step size is divided in +half otherwise the current shift is changed and the selected spectrum +becomes the middle spectrum. Three new spectra are then shown. The same +applies if 'y' is typed when the three spectra are at different scales. +This allows an interactive search similar to the iterative tweakrms method +described previously except the user can use whatever criteria is desired +to search for the best scale and shift. + +There are additional keystrokes and colon commands to set or change sample +regions, reset the current shift, scale, and step sizes, expand the step +size in the current mode, adjust the offsets between the spectra, and +get help. The 'w' key and GTOOLS colon commands are available to window +the graphs. Any changes in the x limits apply to both graphs while y limit +adjustments apply to the graph pointed to by the cursor. + +Two other commands require a short explanation. The 'a' key may +be used to run the tweakrms algorithm starting from the current +shift, scale, and steps and the current sample regions. This allows +one to graphically set or reset the sample regions before doing +the RMS minimization. The ":smooth" command and associated +\fIsmooth\fR task parameter allow the corrected spectra to be +displayed with a boxcar smoothing to better see faint features in +noise. It is important to realize that the smoothing is only +done on the displayed spectra. The telluric correction and computed RMS +are done in the unsmoothed data. + +After the interactive step is quit with 'q' or if the interactive +step is not done then the final output spectrum is computed and +written to the output image. A brief log output is printed for +each spectrum. +.ih +CURSOR KEYS AND COLON COMMANDS +.nf +? - print help +a - automatic RMS minimization within sample regions +c - toggle calibration spectrum display +d - toggle data spectrum display +e - expand (double) the step for the current selection +q - quit +r - redraw the graphs +s - add or reset sample regions +w - window commands (see :/help for additional information) +x - graph and select from corrected shifted candidates +y - graph and select from corrected scaled candidates + +:help - print help +:shift [value] - print or reset the current shift +:scale [value] - print or reset the current scale +:dshift [value] - print or reset the current shift step +:dscale [value] - print or reset the current scale step +:offset [value] - print or reset the current offset between spectra +:sample [value] - print or reset the sample regions +:smooth [value] - print or reset the smoothing box size +.fi +.ih +EXAMPLES +1. To interactively search for a best correction with the default +cross-correlation and tweak steps: + +.nf + cl> skytweak spec001.ms skyspec001.ms spec005.ms +.fi + +2. To search only for a scale factor: + +.nf + cl> skytweak spec001.ms skyspec001.ms spec005.ms xcorr- dshift=0. +.fi + +3. To processes a set of spectra non-interactively with the same calibration +spectrum and to replace the input spectra with the corrected spectra and +log the processing: + +.nf + cl> skytweak spec* "" skyspec inter- > log +.fi +.ih +REVISIONS +.ls SKYTWEAK V2.11 +This task is new in this version. +.le +.ih +SEE ALSO +telluric +.endhelp diff --git a/noao/onedspec/doc/skytweak.key b/noao/onedspec/doc/skytweak.key new file mode 100644 index 00000000..a694ba36 --- /dev/null +++ b/noao/onedspec/doc/skytweak.key @@ -0,0 +1,35 @@ + SKYTWEAK COMMAND SUMMARY + +? - print help +a - automatic RMS minimization within sample regions +c - toggle calibration spectrum display +d - toggle data spectrum display +e - expand (double) the step for the current selection +q - quit +r - redraw the graphs +s - add or reset sample regions +w - window commands (see :/help for additional information) +x - graph and select from corrected shifted candidates +y - graph and select from corrected scaled candidates + +:help - print help +:shift [value] - print or reset the current shift +:scale [value] - print or reset the current scale +:dshift [value] - print or reset the current shift step +:dscale [value] - print or reset the current scale step +:offset [value] - print or reset the current offset between spectra +:sample [value] - print or reset the sample regions +:smooth [value] - print or reset the smoothing box size + + +The stacked display shows three corrected candidate spectra. The center +one is for the current shift and scale and the other two are one step +higher or lower in the shift or scale. The current values and the +step is shown in the title. Toggle between the shift and scale candidates +with 'x' or 'y'. Select the best spectrum with the cursor and typing +'x' or 'y'. Selecting the middle spectrum with 'x' in the shift display +divides the shift step in half. Selecting one of the other spectra +changes the current shift. Selecting the middle spectrum with 'y' +in the scale display divides the scale step in half. Selecting one of +the other spectra changes the current scale. When 'q' is typed the +final shift and scale will be that of the middle spectrum. diff --git a/noao/onedspec/doc/slist.hlp b/noao/onedspec/doc/slist.hlp new file mode 100644 index 00000000..322914b0 --- /dev/null +++ b/noao/onedspec/doc/slist.hlp @@ -0,0 +1,142 @@ +.help slist Mar92 noao.onedspec +.ih +NAME +slist -- List spectral header information +.ih +USAGE +slist images +.ih +PARAMETERS +.ls images +List of images to be listed. +.le +.ls apertures = "" +List of apertures to be selected from the images for listing. A null +list selects all apertures. See \fBranges\fR for the syntax of +this list. +.le +.ls long_header = no +If set to yes, then a multiline listing of the header elements is given. +If set to no, then a single line per spectrum is given. The contents +of the listing depend on the format. +.le +.ih +DESCRIPTION +This task lists header information from apertures in a list of input +images. There is a short one line per spectrum listing and a more +extended listing selected by the \fIlong_header\fR parameter. + +In both short and long outputs the aperture information consists of +lines with the following whitespace separated fields: the image line, +the aperture number, the beam number, the dispersion type, the +wavelength of the first pixel, the wavelength interval per pixel, +the number of valid pixels, and the aperture title. The dispersion +type is an integer with a value of -1 if not dispersion corrected, +0 if dispersion corrected to a linear wavelength sampling, 1 if +dispersion corrected to a log wavelength sampling, and 2 if dispersion +corrected to a nonlinear sampling. The wavelength per pixel is +an approximation based on the wavelength endpoints divided by the +number of pixels in the case of a nonlinear dispersion function. +Also the wavelengths refer to the actual pixels taking any image sections +into account and so may differ from the coordinate system information in +the header which is defined for the original physical coordinates. +The aperture titles may be identical with the image title if individual +aperture titles are not defined. + +In the short output format the image title is given first followed +by the above described information. This format is compact and +suitable for easy use in other programs (see the example below). +The long output format is blocked by image and gives the image name +and title on the first line, the exposure time, universal time, +and siderial time on the second line, the right ascention, declination, +hour angle, and airmass on the third line, and then the individual +aperture information on the remaining lines. If some of the header +information is missing a value of INDEF is printed. The keywords used +are EXPTIME/ITIME/EXPOSURE (in that order) for the exposure time, +and UT, ST, RA, DEC, HA, and AIRMASS for the remaining values. + + demoobj.ms: Hydra artificial image + EXPTIME = 2133.33 UT = 9:10:09.0 ST = 20:09:34.0 + RA = 1:34:02.00 DEC = 30:37:03.0 HA = INDEF AIRMASS = 2.3 +.ih +EXAMPLES +1. List short header for an object and arc from a Hydra multifiber reduction +for fibers 36 to 39. + +.nf + cl> slist demoobj.ms,demoarc1.ms ap=36-39 + demoobj.ms 1 37 0 0 5785.85 6.140271 256 Sky fiber + demoobj.ms 2 38 1 0 5785.85 6.140271 256 SS313 + demoobj.ms 3 39 1 0 5785.85 6.140271 256 SS444 + demoarc1.ms 1 36 2 0 5785.85 6.140271 256 Arc fiber + demoarc1.ms 2 37 0 0 5785.85 6.140271 256 Sky fiber + demoarc1.ms 3 38 1 0 5785.85 6.140271 256 SS313 + demoarc1.ms 4 39 1 0 5785.85 6.140271 256 SS444 +.fi + +Note that fiber 37 is the first image line in demoobj.ms and teh second image +line in demoarc.ms. The dispersion is the same in all fibers by design. + +2. List long headers for the two images of example 1 but restricted to +apertures 38 and 39. + +.nf + cl> slist demoobj.ms,demoarc1.ms ap=38,39 l+ + demoobj.ms: Hydra artificial image + EXPTIME = 2133.33 UT = 9:10:09.0 ST = 20:09:34.0 + RA = 1:34:02.00 DEC = 30:37:03.0 HA = INDEF AIRMASS = 2.3 + 2 38 1 0 5785.85 6.140271 256 SS313 + 3 39 1 0 5785.85 6.140271 256 SS444 + demoarc1.ms: Hydra artificial image + EXPTIME = 2133.33 UT = 9:10:09.0 ST = 20:09:34.0 + RA = 1:34:02.00 DEC = 30:37:03.0 HA = INDEF AIRMASS = 2.3 + 3 38 1 0 5785.85 6.140271 256 SS313 + 4 39 1 0 5785.85 6.140271 256 SS444 +.fi + +The other header parameters are the same because this is artificial +data using the same template header. + +3. Dump the set of image headers on a printer in long format. + +.nf + cl> slist *.ms.imh l+ | lprint +.fi + +4. The short form of SLIST may be used to get some of the aperture +information for use in a script. The following simply prints the +image line corresponding to a specified aperture. In a real application +something more complex would be done. + +.nf + procedure example (images, aperture) + + string images {prompt="List of images"} + int aperture {prompt="Aperture"} + + begin + string temp, image + int line + + # Use SLIST to print to a temporary file. + temp = mktemp ("example") + slist (images, aperture=aperture, long=no, > temp) + + # Scan each line and print the line number. + list = temp + while (fscan (list, image, line) != EOF) + print (image, ": ", line) + list = "" + delete (temp, verify=no) + end +.fi +.ih +REVISIONS +.ls SLIST V2.10 +This task was revised to be relevant for the current spectral image +formats. The old version is still available in the IRS/IIDS package. +.le +.ih +SEE ALSO +imheader, hselect +.endhelp diff --git a/noao/onedspec/doc/specplot.hlp b/noao/onedspec/doc/specplot.hlp new file mode 100644 index 00000000..222d77ff --- /dev/null +++ b/noao/onedspec/doc/specplot.hlp @@ -0,0 +1,387 @@ +.help specplot Jan96 noao.onedspec +.ih +NAME +specplot -- stack and plot multiple spectra +.ih +USAGE +specplot spectra +.ih +PARAMETERS +.ls spectra +List of spectra to plot. The spectra are assigned index numbers increasing +from one in the order of the list. +.le +.ls apertures = "" +List of apertures to plot. An empty list selects all apertures. +An aperture list consists of a comma separated list of aperture numbers or +hyphen separated range of numbers. A step size may also be specified preceded +by 'x'. See \fBranges\fR for more. +.le +.ls bands = "1" +List of bands to plot if the image is three dimensional. The list has +the same syntax as for the apertures. +.le +.ls dispaxis = 1, nsum = 1 +Parameters for defining vectors in 2D images. The +dispersion axis is 1 for line vectors and 2 for column vectors. +A DISPAXIS parameter in the image header has precedence over the +\fIdispaxis\fR parameter. These may be changed interactively. +.le +.ls autolayout = yes +Automatically layout the spectra by shifting or scaling to a common mean +and determining a separation step which does overlaps the spectra +by the specified fraction? The algorithm uses the following parameters. +.ls autoscale = yes +Scale the spectra to a common mean? If no then the spectra are shifted +to a common mean and if yes they are scaled to a common mean. +.le +.ls fraction = 1. +The separation step which just avoids overlapping the spectra is multiplied +by this number. Numbers greater than 1 increase the separation while numbers +less than 1 decrease the separation and provide some amount of overlap. +.le +.le +.ls units = "" +Dispersion coordinate units. If the spectra have known units, currently +this is generally Angstroms, the plotted units may be converted +for plotting to other units as specified by this parameter. +If this parameter is the null string then the units specified by the +world coordinate system attribute "units_display" is used. If neither +is specified than the units of the coordinate system are used. +The units +may also be changed interactively. See the units section of the +\fBonedspec\fR help for a further description and available units. +.le +.ls transform = "none" (none|log) +Transform for the input pixel values. Currently only "log" is implemented. +If all pixels are negative the spectrum values will be unchanged and if +some pixels are negative they are mapped to the lowest non-negative value in +the spectrum. Note that this cannot be changed interactively or applied +independently for each spectrum. To change the setting one must exit +the task and execute it with the new value. +.le +.ls scale = 1., offset = 0. (value, @file, keyword) +The scale and offset to apply to each spectrum. The value of the parameter +may be a constant value applying to all spectra, a file containing the +values specified as @ where is the filename, or an image +header keyword whose value is to be used. +.le +.ls step = 0 +The step separating spectra when not using the autolayout option. +The value of this parameter depends on the range of the data. +.le +.ls ptype = "1" +Default plotting type for the spectra. A numeric value selects line plots +while marker type strings select marker plots. The sign of the line type +number selects histogram style lines when negative or connected pixel +values when positive. The absolute value selects the line type with 0 +being an invisible line, 1 being a solid line, and higher integers +different types of lines depending on the capabilities of the graphics +device. The marker type strings are "point", "box", "plus", "cross", +"diamond", "hline", "vline", "hebar", "vebar", and "circle". +The types for individual spectra may be changed interactively. +.le +.ls labels = "user" +Spectrum labels to be used. If the null string or the word "none" is +given then the spectra are not labeled. The word "imname" labels the +spectra with the image name, the word "imtitle" labels them wih the +image title, the word "index" labels them with the index number, and +the word "user" labels them with user defined labels. The user labels +may be given in the file specified by the parameter \fIulabels\fR, which +are matched with the list of spectra, and also added interactively. +.le +.ls ulabels = "" +File containing user labels. +.le +.ls xlpos = 1.02, ylpos = 0.0 +The starting position for the spectrum labels in fractions of the +graph limits. The horizontal (x) position is measured from the left +edge while the vertical position is measured from the mean value of the +spectrum. For vertical positions a negative value may be used to label +below the spectrum. The default is off the right edge of the graph at +the mean level of the spectrum. +.le +.ls sysid = yes +Include system banner and separation step label? This may be changed +interactively using ":/sysid". +.le +.ls yscale = no +Draw a Y axis scale? Since stacked plots are relative labeling the Y +axes may not be useful. This parameter allows adding the Y axis scale +if desired. The default is to not have a Y axis scale. +.le +.ls title = "", xlabel = "", ylabel = "" +Title, x axis label, and y axis label for graphs. These may be changed +interactively using ":/title", ":/xlabel", and ":/ylabel". +.le +.ls xmin = INDEF, xmax = INDEF, ymin = INDEF, ymax = INDEF +The default limits for the initial graph. If INDEF then the limit is +determined from the range of the data (autoscaling). These values can +be changed with 'w' cursor key or the cursor commands ":/xwindow" and +":/ywindow". +.le +.ls logfile = "" +Logfile to record the final set of spectra and scale factors displayed. +.le +.ls graphics = "stdgraph" +Output graphics device. One of "stdgraph", "stdplot", "stdvdm", +@(enviroment variable), or actual device. +.le +.ls cursor = "" +Graphics cursor input. When null the standard cursor is used otherwise +the specified file is used. +.le +.ih +DESCRIPTION +\fBSpecplot\fR plots multiple spectra with provisions for scaling them, +separating them vertically, shifting them horizontally, and labeling them. +The layout can be defined by an automatic algorithm or explicitly and +adjusted noninteractively (with some limitations) or interactively. The +plotting units can be selected and the vertical axis scale can be shown or +not as desired. This task is used for compressing many spectra to a page +for review, intercomparison of spectra, classification against standards, +and final display. + +The input list of spectra consists of one, two, or three dimensional images. +The set of spectra may be restricted to specific apertures using the +\fIapertures\fR parameter. Note that for true 2D images, such as long slit +spectra, the aperture number corresponds to the line or column to be plotted +and the dispersion axis and nsum parameter are determined either from the +image header or the package parameters. Spectra extracted +with the \fBapextract\fR package may be three dimensional where the 3rd +dimension corresponds to related data. The higher dimensional data is +also plotted though it may be restricted with the \fIbands\fR +parameter. + +Each spectrum has a number of associated parameters which are initially +assigned default values but which may be changed interactively. First each +spectrum is assigned an index number. This is generally sequential +starting from 1. Spectra added interactively are assigned the next higher +or lower index relative to the spectrum being appended or inserted. The +index is used for refering to parameters of a particular spectrum and for +separating the spectra vertically. The spectra are scaled and shifted by +the equation + + I = value * scale + offset + (index - 1) * step + +where "I" is the final plotted value, "value" is the pixel value, "scale" +is a multiplicative scaling, "offset" is a additive offset, and "step" is +an additive separation step used to stack spectra vertically. + +The default values of the vertical scaling parameters may be set by an +automatic layout algorithm or with explicit constants (the same for all +spectra). The automatic mode is selected with the parameter +\fIautolayout\fR and works as follows. All spectra are scaled or shifted +to a common mean (depending on the parameter \fIautoscale\fR) relative to +the lowest indexed spectrum. A step size is then computed to just avoid +overlapping of the minimum of one spectrum with the maximum of another. +Note that this may not yield a good layout if the spectra have large +continuum slopes. Finally, to add some extra space between the spectra or +to allow some overlap, the minimum step is multiplied by a specified +overlap factor, \fIfraction\fR. + +In nonautomatic mode the user specifies the intensity scale, offset, +and separation step explicitly with the parameters, \fIscale, offset\fR +and \fIstep\fR. If the step is zero then spectra will be directly +overplotted while a positive or negative value will separate the +spectra either upward or downward with the index 1 spectrum having no +offset. The scale and offset parameters may be specified as either +constant values, the name of file containing the values (one per line) +preceded by the '@' character, or the name of an image header keyword. +This parameter as well as the scale and offset may be set or +changed interactively via colon commands and the "offset" may also be +set using the cursor to shift a spectrum vertically. + +In addition to shifting spectra vertically they may also be shifted +horizontally as a velocity/redshift or a zero point change with either +cursor or colon commands. The dispersion, inteval per pixel, may be +modified, either with the 't' key or the "wpc" command, in which case if +the dispersion is nonlinear the spectra will be linearized. + +Each spectrum may have a label associated with it. The label type may +be the image name, the image title, the index number, or a user defined +label. The default label type is specified by the parameter +\fIlabels\fR. For user labels the initial labels may be specified in a +file. Interactively the label type may be changed using the ":labels" +command and the user assigned labels may be defined by a colon command +or by using the cursor to mark the position for the label. The label +position is given relative to the range of the graph and the mean +intensity. The default values are set by the parameters \fIxlpos\fR +and \fIylpos\fR. The positions may be changed interactively for all +the spectra or individually. The latter may be done using the cursor +to mark exactly where the label is to go. + +Each spectrum has an associated plotting type. The default type which +applies to all spectra initially is specified by the parameter +\fIptype\fR. This parameter specifies both whether line mode or +marker mode is used and the line type, line style, or marker type to use. +The line +mode and types are given by a small integers with the style, connected +pixel centers or histogram style, chosed by the sign of the integer. +The type of lines produced depend on the capabilities of the terminal. In most +cases a zero line type is invisible. (This may be used interactively +to temporarily eliminate a spectrum from a plot instead of deleting the +spectrum from the list of spectra). A line type of 1 is a solid line +and additional line types are specified by higher numbers. +The marker types are given by name as described in the parameter +section. There is currently no combination of line and marker (such as +connected points with vertical bars) or histogram type plotting. The +plotting type may be changed interactively for individual spectra or +for all spectra using colon commands. + +The cursor and colon commands generally apply to the spectrum nearest +the cursor. This is determined by finding the nearest data point to +the cursor. For the colon commands the spectrum may also be specified +explicitly by the index number using an optional suffix "[index]", where +index is the index number for the spectrum. Also the special index "*" +may be specified to apply to all spectra. + +The operations of adding, deleting, moving, or shifting spectra affect +the index numbers of the other spectra. When deleting a spectrum the +index numbers of all spectra with greater index numbers are decreased +by one resulting in the plotted spectra moving down (positive step). +When adding a spectrum the index numbers above the inserted spectrum +are increased by one resulting in the spectra moving up. Moving a +spectrum to a new index number is equivalent to deleting the spectrum +and then inserting it at the new index position. Spectra may be +shifted to insert gaps in the plotted spectra. The specified value is +added to all spectra above and including the one indicated if the value +is positive to all spectra below and including the one indicated if the +value is negative. +.ih +CURSOR COMMANDS + +The indicated spectrum is the one with a point closest to the cursor position. +.nf + +? - Print help summary +a - Append a new spectrum following the indicated spectrum +i - Insert a new spectrum before the indicated spectrum +d - Delete the indicated spectrum +e - Insert last deleted spectrum before indicated spectrum +f - Toggle between world coordinates and logical pixel coordinates +l - Define the user label at the indicated position +p - Define the label position at the indicated position +o - Reorder the spectra to eliminate gaps +q - Quit +r - Redraw the plot +s - Repeatedly shift the indicated spectrum position with the cursor + q - Quit shift x - Shift horizontally in velocity + s - Shift vertically in scale y - Shift vertically in offset + t - Shift horizontally in velocity z - Shift horizontally in velocity + and vertically in scale and vertically in offset +t - Set a wavelength scale using the cursor +u - Set a wavelength point using the cursor +v - Set velocity plot with zero point at cursor +w - Window the plot +x - Cancel all scales and offsets +y - Automatically layout the spectra with offsets to common mean +z - Automatically layout the spectra scaled to common mean +.fi +.ih +COLON COMMANDS + +A command without a value generally shows the current value of the +parameter while with a value it sets the value of the parameter. The show +commands print to the terminal unless a file is given. For the spectrum +parameters the index specification, "[index]", is optional. If absent the +nearest spectrum to the cursor when the command is given is selected except +for the "units" command which selects all spectra. The index is either a +number or the character *. The latter applies the command to all the +spectra. + +.nf +:show Show spectrum parameters (file optional) +:vshow Show verbose parameters (file optional) +:step Set or show step +:fraction Set or show autolayout fraction +:label Set or show label type + (none|imtitle|imname|index|user) + +:move[index] Move spectrum to new index position +:shift[index|*] Shift spectra by adding to index +:w0[index|*] Set or show zero point wavelength +:wpc[index|*] Set or show wavelength per channel +:velocity[index|*] Set or show radial velocity (km/s) +:redshift[index|*] Set or show redshift +:offset[index|*] Set or show intensity offset +:scale[index|*] Set or show intensity scale +:xlpos[index|*] Set or show X label position +:ylpos[index|*] Set or show Y label position +:ptype[index|*] Set or show plotting type +:color[index|*] Set or show color (1-9) +:ulabel[index|*] Set or show user labels +:units[index|*] Change coordinate units + +:/title Set the title of the graph +:/xlabel Set the X label of the graph +:/ylabel Set the Y label of the graph +:/xwindow Set the X graph range + (use INDEF for autoscaling) +:/ywindow Set the X graph range + (use INDEF for autoscaling) + + +Examples: + w0 Print value of wavelength zero point + w0 4010 Set wavelength zero point of spectrum nearest the cursor + w0[3] 4010 Set wavelength zero point of spectrum with index 3 + w0[*] 4010 Set wavelength zero point of all spectra +.fi +.ih +EXAMPLES +1. To make a nice plot of a set of spectra with the default layout: + + cl> specplot spec* + +2. To set the colors or line types for multiple spectra in a batch +mode application create a cursor file like: + + cl> type cursor.dat + :color[1] 2 + :color[2] 3 + :color[3] 4 + r + cl> specplot im1,im2,im3 cursor=cursor.dat + +Note that the 'r' key is necessary redraw the graph with the changed +attributes. +.ih +REVISIONS +.ls SPECPLOT V2.11 +The scale and offset parameters may now be a value, a filename, or +and image header keyword. + +The 'f' key was added to toggle between world and logical pixel coordinates. +.le +.ls SPECPLOT V2.10.3 +A color parameter was added for graphics terminals supporting color. + +The :units command was extended to have an optional spectrum specifier. +This is primarily intended to plot different (or the same) spectra in +velocity but with different velocity zeros. + +The default task units parameter has been changed to "" to allow picking +up a "units_display" WCS attribute if defined. +.le +.ls SPECPLOT V2.10 +New parameters were added to select apertures and bands, plot +additional dimensions (for example the additional output from the extras +option in \fBapextract\fR), suppress the system ID banner, suppress the Y +axis scale, output a logfile, and specify the plotting units. The \fIptype\fR +parameter now allows negative numbers to select histogram style lines. +Interactively, the plotting units may be changed and the 'v' key allows +setting a velocity scale zero point with the cursor. The new version +supports the new spectral WCS features including nonlinear dispersion +functions. +.le +.ih +NOTES +The automatic layout algorithm is relatively simple and may not +provide visually satisfactory results in all cases. The fonts and Y axis +scale capabilities are not as good as might be desired for publication +quality plots. +.ih +SEE ALSO +bplot, splot, onedspec, gtools, ranges +.endhelp diff --git a/noao/onedspec/doc/specshift.hlp b/noao/onedspec/doc/specshift.hlp new file mode 100644 index 00000000..c72ebd0a --- /dev/null +++ b/noao/onedspec/doc/specshift.hlp @@ -0,0 +1,67 @@ +.help specshift Oct92 noao.onedspec +.ih +NAME +specshift -- Shift dispersion coordinate systems +.ih +USAGE +specshift spectra shift +.ih +PARAMETERS +.ls spectra +List of spectra to be modified. +.le +.ls shift +Dispersion coordinate shift to be added to the current dispersion coordinate +system. +.le +.ls apertures = "" +List of apertures to be modified. The null list +selects all apertures. A list consists of comma separated +numbers and ranges of numbers. A range is specified by a hyphen. An +optional step size may be given by using the 'x' followed by a number. +See \fBxtools.ranges\fR for more information. This parameter is ignored +for N-dimensional spatial spectra such as long slit and Fabry-Perot. +.le +.ls verbose = no +Print a record of each aperture modified? +.le +.ih +DESCRIPTION +This task applies a shift to the dispersion coordinate system of selected +spectra. The image data is not modified as with \fBimshift\fR but rather +the coordinate system is shifted relative to the data. The spectra to be +modified are selected by specifying a list of images and apertures. If no +aperture list is specified then all apertures in the images are modified. +For N-dimensional spatial spectra such as long slit and Fabry-Perot the +aperture list is ignored. + +The specified shift is added to the existing world coordinates. For linear +coordinate systems this has the effect of modifying CRVAL1, for linear +"multispec" coordinate systems this modifies the dispersion coordinate of +the first physical pixel, and for nonlinear "multispec" coordinate systems +this modifies the shift coefficient(s). + +It is also possible to shift the linearized coordinate systems (but not the +nonlinear coordinate systems) with \fBsapertures\fR or possibly with +\fBwcsedit\fR or \fBhedit\fR if the coordinate system is stored with a +global linear system. + +The \fIverbose\fR parameter lists the images, the apertures, the shift, and +the old and new values for the first physical pixel are printed. +.ih +EXAMPLES +1. To add 1.23 Angstroms to the coordinates of all apertures in the +image "ngc456.ms": + +.nf + cl> specshift ngc456.ms 1.23 +.fi +.ih +REVISIONS +.ls SPECSHIFT V2.10.3 +First version. +.le +.ih +SEE ALSO +sapertures, dopcor, imcoords.wcsreset, hedit, ranges, onedspec.package +.endhelp diff --git a/noao/onedspec/doc/specwcs.hlp b/noao/onedspec/doc/specwcs.hlp new file mode 100644 index 00000000..ed8852e3 --- /dev/null +++ b/noao/onedspec/doc/specwcs.hlp @@ -0,0 +1,586 @@ +.help specwcs Mar93 noao.onedspec + +.ce +\fBThe IRAF/NOAO Spectral World Coordinate Systems\fR + + +.sh +1. Types of Spectral Data + +Spectra are stored as one, two, or three dimensional images with one axis +being the dispersion axis. A pixel value is the flux over +some interval of wavelength and position. The simplest example of a +spectrum is a one dimensional image which has pixel values as a +function of wavelength. + +There are two types of higher dimensional spectral image formats. One type +has spatial axes for the other dimensions and the dispersion axis may be +along any of the image axes. Typically this type of format is used for +long slit (two dimensional) and Fabry-Perot (three dimensional) spectra. +This type of spectra is referred to as \fIspatial\fR spectra and the +world coordinate system (WCS) format is called \fIndspec\fR. +The details of the world coordinate systems are discussed later. + +The second type of higher dimensional spectral image consists of multiple, +independent, one dimensional spectra stored in the higher dimensions with +the first image axis being the dispersion axis; i.e. each line is a +spectrum. This format allows associating many spectra and related +parameters in a single data object. This type of spectra is referred to +as \fImultispec\fR and the there are two coordinate system formats, +\fIequispec\fR and \fImultispec\fR. The \fIequispec\fR format applies +to the common case where all spectra have the same linear dispersion +relation. The \fImultispec\fR format applies to the general case of spectra +with differing dispersion relations or non-linear dispersion functions. +These multi-spectrum formats are important since maintaining large numbers +of spectra as individual one dimensional images is very unwieldy for the +user and inefficient for the software. + +Examples of multispec spectral images are spectra extracted from a +multi-fiber or multi-aperture spectrograph or orders from an echelle +spectrum. The second axis is some arbitrary indexing of the spectra, +called \fIapertures\fR, and the third dimension is used for +associated quantities. The IRAF \fBapextract\fR package may produce +multiple spectra from a CCD image in successive image lines with an +optimally weighted spectrum, a simple aperture sum spectrum, a background +spectrum, and sigma spectrum as the associated quantities along the third +dimension of the image. + +Many \fBonedspec\fR package tasks which are designed to operate on +individual one dimensional spectra may operate on spatial spectra by +summing a number of neighboring spectra across the dispersion axis. This +eliminates the need to "extract" one dimensional spectra from the natural +format of this type of data in order to use tasks oriented towards the +display and analysis of one dimensional spectra. The dispersion axis is +either given in the image header by the keyword DISPAXIS or the package +\fIdispaxis\fR parameter. The summing factors across the +dispersion are specified by the \fInsum\fR package parameter. +See "help onedspec.package" for information on these parmaeters. + +One dimensional spectra, whether from multispec spatial spectra, have +several associated quantities which may appear in the image header as part +of the coordinate system description. The primary identification of a +spectrum is an integer aperture number. This number must be unique within +a single image. There is also an integer beam number used for various +purposes such as discriminating object, sky, and arc spectra in +multi-fiber/multi-aperture data or to identifying the order number in +echelle data. For spectra summed from spatial spectra the aperture number +is the central line, column, or band. In 3D images the aperture index +wraps around the lowest non-dispersion axis. Since most one dimensional +spectra are derived from an integration over one or more spatial axes, two +additional aperture parameters record the aperture limits. These limits +refer to the original pixel limits along the spatial axis. This +information is primarily for record keeping but in some cases it is used +for spatial interpolation during dispersion calibration. These values are +set either by the \fBapextract\fR tasks or when summing neighboring vectors +in spatial spectra. + +An important task to be aware of for manipulating spectra between image +formats is \fBscopy\fR. This task allows selecting spectra from multispec +images and grouping them in various ways and also "extracts" apertures from +long slit and 3D spectra simply and without resort to the more general +\fBapextract\fR package. +.sh +2. World Coordinate Systems + +IRAF images have three types of coordinate systems. The pixel array +coordinates of an image or image section, i.e. the lines and +columns, are called the \fIlogical\fR coordinates. The logical coordinates of +individual pixels change as sections of the image are used or extracted. +Pixel coordinates are tied to the data, i.e. are fixed to features +in the image, are called \fIphysical\fR coordinates. Initially the logical +and physical coordinates are the equivalent but differ when image sections +or other tasks which modify the sampling of the pixels are applied. + +The last type of coordinate system is called the \fIworld\fR coordinate +system. Like the physical coordinates, the world coordinates are tied to +the features in the image and remain unchanged when sections of the image +are used or extracted. If a world coordinate system is not defined for an +image, the physical coordinate system is considered to be the world +coordinate system. In spectral images the world coordinate system includes +dispersion coordinates such as wavelengths. In many tasks outside the +spectroscopy packages, for example the \fBplot\fR, \fBtv\fR and +\fBimages\fR packages, one may select the type of coordinate system to be +used. To make plots and get coordinates in dispersion units for spectra +with these tasks one selects the "world" system. The spectral tasks always +use world coordinates. + +The coordinate systems are defined in the image headers using a set of +reserved keywords which are set, changed, and updated by various tasks. +Some of the keywords consist of simple single values following the FITS +convention. Others, the WAT keywords, encode long strings of information, +one for each coordinate axis and one applying to all axes, into a set of +sequential keywords. The values of these keywords must then be pasted +together to recover the string. The long strings contain multiple pieces +called WCS \fIattributes\fR. In general the WCS keywords should be left to +IRAF tasks to modify. However, if one wants modify them directly some +tasks which may be used are \fBhedit\fR, \fBhfix\fR, \fBwcsedit\fR, +\fBwcsreset\fR, \fBspecshift\fR, \fBdopcor\fR, and \fBsapertures\fR. The +first two are useful for the simple keywords, the two "wcs" tasks are +useful for the linear ndspec and equispec formats, the next two are for the +common cases of shifting the coordinate zero point or applying a doppler +correction, and the last one is the one to use for the more complex +multispec format attributes. +.sh +3. Physical Coordinate System + +The physical coordinate system is used by the spectral tasks when there is +no dispersion coordinate information (such as before dispersion +calibration), to map the physical dispersion axis to the logical dispersion +axis, and in the multispec world coordinate system dispersion functions +which are defined in terms of physical coordinates. + +The transformation between logical and physical coordinates is defined by +the header keywords LTVi, LTMi_j (where i and j are axis numbers) through +the vector equation + +.nf + l = |m| * p + v +.fi + +where l is a logical coordinate vector, p is a physical +coordinate vector, v is the origin translation vector specified by +the LTV keywords and |m| is the scale/rotation matrix +specified by the LTM keywords. For spectra rotation terms (nondiagonal +matrix elements) generally do not make sense (in fact many tasks will not +work if there is a rotation) so the transformations along each axis are +given by the linear equation + +where l is a logical coordinate vector, p is a physical coordinate vector, +v is the origin translation vector specified by the LTV keywords and |m| is +the scale/rotation matrix specified by the LTM keywords. For spectra a +rotation term (nondiagonal matrix elements) generally does not make sense +(in fact many tasks will not work if there is a rotation) so the +transformations along each axis are given by the linear equation + +.nf + li = LTMi_i * pi + LTVi. +.fi + +If all the LTM/LTV keywords are missing they are assumed to have zero +values except that the diagonal matrix terms, LTMi_i, are assumed to be 1. +Note that if some of the keywords are present then a missing LTMi_i will +take the value zero which generally causes an arithmetic or matrix +inversion error in the IRAF tasks. + +The dimensional mapping between logical and physical axes is given by the +keywords WCSDIM and WAXMAP01. The WCSDIM keyword gives the dimensionality +of the physical and world coordinate system. There must be coordinate +information for that many axes in the header (though some may be missing +and take their default values). If the WCSDIM keyword is missing it is +assumed to be the same as the logical image dimensionality. + +The syntax of the WAXMAP keyword are pairs of integer values, +one for each physical axis. The first number of each pair indicates which +current \fIlogical\fR axis corresponds to the original \fIphysical\fR axis +(in order) or zero if that axis is missing. When the first number is zero +the second number gives the offset to the element of the original axis +which is missing. As an example consider a three dimensional image in +which the second plane is extracted (an IRAF image section of [*,2,*]). +The keyword would then appear as WAXMAP01 = '1 0 0 1 2 0'. If this keyword +is missing the mapping is 1:1; i.e. the dimensionality and order of the +axes are the same. + +The dimensional mapping is important because the dispersion axis for +the nspec spatial spectra as specified by the DISPAXIS keyword or task +parameter, or the axis definitions for the equispec and or multispec +formats are always in terms of the original physical axes. +.sh +4. Linear Spectral World Coordinate Systems + +When there is a linear or logarithmic relation between pixels and +dispersion coordinates which is the same for all spectra the WCS header +format is simple and uses the FITS convention (with the CD matrix keywords +proposed by Hanisch and Wells 1992) for the logical pixel to world +coordinate transformation. This format applies to one, two, and three +dimensional data. The higher dimensional data may have either linear +spatial axes or the equispec format where each one dimensional spectrum +stored along the lines of the image has the same dispersion. + +The FITS image header keywords describing the spectral world coordinates +are CTYPEi, CRPIXi, CRVALi, and CDi_j where i and j are axis numbers. As +with the physical coordinate transformation the nondiagonal or rotation +terms are not expected in the spectral WCS and may cause problems if they +are not zero. The CTYPEi keywords will have the value LINEAR to identify +the type of coordinate system. The transformation between dispersion +coordinate, wi, and logical pixel coordinate, li, along axis i is given by + +.nf + wi = CRVALi + CDi_i * (li - CRPIXi) +.fi + +If the keywords are missing then the values are assumed to be zero except +for the diagonal elements of the scale/rotation matrix, the CDi_i, which +are assumed to be 1. If only some of the keywords are present then any +missing CDi_i keywords will take the value 0 which will cause IRAF tasks to +fail with arithmetic or matrix inversion errors. If the CTYPEi keyword is +missing it is assumed to be "LINEAR". + +If the pixel sampling is logarithmic in the dispersion coordinate, as +required for radial velocity cross-correlations, the WCS coordinate values +are logarithmic and wi (above) is the logarithm of the dispersion +coordinate. The spectral tasks (though not other tasks) will recognize +this case and automatically apply the anti-log. The two types of pixel +sampling are identified by the value of the keyword DC-FLAG. A value of 0 +defines a linear sampling of the dispersion and a value of 1 defines a +logarithmic sampling of the dispersion. Thus, in all cases the spectral +tasks will display and analyze the spectra in the same dispersion units +regardless of the pixel sampling. + +Other keywords which may be present are DISPAXIS for 2 and 3 dimensional +spatial spectra, and the WCS attributes "system", "wtype", "label", and +"units". The system attribute will usually have the value "world" for +spatial spectra and "equispec" for equispec spectra. The wtype attribute +will have the value "linear". Currently the label will be either "Pixel" +or "Wavelength" and the units will be "Angstroms" for dispersion corrected +spectra. In the future there will be more generality in the units +for dispersion calibrated spectra. + +Figure 1 shows the WCS keywords for a two dimensional long slit spectrum. +The coordinate system is defined to be a generic "world" system and the +wtype attributes and CTYPE keywords define the axes to be linear. The +other attributes define a label and unit for the second axis, which is the +dispersion axis as indicated by the DISPAXIS keyword. The LTM/LTV keywords +in this example show that a subsection of the original image has been +extracted with a factor of 2 block averaging along the dispersion axis. +The dispersion coordinates are given in terms of the \fIlogical\fR pixel +coordinates by the FITS keywords as defined previously. + +.ce +Figure 1: Long Slit Spectrum + +.nf + WAT0_001= 'system=world' + WAT1_001= 'wtype=linear' + WAT2_001= 'wtype=linear label=Wavelength units=Angstroms' + WCSDIM = 2 + DISPAXIS= 2 + DC-FLAG = 0 + + CTYPE1 = 'LINEAR ' + LTV1 = -10. + LTM1_1 = 1. + CRPIX1 = -9. + CRVAL1 = 19.5743865966797 + CD1_1 = 1.01503419876099 + + CTYPE2 = 'LINEAR ' + LTV2 = -49.5 + LTM2_2 = 0.5 + CRPIX2 = -49. + CRVAL2 = 4204.462890625 + CD2_2 = 12.3337936401367 +.fi + +Figure 2 shows the WCS keywords for a three dimensional image where each +line is an independent spectrum or associated data but where all spectra +have the same linear dispersion. This type of coordinate system has the +system name "equispec". The ancillary information about each aperture is +found in the APNUM keywords. These give the aperture number, beam number, +and extraction limits. In this example the LTM/LTV keywords have their +default values; i.e. the logical and physical coordinates are the same. + +.ce +Figure 2: Equispec Spectrum + +.nf + WAT0_001= 'system=equispec' + WAT1_001= 'wtype=linear label=Wavelength units=Angstroms' + WAT2_001= 'wtype=linear' + WAT3_001= 'wtype=linear' + WCSDIM = 3 + DC-FLAG = 0 + APNUM1 = '41 3 7.37 13.48' + APNUM2 = '15 1 28.04 34.15' + APNUM3 = '33 2 43.20 49.32' + + CTYPE1 = 'LINEAR ' + LTM1_1 = 1. + CRPIX1 = 1. + CRVAL1 = 4204.463 + CD1_1 = 6.16689700000001 + + CTYPE2 = 'LINEAR ' + LTM2_2 = 1. + CD2_2 = 1. + + CTYPE3 = 'LINEAR ' + LTM3_3 = 1. + CD3_3 = 1. +.fi +.sh +5. Multispec Spectral World Coordinate System + +The \fImultispec\fR spectral world coordinate system applies only to one +dimensional spectra; i.e. there is no analog for the spatial type spectra. +It is used either when there are multiple 1D spectra with differing +dispersion functions in a single image or when the dispersion functions are +nonlinear. + +The multispec coordinate system is always two dimensional though there may +be an independent third axis. The two axes are coupled and they both have +axis type "multispec". When the image is one dimensional the physical line +is given by the dimensional reduction keyword WAXMAP. The second, line +axis, has world coordinates of aperture number. The aperture numbers are +integer values and need not be in any particular order but do need to be +unique. This aspect of the WCS is not of particular user interest but +applications use the inverse world to physical transformation to select a +spectrum line given a specified aperture. + +The dispersion functions are specified by attribute strings with the +identifier \fIspecN\fR where N is the \fIphysical\fR image line. The +attribute strings contain a series of numeric fields. The fields are +indicated symbolically as follows. + +.nf + specN = ap beam dtype w1 dw nw z aplow aphigh [functions_i] +.fi + +where there are zero or more functions having the following fields, + +.nf + function_i = wt_i w0_i ftype_i [parameters] [coefficients] +.fi + +The first nine fields in the attribute are common to all the dispersion +functions. The first field of the WCS attribute is the aperture number, +the second field is the beam number, and the third field is the dispersion +type with the same function as DC-FLAG in the \fInspec\fR and +\fIequispec\fR formats. A value of -1 indicates the coordinates are not +dispersion coordinates (the spectrum is not dispersion calibrated), a value +of 0 indicates linear dispersion sampling, a value of 1 indicates +log-linear dispersion sampling, and a value of 2 indicates a nonlinear +dispersion. + +The next two fields are the dispersion coordinate of the first +\fIphysical\fR pixel and the average dispersion interval per \fIphysical\fR +pixel. For linear and log-linear dispersion types the dispersion +parameters are exact while for the nonlinear dispersion functions they are +approximate. The next field is the number of valid pixels, hence it is +possible to have spectra with varying lengths in the same image. In that +case the image is as big as the biggest spectrum and the number of pixels +selects the actual data in each image line. The next (seventh) field is a +doppler factor. This doppler factor is applied to all dispersion +coordinates by multiplying by 1/(1+z) (assuming wavelength dispersion +units). Thus a value of 0 is no doppler correction. The last two fields +are extraction aperture limits as discussed previously. + +Following these fields are zero or more function descriptions. For linear +or log-linear dispersion coordinate systems there are no function fields. +For the nonlinear dispersion systems the function fields specify a weight, +a zero point offset, the type of dispersion function, and the parameters +and coefficients describing it. The function type codes, ftype_i, +are 1 for a chebyshev polynomial, 2 for a legendre polynomial, 3 for a +cubic spline, 4 for a linear spline, 5 for a pixel coordinate array, and 6 +for a sampled coordinate array. The number of fields before the next +function and the number of functions are determined from the parameters of +the preceding function until the end of the attribute is reached. + +The equation below shows how the final wavelength is computed based on +the nfunc individual dispersion functions W_i(p). Note that this +is completely general in that different function types may be combined. +However, in practice when multiple functions are used they are generally of +the same type and represent a calibration before and after the actual +object observation with the weights based on the relative time difference +between the calibration dispersion functions and the object observation. + +.nf + w = sum from i=1 to nfunc {wt_i * (w0_i + W_i(p)) / (1 + z)} +.fi + +The multispec coordinate systems define a transformation between physical +pixel, p, and world coordinates, w. Generally there is an intermediate +coordinate system used. The following equations define these coordinates. +The first one shows the transformation between logical, l, and physical, +p, coordinates based on the LTM/LTV keywords. The polynomial functions +are defined in terms of a normalized coordinate, n, as shown in the +second equation. The normalized coordinates run between -1 and 1 over the +range of physical coordinates, pmin and pmax which are +parameters of the function, upon which the coefficients were defined. The +spline functions map the physical range into an index over the number of +evenly divided spline pieces, npieces, which is a parameter of the +function. This mapping is shown in the third and fourth equations where +s is the continuous spline coordinate and j is the nearest integer less +than or equal to s. + +.nf + p = (l - LTV1) / LTM1_1 + n = (p - pmiddle) / (prange / 2) + = (p - (pmax+pmin)/2) / ((pmax-pmin) / 2) + s = (p - pmin) / (pmax - pmin) * npieces + j = int(s) +.fi +.sh +5.1 Linear and Log Linear Dispersion Function + +The linear and log-linear dispersion functions are described by a +wavelength at the first \fIphysical\fR pixel and a wavelength increment per +\fIphysical\fR pixel. A doppler correction may also be applied. The +equations below show the two forms. Note that the coordinates returned are +always wavelength even though the pixel sampling and the dispersion +parameters may be log-linear. + +.nf + w = (w1 + dw * (p - 1)) / (1 + z) + w = 10 ** {(w1 + dw * (p - 1)) / (1 + z)} +.fi + +Figure 3 shows an example from a multispec image with +independent linear dispersion coordinates. This is a linearized echelle +spectrum where each order (identified by the beam number) is stored as a +separate image line. + +.ce +Figure 3: Echelle Spectrum with Linear Dispersion Function + +.nf + WAT0_001= 'system=multispec' + WAT1_001= 'wtype=multispec label=Wavelength units=Angstroms' + WAT2_001= 'wtype=multispec spec1 = "1 113 0 4955.44287109375 0.05... + WAT2_002= '5 256 0. 23.22 31.27" spec2 = "2 112 0 4999.0810546875... + WAT2_003= '58854293 256 0. 46.09 58.44" spec3 = "3 111 0 5043.505... + WAT2_004= '928358078002 256 0. 69.28 77.89" + WCSDIM = 2 + + CTYPE1 = 'MULTISPE' + LTM1_1 = 1. + CD1_1 = 1. + + CTYPE2 = 'MULTISPE' + LTM2_2 = 1. + CD2_2 = 1. +.fi +.sh +5.2 Chebyshev Polynomial Dispersion Function + +The parameters for the chebyshev polynomial dispersion function are the +order (number of coefficients) and the normalizing range of physical +coordinates, pmin and pmax, over which the function is +defined and which are used to compute n. Following the parameters are +the order coefficients, ci. The equation below shows how to +evaluate the function using an iterative definition where x_1 = 1, +x_2 = n, and x_i = 2 * n * x_{i-1} - x_{i-2}. + +The parameters for the chebyshev polynomial dispersion function are the +order (number of coefficients) and the normalizing range of physical +coordinates, pmin and pmax, over which the function is defined +and which are used to compute n. Following the parameters are the +order coefficients, c_i. The equation below shows how to evaluate the +function using an iterative definition +where x_1 = 1, x_2 = n, and x_i = 2 * n * x_{i-1} - x_{i-2}. + +.nf + W = sum from i=1 to order {c_i * x_i} +.fi +.sh +5.3 Legendre Polynomial Dispersion Function + +The parameters for the legendre polynomial dispersion function are the +order (number of coefficients) and the normalizing range of physical +coordinates, pmin and pmax, over which the function is defined +and which are used to compute n. Following the parameters are the +order coefficients, c_i. The equation below shows how to evaluate the +function using an iterative definition where x_1 = 1, x_2 = n, and +x_i = ((2i-3)*n*x_{i-1}-(i-2)*x_{i-2})/(i-1). + +.nf + W = sum from i=1 to order {c_i * x_i} +.fi + +Figure 4 shows an example from a multispec image with independent nonlinear +dispersion coordinates. This is again from an echelle spectrum. Note that +the IRAF \fBechelle\fR package determines a two dimensional dispersion +function, in this case a bidimensional legendre polynomial, with the +independent variables being the order number and the extracted pixel +coordinate. To assign and store this function in the image is simply a +matter of collapsing the two dimensional dispersion function by fixing the +order number and combining all the terms with the same order. + +.ce +Figure 4: Echelle Spectrum with Legendre Polynomial Function + +.nf + WAT0_001= 'system=multispec' + WAT1_001= 'wtype=multispec label=Wavelength units=Angstroms' + WAT2_001= 'wtype=multispec spec1 = "1 113 2 4955.442888635351 0.05... + WAT2_002= '83 256 0. 23.22 31.27 1. 0. 2 4 1. 256. 4963.0163112090... + WAT2_003= '976664 -0.3191636898579552 -0.8169352858733255" spec2 =... + WAT2_004= '9.081188912082 0.06387049476832223 256 0. 46.09 58.44 1... + WAT2_005= '56. 5007.401409453303 8.555959076467951 -0.176732458267... + WAT2_006= '09935064388" spec3 = "3 111 2 5043.505764869474 0.07097... + WAT2_007= '256 0. 69.28 77.89 1. 0. 2 4 1. 256. 5052.586239197408 ... + WAT2_008= '271 -0.03173489817897474 -7.190562320405975E-4" + WCSDIM = 2 + + CTYPE1 = 'MULTISPE' + LTM1_1 = 1. + CD1_1 = 1. + + CTYPE2 = 'MULTISPE' + LTM2_2 = 1. + CD2_2 = 1. +.fi +.sh +5.4 Linear Spline Dispersion Function + +The parameters for the linear spline dispersion function are the number of +spline pieces, npieces, and the range of physical coordinates, pmin +and pmax, over which the function is defined and which are used to +compute the spline coordinate s. Following the parameters are the +npieces+1 coefficients, c_i. The two coefficients used in a linear +combination are selected based on the spline coordinate, where a and b +are the fractions of the interval in the spline piece between the spline +knots, a=(j+1)-s, b=s-j, and x_0=a, and x_1=b. + +.nf + W = sum from i=0 to 1 {c_(i+j) * x_i} +.fi +.sh +5.5 Cubic Spline Dispersion Function + +The parameters for the cubic spline dispersion function are the number of +spline pieces, npieces, and the range of physical coordinates, pmin +and pmax, over which the function is defined and which are used +to compute the spline coordinate s. Following the parameters are the +npieces+3 coefficients, c_i. The four coefficients used are +selected based on the spline coordinate. The fractions of the interval +between the integer spline knots are given by a and b, a=(j+1)-s, +b=s-j, and x_0 =a sup 3, x_1 =(1+3*a*(1+a*b)), +x_2 =(1+3*b*(1+a*b)), and x_3 =b**3. + +The parameters for the cubic spline dispersion function are the number of +spline pieces, npieces, and the range of physical coordinates, pmin +and pmax, over which the function is defined and which are used to +compute the spline coordinate s. Following the parameters are the +npieces+3 coefficients, c_i. The four coefficients used are selected +based on the spline coordinate. The fractions of the interval between the +integer spline knots are given by a and b, a=(j+1)-s, b=s-j, +and x_0=a**3, x_1=(1+3*a*(1+a*b)), x_2=(1+3*b*(1+a*b)), and x_3=b**3. + +.nf + W = sum from i=0 to 3 {c_(i+j) * x_i} +.fi +.sh +5.6 Pixel Array Dispersion Function + +The parameters for the pixel array dispersion function consists of just the +number of coordinates ncoords. Following this are the wavelengths at +integer physical pixel coordinates starting with 1. To evaluate a +wavelength at some physical coordinate, not necessarily an integer, a +linear interpolation is used between the nearest integer physical coordinates +and the desired physical coordinate where a and b are the usual +fractional intervals k=int(p), a=(k+1)-p, b=p-k, +and x_0=a, and x_1=b. + +.nf + W = sum from i=0 to 1 {c_(i+j) * x_i} +.fi +.sh +5.7 Sampled Array Dispersion Function + +The parameters for the sampled array dispersion function consists of +the number of coordinate pairs, ncoords, and a dummy field. +Following these are the physical coordinate and wavelength pairs +which are in increasing order. The nearest physical coordinates to the +desired physical coordinate are located and a linear interpolation +is computed between the two sample points. +.endhelp diff --git a/noao/onedspec/doc/splot.hlp b/noao/onedspec/doc/splot.hlp new file mode 100644 index 00000000..a5bc3b96 --- /dev/null +++ b/noao/onedspec/doc/splot.hlp @@ -0,0 +1,1118 @@ +.help splot Jul95 noao.onedspec +.ih +NAME +splot -- plot and analyze spectra +.ih +USAGE +splot images [line [band]] +.ih +PARAMETERS +.ls images +List of images (spectra) to plot. If the image is 2D or 3D the line +and band parameters are used. Successive images are plotted +following each 'q' cursor command. One may use an image section +to select a desired column, line, or band but the full image will +be in memory and any updates to the spectrum will be part of the +full image. +.le +.ls line, band +The image line/aperture and band to plot in two or three dimensional +images. For multiaperture spectra the aperture specified by the line +parameter is first sought and if not found the specified image line is +selected. For other two dimensional images, such as long slit spectra, the +line parameter specifies a line or column. Note that if +the line and band parameters are specified on the command line it will not +be possible to change them interactively. +.le +.ls units = "" +Dispersion coordinate units for the plot. If the spectra have known units, +currently this is generally Angstroms, the units may be converted +to other units for plotting as specified by this task parameter. +If this parameter is the null string and the world coordinate system +attribute "units_display" is defined then that will +be used. If both this task parameters and "units_display" are not +given then the spectrum dispersion units will be used. +The units +may also be changed interactively. See the units section of the +\fBpackage\fR help for a further description and available units. +.le +.ls options = "auto" [auto,zero,xydraw,histogram,nosysid,wcreset,flip,overplot] +A list of zero or more, possibly abbreviated, options. The options can +also be toggled with colon commands. The currently defined options are +"auto", "zero", "xydraw", "histogram", "nosysid", "wreset", "flip", and +"overplot". Option "auto" automatically replots the graph whenever changes +are made. Otherwise the graph is replotted with keystrokes 'c' or 'r'. +Option "zero" makes the initial minimum y of the graphs occur at zero. +Otherwise the limits are set automatically from the range of the data or +the \fIymin\fR parameter. Option "xydraw" changes the 'x' draw key to use +both x and y cursor values for drawing rather than the nearest pixel value +for the y value. Option "histogram" plots the spectra in a histogram style +rather than connecting the pixel centers. Option "nosysid" excludes the +system banner from the graph title. Option "wreset" resets the graph +limits to those specified by the \fIxmin, xmax, ymin, ymax\fR parameters +whenever a new spectrum is plotted. The "flip" option selects that +initially the spectra be plotted with decreasing wavelengths. The options +may be queried and changed interactively. The "overplot" options overplots +all graphs and a screen erase only occurs with the redraw key. +.le +.ls xmin = INDEF, xmax = INDEF, ymin = INDEF, ymax = INDEF +The default limits for the initial graph. If INDEF then the limit is +determined from the range of the data (autoscaling). These values can +be changed interactively with 'w' window key options or the cursor commands +":/xwindow" and ":/ywindow" (see \fBgtools\fR). +.le +.ls save_file = "splot.log" +The file to contain any results generated by the equivalent width or +deblending functions. Results are added to this file until the file is +deleted. If the filename is null (""), then no results are saved. +.le +.ls graphics = "stdgraph" +Output graphics device: one of "stdgraph", "stdplot", "stdvdm", or device +name. +.le +.ls cursor = "" +Graphics cursor input. When null the standard cursor is used otherwise +the specified file is used. +.le + +The following parameters are used for error estimates in the 'd', +'k', and 'e' key measurements. See the ERROR ESTIMATES section for a +discussion of the error estimates. +.ls nerrsample = 0 +Number of samples for the error computation. A value less than 10 turns +off the error computation. A value of ~10 does a rough error analysis, a +value of ~50 does a reasonable error analysis, and a value >100 does a +detailed error analysis. The larger this value the longer the analysis +takes. +.le +.ls sigma0 = INDEF, invgain = INDEF +The pixel sigmas are modeled by the formula: + +.nf + sigma**2 = sigma0**2 + invgain * I +.fi + +where I is the pixel value and "**2" means the square of the quantity. If +either parameter is specified as INDEF or with a value less than zero then +no sigma estimates are made and so no error estimates for the measured +parameters are made. +.le + +The following parameters are for the interactive curve fitting function +entered with the 't' key. This function is usually used for continuum +fitting. The values of these parameters are updated during the fitting. +See \fBicfit\fR for additional details on interactive curve fitting. +.ls function = "spline3" +Function to be fit to the spectra. The functions are +"legendre" (legendre polynomial), "chebyshev" (chebyshev polynomial), +"spline1" (linear spline), and "spline3" (cubic spline). The functions +may be abbreviated. +.le +.ls order = 1 +The order of the polynomials or the number of spline pieces. +.le +.ls low_reject = 2., high_reject = 4. +Rejection limits below and above the fit in units of the residual sigma. +Unequal limits are used to reject spectral lines on one side of the continuum +during continuum fitting. +.le +.ls niterate = 10 +Number of rejection iterations. +.le +.ls grow = 1. +When a pixel is rejected, pixels within this distance of the rejected pixel +are also rejected. +.le +.ls markrej = yes +Mark rejected points? If there are many rejected points it might be +desired to not mark rejected points. +.le + +The following parameters are used to overplot standard star fluxes with +the 'y' key. See \fBstandard\fR for more information about these parameters. +.ls star_name +Query parameter for the standard star fluxes to be overplotted. +Unrecognized names or a "?" will print a list of the available stars +in the specified calibration directory. +.le +.ls mag +The magnitude of the observed star in the band given by the +\fImagband\fR parameter. If the magnitude is not in the same band as +the blackbody calibration file then the magnitude may be converted to +the calibration band provided the "params.dat" file containing relative +magnitudes between the two bands is in the calibration directory +.le +.ls magband +The standard band name for the input magnitude. This should generally +be the same band as the blackbody calibration file. If it is +not the magnitude will be converted to the calibration band. +.le +.ls teff +The effective temperature (deg K) or the spectral type of the star being +calibrated. If a spectral type is specified a "params.dat" file must exist +in the calibration directory. The spectral types are specified in the same +form as in the "params.dat" file. For the standard blackbody calibration +directory the spectral types are specified as A0I, A0III, or A0V, where A +can be any letter OBAFGKM, the single digit subclass is between 0 and 9, +and the luminousity class is one of I, III, or V. If no luminousity class +is given it defaults to dwarf. +.le +.ls caldir = ")_.caldir" +The standard star calibration directory. The default value redirects the +value to the parameter of the same name in the package parameters. +.le +.ls fnuzero = 3.68e-20 +The absolute flux per unit frequency at a magnitude of zero used to +to convert the calibration magnitudes to absolute flux. +.le + +The following parameters are used for queries in response to particular +keystrokes. +.ls next_image +In response to 'g' (get next image) this parameter specifies the image. +.le +.ls new_image +In response to 'i' (write current spectrum) this parameter specifies the +name of a new image to create or existing image to overwrite. +.le +.ls overwrite = no +Overwrite an existing output image? If set to yes it is possible to write +back into the input spectrum or to some other existing image. Otherwise +the user is queried again for a new image name. +.le +.ls spec2 +When adding, subtracting, multiplying, or dividing by a second spectrum +('+', '-', '*', '/' keys in the 'f' mode) this parameter is used to get +the name of the second spectrum. +.le +.ls constant +When adding or multiplying by a constant ('p' or 'm' keys in the 'f' mode) +the parameter is used to get the constant. +.le +.ls wavelength +This parameter is used to get a dispersion coordinate value during deblending or +when changing the dispersion coordinates with 'u'. +.le +.ls linelist +During deblending this parameter is used to get a list of line positions, +peak values, profile types, and widths. +.le +.ls wstart, wend, dw +In response to 'p' (convert to a linear wavelength scale) these parameters +specify the starting wavelength, ending wavelength, and wavelength per pixel. +.le +.ls boxsize +In response to 's' (smooth) this parameter specifies the box size in pixels +to be used for the boxcar smooth. The value must be odd. If an even +value is specified the next larger odd value is actually used. +.le +.ih +DESCRIPTION +\fBSplot\fR provides an interactive facility to display and analyze +spectra. See also \fBbplot\fR for a version of this task useful for making +many plots noninteractively. Each spectrum in the image list is displayed +successively. To quit the current image and go on to the next the 'q' +cursor command is used. If an image is two-dimensional, such as with +multiple aperture or long slit spectra, the aperture or image column/line +to be displayed is needed. If the image is three-dimensional, such as with +the extra information produced by \fBapextract\fR, the band is needed. +These parameters are queried unless specified on the command line. If +given on the command line it will not be possible to change them +interactively. + +The plots are made on the specfied graphics device which is usually to +the graphics terminal. The initial plot limits are set with the parameters +\fIxmin, xmax, ymin\fR, and \fIymax\fR. If a limit is INDEF then that limit +is determined from the range of the data. The "zero" option may also +be set in the \fIoptions\fR parameter to set the lower intensity limit +to zero. Other options that may be set to control the initial plot +are to exclude the system identification banner, and to select a +histogram line type instead of connecting the pixel centers. +The dispersion units used in the plot are set by the \fIunits\fR +parameter. This allows converting to units other than those in which the +dispersion coordinates are defined in the spectra. + +The \fIoption\fR parameter, mentioned in the previous paragraph, is a +a list of zero or more options. As previously noted, some of the options +control the initial appearance of the plots. The "auto" option determines +how frequently plots are redrawn. For slow terminals or via modems one +might wish to minimize the redrawing. The default, however, is to redraw +when changes are made. The "xydraw" parameter is specific to the 'x' +key. + +After the initial graph is made an interactive cursor loop is entered. +The \fIcursor\fR parameter may be reset to read from a file but generally +the graphics device cursor is read. The cursor loop takes single +keystroke commands and typed in commands begun with a colon, called +colon commands. These commands are described below and a summary of +the commands may be produced interactively with the '?' key or +a scrolling help on the status line with the '/' key. + +Modifications to the spectra being analyzed may be saved using the 'i' key +in a new, the current, or other existing spectra. A new image is created +as a new copy of the current spectrum and so if the current spectrum is +part of a multiple spectrum image (including a long slit spectrum) the +other spectra are copied. If other spectra in the same image are then +modified and saved use the overwrite option to replace then in the new +output image. If the output spectrum already exists then the +\fIoverwrite\fR flag must be set to allow modifying the data. This +includes the case when the output spectrum is the same as the input +spectrum. The only odd case here is when the input spectrum is one +dimensional and the output spectrum is two dimensional. In this case the +user is queried for the line to be written. + +The other form of output, apart from that produced on the terminal, are +measurements of equivalent widths, and other analysis functions. This +information will be recorded in the \fIsave_file\fR if specified. + +The following keystrokes are active in addition to the normal IRAF +cursor facilities (available with ":.help"): + +.ls ? +Page help information. +.le +.ls / +Cycle through short status line help. +.le +.ls +The space bar prints the cursor position and value of the nearest +pixel. +.le +.ls a +Expand and autoscale to the data range between two cursor positions. +See also 'w', and 'z'. Selecting no range, that is the two +cursor positions the same, produces an autoscale of the whole spectrum. +.le +.ls b +Set the plot base level to zero rather than autoscaling. +.le +.ls c +Clear all windowing and redraw the full current spectrum. This redraws the +spectrum and cancels any effects of the 'a', 'z', and 'w' keys. The 'r' +key is used to redraw the spectrum with the current windowing. +.le +.ls d +Mark two continuum points and fit (deblend) multiple line profiles. +The center, continuum at the center, core intensity, integrated flux, +equivalent width, FWHMs for each profile are printed and saved +in the log file. See 'k' for fitting a single profile and +'-' to subtract the fitted profiles. +.le +.ls e +Measure equivalent width by marking two continuum points around the line +to be measured. The linear continuum is subtracted and the flux is +determined by simply summing the pixels with partial pixels at the ends. +Returned values are the line center, continuum at the region center, +flux above or below the continuum, and the equivalent width. +.le +.ls f +Enter arithmetic function mode. This mode allows arithmetic functions to be +applied to the spectrum. The pixel values are modified according to the +function request and may be saved as a new spectrum with the 'i' +command. Operations with a second spectrum are done in wavelength +space and the second spectrum is automatically resampled if necessary. +If one spectrum is longer than the other, only the smaller number of +pixels are affected. To exit this mode type 'q'. + +The following keystrokes are available in the function mode. Binary +operations with a constant or a second spectrum produce a query for the +constant value or spectrum name. +.ls a +Absolute value +.le +.ls d +Power of base 10 (inverse log base 10) +.le +.ls e +Power of base e (inverse log base e) +.le +.ls i +Inverse/reciprocal (values equal to zero are set to 0.0 in the inverse) +.le +.ls l +Log base 10 (values less than or equal to 0.0 are set to -0.5) +.le +.ls m +Multiply by a constant (constant is queried) +.le +.ls n +Log base e (values less than or equal to 0.0 are set to -0.5) +.le +.ls p +Add by a constant (constant is queried) +.le +.ls q +Quit Function mode +.le +.ls s +Square root (values less than 0.0 are set to 0.0) +.le +.ls + +Add another spectrum +.le +.ls -3 - +Subtract another spectrum +.le +.ls * +Multiply by another spectrum +.le +.ls / +Divide by another spectrum +.le +.le +.ls g +Get another spectrum. The current spectrum is replaced by the new spectrum. +The aperture/line and band are queried is necessary. +.le +.ls h +Measure equivalent widths assuming a gaussian profile with the width +measured at a specified point. Note that this is not a gaussian fit (see +'k' to fit a gaussian)! The gaussian profile determined here may be +subtracted with the '-' key. A second cursor key is requested with one of +the following values: +.ls a +Mark the continuum level at the line center and use the LEFT half width +at the half flux point. +.le +.ls b +Mark the continuum level at the line center and use the RIGHT half width +at the half flux point. +.le +.ls c +Mark the continuum level at the line center and use the FULL width +at the half flux point. +.le +.ls l +Mark a flux level at the line center relative to a normalized continuum +and use the LEFT width at that flux point. +.le +.ls r +Mark a flux level at the line center relative to a normalized continuum +and use the RIGHT width at that flux point. +.le +.ls k +Mark a flux level at the line center relative to a normalized continuum +and use the FULL width at that flux point. +.le +.le +.ls i +Write the current spectrum out to a new or existing image. The image +name is queried and overwriting must be confirmed. +.le +.ls j +Set the value of the nearest pixel to the x cursor to the y cursor position. +.le +.ls k + (g, l or v) +Mark two continuum points and fit a single line profile. The second key +selects the type of profile: g for gaussian, l for lorentzian, and v for +voigt. Any other second key defaults to gaussian. The center, continuum +at the center, core intensity, integrated flux, equivalent width, and FWHMs +are printed and saved in the log file. See 'd' for fitting multiple +profiles and '-' to subtract the fit. +.le +.ls l +Convert to flux per unit wavelength (f-lambda). The spectrum is assumed +to be flux calibrated in flux per unit frequency (f-nu). See also 'n'. +.le +.ls m +Compute the mean, RMS, and signal-to-noise over a region marked with two +x cursor positions. +.le +.ls n +Convert to flux per unit frequency (f-nu). The spectrum is assumed +to be flux calibrated in flux per unit wavelength (f-lambda). See also 'l'. +.le +.ls o +Set overplot flag. The next plot will overplot the current plot. +Normally this key is immediately followed by one of 'g', '#', '%', '(', or ')'. +The ":overplot" colon command and overplot parameter option may be +used to set overplotting to be permanently on. +.le +.ls p +Define a linear wavelength scale. The user is queried for a starting +wavelength and an ending wavelength. If either (though not both) +are specified as INDEF a dispersion is queried for and used to compute +an endpoint. A wavelength scale set this way will be used for +other spectra which are not dispersion corrected. +.le +.ls q +Quit and go on to next input spectrum. After the last spectrum exit. +.le +.ls r +Redraw the spectrum with the current windowing. To redraw the full +spectrum and cancel any windowing use the 'c' key. +.le +.ls s +Smooth via a boxcar. The user is prompted for the box size. +.le +.ls t +Fit a function to the spectrum using the ICFIT mode. Typically +interactive rejection is used to exclude spectra lines from the fit +in order to fit a smooth continuum. A second keystroke +selects what to do with the fit. +.ls / +Normalize by the fit. When fitting the continuum this continuum +normalizes the spectrum. +.le +.ls -3 - +Subtract the fit. When fitting the continuum this continuum subtracts +the spectrum. +.le +.ls f +Replace the spectrum by the fit. +.le +.ls c +Clean the spectrum by replacing any rejected points by the fit. +.le +.ls n +Do the fitting but leave the spectrum unchanged (a NOP on the spectrum). +This is useful to play with the spectrum using the capabilities of ICFIT. +.le +.ls q +Quit and don't do any fitting. The spectrum is not modified. +.le +.le +.ls u +Adjust the user coordinate scale. There are three options, 'd' mark a +position with the cursor and doppler shift it to a specified value, +'z' mark a position with the cursor and zeropoint shift it to a specified +value, or 'l' mark two postions and enter two values to define a linear +(in wavelength) dispersion scale. The units used for input are those +currently displayed. A wavelength scale set this way will be used for +other spectra which are not dispersion corrected. +.le +.ls v +Toggle to a velocity scale using the position of the cursor as the +velocity origin and back. +.le +.ls w +Window the graph. For further help type '?' to the "window:" prompt or +see help under \fBgtools\fR. To cancel the windowing use 'a'. +.le +.ls x +"Etch-a-sketch" mode. Straight lines are drawn between successive +positions of the cursor. Requires 2 cursor settings in x. The nearest pixels +are used as the endpoints. To draw a line between arbitrary y values first +use 'j' to adjust the endpoints or set the "xydraw" option. +.le +.ls y +Overplot standard star values from a calibration file. +.le +.ls z +Zoom the graph by a factor of 2 in x. +.le +.ls ( +In multiaperture spectra go to the spectrum in the preceding image line. +If there is only one line go to the spectrum in the preceding band. +.le +.ls ) +In multiaperture spectra go to the spectrum in the following image line. +If there is only one line go to the spectrum in the following band. +.le +.ls # +Get a different line in multiaperture spectra or two dimensional images. +The aperture/line/column is queried. +.le +.ls % +Get a different band in a three dimensional image. +.le +.ls $ +Switch between physical pixel coordinates and world (dispersion) coordinates. +.le +.ls -4 - +Subtract the fits generated by the 'd' (deblend), 'k' (single profile fit), +and 'h' (gaussian of specified width). The region to be subtracted is +marked with two cursor positions. +.le +.ls -4 ',' +Shift the graph window to the left. +.le +.ls . +Shift the graph window to the right. +.le +.ls I +Force a fatal error interupt to leave the graph. This is used because +the normal interupt character is ignored in graphics mode. +.le + +.ls :show +Page the full output of the previous deblend and equivalent width +measurements. +.le +.ls :log +Enable logging of measurements to the file specified by the parameter +\fIsave_file\fR. When the program is first entered logging is enabled +(provided a log file is specified). There is no way to change the file +name from within the program. +.le +.ls :nolog +Disable logging of measurements. +.le +.ls :dispaxis +Show or change dispersion axis for 2D images. +.le +.ls :nsum +Show or change summing for 2D images. +.le +.ls :units +Change the coordinate units in the plot. See below for more information. +.le +.ls :# +Add comment to logfile. +.le +.ls Labels: +.ls :label