Blame view

src/idl/dustem_test_model_exists.pro 3.8 KB
ba6d7415   Annie Hughes   First coomit
1
2
3
4
5
function dustem_test_model_exists,model $ 
                                  ,help=help $
                                  ,polarisation=polarisation $
                                  ,silent=silent

93cd417b   Annie Hughes   updated help
6
7
;+
; NAME:
ba6d7415   Annie Hughes   First coomit
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
;    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:
1efc19ff   Annie Hughes   changes for HD22
39
;    If dust model is unknown, code will stop unless /silent keyword is set
ba6d7415   Annie Hughes   First coomit
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
;
; 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
a22cb625   Annie Hughes   reworked help
57

04aa7dcd   Wilma Kiviaho   stopped dump to s...
58
  IF keyword_set(help) THEN BEGIN
ba6d7415   Annie Hughes   First coomit
59
60
61
62
63
     doc_library,'dustem_test_model_exists'
     goto,the_end
  END

  known_mdls=['MC10' $
b3211d62   Annie Hughes   tidied up missing...
64
65
              ,'C10' $ ; for convenience = MC10
              ,'COMPIEGNE_ETAL10' $ ; for backwards compatibility = MC10
ba6d7415   Annie Hughes   First coomit
66
67
68
69
70
71
              ,'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
b3211d62   Annie Hughes   tidied up missing...
72
              ,'WD01' $ ; for convenience = WD01_RV5P5B
ba6d7415   Annie Hughes   First coomit
73
74
75
              ,'WD01_RV5P5B' $ 
              ,'DL07' $
              ,'J13' $
b3211d62   Annie Hughes   tidied up missing...
76
              ,'AJ13' $ ; for backwards compatibility = J13
ba6d7415   Annie Hughes   First coomit
77
78
79
80
              ,'G17_MODELA' $
              ,'G17_MODELB' $
              ,'G17_MODELC' $
              ,'G17_MODELD' $
b3211d62   Annie Hughes   tidied up missing...
81
82
              ,'THEMIS' $ ; for convenience = J13
              ,'THEMIS2' $ ; for convenience = Y24
f197ecae   Annie Hughes   added Y24/THEMIS2...
83
              ,'Y24' $
1efc19ff   Annie Hughes   changes for HD22
84
85
              ,'HD22' $ 
              ,'ASTRODUST' $  ; for convience = HD22
ba6d7415   Annie Hughes   First coomit
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
              ,'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' $
f197ecae   Annie Hughes   added Y24/THEMIS2...
108
              ,'Y24' $
1efc19ff   Annie Hughes   changes for HD22
109
110
              ,'ASTRODUST' $
              ,'HD22' $
f197ecae   Annie Hughes   added Y24/THEMIS2...
111
              ,'THEMIS2' $
ba6d7415   Annie Hughes   First coomit
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
              ,'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