pro ns_calclrange,lmstruct,DELTAL=deltal, NL=nl ; ;+ ; NAME: ; NS_CALCLRANGE ; PURPOSE: ; Calculate a range of wavelengths and their corresponding ; echelle orders appropriate to the current instrument setup. ; CALLING SEQUENCE: ; ns_calclrange,lmstruct[,DELTAL=deltal] ; INPUTS: ; none ; OPTIONAL KEYWORD PARAMETERS: ; deltal -- optional wavelength spacing (microns) ; if not set, deltal=5.0e-5 ; nl -- number of wavelengths to calculate per order ; OUTPUTS: ; lmstruct -- anonymous structure containing the echelle order ; (tagname = order) and wavelengths (mm) (tagname = ; lambdas) ; COMMON BLOCKS: ; varypars, filterpars ; NOTES: ; ; EXAMPLE: ; ; PROCEDURES CALLED: ; none ; MODIFICATION HISTORY: ; NAL/UCB 98/03/06 ;- ;common fixedpars COMMON fixedpars COMMON varypars COMMON filterpars IF NOT keyword_set(nl) THEN nl = lmax ; large range will probably include lots of wavelengths with no data ; on ends xmin=-600-shiftx xmax=600-shiftx ymin=-600-shifty ymax=600-shifty narfils = [7, 8, 12, 14, 15, 16, 17] narrow = total(filternum eq narfils) IF spmode EQ 'high res' THEN BEGIN if not keyword_set(deltal) then deltal=5.000e-5 ; in micron deltal=deltal*1.0e-3 ; in mm ; print, sigmae, gammae, alphae blaze=2.0*sigmae*cos(gammae)*sin(alphae) ; print, 'blaze=', blaze ; calculate extreme blaze wavelengths ; cut off either by detector edges or filter in broad bands, ; use entire wavelength range of narrow IF narrow THEN BEGIN lymin = min_lambda lymax = max_lambda ENDIF ELSE BEGIN lymin = (sin(ymin*px/feh+betac)+sin(alphac))*sigmac/orderc > min_lambda lymax=(sin(ymax*px/feh+betac)+sin(alphac))*sigmac/orderc < max_lambda ENDELSE order_max=round(blaze/lymin) order_min=round(blaze/lymax) ;create anonymous structure for order, wavelengths temps=replicate({order:0,lambdas:fltarr(nl)},(order_max-order_min+1)) FOR iorder=order_min,order_max DO BEGIN lxmin=(sin(xmin*px/few+alphae)+sin(alphae))*sigmae*cos(gammae)/iorder-2.5E-06 lxmax=(sin(xmax*px/few+alphae)+sin(alphae))*sigmae*cos(gammae)/iorder+2.5E-06 ng = round((lxmax - lxmin)/deltal) lambdas = lxmin + findgen(ng)*deltal temps(iorder-order_min).order=iorder temps(iorder-order_min).lambdas(0:ng-1)=lambdas ENDFOR ; end loop through orders ENDIF ELSE IF spmode EQ 'low res' THEN BEGIN IF NOT keyword_set(deltal) THEN deltal=2.000e-4 ; in micron deltal=deltal*1.0e-3 ; in mm IF narrow THEN BEGIN lymin = min_lambda lymax = max_lambda ENDIF ELSE BEGIN lymin=((sin(ymin*px/feh+betac)+sin(alphac))*sigmac/orderc - 3.0E-05) > min_lambda lymax=((sin(ymax*px/feh+betac)+sin(alphac))*sigmac/orderc + 3.0E-05) < max_lambda ENDELSE ng = round((lymax - lymin)/deltal) lambdas = lymin + findgen(ng)*deltal ; lambdas = lymin+findgen(nl)*deltal ; goodlambdas = lambdas(where(lambdas LE lymax)) ; ng=n_elements(goodlambdas) temps={order:0,lambdas:fltarr(nl)} temps(0).lambdas(0:ng-1)=lambdas ENDIF ELSE BEGIN print, 'Cannot do imaging mode' ns_stop_reduce ENDELSE lmstruct=temps return end