Commit 70df99d7b1c6f92a079ff4c902f82f16c103ff56

Authored by Jean-Philippe Bernard
1 parent d339db1c
Exists in master

First commit

src/idl/dustem_make_empty_fortran_st.pro 0 → 100644
... ... @@ -0,0 +1,56 @@
  1 +FUNCTION dustem_make_empty_fortran_st,Ngrains
  2 +
  3 +;This makes an empty fortran structure.
  4 +;May have to be adapted for polarized models ...
  5 +
  6 +;st=dustem_make_empty_fortran_st(3)
  7 +
  8 +;IDL> help,st,/str
  9 +;** Structure <b4023ea8>, 2 tags, length=57600, data length=54400, refs=1:
  10 +; SED STRUCT -> <Anonymous> Array[800]
  11 +; EXT STRUCT -> <Anonymous> Array[800]
  12 +
  13 +;IDL> help,st.ext
  14 +;<Expression> STRUCT = -> <Anonymous> Array[800]
  15 +;IDL> help,st.sed
  16 +;<Expression> STRUCT = -> <Anonymous> Array[800]
  17 +
  18 +;IDL> help,st.sed,/str
  19 +;** Structure <c4007d08>, 5 tags, length=40, data length=36, refs=2:
  20 +; WAV FLOAT 0.0400000
  21 +; EM_GRAIN_1 DOUBLE 0.0000000
  22 +; EM_GRAIN_2 DOUBLE 0.0000000
  23 +; EM_GRAIN_3 DOUBLE 0.0000000
  24 +; EM_TOT DOUBLE 0.0000000
  25 +
  26 +;IDL> help,st.ext,/str
  27 +;** Structure <b4020c68>, 4 tags, length=32, data length=32, refs=2:
  28 +; WAV FLOAT 0.0400000
  29 +; ABS_GRAIN FLOAT Array[3]
  30 +; SCA_GRAIN FLOAT Array[3]
  31 +; EXT_TOT FLOAT 0.00000
  32 +
  33 +lambir=dustem_get_wavelengths()
  34 +Nwavs=n_elements(lambir)
  35 +
  36 +;do the sed structure
  37 +instruc='one_st={wav:0.,'
  38 +FOR i=0L,Ngrains-1 DO BEGIN
  39 + instruc=instruc+'em_grain_'+strtrim(i+1,2)+':0.,'
  40 +ENDFOR
  41 +instruc=instruc+'em_tot:0.}'
  42 +toto=execute(instruc)
  43 +sed_st=replicate(one_st,Nwavs)
  44 +sed_st.wav=lambir
  45 +
  46 +;do the ext structure
  47 +abs_g=fltarr(Ngrains)
  48 +ext_g=fltarr(Ngrains)
  49 +one_st={wav:0.,abs_grain:abs_g,sca_grain:abs_g,ext_tot:0.}
  50 +ext_st=replicate(one_st,Nwavs)
  51 +ext_st.wav=lambir
  52 +
  53 +st={sed:sed_st,ext:ext_st}
  54 +
  55 +RETURN,st
  56 +END
0 57 \ No newline at end of file
... ...
src/idl/dustem_print_params.pro 0 → 100644
... ... @@ -0,0 +1,111 @@
  1 +PRO dustem_print_params
  2 +
  3 +;help,!dustem_params,/str
  4 +;** Structure <5f85ea08>, 14 tags, length=5672, data length=5652, refs=1:
  5 +; NGRAINS LONG 3
  6 +; G0 FLOAT 1.00000e+07
  7 +; KEYWORDS STRING 'quiet sdist zdistf tempf'
  8 +; GRAINS STRUCT -> <Anonymous> Array[3]
  9 +; ISRF STRUCT -> <Anonymous> Array[200]
  10 +; QABS POINTER Array[3]
  11 +; CALOR POINTER Array[3]
  12 +; LAMBDA STRUCT -> <Anonymous> Array[800]
  13 +; SIZE POINTER Array[3]
  14 +; MIX POINTER Array[3]
  15 +; CHRG POINTER Array[3]
  16 +; GAS STRUCT -> <Anonymous> Array[1]
  17 +; SPIN POINTER Array[3]
  18 +; TLS STRUCT -> <Anonymous> Array[3]
  19 +
  20 +;help,*!dustem_fit,/str
  21 +;** Structure <689050c8>, 13 tags, length=80, data length=76, refs=1:
  22 +; DATA POINTER <NullPointer>
  23 +; PARAM_DESCS POINTER <PtrHeapVar4567>
  24 +; PARAM_INIT_VALUES
  25 +; POINTER <PtrHeapVar4568>
  26 +; FIXED_PARAM_DESCS
  27 +; POINTER <PtrHeapVar4547>
  28 +; FIXED_PARAM_INIT_VALUES
  29 +; POINTER <PtrHeapVar4548>
  30 +; CHI2 DOUBLE 0.0000000
  31 +; RCHI2 DOUBLE 0.0000000
  32 +; QCHI2 DOUBLE 0.0000000
  33 +; QRCHI2 DOUBLE 0.0000000
  34 +; UCHI2 DOUBLE 0.0000000
  35 +; URCHI2 DOUBLE 0.0000000
  36 +; CURRENT_PARAM_VALUES
  37 +; POINTER <PtrHeapVar4569>
  38 +; CURRENT_PARAM_ERRORS
  39 +; POINTER <NullPointer>
  40 +
  41 +
  42 +;help,*!dustem_parinfo,/str
  43 +;** Structure <6890d878>, 9 tags, length=80, data length=72, refs=1:
  44 +; VALUE DOUBLE 1.0000000
  45 +; FIXED INT 0
  46 +; LIMITED INT Array[2]
  47 +; LIMITS DOUBLE Array[2]
  48 +; PARNAME STRING '(*!dustem_params).G0'
  49 +; RELSTEP FLOAT 0.00000
  50 +; STEP FLOAT 0.00000
  51 +; MPSIDE INT 0
  52 +; TIED STRING ' 0'
  53 +
  54 +message,'=================================================',/info
  55 +
  56 +;stop
  57 +
  58 +
  59 +message,'======= content of !dustem_fit:',/continue
  60 +;=== make a structure for a noce display
  61 +N_variable_par=n_elements(*(*!dustem_fit).param_descs)
  62 +N_fixed_par=n_elements(*(*!dustem_fit).fixed_param_descs)
  63 +Npar=N_variable_par+N_fixed_par
  64 +one_st={Parameter_name:'',Parameter_init_value:0.D0,Parameter_fixed:0L,status:'',Parameter_fortran_value:la_undef(5)}
  65 +st=replicate(one_st,Npar)
  66 +
  67 +status_params=strarr(N_variable_par)
  68 +status_fixed_params=strarr(N_fixed_par)
  69 +fortran_values=dblarr(N_variable_par)+la_undef(5)
  70 +fortran_fixed_values=dblarr(N_fixed_par)+la_undef(5)
  71 +FOR i=0L,N_variable_par-1 DO BEGIN
  72 + status_params[i]=dustem_parameter_description2type((*(*!dustem_fit).param_descs)[i],string_name=string_name)
  73 + IF status_params[i] EQ 'FORTRAN' THEN BEGIN
  74 + str='fortran_values[i]='+(*(*!dustem_fit).param_descs)[i]
  75 + message,'executing '+str,/continue
  76 + toto=execute(str)
  77 + ENDIF
  78 +ENDFOR
  79 +FOR i=0L,N_fixed_par-1 DO BEGIN
  80 + status_fixed_params[i]=dustem_parameter_description2type((*(*!dustem_fit).fixed_param_descs)[i],string_name=string_name)
  81 + IF status_fixed_params[i] EQ 'FORTRAN' THEN BEGIN
  82 + str='fortran_fixed_values[i]='+(*(*!dustem_fit).param_descs)[i]
  83 + message,'executing '+str,/continue
  84 + toto=execute(str)
  85 + ENDIF
  86 +ENDFOR
  87 +
  88 +;stop
  89 +
  90 +st[0:N_variable_par-1].Parameter_name=*(*!dustem_fit).param_descs
  91 +st[0:N_variable_par-1].Parameter_init_value=*(*!dustem_fit).param_init_values
  92 +st[0:N_variable_par-1].Parameter_fixed=0
  93 +st[0:N_variable_par-1].status=status_params
  94 +st[0:N_variable_par-1].Parameter_fortran_value=fortran_values
  95 +st[N_variable_par:Npar-1].Parameter_name=*(*!dustem_fit).fixed_param_descs
  96 +st[N_variable_par:Npar-1].Parameter_init_value=*(*!dustem_fit).fixed_param_init_values
  97 +st[N_variable_par:Npar-1].Parameter_fixed=1
  98 +st[N_variable_par:Npar-1].status=status_fixed_params
  99 +st[N_variable_par:Npar-1].Parameter_fortran_value=fortran_fixed_values
  100 +
  101 +write_xcat,st,'/tmp/bidon.xcat'
  102 +
  103 +;message,'======= content of !dustem_parinfo:',/continue
  104 +;Npar=n_elements(*!dustem_parinfo)
  105 +;FOR i=0L,Npar-1 DO BEGIN
  106 +; print,(*!dustem_parinfo)[i].parname,(*!dustem_parinfo)[i].value
  107 +;ENDFOR
  108 +
  109 +message,'=================================================',/info
  110 +
  111 +END
0 112 \ No newline at end of file
... ...