added equivalency module
Browse files- CHRIS.py +4 -1
- equivalency_module/__init__.py +5 -0
- equivalency_module/equivalency.py +26 -0
- equivalency_module/static/Changelog.md +24 -0
- equivalency_module/static/equivalency_COU.md +19 -0
- equivalency_module/static/images/FDAgraphic.png +3 -0
- equivalency_module/static/images/FDAlogo.png +3 -0
- equivalency_module/static/md2html.sh +5 -0
- equivalency_module/templates/equivalency_index.html +56 -0
- static/images/molecules.png +3 -0
CHRIS.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
from flask import Flask, render_template
|
| 2 |
|
| 3 |
app = Flask(__name__)
|
| 4 |
-
app.debug =
|
| 5 |
|
| 6 |
from color_module import blueprint
|
| 7 |
app.register_blueprint(blueprint)
|
|
@@ -18,6 +18,9 @@ app.register_blueprint(blueprint)
|
|
| 18 |
from exposure2_module import blueprint
|
| 19 |
app.register_blueprint(blueprint)
|
| 20 |
|
|
|
|
|
|
|
|
|
|
| 21 |
@app.route('/', methods=['GET'])
|
| 22 |
def app_init():
|
| 23 |
return render_template('main.html')
|
|
|
|
| 1 |
from flask import Flask, render_template
|
| 2 |
|
| 3 |
app = Flask(__name__)
|
| 4 |
+
app.debug = True
|
| 5 |
|
| 6 |
from color_module import blueprint
|
| 7 |
app.register_blueprint(blueprint)
|
|
|
|
| 18 |
from exposure2_module import blueprint
|
| 19 |
app.register_blueprint(blueprint)
|
| 20 |
|
| 21 |
+
from equivalency_module import blueprint
|
| 22 |
+
app.register_blueprint(blueprint)
|
| 23 |
+
|
| 24 |
@app.route('/', methods=['GET'])
|
| 25 |
def app_init():
|
| 26 |
return render_template('main.html')
|
equivalency_module/__init__.py
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from flask import Blueprint
|
| 2 |
+
|
| 3 |
+
blueprint = Blueprint('equivalency_module', __name__, template_folder='templates', static_folder='static', static_url_path='/equivalency_module')
|
| 4 |
+
|
| 5 |
+
from . import equivalency
|
equivalency_module/equivalency.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import numpy as np
|
| 2 |
+
from flask import render_template, request, session
|
| 3 |
+
from . import blueprint
|
| 4 |
+
from numpy import *
|
| 5 |
+
from scipy.special import erf
|
| 6 |
+
from scipy import integrate
|
| 7 |
+
|
| 8 |
+
def max_CDF(x, mu, sigma, N):
|
| 9 |
+
return (0.5 * (1. + erf((x - mu) / sigma / sqrt(2)))) ** N
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def max_PDF(x, mu, sigma, N):
|
| 13 |
+
return (1. + erf((x - mu) / sigma / sqrt(2))) ** (N - 1) * N * 2. ** (0.5 - N) * exp(
|
| 14 |
+
-(-mu + x) ** 2. / (2. * sigma ** 2.)) / sqrt(pi) / sigma
|
| 15 |
+
|
| 16 |
+
def max_PDFCDF(y, lamb, mu_x, mu_y, sigma_x, sigma_y, N):
|
| 17 |
+
return max_PDF(y, mu_y, sigma_y, N) * max_CDF(y * lamb, mu_x, sigma_x, N)
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
# load the index page for the equivalency module
|
| 22 |
+
@blueprint.route('/equivalency', methods=['GET','POST'])
|
| 23 |
+
def equivalency():
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
return render_template('equivalency_index.html',)
|
equivalency_module/static/Changelog.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
```{=html}
|
| 2 |
+
<!DOCTYPE html>
|
| 3 |
+
<html lang="en">
|
| 4 |
+
<head>
|
| 5 |
+
<title>CHRIS-COU</title>
|
| 6 |
+
<link rel="stylesheet" href="styles.css">
|
| 7 |
+
<meta charset="UTF-8">
|
| 8 |
+
|
| 9 |
+
</head>
|
| 10 |
+
|
| 11 |
+
<header>
|
| 12 |
+
<h1 style="text-align:center"><font color="#0070C0">CH</font>emical <font color="#0070C0">RIS</font>k calculators (CHRIS) - Extraction efficiency</h1>
|
| 13 |
+
</header>
|
| 14 |
+
```
|
| 15 |
+
## Change Log
|
| 16 |
+
|
| 17 |
+
### Version 1.0 - 2023-05-16
|
| 18 |
+
|
| 19 |
+
* RST version
|
| 20 |
+
* Added link to reference manuscript
|
| 21 |
+
|
| 22 |
+
### Version 0.1 - 2023-01-05
|
| 23 |
+
|
| 24 |
+
* Development version released
|
equivalency_module/static/equivalency_COU.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
```{=html}
|
| 2 |
+
<!DOCTYPE html>
|
| 3 |
+
<html lang="en">
|
| 4 |
+
<head>
|
| 5 |
+
<title>Equivalency-COU</title>
|
| 6 |
+
<link rel="stylesheet" href="../../static/styles.css">
|
| 7 |
+
<meta charset="UTF-8">
|
| 8 |
+
</head>
|
| 9 |
+
|
| 10 |
+
<header>
|
| 11 |
+
<img src="images/FDAlogo.png" style="float: left;" height="100"/>
|
| 12 |
+
<img src="images/FDAgraphic.png" style="float: right;" height="100"/>
|
| 13 |
+
<br clear="all" />
|
| 14 |
+
<h1 style="text-align:center">CHRIS: <font color="#0070C0">CH</font>emical <font color="#0070C0">RIS</font>k calculators - Equivalency Requirements </h1>
|
| 15 |
+
</header>
|
| 16 |
+
```
|
| 17 |
+
|
| 18 |
+
## Context of Use (COU)
|
| 19 |
+
|
equivalency_module/static/images/FDAgraphic.png
ADDED
|
Git LFS Details
|
equivalency_module/static/images/FDAlogo.png
ADDED
|
Git LFS Details
|
equivalency_module/static/md2html.sh
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
pandoc efficiency_COU.md > efficiency_COU.html
|
| 4 |
+
pandoc Changelog.md > Changelog.html
|
| 5 |
+
|
equivalency_module/templates/equivalency_index.html
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<title>CHRIS</title>
|
| 6 |
+
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js" ></script>
|
| 7 |
+
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
|
| 8 |
+
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.min.js" integrity="sha384-VHvPCCyXqtD5DqJeNxl2dtTyhF78xXNXdkwX1CZeRusQfRKp+tA7hAShOK/B/fQ2" crossorigin="anonymous"></script>
|
| 9 |
+
<link rel= "stylesheet" type= "text/css" href= "{{ url_for('static',filename='styles.css') }}">
|
| 10 |
+
|
| 11 |
+
<style>
|
| 12 |
+
table, th, td {
|
| 13 |
+
border: 1px solid black;
|
| 14 |
+
border-collapse: collapse;
|
| 15 |
+
}
|
| 16 |
+
</style>
|
| 17 |
+
|
| 18 |
+
</head>
|
| 19 |
+
|
| 20 |
+
<img src="{{ url_for('static',filename='images/FDAlogo.png') }}" style="float: left;" height="100"/>
|
| 21 |
+
<img src="{{ url_for('static',filename='images/molecules.png') }}" style="float: right;" height="100"/>
|
| 22 |
+
<br clear="all" />
|
| 23 |
+
|
| 24 |
+
<header>
|
| 25 |
+
<h1 style="text-align:center"><font color="#0070C0">CH</font>emical <font color="#0070C0">RIS</font>k calculators (CHRIS) - Equivalency</h1>
|
| 26 |
+
|
| 27 |
+
<p>
|
| 28 |
+
For details on how to use the CHRIS equivalency module, please click the information icons next to each field and read the
|
| 29 |
+
<a href="{{url_for('.static', filename='equivalency_COU.html')}}"> context of use (COU)</a>, which includes limitations of use.
|
| 30 |
+
You are accessing v.1.0 on <script> document.write(new Date().toLocaleDateString()); </script>. For a history of updates,
|
| 31 |
+
please see the <a href="{{url_for('.static', filename='Changelog.html')}}"> changelog</a>.
|
| 32 |
+
</p>
|
| 33 |
+
|
| 34 |
+
</header>
|
| 35 |
+
|
| 36 |
+
<body>
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
<form method="POST" id="theForm" align="left">
|
| 40 |
+
|
| 41 |
+
RSD: <input name="RSD" id="RSD" value="0.2" step="0.05" min="0.001" type="number" required> <br>
|
| 42 |
+
N: <input name="N" id="N" value="3" step="1" min="1" type="number" onchange="this.value = parseInt(this.value);" required> <br>
|
| 43 |
+
FPR (%): <input name="FPR" id="FPR" value="0.3" step="0.1" min="0.0001" type="number" required> <br>
|
| 44 |
+
FNR (%): <input name="FNR" id="FNR" value="0.3" step="0.1" min="0.0001" type="number" required> <br> <br>
|
| 45 |
+
|
| 46 |
+
Acceptance criterion: <br>
|
| 47 |
+
Minimum MOS: <br>
|
| 48 |
+
|
| 49 |
+
<br> <button type="submit">Calculate</button>
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
</form>
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
</body>
|
| 56 |
+
</html>
|
static/images/molecules.png
ADDED
|
Git LFS Details
|