PRO read_profile_tm,line,init_model,tp,mp,prof,plot=plot ; ; Reading synthetic profiles from the database ; ; INPUTS: ; line - line name (string): ; 'La','Lb','Lc','Ld', 'Ha','Hb','Hc', 'Pa','Pb','Ba' for hydrogen ; 'CaK','CaH', '8498','8542','8662' for calcium II ; 'Mgk','Mgh', '2790.8','2797.9','2798.0' for magnesium II ; init_model (string) in the form 'C' defines the folder 'Models/VAL_'+init_model ; tp - temperature parameter in the range -0.03 to 0.03 ; mp - column-mass parameter in the range 0.2 to 5 ; ; OUTPUT: ; prof - synthetic profile array DOUBLE (2,n) [delta_lambda, intensity] ; units [A, erg/cm^2/s/sr/Hz], delta_lambda starts at 0 A ; ; KEYWORD: /plot - if set, a plot of the profile is made ; on_error,1 tp=tp<0.03>(-0.03) mp=mp<5.>0.2 id=49*round((tp+0.03)*1000)+round((mp-0.2)*10) ; model ID print,'Model T-par, m-par, ID: ',tp,mp,id ; LINES DATA name=['La','Lb','Lc','Ld','Ha','Hb','Hc','Pa','Pb','Ba', $ 'CaK','CaH','8662','8498','8542','Mgh','Mgk','2790.8','2798.0','2797.9'] elem=['HYD','HYD','HYD','HYD','HYD','HYD','HYD','HYD','HYD','HYD', $ 'CA','CA','CA','CA','CA','MG','MG','MG','MG','MG'] ll= [15,36,57,77,97,137,165,193,221,249, $ 8,36,64,82,100,26,66,106,138,170] ul= [35,56,76,96,136,164,192,220,248,276, $ 35,63,81,99,123,65,105,137,169,201] w=where(line eq name) if w eq -1 then message,'Unexpected line name encountered' filename='Profiles/'+elem[w]+'/'+elem[w]+'_'+init_model+'/'+elem[w]+string(id,format='(I05)')+'.DAT' n=ul[w[0]] prof=fltarr(2,n+1) openr,1,filename for i=0,n do begin if elem[w] eq 'HYD' then readf,1,dum,dlam,intensity else readf,1,dlam,intensity prof[0,i]=dlam prof[1,i]=intensity endfor close,1 ; Presence of NaNs if total(finite(prof)) ne n_elements(prof) then message,'Profile not found (NaN)' prof=prof[*,ll[w[0]]:ul[w[0]]] if keyword_set(plot) then $ plot,prof[0,*],prof[1,*],xtit='!4Dk!3 ['+string("305B)+']', $ ytit='I [erg cm!U-2!N s!U-1!N sr!U-1!N Hz!U-1!N]', $ title='Line '+line+' model '+init_model+'-'+string(id,format='(I04)'), $ charsiz=1.5,xmargin=[14,4],col=0,back=255 END