Blame view

src/idl/dustem_test_model_exists.pro 3.65 KB
ba6d7415   Annie Hughes   First coomit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
function dustem_test_model_exists,model $ 
                                  ,help=help $
                                  ,polarisation=polarisation $
                                  ,silent=silent

;+ NAME:
;    dustem_test_model_exists
;
; PURPOSE:
;    Test if DustEMWrap user has entered a string that matches a known dust model
;  
; CATEGORY:
;    DustEMWrap, Distributed, Low-Level, helper parse I/O
;
; CALLING SEQUENCE:
;    exist_status=dustem_test_model_exists(model)
;  
; INPUTS:
;    model : string provided by user to indicate an ISM dust model
;
; OPTIONAL INPUT PARAMETERS:
;    None
;
; OUTPUTS:
;    exist_status : 1 = exists, 0 = does not exists
;
; OPTIONAL OUTPUT PARAMETERS:
;
; ACCEPTED KEY-WORDS:
;    help = print this help
;    silent = determine status, but don't print anything
;    polarisation =  check if model includes polarisation
;  
; COMMON BLOCKS:
;    None
;
; SIDE EFFECTS:
;    If model is unknown, code will stop.
;
; RESTRICTIONS:
;    The DustEMWrap IDL code must be installed
;
; PROCEDURES AND SUBROUTINES USED:
;
; EXAMPLES
;   dustem_test_model_exists,'DL01'
;   dustem_test_model_exists,'G17_MODELA',/pol,/silent
;  
; MODIFICATION HISTORY:
;    Written by AH Feb 2023
;    Evolution details on the DustEMWrap gitlab.
;    See http://dustemwrap.irap.omp.eu/ for FAQ and help.  
;-

  exists=0
  
  IF keyword_set(help) or not keyword_set(model) THEN BEGIN
     doc_library,'dustem_test_model_exists'
     goto,the_end
  END

  known_mdls=['MC10' $
              ,'COMPIEGNE_ETAL10' $ ; for backwards compatibility
              ,'DBP90' $
              ,'DL01' $ ; for backwards compatibility
              ,'LD01' $ ; for backwards compatibility
              ,'DL01_RV3P1_BC6' $
;              ,'DL01_RV5P5B_BC3' $ ; removed from DUSTEM fortran in Feb2023 release
;              ,'DL01_RV5P5B_BC0' $ ; removed from DUSTEM fortran in Feb2023 release
              ,'WD01' $ ; for convenience
              ,'WD01_RV5P5B' $ 
              ,'DL07' $
              ,'J13' $
              ,'AJ13' $ ; for backwards compatibility
              ,'G17_MODELA' $
              ,'G17_MODELB' $
              ,'G17_MODELC' $
              ,'G17_MODELD' $
;              ,'THEMIS' $ ; removed from DUSTEM fortran in Feb2023 release
;              ,'ASTRODUST' $ ; removed from DUSTEM fortran in Feb2023 release
;              ,'NY_MODELA' $ ; removed from DUSTEM fortran in Feb2023 release
              ,'USER_MODEL']

  test_model = where(known_mdls eq model,ct)

  if ct eq 0 then begin
     if not keyword_set(silent) then begin
        message,'-----------------------------',/continue
        message,'ISM dust model '+model+' unknown',/continue
        message,'Known models are ',/continue
        for i=0,n_elements(known_mdls)-1 do print,known_mdls[i]
        message,'-----------------------------',/continue
     end
     exists=0
  end else begin
     exists=1
  end
  

  pol_mdls=['G17_MODELA' $
              ,'G17_MODELB' $
              ,'G17_MODELC' $
              ,'G17_MODELD' $
              ,'USER_MODEL'] ; we assume the USER knows their own model!

  if keyword_set(polarisation) then begin
     test_model = where(pol_mdls eq model,ct)
     if ct eq 0 then begin
        if not keyword_set(silent) then begin
           message,'-----------------------------',/continue
           message,'ISM dust model '+model+' does not describe polarisation',/continue
           message,'Known polarisation models are ',/continue
           for i=0,n_elements(pol_mdls)-1 do print,pol_mdls[i]
           message,'-----------------------------',/continue
        end
        exists=0
     end else begin
        exists=1
     end
     
  endif

  the_end:
  return,exists
end