pro for_linelookup_tables,LogNe,LogT,WRange,ioneq=ioneq0,outdir=outdir ;+ ; Project : ISSI - Cavities ; ; Name : for_linelookup_tables ; ; Purpose: Calculate and write out lookup tables of line emissivities for use by for_linesearch.pro ; ;Inputs: ; LogT - Log T (K) ; LogNe - Log electron density (cm^{-3}). Should be a scalar or an array equal in length to Temperature ; WRange - wavelength range [min, max] in Angstroms ;Input Keywords: ; Ioneq - Ion equilibrium file. Default is chianti.ioneq ; OutDir - output directory for files ; ; History ; 3-Jan-2014 based on for_spec_calc. T. Kucera ; 18-Dec-2015 Added OUTDIR keyword. TAK ;- default,outdir,'' if not dir_exist(outdir) then begin mk_dir,outdir,err=err if err ne '' then begin message,/cont,'Returning without performing calculation' retuurn endif endif default,WRange,[1,1410] default,LogT,[4, 4.5,5, 5.5,6,6.5,7,7.5] default,LogNe,[11.,10, 9, 8, 7,7, 7,7] NTemp=n_elements(LogT) density=10^Logne ff = findfile(concat_dir(!xuvtop,'VERSION')) chianti_version = ' ' IF ff(0) NE '' THEN BEGIN openr, 1, ff(0) readf, 1, chianti_version close, 1 ENDIF ELSE BEGIN print, 'Please update your CHIANTI database version, which is older than 4.0' chianti_version = ' ' END default,ioneq0,'chianti' ioneq=form_filename(ioneq0,'.ioneq',dir=concat_dir(!xuvtop,'ioneq')) Print,'Ioneq File: ',ioneq break_file,ioneq0, disk_log, dir, ioneq_nm, ioneq_ext for i=0,NTemp-1 do begin print,'LogT: ',trim(LogT[i]),', Log Ne: ',trim(LogNe[i]),', ',systime() ch_synthetic,WRange[0],WRange[1],logt=LogT[i],density=density[i],output=syn_struct,$ ioneq=ioneq lookfile='linelookup_'+trim(fix(WRANGE[0]))+'t'+trim(fix(WRange[1]))+$ '_T'+trim(LogT[i])+'_ne'+trim(fix(LogNe[i]))+$ '_'+str_replace(ioneq_nm,'_')+'_cv'+chianti_version savegenx,file=concat_dir(outdir,lookfile),syn_struct end end