David Saylor commited on
Commit Β·
53aedd4
1
Parent(s): a631620
got blueprints working for facilitating module structure
Browse files- CHRIS.py +3 -77
- color_module/__init__.py +5 -0
- color_module/colors.py +133 -0
- {static β color_module/static}/COU.html +0 -0
- {static β color_module/static}/COU.md +0 -0
- {static β color_module/static}/FAQ.html +0 -0
- {static β color_module/static}/FAQ.md +0 -0
- {static β color_module/static}/README.html +0 -0
- {static β color_module/static}/README.md +0 -0
- {static β color_module/static}/ToxProfiles.pdf +0 -0
- color_module/static/images/FDAgraphic.png +3 -0
- color_module/static/images/FDAlogo.png +3 -0
- color_module/static/md2html.sh +7 -0
- color_module/static/styles.css +42 -0
- {templates β color_module/templates}/index.html +3 -3
- {templates β color_module/templates}/report.html +0 -0
- functions.py +49 -0
- static/mainpage.css +0 -9
- templates/main.html +0 -2
CHRIS.py
CHANGED
|
@@ -66,91 +66,17 @@ for i in range(nCA):
|
|
| 66 |
app = Flask(__name__)
|
| 67 |
app.debug = True
|
| 68 |
|
|
|
|
|
|
|
|
|
|
| 69 |
@app.route('/', methods=['GET'])
|
| 70 |
def app_init():
|
| 71 |
return render_template('main.html')
|
| 72 |
|
| 73 |
-
@app.route('/color', methods=['GET'])
|
| 74 |
-
def colors():
|
| 75 |
-
return render_template('index.html', polymers=polymers, CAs=CAs, caMW=caMW)
|
| 76 |
-
|
| 77 |
@app.route('/exposure', methods=['GET'])
|
| 78 |
def exposure():
|
| 79 |
return render_template('exposure_index.html', polymers=polymers, CAs=CAs, caMW=caMW)
|
| 80 |
|
| 81 |
-
@app.route('/color', methods=['POST'])
|
| 82 |
-
def app_post():
|
| 83 |
-
amount = float(request.form["amount"])
|
| 84 |
-
mass = float(request.form["mass"])
|
| 85 |
-
density = float(request.form["density"])
|
| 86 |
-
vol = mass / density
|
| 87 |
-
polymer = request.form["polymer"]
|
| 88 |
-
pIndex = (np.where(polymers == polymer)[0])[0]
|
| 89 |
-
area = float(request.form["area"])
|
| 90 |
-
exposure = request.form["exposure"]
|
| 91 |
-
CA = request.form["CA"]
|
| 92 |
-
caIndex = (np.where(CAs == CA)[0])[0]
|
| 93 |
-
|
| 94 |
-
TI = caData[caIndex][1]
|
| 95 |
-
impurity = 1.
|
| 96 |
-
MW = 1100.
|
| 97 |
-
isCA = True
|
| 98 |
-
chemName = ''
|
| 99 |
-
|
| 100 |
-
if caIndex < 11:
|
| 101 |
-
MW = caData[caIndex][2]
|
| 102 |
-
chemName = '*' + caData[caIndex][0].decode('UTF-8') + '*'
|
| 103 |
-
impurity = float(request.form["impurity"]) * amount * 1e-2
|
| 104 |
-
if caIndex == 11:
|
| 105 |
-
MW = caData[caIndex][2]
|
| 106 |
-
chemName = '*' + request.form["chemName"] + '*'
|
| 107 |
-
impurity = float(request.form["impurity"]) * amount * 1e-2
|
| 108 |
-
if caIndex == 12:
|
| 109 |
-
MW = float(request.form["MW"])
|
| 110 |
-
chemName = '*' + request.form["chemName"] + '*'
|
| 111 |
-
impurity = float(request.form["impurity"]) * amount * 1e-2
|
| 112 |
-
if caIndex == 13:
|
| 113 |
-
MW = float(request.form["MW"])
|
| 114 |
-
chemName = '*' + request.form["chemName"] + '*'
|
| 115 |
-
|
| 116 |
-
if exposure != "limited":
|
| 117 |
-
time = 24.
|
| 118 |
-
else:
|
| 119 |
-
time = float(request.form["exptime"])
|
| 120 |
-
if exposure != "long-term":
|
| 121 |
-
TTC = 0.12
|
| 122 |
-
else:
|
| 123 |
-
TTC = 0.0015
|
| 124 |
-
|
| 125 |
-
assume1 = request.form.get("assume1") is not None
|
| 126 |
-
assume2 = request.form.get("assume2") is not None
|
| 127 |
-
assume3 = request.form.get("assume3") is not None
|
| 128 |
-
assume4 = request.form.get("assume4") is not None
|
| 129 |
-
assume5 = request.form.get("assume5") is not None
|
| 130 |
-
|
| 131 |
-
assume = np.array((assume1, assume2, assume3, assume4, assume5))
|
| 132 |
-
|
| 133 |
-
release, diff = calcexposure(MW, amount, vol, area, time, pIndex)
|
| 134 |
-
|
| 135 |
-
if caIndex > 10:
|
| 136 |
-
MOS = TTC / release
|
| 137 |
-
else:
|
| 138 |
-
MOS = 50. * TI / release
|
| 139 |
-
|
| 140 |
-
iMOS = TTC / impurity
|
| 141 |
-
|
| 142 |
-
release = sigfigs(release, 2)
|
| 143 |
-
MOS = sigfigs(MOS, 2)
|
| 144 |
-
diff = sigfigs(diff, 2)
|
| 145 |
-
iMOS = sigfigs(iMOS, 2)
|
| 146 |
-
impurity = sigfigs(impurity, 2)
|
| 147 |
-
|
| 148 |
-
return render_template('report.html', polymers=polymers, pIndex=pIndex, caIndex=caIndex, release=release,
|
| 149 |
-
assume=assume,
|
| 150 |
-
area=area, vol=vol, amount=amount, diff=diff, time=time, exposure=exposure, TTC=TTC,
|
| 151 |
-
isCA=isCA, TI=TI, MOS=MOS,
|
| 152 |
-
chemName=chemName, impurity=impurity, iMOS=iMOS)
|
| 153 |
-
|
| 154 |
@app.route('/exposure', methods=['POST'])
|
| 155 |
def exp_post():
|
| 156 |
amount = float(request.form["amount"])
|
|
|
|
| 66 |
app = Flask(__name__)
|
| 67 |
app.debug = True
|
| 68 |
|
| 69 |
+
from color_module import blueprint
|
| 70 |
+
app.register_blueprint(blueprint)
|
| 71 |
+
|
| 72 |
@app.route('/', methods=['GET'])
|
| 73 |
def app_init():
|
| 74 |
return render_template('main.html')
|
| 75 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
@app.route('/exposure', methods=['GET'])
|
| 77 |
def exposure():
|
| 78 |
return render_template('exposure_index.html', polymers=polymers, CAs=CAs, caMW=caMW)
|
| 79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
@app.route('/exposure', methods=['POST'])
|
| 81 |
def exp_post():
|
| 82 |
amount = float(request.form["amount"])
|
color_module/__init__.py
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from flask import Blueprint
|
| 2 |
+
|
| 3 |
+
blueprint = Blueprint('color_module', __name__, template_folder='templates', static_folder='static', static_url_path='/color_module')
|
| 4 |
+
|
| 5 |
+
from . import colors
|
color_module/colors.py
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import numpy as np
|
| 2 |
+
from flask import render_template, request
|
| 3 |
+
from functions import *
|
| 4 |
+
from . import blueprint
|
| 5 |
+
|
| 6 |
+
# Named polymer matrices and category numbers
|
| 7 |
+
nPoly = 20
|
| 8 |
+
PolyData = np.zeros((nPoly,), dtype=[('name', 'a75'), ('Category', 'i')])
|
| 9 |
+
PolyData[0] = ('Silicone', 0)
|
| 10 |
+
PolyData[1] = ('Polyethylene (density <= 0.94 g/cm3)', 1)
|
| 11 |
+
PolyData[2] = ('Polyethylene (density > 0.94 g/cm3)', 2)
|
| 12 |
+
PolyData[3] = ('Polyethylene terephthalate', 3)
|
| 13 |
+
PolyData[4] = ('Polyurethane (polyether)', 1)
|
| 14 |
+
PolyData[5] = ('Polycarbonate', 3)
|
| 15 |
+
PolyData[6] = ('Polyoxymethylene', 2)
|
| 16 |
+
PolyData[7] = ('Poly(methyl methacrylate)', 3)
|
| 17 |
+
PolyData[8] = ('Acrylonitrile butadiene styrene', 2)
|
| 18 |
+
PolyData[9] = ('Polyether block amide', 1)
|
| 19 |
+
PolyData[10] = ('Polyamide', 3)
|
| 20 |
+
PolyData[11] = ('Polystyrene', 3)
|
| 21 |
+
PolyData[12] = ('Polyvinyl chloride (plasticized)', 0)
|
| 22 |
+
PolyData[13] = ('Polytetrafluoroethylene', 2)
|
| 23 |
+
PolyData[14] = ('Polyvinyl acetate', 1)
|
| 24 |
+
PolyData[15] = ('Polypropylene', 2)
|
| 25 |
+
PolyData[16] = ('Polybutylene terephthalate', 3)
|
| 26 |
+
PolyData[17] = ('Polyetheretherketone', 3)
|
| 27 |
+
PolyData[18] = ('Fluorinated ethylene propylene', 2)
|
| 28 |
+
PolyData[19] = ('Other polymer', 4)
|
| 29 |
+
|
| 30 |
+
nCA = 14
|
| 31 |
+
caData = np.zeros((nPoly,), dtype=[('name', 'a75'), ('TI', 'd'), ('MW', 'd')])
|
| 32 |
+
caData[0] = ('Titanium dioxide (CAS#:13463-67-7)', 1.0, 1100.)
|
| 33 |
+
caData[1] = ('Carbon black (CAS#:1333-86-4)', 2.0, 1100.)
|
| 34 |
+
caData[2] = ('Pigment brown 24 (CAS#:68186-90-3)', 0.5, 1100.)
|
| 35 |
+
caData[3] = ('Zinc Oxide (CAS#:1314-13-2)', 0.05, 1100.)
|
| 36 |
+
caData[4] = ('Pigment Red 101 (CAS#: 1309-37-1)', 1.0, 1100.)
|
| 37 |
+
caData[5] = ('Solvent violet 13 (CAS#:81-48-1)', 0.0013, 319.4)
|
| 38 |
+
caData[6] = ('Manganese phthalocyanine (CAS#:14325-24-7)', 0.15, 567.5)
|
| 39 |
+
caData[7] = ('Pigment blue 15 (CAS#:147-14-8)', 0.15, 576.1)
|
| 40 |
+
caData[8] = ('Phthalocyanine green (CAS#:1326-53-6)', 0.15, 1092.8)
|
| 41 |
+
caData[9] = ('Ultramarine blue (CAS#:57445-37-5)', 3.3, 1100.)
|
| 42 |
+
caData[10] = ('Pigment Yellow 138 (CAS#:30125-47-4)', 1.0, 693.96)
|
| 43 |
+
caData[11] = ('Other metal oxide color additive', 1.0, 1100.0)
|
| 44 |
+
caData[12] = ('Other non-metal oxide color additive', 1.0, 1100.0)
|
| 45 |
+
caData[13] = ('Other compound (non-color additive)', 1.0, 1100.0)
|
| 46 |
+
|
| 47 |
+
polymers = np.zeros(nPoly, dtype='object')
|
| 48 |
+
for i in range(nPoly):
|
| 49 |
+
polymers[i] = PolyData[i][0].decode('UTF-8')
|
| 50 |
+
|
| 51 |
+
CAs = np.zeros(nCA, dtype='object')
|
| 52 |
+
caMW = np.zeros(nCA, dtype='object')
|
| 53 |
+
for i in range(nCA):
|
| 54 |
+
CAs[i] = caData[i][0].decode('UTF-8')
|
| 55 |
+
for i in range(nCA):
|
| 56 |
+
caMW[i] = caData[i][2]
|
| 57 |
+
|
| 58 |
+
@blueprint.route('/color', methods=['GET'])
|
| 59 |
+
def colors():
|
| 60 |
+
return render_template('index.html', polymers=polymers, CAs=CAs, caMW=caMW)
|
| 61 |
+
|
| 62 |
+
@blueprint.route('/color', methods=['POST'])
|
| 63 |
+
def app_post():
|
| 64 |
+
amount = float(request.form["amount"])
|
| 65 |
+
mass = float(request.form["mass"])
|
| 66 |
+
density = float(request.form["density"])
|
| 67 |
+
vol = mass / density
|
| 68 |
+
polymer = request.form["polymer"]
|
| 69 |
+
pIndex = (np.where(polymers == polymer)[0])[0]
|
| 70 |
+
area = float(request.form["area"])
|
| 71 |
+
exposure = request.form["exposure"]
|
| 72 |
+
CA = request.form["CA"]
|
| 73 |
+
caIndex = (np.where(CAs == CA)[0])[0]
|
| 74 |
+
|
| 75 |
+
TI = caData[caIndex][1]
|
| 76 |
+
impurity = 1.
|
| 77 |
+
MW = 1100.
|
| 78 |
+
isCA = True
|
| 79 |
+
chemName = ''
|
| 80 |
+
|
| 81 |
+
if caIndex < 11:
|
| 82 |
+
MW = caData[caIndex][2]
|
| 83 |
+
chemName = '*' + caData[caIndex][0].decode('UTF-8') + '*'
|
| 84 |
+
impurity = float(request.form["impurity"]) * amount * 1e-2
|
| 85 |
+
if caIndex == 11:
|
| 86 |
+
MW = caData[caIndex][2]
|
| 87 |
+
chemName = '*' + request.form["chemName"] + '*'
|
| 88 |
+
impurity = float(request.form["impurity"]) * amount * 1e-2
|
| 89 |
+
if caIndex == 12:
|
| 90 |
+
MW = float(request.form["MW"])
|
| 91 |
+
chemName = '*' + request.form["chemName"] + '*'
|
| 92 |
+
impurity = float(request.form["impurity"]) * amount * 1e-2
|
| 93 |
+
if caIndex == 13:
|
| 94 |
+
MW = float(request.form["MW"])
|
| 95 |
+
chemName = '*' + request.form["chemName"] + '*'
|
| 96 |
+
|
| 97 |
+
if exposure != "limited":
|
| 98 |
+
time = 24.
|
| 99 |
+
else:
|
| 100 |
+
time = float(request.form["exptime"])
|
| 101 |
+
if exposure != "long-term":
|
| 102 |
+
TTC = 0.12
|
| 103 |
+
else:
|
| 104 |
+
TTC = 0.0015
|
| 105 |
+
|
| 106 |
+
assume1 = request.form.get("assume1") is not None
|
| 107 |
+
assume2 = request.form.get("assume2") is not None
|
| 108 |
+
assume3 = request.form.get("assume3") is not None
|
| 109 |
+
assume4 = request.form.get("assume4") is not None
|
| 110 |
+
assume5 = request.form.get("assume5") is not None
|
| 111 |
+
|
| 112 |
+
assume = np.array((assume1, assume2, assume3, assume4, assume5))
|
| 113 |
+
|
| 114 |
+
release, diff = calcexposure(MW, amount, vol, area, time, pIndex, PolyData)
|
| 115 |
+
|
| 116 |
+
if caIndex > 10:
|
| 117 |
+
MOS = TTC / release
|
| 118 |
+
else:
|
| 119 |
+
MOS = 50. * TI / release
|
| 120 |
+
|
| 121 |
+
iMOS = TTC / impurity
|
| 122 |
+
|
| 123 |
+
release = sigfigs(release, 2)
|
| 124 |
+
MOS = sigfigs(MOS, 2)
|
| 125 |
+
diff = sigfigs(diff, 2)
|
| 126 |
+
iMOS = sigfigs(iMOS, 2)
|
| 127 |
+
impurity = sigfigs(impurity, 2)
|
| 128 |
+
|
| 129 |
+
return render_template('report.html', polymers=polymers, pIndex=pIndex, caIndex=caIndex, release=release,
|
| 130 |
+
assume=assume,
|
| 131 |
+
area=area, vol=vol, amount=amount, diff=diff, time=time, exposure=exposure, TTC=TTC,
|
| 132 |
+
isCA=isCA, TI=TI, MOS=MOS,
|
| 133 |
+
chemName=chemName, impurity=impurity, iMOS=iMOS)
|
{static β color_module/static}/COU.html
RENAMED
|
File without changes
|
{static β color_module/static}/COU.md
RENAMED
|
File without changes
|
{static β color_module/static}/FAQ.html
RENAMED
|
File without changes
|
{static β color_module/static}/FAQ.md
RENAMED
|
File without changes
|
{static β color_module/static}/README.html
RENAMED
|
File without changes
|
{static β color_module/static}/README.md
RENAMED
|
File without changes
|
{static β color_module/static}/ToxProfiles.pdf
RENAMED
|
File without changes
|
color_module/static/images/FDAgraphic.png
ADDED
|
Git LFS Details
|
color_module/static/images/FDAlogo.png
ADDED
|
Git LFS Details
|
color_module/static/md2html.sh
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
pandoc FAQ.md > FAQ.html
|
| 4 |
+
pandoc README.md > README.html
|
| 5 |
+
pandoc COU.md > COU.html
|
| 6 |
+
pandoc exposure_COU.md > exposure_COU.html
|
| 7 |
+
|
color_module/static/styles.css
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
body {font-family: Arial, Helvetica, sans-serif;}
|
| 2 |
+
|
| 3 |
+
/* The Modal (background) */
|
| 4 |
+
.modal {
|
| 5 |
+
display: none; /* Hidden by default */
|
| 6 |
+
position: fixed; /* Stay in place */
|
| 7 |
+
z-index: 1; /* Sit on top */
|
| 8 |
+
padding-top: 100px; /* Location of the box */
|
| 9 |
+
left: 0;
|
| 10 |
+
top: 0;
|
| 11 |
+
width: 100%; /* Full width */
|
| 12 |
+
height: 100%; /* Full height */
|
| 13 |
+
max-height: calc(100vh - 210px);
|
| 14 |
+
overflow: auto; /* Enable scroll if needed */
|
| 15 |
+
background-color: rgb(0,0,0); /* Fallback color */
|
| 16 |
+
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
/* Modal Content */
|
| 20 |
+
.modal-content {
|
| 21 |
+
background-color: #fefefe;
|
| 22 |
+
margin: auto;
|
| 23 |
+
padding: 20px;
|
| 24 |
+
border: 1px solid #888;
|
| 25 |
+
width: 80%;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
/* The Close Button */
|
| 29 |
+
.close {
|
| 30 |
+
color: #aaaaaa;
|
| 31 |
+
float: right;
|
| 32 |
+
font-size: 28px;
|
| 33 |
+
font-weight: bold;
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
.close:hover,
|
| 37 |
+
.close:focus {
|
| 38 |
+
color: #000;
|
| 39 |
+
text-decoration: none;
|
| 40 |
+
cursor: pointer;
|
| 41 |
+
}
|
| 42 |
+
|
{templates β color_module/templates}/index.html
RENAMED
|
@@ -27,9 +27,9 @@
|
|
| 27 |
for their device type and color additive. </strong></p>
|
| 28 |
|
| 29 |
|
| 30 |
-
<p> For details on how to use CHRIS, please read the <a href="{{url_for('static', filename='README.html')}}"> instructions.</a> and
|
| 31 |
-
<a href="{{url_for('static', filename='COU.html')}}"> context of use (COU)</a>. Answers to frequently asked questions can be
|
| 32 |
-
found <a href="{{url_for('static', filename='FAQ.html')}}"> here</a>.</p>
|
| 33 |
|
| 34 |
<body>
|
| 35 |
|
|
|
|
| 27 |
for their device type and color additive. </strong></p>
|
| 28 |
|
| 29 |
|
| 30 |
+
<p> For details on how to use CHRIS, please read the <a href="{{url_for('.static', filename='README.html')}}"> instructions.</a> and
|
| 31 |
+
<a href="{{url_for('color_module.static', filename='COU.html')}}"> context of use (COU)</a>. Answers to frequently asked questions can be
|
| 32 |
+
found <a href="{{url_for('color_module.static', filename='FAQ.html')}}"> here</a>.</p>
|
| 33 |
|
| 34 |
<body>
|
| 35 |
|
{templates β color_module/templates}/report.html
RENAMED
|
File without changes
|
functions.py
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import math
|
| 2 |
+
import numpy as np
|
| 3 |
+
|
| 4 |
+
def sigfigs(number, n):
|
| 5 |
+
return round(number, n - int(math.floor(math.log10(math.fabs(number)))) - 1)
|
| 6 |
+
|
| 7 |
+
def calcexposure(MW, amount, vol, area, time, pIndex, PolyData):
|
| 8 |
+
Ap = np.array((16.9, 11.7, 8.2, 2.6))
|
| 9 |
+
L = vol / area
|
| 10 |
+
if PolyData[pIndex][1] < 4:
|
| 11 |
+
D = 1e4 * np.exp(Ap[PolyData[pIndex][1]] - 0.1351 * MW ** (2. / 3.) + 0.003 * MW - 10454. / 310.)
|
| 12 |
+
else:
|
| 13 |
+
Va = 4.76 + 1.32 * MW
|
| 14 |
+
D = 7.4e-8 * (18. * 2.6) ** 0.5 * 310. / 0.6913 / Va ** 0.6
|
| 15 |
+
|
| 16 |
+
D = D * 3600.
|
| 17 |
+
tau = D * time / L ** 2.
|
| 18 |
+
if tau <= 0.5:
|
| 19 |
+
release = 2. * amount * np.sqrt(tau / np.pi)
|
| 20 |
+
else:
|
| 21 |
+
release = amount * (1. - (8. / (np.pi ** 2.)) * np.exp(-tau * np.pi ** 2. / 4.))
|
| 22 |
+
|
| 23 |
+
return release, D
|
| 24 |
+
|
| 25 |
+
def calcrates(MW, amount, vol, area, time, pIndex):
|
| 26 |
+
Ap = np.array((16.9, 11.7, 8.2, 2.6))
|
| 27 |
+
L = vol / area
|
| 28 |
+
if PolyData[pIndex][1] < 4:
|
| 29 |
+
D = 1e4 * np.exp(Ap[PolyData[pIndex][1]] - 0.1351 * MW ** (2. / 3.) + 0.003 * MW - 10454. / 310.)
|
| 30 |
+
else:
|
| 31 |
+
Va = 4.76 + 1.32 * MW
|
| 32 |
+
D = 7.4e-8 * (18. * 2.6) ** 0.5 * 310. / 0.6913 / Va ** 0.6
|
| 33 |
+
D = D * 86400.
|
| 34 |
+
|
| 35 |
+
rates = np.zeros(len(time))
|
| 36 |
+
tau = D * time[0] / L ** 2.
|
| 37 |
+
if tau < 0.2:
|
| 38 |
+
rates[0] = 2. * amount * np.sqrt(tau / np.pi)
|
| 39 |
+
else:
|
| 40 |
+
rates[0] = amount * (1. - (8. / (np.pi ** 2.)) * np.exp(-tau * np.pi ** 2. / 4.))
|
| 41 |
+
|
| 42 |
+
for i in range(1, len(time)):
|
| 43 |
+
tau = D * time[i] / L ** 2.
|
| 44 |
+
if tau < 0.2:
|
| 45 |
+
rates[i] = 2. * amount * np.sqrt(tau / np.pi) - np.sum(rates[:i])
|
| 46 |
+
else:
|
| 47 |
+
rates[i] = amount * (1. - (8. / (np.pi ** 2.)) * np.exp(-tau * np.pi ** 2. / 4.)) - np.sum(rates[:i])
|
| 48 |
+
|
| 49 |
+
return rates
|
static/mainpage.css
DELETED
|
@@ -1,9 +0,0 @@
|
|
| 1 |
-
a {
|
| 2 |
-
display:inline-block;
|
| 3 |
-
vertical-align: middle;
|
| 4 |
-
text-align: center;
|
| 5 |
-
width:150px;
|
| 6 |
-
height:150px;
|
| 7 |
-
background-color:#fff;
|
| 8 |
-
border:5px solid #0070C0;
|
| 9 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
templates/main.html
CHANGED
|
@@ -4,8 +4,6 @@
|
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<title>CHRIS</title>
|
| 6 |
|
| 7 |
-
<!-- <link rel= "stylesheet" type= "text/css" href= "{{ url_for('static',filename='mainpage.css') }}">-->
|
| 8 |
-
|
| 9 |
</head>
|
| 10 |
|
| 11 |
<img src="{{ url_for('static',filename='images/FDAlogo.png') }}" style="float: left;" height="100"/>
|
|
|
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<title>CHRIS</title>
|
| 6 |
|
|
|
|
|
|
|
| 7 |
</head>
|
| 8 |
|
| 9 |
<img src="{{ url_for('static',filename='images/FDAlogo.png') }}" style="float: left;" height="100"/>
|