make_sed_phangs_tables.pro 4.07 KB
PRO make_sed_phangs_tables,test=test,show_seds=show_seds,grid_type=grid_type,isrf_class=isrf_class

;make_sed_phangs_tables
;make_sed_phangs_tables,/test,grid_type=2,/show_seds,isrf_class=15

;=== This is needed for Phangs work
;defsysv,'!phangs_data_dir','/Volumes/PILOT_FLIGHT1/PHANGS/'
;defsysv,'!phangs_data_dir','/data/projects/phangs/'
;=== This is where the grids will be written
;dir=!dustem_wrap_soft_dir+'/Grids/'
dir=!phangs_data_dir+'/ISRF/GRIDS/'

dustem_define_la_common

use_grid_type=1
IF keyword_set(grid_type) THEN BEGIN
  use_grid_type=grid_type
ENDIF

CASE use_grid_type OF
   1: BEGIN ;======= This is to produce a grid with the DBP90 model for G0 and PAH abundance

      !quiet=1
      model='DBP90'

      ;===== This is to do a small test_table
      pd = [ $
           '(*!dustem_params).G0', $                           ;G0
           '(*!dustem_params).grains(0).mdust_o_mh',$          ;PAH0 mass fraction
           '(*!dustem_params).grains(1).mdust_o_mh']          ;VSG mass fraction

      iv_min =   [0.1,1.e-4,1.e-4]
      iv_max =   [100,1.e-1,1.e-1] 
      log=[1,1,1]

      fpd=[]
      fiv=[]

      IF keyword_set(test) THEN BEGIN
         iv_Nvalues=[5,3,3]
         table_name=dir+'TEST_DBP90_JWST_G0_YPAH_YVSG_4Phangs.fits'
      ENDIF ELSE BEGIN
      	iv_Nvalues=[50,20,20]
      	table_name=dir+'DBP90_JWST_G0_YPAH_YVSG_4Phangs.fits'
      ENDELSE

      dustem_init,model=model
      ;=== select filters to be used for the grid
      filters=[(*!dustem_filters).nircam.filter_names,(*!dustem_filters).miri.filter_names]

      dustem_make_sed_table,model,pd,iv_min,iv_max,iv_Nvalues,fpd=fpd,fiv=fiv,filename=table_name,filters=filters,log=log,show_seds=show_seds
   END
   2: BEGIN
      !quiet=1
      model='DBP90'

      ;======= This is to produce a grid with the DL07 model for G0 and PAH abundance and ISRF from Muse data
      pd = [ $
           'dustem_plugin_phangs_class_isrf_2', $             ;G0 factor for Phangs ISRF classes
           '(*!dustem_params).grains(0).mdust_o_mh',$         ;PAH0 mass fraction
           '(*!dustem_params).grains(1).mdust_o_mh']          ;VSG mass fraction
      iv_min =   [0.1,1.e-4,1.e-4]
      iv_max =   [100,1.e-1,1.e-1] 
      log=[1,1,1]

      show_seds=1
      Nclass=31L
      fpd=['(*!dustem_params).gas.g0','(*!dustem_params).g0','dustem_plugin_phangs_class_isrf_1']             ;ISRF class to be used
      dustem_init,model=model
      ;=== select filters to be used for the grid
      filters=[(*!dustem_filters).nircam.filter_names,(*!dustem_filters).miri.filter_names, $
               (*!dustem_filters).pacs.filter_names,(*!dustem_filters).spire.filter_names]
      IF keyword_set(isrf_class) THEN BEGIN  ;do just one table
         i=isrf_class
         fiv=[-1.,1.,i]
         isrf_class_str='_isrfclass'+strtrim(i,2)
         IF keyword_set(test) THEN BEGIN
            iv_Nvalues=[5,3,3]
            table_name=dir+'TEST_DBP90_MuseISRF_JWST_G0_YPAH_YVSG_4Phangs'+isrf_class_str+'.fits'
         ENDIF ELSE BEGIN
            iv_Nvalues=[50,20,20]
            table_name=dir+'DBP90_MuseISRF_JWST_G0_YPAH_YVSG_4Phangs'+isrf_class_str+'.fits'
         ENDELSE
         dustem_make_sed_table,model,pd,iv_min,iv_max,iv_Nvalues,fpd=fpd,fiv=fiv,filename=table_name,filters=filters,log=log,show_seds=show_seds,isrf_class=i,/use_isrf_class
      ENDIF ELSE BEGIN
         FOR i=0L,Nclass-1 DO BEGIN  ;do all tables (could take a long time)
            fiv=[-1.,1.,i]
            isrf_class_str='_isrfclass'+strtrim(i,2)
            IF keyword_set(test) THEN BEGIN
               iv_Nvalues=[5,3,3]
               table_name=dir+'TEST_DBP90_MuseISRF_JWST_G0_YPAH_YVSG_4Phangs'+isrf_class_str+'.fits'
            ENDIF ELSE BEGIN
               iv_Nvalues=[50,20,20]
               table_name=dir+'DBP90_MuseISRF_JWST_G0_YPAH_YVSG_4Phangs'+isrf_class_str+'.fits'
            ENDELSE
            ;dustem_init,model=model
            dustem_make_sed_table,model,pd,iv_min,iv_max,iv_Nvalues,fpd=fpd,fiv=fiv,filename=table_name,filters=filters,log=log,show_seds=show_seds,isrf_class=i,/use_isrf_class
         ENDFOR
      ENDELSE
   END
ENDCASE


the_end:

END