PRO convert_grid_tables,filename_in,filename_out,model,fpd=fpd,fiv=fiv,use_polarisation=use_polarisation ; ;convert_grid_tables,'DBP90_JWST_G0_YPAH_YVSG_4Phangs.fits','DBP90_JWST_G0_YPAH_YVSG_4Phangs.fits','DBP90',fpd=0,fiv=0,use_polarisation=0 dustem_init,model=model dustem_define_la_common dir_in=!phangs_data_dir+'/ISRF/GRIDS/SAVED_V1/' dustem_define_grid_v1,dir_in+filename_in dir_out=!phangs_data_dir+'/ISRF/GRIDS/' a=mrdfits(dir_in+filename_in,1,h1) i=0L count=1 parameters_description=[''] REPEAT BEGIN v=sxpar(h1,'PNAME'+strtrim(i+1,2),count=count) IF count EQ 1 THEN BEGIN i=i+1 parameters_description=[parameters_description,v] ENDIF ENDREP UNTIL count EQ 0 parameters_description=parameters_description[1:*] Nparams=n_elements(parameters_description) iv_min=dblarr(Nparams) iv_max=dblarr(Nparams) iv_Nvalues=lonarr(Nparams) plog=intarr(Nparams) FOR i=0L,Nparams-1 DO BEGIN iv_min[i]=sxpar(h1,'PMIN'+strtrim(i+1,2),count=count) iv_max[i]=sxpar(h1,'PMAX'+strtrim(i+1,2),count=count) iv_Nvalues[i]=sxpar(h1,'PNVAL'+strtrim(i+1,2),count=count) plog[i]=sxpar(h1,'PLOG'+strtrim(i+1,2),count=count) ENDFOR ;parameter_values=!dustem_grid.ST_PARAMS ;IDL> help,parameter_values ;PARAMETER_VALUES ; POINTER = Array[8] ;IDL> help,parameter_values[0] ; POINTER = ;IDL> help,*parameter_values[0] ; ; FLOAT = Array[3] Nc=(*!dustem_grid).Nsed parameter_values=ptrarr(Nc) par_values=dblarr(Nparams) FOR i=0L,Nc-1 DO BEGIN FOR j=0L,Nparams-1 DO BEGIN par_values[j]=((*!dustem_grid).ST_PARAMS)[i].(j) ENDFOR parameter_values[i]=ptr_new(par_values) ENDFOR ;stop ;Iem_seds_array=replicate(one_Iemsed_st,Nc) Iem_seds_array=(*!dustem_grid).st_seds Nfilters=(*!dustem_grid).Nfilters one_seds=dustem_initialize_sed(Nfilters) one_seds.filter=(*!dustem_grid).filters seds=ptrarr(Nc) ;=== Fill up seds FOR i=0L,Nc-1 DO BEGIN FOR j=0L,Nfilters-1 DO BEGIN one_seds[j].stokesI=Iem_seds_array[i].(j) ;((seds[i]).stokesI)[j]=Iem_seds_array[i].(j) ENDFOR seds[i]=ptr_new(one_seds) ENDFOR saved_dustem_grid=*!dustem_grid dustem_write_sed_grid,model,parameters_description,iv_min,iv_max,iv_Nvalues,plog,parameter_values,seds,em_spectra=0,ext_spectra=0 $ ,fpd=fpd,fiv=fiv,use_polarisation=use_polarisation $ ,filename=dir_out+filename_out ;stop dustem_define_grid,dir_out+filename_out ;help,saved_dustem_grid ;** Structure <9b80dc08>, 10 tags, length=3760784, data length=3760780, refs=2: ; NSED LONG 20000 ; NFILTERS LONG 42 ; NPARAMS LONG 3 ; FILTERS STRING Array[42] ; PARAMS STRING Array[3] ; ST_SEDS STRUCT -> Array[20000] ; ST_PARAMS STRUCT -> Array[20000] ; SED_TOTALS DOUBLE Array[20000] ; PMIN_VALUES DOUBLE Array[3] ; PMAX_VALUES DOUBLE Array[3] ;help,*!dustem_grid ;** Structure , 10 tags, length=3760784, data length=3760780, refs=3: ; NSED LONG 20000 ; NFILTERS LONG 42 ; NPARAMS LONG 3 ; FILTERS STRING Array[42] ; PARAMS STRING Array[3] ; ST_SEDS STRUCT -> Array[20000] ; ST_PARAMS STRUCT -> Array[20000] ; SED_TOTALS DOUBLE Array[20000] ; PMIN_VALUES DOUBLE Array[3] ; PMAX_VALUES DOUBLE Array[3] ;help,saved_dustem_grid.ST_SEDS,/str ;help,(*!dustem_grid).ST_SEDS,/str END