;+ ; FUNCTION isoh,x,spec,mag=mag,scaled=scaled,isowave=isowave,factor=factor,calcmag=calcmag,quiet=quiet ; ; Use: The minimum you need is just two arrays, x=wavelength in microns, ; spec=specta in flux units, everything else is gravy. ; Function outputs the isophotal flux in the H band spectra using ; the 2MASS RSR curves and a user supplied spectra given in Watts/cm-2/micron-1 ; The spectra should be in flux units and returns the same units ; Returns an array with isophotal flux and isophotal wavelength ; which can be used to scale the input spectra to a given magnitude. ; Scale it by a factor of Scaled=Input* 10^(Hmag/(-2.5))*(1.133e-13/isoflux) ; ; Keywords: ; Mag:Actual magnitude of object ; Scaled: scaled spectrum to the actual magnitude given ; Isowave: The isophotal wavelength for this star in this band ; Factor: The multiplicitive factor used to scale your spectrum ; Calcmag: The magnitude calculated of you input spectrum if you got your flux units right ; Quiet: Flag to supress screen output, for using within loops, 0 or nothing=Screen Output, ; Anything other number=quiet ; ; Written by Conor Laver July 5th 2006 ;- FUNCTION isoh,x,spec,mag=mag,scaled=scaled,isowave=isowave,factor=factor,calcmag=calcmag,quiet=quiet ;allow user to give an H magnitude if they want a scaled result otherwise they can just get the isophotal flux if ~(keyword_set(mag)) then mag=0.0 if ~(keyword_set(quiet)) then quiet=0 ;Read in the relative spectral response curves for 2MASS restore,'~/idl/osiris/conor/Photometry/2massrsr.sav' xmin=max(where(x le min(waveh))) xmax=max(where(x le max(waveh)))+1 xrange=x[xmin:xmax] lrange=spec[xmin:xmax] ;Interpolate the rough RSR grid up to a fine resolution to match your spectra rfine=interpol(rh,waveh,xrange) ;This the equation that defines isophotal flux, see Tokugawa 2005 isoflux=total(xrange*rfine*lrange)/total(xrange*rfine) isowave=xrange[max(where(lrange ge total(xrange*rfine*lrange)/total(xrange*rfine)))] ;set the baseline from Cohen 2003 to scale it to the given magnitude hvegazero=1.133e-13 calcmag=-2.5*alog10(isoflux/hvegazero) factor=10^(mag/(-2.5))*(hvegazero/isoflux) scaled=spec*factor if (quiet eq 0) then begin print,'The calculated magnitude for your spectra is: ',calcmag print,'The magnitude you gave for your spectra was: ',mag print,'The factor used to scale your spectra to the magnitude you gave was: ',factor plot,xrange,lrange,title='Your spectra with the RSR overplotted (dashed)',xtitle='Wavelength in microns',ytitle='Flux in W/cm2/micron' plot,xrange,rfine,/noerase,ystyle=4,yr=[0,1],linestyle=2 endif return,isoflux end