-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
167 lines (139 loc) · 4.89 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name=viewport content='width=700'>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Conversion for Raman Spectroscopy</title>
<!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> -->
<style>
html,
body {
font-size: 1.25rem;
}
#root {
width: fit-content;
height: 98vh;
margin: 0 auto;
padding: 0 1rem;
display: flex;
flex-flow: column;
}
#header {
margin-bottom: 3rem;
text-align: center;
}
#header>div:first-child {
padding-right: 1rem;
font-size: 1.75rem;
font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
}
#header>div:nth-child(2) {
font-size: 1rem;
text-overflow: ellipsis;
}
#mainBody {
flex: 1;
}
input[type='text'],
input[type='file'],
input[type='number'],
input[type='submit'],
select {
font-size: 1.0rem;
width: 10pc;
}
input:disabled {
background: white;
color: black;
border: solid 1px black
}
#form {
display: grid;
grid-auto-flow: row;
grid-column-gap: .5em;
grid-row-gap: 0.5em;
grid-template-columns: 1fr 1fr;
grid-template-rows: repeat(3, max-content);
align-items: center;
}
hr{
height: 1px;
background-color: black;
}
#note {
font-style: italic;
font-size: medium;
text-align: center;
width: 60%;
margin: 5em auto;
}
#footer{
font-size: 0.9rem;
text-align: center;
}
</style>
</head>
<!-- ToDo: Inherit from a base template -->
<body>
<div id="root">
<div id="header">
<div>Conversion for <br>
Raman Spectroscopy</div>
<!-- Change the printer name here. -->
<div style="font-style: italic;">cm<sup>-1</sup> to nm (and vice versa) </div>
<!-- ToDo: Use pycups to detect printer name dynamically -->
<hr>
</div>
<div id="mainBody">
<div id='form'>
<label>Laser Wevelength (nm) </label> <input id="laser-wavelenght" type="number" step=0.0001>
<label>Raman Mode (nm) </label> <input id="raman-mode" type="number" step=0.0001>
<label>Raman Shift (cm<sup>-1</sup>) </label> <input id="raman-shift" type="number" step=0.0001>
<label>Phonon Energy (meV) </label> <input id="ph-enr-mev" type="number" step=0.0001 disabled>
<label>Phonon Energy (THz) </label> <input id="ph-enr-tz" type="number" step=0.0001 disabled>
</div>
<div>
<p id="note">
<b>Note:</b> -ve sign in Raman Shift signifies Stokes line and +ve sign for AntiStokes
</p>
</div>
</div>
<div id="footer">
<div id="add">
Created by <a href="https://github.com/Koushikphy"> Koushikphy</a>
</div>
</div>
</div>
</div>
<script>
const laserWavelength = document.getElementById('laser-wavelenght')
const ramanMode = document.getElementById('raman-mode')
const ramanShift = document.getElementById('raman-shift')
const phEnergyMev = document.getElementById('ph-enr-mev')
const phEnergyThz = document.getElementById('ph-enr-tz')
const roundToThree = (x) => Math.round(x * 1000) / 1000
ramanMode.oninput = (ev) => {
var lwVal = laserWavelength.value
var rmVal = ramanMode.value
var rsVal = (1 / lwVal - 1 / rmVal) * 1e7
ramanShift.value = roundToThree(rsVal)
var tmp = Math.abs(1 / lwVal - 1 / rmVal)* 1239.8 * 1000
console.log(tmp, tmp * 0.2418)
phEnergyMev.value = roundToThree(tmp)
phEnergyThz.value = roundToThree(tmp * 0.2418)
}
ramanShift.oninput = (ev) => {
var lwVal = laserWavelength.value
var rsVal = ramanShift.value
var rmVal = 1.0 / (1.0 / lwVal - rsVal / 1.0e7)
ramanMode.value = roundToThree(rmVal)
var tmp = Math.abs(1 / lwVal - 1 / rmVal)* 1239.8 * 1000
console.log(tmp, tmp * 0.2418)
phEnergyMev.value = roundToThree(tmp)
phEnergyThz.value = roundToThree(tmp * 0.2418)
}
</script>
</body>
</html>