-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path*Python*
285 lines (284 loc) · 10.6 KB
/
*Python*
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
Python 3.7.9 (default, Aug 31 2020, 12:42:55)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> python.el: native completion setup loaded
>>> import numpy as np
...
... ##############
... ### INPUTS ###
... ##############
...
... weight = 1 # [Kiloton]
...
... dist = 1 ## [km]
...
...
... ## calculate scaled distance
... z = dist/(weight**(1/3))
>>> p_over = 3.2 * 10**6 * z**(-3) * (1 + (z/87)**2)**(1/2) * (1 + z/800)
>>> p_over
3204211.6458039763
>>> z
1.0
>>>
>>>
>>>
>>>
>>> dist = 10 ## [km]
...
...
... ## calculate scaled distance
... z = dist/(weight**(1/3))
...
... ## calculate the overpressure
... p_over = 3.2 * 10**6 * z**(-3) * (1 + (z/87)**2)**(1/2) * (1 + z/800)
>>> p_over
3261.332861468405
>>> weight = 1 # [Kiloton]
...
... dist = 10 ## [km]
...
...
... ## calculate scaled distance
... z = dist/(weight**(1/3))
...
... ## calculate the overpressure
... p_over = 3.2 * 10**6 * z**(-3) * (1 + (z/87)**2)**(1/2) * (1 + z/800)
>>> p_over
3261.332861468405
>>> def calc_overpressure(weight, dist=1):
...
... ## calculate scaled distance
... z = dist/(weight**(1/3))
...
... ## calculate the overpressure
... p_over = 3.2 * 10**6 * z**(-3) * (1 + (z/87)**2)**(1/2) * (1 + z/800)
...
... return(p_over)
>>>
>>>
>>> calc_overpressure(1)
3204211.6458039763
>>> calc_overpressure(1,10)
3261.332861468405
>>> calc_overpressure(1,15)
980.1775947028895
>>> calc_overpressure(1,20)
420.6941931794685
>>> weight = 1 # [Kiloton]
... dist = 10 ## [km]
...
... ## calculate scaled distance
... z = dist/(weight**(1/3))
...
... ## calculate zero crossing
... zero_xing = (180*(1 + (z/100)**3)**(1/2)) / ((1 + z/40)**(1/2) * (1 +(z/285)**5)**(1/6) * (1+(z/50000))**(1/6))
>>>
>>>
>>> zero_xing
161.07200266545874
>>>
>>> weight = 1 # [Kiloton]
... dist = 1000 ## [m]
...
... ## calculate scaled distance
... z = dist/(weight**(1/3))
...
... ## calculate zero crossing [seconds]
... zero_xing = (180*(1 + (z/100)**3)**(1/2)) / ((1 + z/40)**(1/2) * (1 +(z/285)**5)**(1/6) * (1+(z/50000))**(1/6))
>>> zero_xing
390.9647351040575
>>> ## calculate zero crossing [seconds]
... zero_xing = (180*(1 + (z/100)**3)**(1/2)) / ((1 + z/40)**(1/2) * (1 +(z/285)**5)**(1/6) * (1+(z/50000))**(1/6)) * weight**(1/3)
>>> zero_xing
390.9647351040575
>>>
>>>
>>>
>>>
>>>
>>> weight = 10000 # [Kiloton]
... dist = 1000 ## [m]
...
... ## calculate scaled distance
... z = dist/(weight**(1/3))
...
... ## calculate zero crossing [seconds]
... zero_xing = (180*(1 + (z/100)**3)**(1/2)) / ((1 + z/40)**(1/2) * (1 +(z/285)**5)**(1/6) * (1+(z/50000))**(1/6)) * weight**(1/3)
>>> zero_xing
2766.686312218734
>>>
>>>
>>>
>>> weight = 1 # [Kiloton]
... dist = 10 ## [m]
...
... ## calculate scaled distance
... z = dist/(weight**(1/3))
...
... ## calculate zero crossing [seconds]
... zero_xing = (180*(1 + (z/100)**3)**(1/2)) / ((1 + z/40)**(1/2) * (1 +(z/285)**5)**(1/6) * (1+(z/50000))**(1/6)) * weight**(1/3)
>>> zero_xing
161.07200266545874
>>> weight = 500 # [Kiloton]
... dist = 10 ## [m]
...
... ## calculate scaled distance
... z = dist/(weight**(1/3))
...
... ## calculate zero crossing [seconds]
... zero_xing = (180*(1 + (z/100)**3)**(1/2)) / ((1 + z/40)**(1/2) * (1 +(z/285)**5)**(1/6) * (1+(z/50000))**(1/6)) * weight**(1/3)
>>> zero_xing
1406.6743972015668
>>> weight = 1 # [Kiloton]
... dist = 10 ## [m]
...
... ## calculate scaled distance
... z = dist/(weight**(1/3))
...
... ## calculate zero crossing [seconds]
... zero_xing = (180*(1 + (z/100)**3)**(1/2)) / ((1 + z/40)**(1/2) * (1 +(z/285)**5)**(1/6) * (1+(z/50000))**(1/6)) * weight**(1/3)
>>> zero_xing
161.07200266545874
>>>
>>>
>>>
>>> zero_xing = (180*(1 + (z/100)**3)**(1/2)) / ((1 + z/40)**(1/2) * (1 +(z/285)**5)**(1/6) * (1+(z/50000))**(1/6)) * weight**(1/3) / 100
>>> zero_xing
1.6107200266545874
>>> ## calculate zero crossing [seconds]
... zero_xing = (180*(1 + (z/100)**3)**(1/2)) / ((1 + z/40)**(1/2) * (1 +(z/285)**5)**(1/6) * (1+(z/50000))**(1/6)) * weight**(1/3) / 1000
>>> zero_xing
0.16107200266545874
>>>
>>>
>>>
>>>
>>> dist = 15 ## [m]
...
... ## calculate scaled distance
... z = dist/(weight**(1/3))
...
... ## calculate zero crossing [seconds]
... zero_xing = (180*(1 + (z/100)**3)**(1/2)) / ((1 + z/40)**(1/2) * (1 +(z/285)**5)**(1/6) * (1+(z/50000))**(1/6)) * weight**(1/3) / 1000
>>> zero_xing
0.15375563927941274
>>>
>>>
>>>
>>>
>>>
>>>
>>> dist = 45 ## [m]
...
... ## calculate scaled distance
... z = dist/(weight**(1/3))
...
... ## calculate zero crossing [seconds]
... zero_xing = (180*(1 + (z/100)**3)**(1/2)) / ((1 + z/40)**(1/2) * (1 +(z/285)**5)**(1/6) * (1+(z/50000))**(1/6)) * weight**(1/3) / 1000
>>> zero_xing
0.12896090528548182
>>> dist = 1000 ## [m]
...
... ## calculate scaled distance
... z = dist/(weight**(1/3))
...
... ## calculate zero crossing [seconds]
... zero_xing = (180*(1 + (z/100)**3)**(1/2)) / ((1 + z/40)**(1/2) * (1 +(z/285)**5)**(1/6) * (1+(z/50000))**(1/6)) * weight**(1/3) / 1000
>>> zero_xing
0.39096473510405755
>>> weight = 500 # [Kiloton]
... dist = 1000 ## [m]
...
... ## calculate scaled distance
... z = dist/(weight**(1/3))
...
... ## calculate zero crossing [seconds]
... zero_xing = (180*(1 + (z/100)**3)**(1/2)) / ((1 + z/40)**(1/2) * (1 +(z/285)**5)**(1/6) * (1+(z/50000))**(1/6)) * weight**(1/3) / 1000
>>> zero_xing
1.2108266407405779
>>> weight = 10 # [Kiloton]
... dist = 1000 ## [m]
...
... ## calculate scaled distance
... z = dist/(weight**(1/3))
...
... ## calculate zero crossing [seconds]
... zero_xing = (180*(1 + (z/100)**3)**(1/2)) / ((1 + z/40)**(1/2) * (1 +(z/285)**5)**(1/6) * (1+(z/50000))**(1/6)) * weight**(1/3) / 1000
>>> zero_xing
0.7198950971530833
>>>
>>>
>>>
>>> calc_overpressure(1, 10000)
0.0049657051578235285
>>> calc_overpressure(1, 1000)
0.08307123026929493
>>> calc_overpressure(500, 1000)
3.2593028632961945
>>>
>>>
>>> calc_overpressure(500, 1)
1600253662.2654362
>>> calc_overpressure(1, 10)
3261.332861468405
>>> zero_xing(1, 10)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'float' object is not callable
>>> def calc_zero_xing(weight, dist=1000):
...
... ## calculate scaled distance
... z = dist/(weight**(1/3))
...
... ## calculate zero crossing [seconds]
... zero_xing = (180*(1 + (z/100)**3)**(1/2)) / ((1 + z/40)**(1/2) * (1 +(z/285)**5)**(1/6) * (1+(z/50000))**(1/6)) * weight**(1/3) / 1000
...
... return(zero_xing)
>>> calc_zero_xing(1,10)
0.16107200266545874
>>> calc_zero_xing(1,200)
0.2146116637565576
>>> calc_overpressure(1,50)
31.372044462147688
>>> calc_overpressure(500,1000)
3.2593028632961945
>>> calc_overpressure(500,1)
1600253662.2654362
>>> calc_overpressure(1,1)
3204211.6458039763
>>>
>>>
>>>
>>>
>>> from idac.functions.calc_overpressure import calc_overpressure
... from idac.functions.calc_zero_xing import calc_zero_xing
Using TensorFlow backend.
/home/alex/miniconda3/envs/dev_idac/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
/home/alex/miniconda3/envs/dev_idac/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/home/alex/miniconda3/envs/dev_idac/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
/home/alex/miniconda3/envs/dev_idac/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/home/alex/miniconda3/envs/dev_idac/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
/home/alex/miniconda3/envs/dev_idac/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
/home/alex/miniconda3/envs/dev_idac/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
/home/alex/miniconda3/envs/dev_idac/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/home/alex/miniconda3/envs/dev_idac/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
/home/alex/miniconda3/envs/dev_idac/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/home/alex/miniconda3/envs/dev_idac/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
/home/alex/miniconda3/envs/dev_idac/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
>>>
>>>
>>> exit()
Process Python finished