FUNCTION dustem_plugin_mbbdy ,key=key,val=val,scope=scope,paramtag=paramtag,help=help ;+ ; NAME: ; dustem_plugin_mbbdy ; PURPOSE: ; DUSTEM plugin to compute modified black-body emission ; CATEGORY: ; DUSTEM Wrapper ; CALLING SEQUENCE: ; output=dustem_plugin_mbbdy([,key=][,val=]) ; INPUTS: ; None ; OPTIONAL INPUT PARAMETERS: ; key = input parameter number ; val = input parameter value ; OUTPUTS: ; output = MBB spectrum (on dustem wavelengths) (output[*,0] is Stokes I, output[*,1] Stokes Q and output[*,2] Stokes U) ; OPTIONAL OUTPUT PARAMETERS: ; None ; ACCEPTED KEY-WORDS: ; help = if set, print this help ; COMMON BLOCKS: ; None ; SIDE EFFECTS: ; None ; RESTRICTIONS: ; None ; PROCEDURE: ; This is a dustem plugin ; EXAMPLES ; ; MODIFICATION HISTORY: ; Written by JPB ;- IF keyword_set(help) THEN BEGIN doc_library,'dustem_plugin_mbbdy' output=0. goto,the_end ENDIF ;default values of input parameters amp = 0.5 ; Amplitude of the modified black-body emission temp = 19 ; Temperature of the dust species beta = 1.8 ; Emissivity index w0=100. ; Theoretical wavelength (3THz) where optical depth equals unity ;check formula of modified black body in the optically thin case ;default polarization values smallp=0. psi=0. scope='ADD_SED+ADD_POLSED' paramtag=['Amp','T_MBB (K)','beta (Plaw_index)','p','Psi (deg)'] IF keyword_set(key) THEN BEGIN ind1=where(key EQ 1,count1) ; reading amp ind2=where(key EQ 2,count2) ; reading temp ind3=where(key EQ 3,count3) ; reading beta ;In the case this plugin is used in polarization ind4=where(key EQ 4,count4) ; reading smallp ind5=where(key EQ 5,count5) ; reading psi IF count1 NE 0 then amp=val[ind1[0]] ;else default value IF count2 NE 0 then temp=val[ind2[0]] ; // // IF count3 NE 0 then beta=val[ind3[0]] ; // // IF count4 NE 0 then smallp=val[ind4[0]] ; // // IF count5 NE 0 then psi=val[ind5[0]] ; // // ENDIF lambir=dustem_get_wavelengths() Nwavs=n_elements(lambir) spec=amp*(lambir/w0)^(-1.*beta)*dustem_planck_function(temp,lambir) ;see Deschenes et al 2008, eq 6 output=fltarr(Nwavs,3) output[*,0]=spec ;polarization this actually need to polar_ippsi2iqu,output[*,0],Q,U,replicate(smallp,Nwavs),replicate(psi,Nwavs) output[*,1]=Q output[*,2]=U the_end: RETURN,output END