dustem_read_tls.pro 1.93 KB
FUNCTION dustem_read_tls,dir_in,file,silent=silent,help=help


;+
; NAME:
;   dustem_read_tls
;
; PURPOSE:
;   read information relating to TLS model parameters from the .DAT
;   files into a structure.
;
; CATEGORY:
;    DustEMWrap, Distributed, LowLevel, Initialization
;
; CALLING SEQUENCE:
;   st=dustem_read_tls(dir,file)
;
; INPUTS:
;    file : TLS .dat file name to be read
;    dir  : input directory to find TLS .dat file
;
; OPTIONAL INPUT PARAMETERS:
;    None
;
; OUTPUTS:
;    st : dustem data structure
;
; OPTIONAL OUTPUT PARAMETERS:
;    None
;
; ACCEPTED KEY-WORDS:
;    silent     : quiet mode
;    help     : writes this help
;
; COMMON BLOCKS:
;    None
;
; SIDE EFFECTS:
;
; RESTRICTIONS:
;    The DustEM fortran code must be installed
;    The DustEMWrap IDL code must be installed
;
; PROCEDURES AND SUBROUTINES USED:  
;
; EXAMPLES:
;
; MODIFICATION HISTORY:
;    Written DP (?)
;    Evolution details on the DustEMWrap gitlab.
;    See http://dustemwrap.irap.omp.eu/ for FAQ and help.  
;-

IF keyword_set(help) THEN BEGIN
  doc_library,'dustem_read_tls' 
  full_st=0
  goto,the_end
ENDIF

  
st=''
Nmax=10000L
sts=strarr(Nmax)
openr,unit,dir_in+'data/'+file,/get_lun

;==read comments
str1='' & first_char='#'
str2=''
str3=''
WHILE first_char EQ '#' DO BEGIN
  readf,unit,str1
  readf,unit,str2
  readf,unit,str3
  first_char=strmid(str1,0,1)
ENDWHILE

stv1=str_sep(strtrim(strcompress(str1),2),' ')
a_dtls=float(stv1(0))
lc=float(stv1(1))
c_delta=float(stv1(2))
stv2=str_sep(strtrim(strcompress(str2),2),' ')
vt=float(stv2(0))
Pmu=float(stv2(1))
gamma_e=float(stv2(2))
stv3=str_sep(strtrim(strcompress(str3),2),' ')
omega_m=float(stv3(0))
tau_0=float(stv3(1))
V0=float(stv3(2))
Vmin=float(stv3(3))
Vm=float(stv3(4))
readf,unit,ldtresh

full_st={file:file,vt:vt,lc:lc,a_dtls:a_dtls,Pmu:Pmu,gamma_e:gamma_e, omega_m:omega_m,c_delta:c_delta,tau_0:tau_0,V0:V0,Vmin:Vmin,Vm:Vm,ldtresh:ldtresh}

close,unit
free_lun,unit
;cd 
the_end:
return,full_st

END