webmo 1.1.4__tar.gz → 1.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,12 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: webmo
3
- Version: 1.1.4
3
+ Version: 1.2.0
4
4
  Summary: A Python-based interface to WebMO
5
5
  Home-page: https://github.com/jrschmidt2/webmo-python
6
- Download-URL: https://github.com/jrschmidt2/webmo-python/archive/refs/tags/1.1.4.tar.gz
6
+ Download-URL: https://github.com/jrschmidt2/webmo-python/archive/refs/tags/1.2.0.tar.gz
7
7
  Author: J.R. Schmidt
8
8
  Author-email: schmidt@webmo.net
9
9
  License: MIT
10
10
  Keywords: WEBMO,REST,API
11
+ Provides-Extra: spectrum
11
12
  License-File: LICENSE
@@ -31,5 +31,8 @@ setup(
31
31
  install_requires=[
32
32
  'requests',
33
33
  'websockets',
34
- ],
34
+ ],
35
+ extras_require={
36
+ "spectrum": ["numpy"]
37
+ }
35
38
  )
@@ -1,2 +1,2 @@
1
1
  from .webmo_rest import WebMOREST
2
- __version__ = "1.1.4"
2
+ __version__ = "1.2.0"
@@ -0,0 +1,448 @@
1
+ import numpy as np
2
+
3
+ #
4
+ # lineshape functions
5
+ #
6
+
7
+ def _faddeeva(z):
8
+ """
9
+ Calculates the scaled complex complementary function in the complex plane.
10
+ We use this to calculate voigt lineshapes.
11
+ """
12
+ if _faddeeva.run_yet == False:
13
+ _faddeeva.run_yet = True
14
+ _faddeeva.N = 1000
15
+ _faddeeva.L = np.sqrt(_faddeeva.N / np.sqrt(2))
16
+ # our basis set. 1000 elements hits a good blend of speed and accuracy.
17
+ l = [
18
+ 5.11748989e-16,-1.44365777e-16,1.71205586e-16,1.43270169e-16,
19
+ 2.40509424e-16,9.34400028e-17,3.33586468e-16,2.07038704e-16,
20
+ 3.95030052e-16,-2.26565767e-17,2.99460336e-16,5.72632548e-16,
21
+ 1.29042294e-16,-7.07527120e-17,-5.62526370e-18,2.36711749e-16,
22
+ 1.02183724e-16,-4.34250382e-16,-8.07532865e-17,-4.96929924e-16,
23
+ 1.26045192e-16,-2.53796359e-16,-1.03766119e-16,-2.15858058e-16,
24
+ -1.83552885e-16,-8.67481915e-17,-3.07549909e-16,-2.74584240e-16,
25
+ -2.69389284e-17,-4.24362029e-16,-5.95060089e-16,-3.70830265e-16,
26
+ 2.29567357e-16,7.09903912e-17,-9.60967179e-16,2.56731866e-16,
27
+ -4.28826105e-16,-4.30205991e-16,-5.08718759e-16,-2.72358486e-16,
28
+ -2.89119580e-16,-3.97432513e-16,-4.35239789e-16,-8.06482626e-17,
29
+ -8.25507147e-16,-3.76087656e-16,-8.24193610e-16,-5.49494587e-16,
30
+ -6.65608655e-16,-7.53824209e-16,-7.22452074e-16,-3.57335854e-16,
31
+ -2.98311037e-16,-4.14104958e-16,-2.58059335e-16,-7.98829398e-16,
32
+ -3.86795717e-16,-2.37823897e-16,-1.83073068e-16,-8.98227362e-17,
33
+ -5.28120565e-17,-4.52881008e-16,-1.81103394e-16,-8.56200133e-17,
34
+ -1.22186640e-16,-5.41322089e-17,-7.24757378e-16,-3.50403658e-16,
35
+ -1.42903007e-16,-1.86846592e-16,-3.94211076e-16,-5.10446457e-16,
36
+ -2.41826709e-16,-1.21038373e-16,-3.79652685e-16,-3.19221360e-16,
37
+ -3.57241318e-16,-3.08579376e-16,-1.28131320e-16,-3.12949918e-16,
38
+ -2.46392992e-16,-2.91414183e-16,-2.85635470e-16,-8.72117464e-17,
39
+ -5.38404011e-17,-7.88752966e-17,8.44277161e-17,2.10083596e-17,
40
+ 1.82773768e-17,-4.62896364e-16,-2.15480876e-16,-3.50123461e-16,
41
+ -2.44328019e-16,-5.22369602e-16,-3.02177957e-16,-4.95661311e-16,
42
+ -2.05232527e-16,-6.89780504e-16,-5.76999940e-16,-3.57086548e-16,
43
+ -1.73695260e-16,-5.10360238e-16,-3.18226893e-16,-6.53936479e-16,
44
+ -4.07209831e-16,-5.23531607e-16,-6.25241467e-16,-5.59616421e-16,
45
+ -5.05190494e-16,-4.95920116e-16,5.91918728e-17,-4.24242069e-16,
46
+ -4.26716888e-16,-1.94214030e-16,-3.91975316e-16,1.89855222e-17,
47
+ -8.41436616e-17,-1.91135361e-16,1.17185773e-16,1.70875441e-17,
48
+ -7.82465278e-17,-4.50946865e-16,-3.49996280e-16,-3.61639701e-16,
49
+ -1.44123098e-16,-4.53945169e-16,-1.19604860e-16,-1.05312368e-16,
50
+ -1.05598414e-16,-1.98885939e-16,-1.60492266e-16,-5.06892532e-17,
51
+ -2.08435369e-16,-1.15672143e-16,-2.28953471e-16,-2.10576416e-16,
52
+ -1.43268468e-16,-3.93351320e-16,-3.19012003e-16,-2.86881044e-16,
53
+ -3.09187106e-16,4.85144017e-17,-1.43142304e-17,-2.05880804e-16,
54
+ -2.88573343e-16,-2.34476402e-16,-4.24449546e-16,-3.15047863e-16,
55
+ 7.15863776e-18,-9.40085268e-17,-3.41068217e-16,-5.81558958e-16,
56
+ -1.23060165e-16,-2.29925794e-16,-1.00051620e-16,2.60549021e-16,
57
+ -1.95855091e-16,-6.47544512e-16,-2.11951657e-16,1.68350302e-16,
58
+ -3.31451746e-16,-9.37946003e-17,-5.38246225e-17,2.45588357e-16,
59
+ -1.55116503e-16,1.47231294e-16,3.32452583e-17,-1.15883349e-16,
60
+ -6.26556401e-17,-4.11199133e-16,3.40065530e-16,2.76793021e-16,
61
+ 4.41447793e-16,5.24289805e-16,2.00946326e-16,3.90427144e-16,
62
+ 1.15328785e-16,1.07955299e-17,-2.17963342e-17,4.93958279e-16,
63
+ 2.49313066e-17,-1.32566816e-16,4.10357049e-16,-4.52822565e-16,
64
+ 4.07881112e-16,-7.92449589e-17,1.19915180e-16,1.39818533e-15,
65
+ 1.00809312e-17,-4.43575229e-16,-5.06216625e-17,4.14292705e-17,
66
+ 3.96859128e-17,-8.34232666e-16,9.11190986e-16,9.32038663e-16,
67
+ 8.84033937e-18,6.99303277e-18,9.01104015e-16,9.15275917e-16,
68
+ 0.00000000e00,9.09494702e-16,0.00000000e00,-9.09494702e-16,
69
+ 0.00000000e00,-9.09494702e-16,-9.09494702e-16,0.00000000e00,
70
+ -9.09494702e-16,0.00000000e00,0.00000000e00,-4.54747351e-16,
71
+ -4.54747351e-16,0.00000000e00,0.00000000e00,4.54747351e-16,
72
+ 4.54747351e-16,0.00000000e00,4.54747351e-16,0.00000000e00,
73
+ 0.00000000e00,0.00000000e00,0.00000000e00,4.54747351e-16,
74
+ 0.00000000e00,4.54747351e-16,4.54747351e-16,-4.54747351e-16,
75
+ 0.00000000e00,0.00000000e00,-4.54747351e-16,-4.54747351e-16,
76
+ 0.00000000e00,2.27373675e-16,-2.27373675e-16,-2.27373675e-16,
77
+ 0.00000000e00,-2.27373675e-16,-3.41060513e-16,-2.27373675e-16,
78
+ -1.13686838e-16,-2.27373675e-16,0.00000000e00,5.68434189e-17,
79
+ 5.68434189e-17,3.97903932e-16,1.70530257e-16,-2.27373675e-16,
80
+ 1.70530257e-16,0.00000000e00,3.12638804e-16,1.42108547e-17,
81
+ -1.13686838e-16,1.98951966e-16,9.94759830e-17,9.94759830e-17,
82
+ 1.20792265e-16,3.41060513e-16,2.62900812e-16,1.06581410e-16,
83
+ 2.73558953e-16,2.13162821e-17,2.87769808e-16,1.81188398e-16,
84
+ 4.19220214e-16,3.90798505e-17,2.38031816e-16,1.49213975e-16,
85
+ 4.86721774e-16,6.03961325e-17,3.49054119e-16,1.88737914e-16,
86
+ 3.00204306e-16,4.88498131e-17,9.72555370e-17,5.17141885e-16,
87
+ 1.27453603e-16,4.18998169e-16,4.35429470e-16,2.03947970e-16,
88
+ 3.28403971e-16,7.09432513e-17,2.75390821e-16,1.28230759e-16,
89
+ 1.38278278e-16,1.62314606e-16,1.17683641e-16,-7.49122986e-17,
90
+ -4.42562653e-17,2.25021390e-16,5.67809688e-17,-9.29117894e-17,
91
+ 4.77465290e-17,-4.95159469e-17,-7.98319744e-17,-1.82109536e-16,
92
+ 1.66366920e-16,-1.86119349e-16,1.35362208e-16,-3.26893894e-16,
93
+ 1.89110880e-16,8.02986150e-17,2.42919400e-16,-1.88988365e-16,
94
+ 1.09200626e-16,-1.55745100e-16,-1.23230690e-16,-7.49633103e-17,
95
+ -1.58868199e-16,-5.36516361e-17,2.77595573e-16,2.81580071e-16,
96
+ -2.95155908e-16,-2.48784798e-16,2.91340472e-16,1.36892539e-16,
97
+ 1.70318153e-16,1.73748269e-16,4.65475589e-17,-2.31324207e-16,
98
+ 1.83833839e-17,-6.04137894e-17,4.80069234e-17,-2.85632380e-16,
99
+ 3.67524426e-17,-4.74434771e-17,-3.17576294e-16,-1.71678676e-16,
100
+ -1.08599054e-16,-2.18406185e-16,1.85501493e-16,-1.46516971e-17,
101
+ -9.07895605e-17,-7.19678890e-17,1.53856704e-16,-1.40846832e-16,
102
+ 7.20265739e-17,-2.54008979e-16,-1.23325143e-16,2.75474757e-16,
103
+ 2.32616486e-16,-1.75463698e-16,9.79362317e-17,2.20669333e-16,
104
+ -2.29810374e-16,-7.95069634e-17,2.87994117e-16,3.12697006e-16,
105
+ 3.14586804e-16,1.79021616e-16,2.06952162e-17,-2.67293573e-16,
106
+ 3.45231230e-16,8.68326886e-17,2.65629639e-16,3.06821693e-18,
107
+ 1.34860677e-16,2.74418053e-16,-3.04162528e-16,1.09786189e-16,
108
+ -1.54948449e-17,-3.43520294e-16,-8.60630571e-17,-3.28755503e-16,
109
+ -2.06357180e-16,-7.70834219e-16,-4.48670877e-16,-4.21195874e-16,
110
+ -3.33542439e-16,-1.12012549e-16,1.31482158e-16,-9.05916732e-17,
111
+ -1.88320054e-16,-2.71973298e-16,-1.85779885e-16,-2.41487719e-16,
112
+ -3.34298416e-16,-1.26864283e-16,-1.07737460e-16,-3.00912980e-16,
113
+ -5.14639839e-16,-3.53320333e-16,-5.69661721e-16,-1.64073995e-16,
114
+ -1.61323191e-16,-6.91875273e-16,2.10402594e-17,-4.97408214e-16,
115
+ -9.58387029e-17,-4.71724194e-16,-2.64915700e-16,-3.20381256e-16,
116
+ -1.81528269e-16,-3.63661361e-16,-3.33501787e-16,-4.82454667e-16,
117
+ 1.92955199e-17,-2.70836693e-16,3.39983475e-17,6.18997114e-17,
118
+ -1.02320106e-16,1.27057441e-16,8.31854263e-17,-1.18884147e-16,
119
+ 9.89208773e-17,2.55999309e-16,-1.28411687e-17,1.37041750e-16,
120
+ 1.06258503e-16,4.81342042e-16,4.98521006e-16,2.55381445e-16,
121
+ 2.54674725e-16,2.62261848e-16,3.83584674e-16,1.89662976e-16,
122
+ 1.26359468e-16,3.08514032e-16,2.58755647e-16,2.87385786e-16,
123
+ 8.62079097e-17,2.85730122e-16,1.60530531e-16,2.12208599e-16,
124
+ -7.50533882e-17,1.03721015e-16,-9.44620129e-17,-1.25196451e-17,
125
+ 1.83989433e-16,1.02092358e-16,1.23199547e-16,3.12924987e-16,
126
+ 7.94899735e-18,3.13515155e-17,-1.91924262e-16,-1.57024233e-16,
127
+ -1.16563275e-16,1.01280507e-16,-3.14811048e-16,-1.99895021e-16,
128
+ 3.17185157e-17,3.72378215e-16,-2.48438099e-17,-1.96408130e-16,
129
+ 2.19875515e-16,-1.48259617e-16,-1.88755403e-16,6.10412835e-17,
130
+ -7.97417495e-17,1.04554694e-16,-1.34343584e-16,1.57394697e-16,
131
+ -2.97867426e-16,9.44191922e-17,-3.12413672e-16,1.09925848e-16,
132
+ -1.70858155e-16,1.22319748e-16,-2.39270244e-16,2.99282075e-16,
133
+ 2.71551291e-16,1.51896598e-16,-1.91045098e-16,3.37244715e-16,
134
+ -1.68447924e-16,2.78788148e-16,-1.02388408e-16,2.28266264e-16,
135
+ -1.06314013e-16,7.49857205e-17,6.80150911e-17,2.62399291e-16,
136
+ 2.93062592e-16,6.72930693e-16,1.23409884e-16,7.80241772e-17,
137
+ 1.23935426e-16,7.42401592e-17,-4.97733202e-17,2.24872387e-17,
138
+ 3.13006754e-17,4.36894318e-16,-2.73584271e-17,5.34106732e-16,
139
+ 3.04015329e-17,3.55236272e-16,2.00061692e-16,2.35008822e-17,
140
+ 2.00115055e-16,7.50216609e-16,1.71467707e-16,5.48936595e-16,
141
+ 6.59987339e-16,9.11465756e-16,3.27550321e-16,3.16454926e-16,
142
+ 3.25061464e-16,3.92881805e-16,4.45080470e-16,4.34813674e-16,
143
+ 2.86276929e-16,2.80084273e-16,4.02814643e-16,2.86153600e-16,
144
+ 1.46638302e-16,2.34169964e-16,-3.36764594e-17,1.72043602e-16,
145
+ 3.94568392e-16,1.84240100e-16,1.58638568e-16,-6.67371223e-17,
146
+ 2.14683219e-16,-4.10907209e-17,-5.60176818e-18,-4.23445380e-16,
147
+ 1.13835939e-18,-1.09095088e-16,8.20242358e-17,8.94645890e-17,
148
+ 1.93399044e-16,3.99021608e-17,-1.82013746e-16,6.18526657e-16,
149
+ -1.11938105e-16,6.66551783e-16,5.13967366e-16,5.58363111e-16,
150
+ -4.19435265e-18,-3.54000381e-16,1.01030703e-16,4.22960946e-16,
151
+ 2.42257871e-16,1.01132651e-16,1.82876993e-16,-9.86957381e-17,
152
+ 3.56039675e-16,1.05496299e-16,3.44095847e-16,5.75735467e-16,
153
+ 2.24941492e-16,2.69783032e-16,1.92864050e-16,-9.74377652e-18,
154
+ 2.79461094e-16,-3.94524145e-16,6.85116549e-17,-3.18711202e-16,
155
+ -7.88669123e-17,7.99601369e-17,-2.31458426e-17,-2.50800230e-16,
156
+ -7.86084747e-17,-4.74833060e-16,-4.36565773e-17,-1.55929470e-16,
157
+ -4.05522987e-16,-3.59094184e-16,-2.55120726e-16,-4.05726600e-16,
158
+ -2.13699502e-16,-5.41348764e-16,-4.78030787e-17,-2.58327801e-16,
159
+ -3.46581471e-16,-3.46533290e-16,-8.53057559e-17,-5.38831280e-16,
160
+ -3.46786352e-16,-4.32363655e-16,-1.68813053e-16,-7.17961227e-17,
161
+ -3.91976466e-16,-2.55961277e-16,-6.32428739e-17,-2.99788312e-16,
162
+ 5.13471358e-17,-4.10951740e-16,-1.03668319e-17,-2.33628706e-16,
163
+ -3.38590834e-16,-5.28009955e-18,-6.29904955e-17,-2.06798096e-16,
164
+ -2.06115411e-16,-5.30012252e-16,-8.60235170e-17,-3.79126886e-16,
165
+ -3.93774310e-16,-1.23453191e-16,-1.98039359e-16,-2.99884806e-16,
166
+ -1.70348792e-16,-5.75530462e-16,-1.90399233e-17,-1.33260936e-16,
167
+ -2.41764387e-16,-2.41057218e-16,2.74137576e-17,-1.43504070e-16,
168
+ -1.79498040e-16,-1.49035292e-16,-5.13045291e-17,7.64957220e-17,
169
+ -9.01996753e-18,7.79047747e-17,8.01635709e-17,1.01525911e-16,
170
+ 3.24917016e-16,1.64160518e-16,1.22226009e-16,5.58281902e-16,
171
+ 7.64857413e-17,2.02497667e-16,8.65193004e-17,3.72152535e-16,
172
+ -9.26868752e-18,-2.09224351e-16,-8.47794702e-17,-1.25922233e-16,
173
+ 1.29086358e-16,2.89461144e-16,-8.20626177e-17,-5.16486509e-17,
174
+ 1.83191796e-16,-3.06674860e-16,-1.13915329e-16,3.80596575e-16,
175
+ -3.28275082e-16,1.10666724e-16,-5.99813539e-17,1.05195582e-16,
176
+ -1.75628122e-16,-3.65824066e-16,-4.36305437e-16,-1.34170680e-16,
177
+ -2.35694163e-18,-8.44147857e-17,-2.29387585e-16,-2.49491085e-16,
178
+ -3.82957891e-16,-2.01082319e-16,-3.69520171e-16,3.08359859e-16,
179
+ -1.99895640e-17,-3.32817349e-16,-1.20815203e-16,-3.95566702e-18,
180
+ -4.24507796e-16,-3.33867325e-16,-6.50492639e-16,-4.67244932e-16,
181
+ -6.40278657e-17,-1.99413595e-16,-6.38794849e-17,-4.86309451e-16,
182
+ -3.90516920e-16,-5.53476004e-16,-4.25387534e-16,-5.07859220e-16,
183
+ 1.50184194e-16,-1.56593179e-16,-5.77023883e-17,-1.20813224e-16,
184
+ -2.42609780e-16,-6.96228162e-16,-2.31425493e-16,-5.63834410e-16,
185
+ -3.28654446e-16,-3.29201011e-16,1.15017889e-16,-5.36343420e-16,
186
+ -2.25728055e-17,-4.08400873e-16,-7.62532358e-18,-5.63480342e-16,
187
+ 2.29275694e-17,-3.86463027e-16,-1.19440287e-16,-1.12034603e-17,
188
+ -4.48245375e-16,-8.71150653e-17,-3.59698822e-16,7.63701580e-16,
189
+ -2.09249540e-16,-7.29027711e-17,4.34806301e-16,2.79370416e-16,
190
+ 4.35781459e-16,9.68543292e-17,1.82341529e-16,4.66259454e-16,
191
+ 4.58752443e-16,-5.47309304e-16,4.82142613e-16,6.60132335e-16,
192
+ 4.61280949e-16,-3.13067390e-16,1.92698504e-16,1.04964129e-16,
193
+ -8.98832392e-17,-3.42289455e-16,3.43710315e-16,3.40297977e-17,
194
+ 2.34400799e-16,3.56171595e-17,-1.35737919e-16,4.13360932e-16,
195
+ 9.28909624e-17,-5.26283763e-17,5.39552046e-16,2.63123975e-16,
196
+ 1.77400491e-16,1.60163316e-16,1.73522799e-16,2.60524046e-16,
197
+ 3.91736558e-16,1.22245854e-16,5.72475581e-16,-2.79943119e-17,
198
+ 5.39626522e-16,4.69224371e-16,1.79053135e-16,4.94826390e-16,
199
+ 3.39932067e-16,8.38290822e-17,2.83931853e-16,5.55942954e-16,
200
+ 4.19747676e-16,2.79124937e-16,2.03558902e-16,4.24519122e-16,
201
+ 1.02658980e-16,1.89197331e-17,3.63112861e-16,1.41263763e-16,
202
+ -6.39833244e-17,2.94156130e-16,1.19279922e-16,2.62537867e-16,
203
+ 9.23250107e-17,9.54340873e-17,2.02657914e-16,8.56837549e-17,
204
+ 1.09912242e-16,3.25830034e-16,-6.06707638e-17,1.19561917e-16,
205
+ 1.82940837e-18,-4.63814691e-17,-1.76004402e-16,-1.14268787e-16,
206
+ -1.99388849e-16,-2.34993921e-16,-2.91227483e-16,7.53550548e-18,
207
+ 4.82690083e-18,-2.38575495e-16,-2.44652589e-16,-8.24120125e-17,
208
+ -1.33320590e-16,-2.00054414e-16,-1.43372915e-16,1.89338899e-16,
209
+ -3.10018714e-16,-1.46340691e-16,-1.07599704e-16,-1.64066751e-16,
210
+ -2.17562644e-16,-1.17636359e-16,-1.86483075e-16,5.34358570e-17,
211
+ -4.22094388e-17,1.49639967e-16,-9.19369910e-17,6.43735552e-17,
212
+ -4.95497319e-17,3.33550953e-16,-5.58797396e-18,1.08044533e-17,
213
+ -5.68782134e-17,-1.09699521e-16,2.02816822e-17,6.57529483e-18,
214
+ -5.62985774e-17,1.37422525e-16,3.68137873e-16,2.93855626e-16,
215
+ 4.60911681e-16,2.79558527e-16,1.93645149e-16,4.29339673e-16,
216
+ 3.94346119e-16,-9.11980916e-17,2.08587798e-16,4.60632308e-16,
217
+ 2.46253693e-16,2.94939706e-16,2.89601071e-16,2.36630408e-16,
218
+ 3.40090024e-16,2.08679525e-16,1.92263017e-16,9.71798469e-17,
219
+ 2.75039790e-16,4.35625730e-16,3.44388483e-16,3.13739000e-16,
220
+ 2.67825858e-16,5.23555689e-16,7.02254341e-17,1.24864649e-16,
221
+ 3.20139668e-16,2.33491483e-16,2.19996198e-16,3.10765864e-16,
222
+ 1.92283246e-16,4.58564011e-16,5.97928541e-16,1.65336064e-16,
223
+ 1.97369721e-16,4.79474407e-16,4.74556351e-16,-2.72567462e-17,
224
+ 4.84030144e-16,2.35944695e-16,-1.64178854e-16,2.08598406e-16,
225
+ 4.78048738e-16,-1.07186669e-16,2.72374315e-16,1.30982162e-16,
226
+ 6.19721697e-16,1.84166717e-16,2.19916975e-16,-8.38157837e-17,
227
+ 3.10783706e-16,1.43651243e-16,8.32086938e-16,-8.60950101e-17,
228
+ 1.12719684e-15,1.25055521e-15,1.59161573e-15,2.61479727e-15,
229
+ 5.34328137e-15,8.24229573e-15,1.30739863e-14,2.09752216e-14,
230
+ 3.33102435e-14,5.24096322e-14,8.29913915e-14,1.30512490e-13,
231
+ 2.04465778e-13,3.19687388e-13,4.96527264e-13,7.69091457e-13,
232
+ 1.18768639e-12,1.82723170e-12,2.80164159e-12,4.28093472e-12,
233
+ 6.51965593e-12,9.89587079e-12,1.49690322e-11,2.25677468e-11,
234
+ 3.39091173e-11,5.07809830e-11,7.57933947e-11,1.12751053e-10,
235
+ 1.67175699e-10,2.47052924e-10,3.63894571e-10,5.34237415e-10,
236
+ 7.81753258e-10,1.14021130e-09,1.65761999e-09,2.40199471e-09,
237
+ 3.46936706e-09,4.99485579e-09,7.16792849e-09,1.02533485e-08,
238
+ 1.46198336e-08,2.07791178e-08,2.94389945e-08,4.15750919e-08,
239
+ 5.85276356e-08,8.21314254e-08,1.14889782e-07,1.60206498e-07,
240
+ 2.22693985e-07,3.08581163e-07,4.26251360e-07,5.86949080e-07,
241
+ 8.05705175e-07,1.10254346e-06,1.50404848e-06,2.04539498e-06,
242
+ 2.77296513e-06,3.74771110e-06,5.04945887e-06,6.78239587e-06,
243
+ 9.08204151e-06,1.21240672e-05,1.61354139e-05,2.14082509e-05,
244
+ 2.83174350e-05,3.73422599e-05,4.90934463e-05,6.43464991e-05,
245
+ 8.40827711e-05,1.09539808e-04,1.42272822e-04,1.84229443e-04,
246
+ 2.37840239e-04,3.06127873e-04,3.92838172e-04,5.02596823e-04,
247
+ 6.41095903e-04,8.15314926e-04,1.03378162e-03,1.30687819e-03,
248
+ 1.64719925e-03,2.06996828e-03,2.59351969e-03,3.23985416e-03,
249
+ 4.03527510e-03,5.01111418e-03,6.20455414e-03,7.65955651e-03,
250
+ 9.42790170e-03,1.15703481e-02,1.41579155e-02,1.72732972e-02,
251
+ 2.10124030e-02,2.54860316e-02,3.08216711e-02,3.71654197e-02,
252
+ 4.46840156e-02,5.35669618e-02,6.40287248e-02,7.63109798e-02,
253
+ 9.06848724e-02,1.07453255e-01,1.26952855e-01,1.49556315e-01,
254
+ 1.75674058e-01,2.05755892e-01,2.40292299e-01,2.79815316e-01,
255
+ 3.24898926e-01,3.76158879e-01,4.34251842e-01,4.99873794e-01,
256
+ 5.73757579e-01,6.56669521e-01,7.49405043e-01,8.52783210e-01,
257
+ 9.67640138e-01,1.09482124e00,1.23517231e00,1.38952936e00,
258
+ 1.55870741e00,1.74348805e00,1.94460614e00,2.16273548e00,
259
+ 2.39847384e00,2.65232736e00,2.92469468e00,3.21585089e00,
260
+ 3.52593174e00,3.85491824e00,4.20262214e00,4.56867248e00,
261
+ 4.95250359e00,5.35334499e00,5.77021329e00,6.20190671e00,
262
+ 6.64700218e00,7.10385565e00,7.57060543e00,8.04517909e00,
263
+ 8.52530380e00,9.00852024e00,9.49220006e00,9.97356678e00,
264
+ 1.04497200e01,1.09176625e01,1.13743304e01,1.18166252e01,
265
+ 1.22414481e01,1.26457352e01,1.30264942e01,1.33808408e01,
266
+ 1.37060347e01,1.39995149e01,1.42589331e01,1.44821848e01,
267
+ 1.46674378e01,1.48131571e01,1.49181262e01,1.49814637e01,
268
+ ]
269
+ a = np.array(l)
270
+ a = np.flip(a)
271
+ _faddeeva.vals = a
272
+ _faddeeva.poly = np.polynomial.polynomial.Polynomial(a)
273
+
274
+ Z = (_faddeeva.L + 1j * z) / (_faddeeva.L - 1j * z)
275
+ p = _faddeeva.poly(Z)
276
+ w = 2 * p / (_faddeeva.L - 1j * z)**2 + (1 / np.sqrt(np.pi)) / (_faddeeva.L - 1j * z)
277
+
278
+ return(w)
279
+
280
+ _faddeeva.run_yet = False
281
+ _faddeeva.vals = None
282
+ _faddeeva.L = None
283
+ _faddeeva.N = None
284
+ _faddeeva.poly = None
285
+
286
+ def _arb_voigt(center, intensity, ratio, peak_width):
287
+ """
288
+ Use the Faddeeva function to calculate a voigt line shape. See
289
+ https://en.wikipedia.org/wiki/Voigt_profile#The_uncentered_Voigt_profile
290
+ """
291
+
292
+ def _voigt_decoder(q, k):
293
+ """
294
+ Takes the FWHM (k) and a ratio (q) and determines the values of gamma and sigma.
295
+
296
+ Accurate to within around 1.2%.
297
+ """
298
+ f_l = (-k*(q**2) + (-1 + q)**2 * np.sqrt(((k**2)*(q**2) * (4 - 8 * q + 5 * (q**2)))/(-1 + q)**4))/(2 * (-1 + q)**2)
299
+ f_g = (k * (q**2) - (-1 + q)**2 * np.sqrt(((k**2) * (q**2) * (4 - 8 * q + 5 * (q**2)))/(-1 + q)**4))/(2 * (-1 + q) * q)
300
+
301
+
302
+ gamma = f_l/2 # because gamma = FWHM/2
303
+ sigma = f_g / (2 * np.sqrt(2*np.log(2)))
304
+
305
+ return(gamma,sigma)
306
+
307
+ from math import sqrt, pi
308
+
309
+ gamma, sigma = _voigt_decoder(ratio, peak_width)
310
+ denom = sigma * sqrt(2 * pi) # denomonator
311
+ z = lambda x: _faddeeva((x - center + gamma*1j)/(sqrt(2) * sigma)) # Define z(x) as numerator, more or less
312
+ l = lambda x: intensity * ((z(x).real)/denom) # define the actual voigt function
313
+
314
+ return l
315
+
316
+ def voigt_line(center, intensity, width=10, q=0.5, start=0, stop=4000, step=1):
317
+ """Calculate a voigt lineshape
318
+
319
+ This function returns a pair of numpy arrays that define a voigt line.
320
+
321
+ Arguments:
322
+ center(float): the center point of the line
323
+ intensity(float): the area under the line (NOT the height!)
324
+ width(float,optional): the full width half max of the desired line
325
+ q(float,optional): the ratio of gaussian to lorentzian, from 0 < q < 1.
326
+ start(float,optional): the starting point of the returned array
327
+ stop(float,optional): the ending point of the returned array
328
+ step(float,optional): the space between points of the returned array
329
+
330
+ Returns:
331
+ (x,y): a tuple of the x and y numpy arrays of the specified line
332
+ """
333
+ if (not 0 < q < 1):
334
+ q = 0.5
335
+
336
+ x = np.arange(start=start, stop=stop, step=step)
337
+ vfunc = np.vectorize(_arb_voigt(center, intensity, q, width))
338
+ return((x,vfunc(x)))
339
+
340
+ def _arb_gaussian(center, intensity, width=10):
341
+ """
342
+ Return a gaussian with an arbitrary height and intensity, with sigma being determined by calculating
343
+ it from our FWHM peak width.
344
+ """
345
+ from math import sqrt, pi, exp, log
346
+
347
+ sigma = (width / (2 * sqrt(2 * log(2))))
348
+ l = lambda x: intensity * (1/sigma*sqrt(2*pi)) * exp(-((x-center)**2/(2*sigma**2)))
349
+
350
+ return l
351
+
352
+ def gauss_line(center, intensity, width=10, start=0, stop=4000, step=1):
353
+ """Calculate a gaussian lineshape
354
+
355
+ This function returns a pair of numpy arrays that define a gaussian with
356
+ given parameters.
357
+
358
+ Arguments:
359
+ center(float): the center point of the line
360
+ intensity(float): the area under the line (NOT the height!)
361
+ width(float,optional): the full width half max of the desired line
362
+ start(float,optional): the starting point of the returned array
363
+ stop(float,optional): the ending point of the returned array
364
+ step(float,optional): the space between points of the returned array
365
+
366
+ Returns:
367
+ (x,y): a tuple of the x and y numpy arrays of the specified line
368
+ """
369
+ x = np.arange(start=start, stop=stop, step=step)
370
+ vfunc = np.vectorize(_arb_gaussian(center, intensity, width))
371
+ return((x,vfunc(x)))
372
+
373
+ def _arb_lorentz(center, intensity, width=10):
374
+ """
375
+ Return a lorentzian with an arbitrary height and intensity, with gamma being calculated from our
376
+ FWHM peak width.
377
+ """
378
+ from math import pi
379
+
380
+ gamma = (width / 2)
381
+ l = lambda x: (intensity/pi) * (gamma/((x-(center))**2 + gamma**2))
382
+
383
+ return l
384
+
385
+ def lorentz_line(center, intensity, width=10, start=0, stop=4000, step=1):
386
+ """Calculate a lorentzian lineshape
387
+
388
+ This function returns a pair of numpy arrays that define a lorentzian line
389
+ given a set of parameters.
390
+
391
+ Arguments:
392
+ center(float): the center point of the line
393
+ intensity(float): the area under the line (NOT the height!)
394
+ width(float,optional): the full width half max of the desired line
395
+ start(float,optional): the starting point of the returned array
396
+ stop(float,optional): the ending point of the returned array
397
+ step(float,optional): the space between points of the returned array
398
+
399
+ Returns:
400
+ (x,y): a tuple of the x and y numpy arrays of the specified line
401
+ """
402
+ x = np.arange(start=start, stop=stop, step=step)
403
+ vfunc = np.vectorize(_arb_lorentz(center, intensity, width))
404
+ return((x,vfunc(x)))
405
+
406
+ def construct_spectrum(points, intensities, lineshape="gauss", width=10, start=0, stop=4000, step=1):
407
+ """Construct an entire spectrum plot of data
408
+
409
+ This function returns a pair of numpy arrays that make a spectrum; an x axis
410
+ and a y axis of the spectrum at each point on the x axis. This can then be
411
+ plotted or analyzed.
412
+
413
+ Arguments:
414
+ points([float]): a list of peak positions
415
+ intensities([float]): a list of corresponding peak intensities - the order must
416
+ match `points`
417
+ lineshape(string,optional): the desired lineshape. The options are "gauss", "lorentz", and "voigt"
418
+ width(float,optional): the full width half max of each peak
419
+ start(float,optional): the starting point of the returned array
420
+ stop(float,optional): the ending point of the returned array
421
+ step(float,optional): the space between points of the returned array
422
+
423
+ Returns:
424
+ (x,y): a tuple of the x and y numpy arrays for the constructed spectrum
425
+ """
426
+ l = []
427
+
428
+ linefuncs = {
429
+ "gauss": gauss_line,
430
+ "lorentz": lorentz_line,
431
+ "voigt": voigt_line
432
+ }
433
+ if (lineshape not in linefuncs.keys()):
434
+ linefunc = gauss_line
435
+ else:
436
+ linefunc = linefuncs[lineshape]
437
+
438
+ if (len(points) == 0 or len(intensities) == 0):
439
+ raise AssertionError("points or intensities are empty")
440
+
441
+ if (len(points) != len(intensities)):
442
+ raise AssertionError("peaks and intensities do not match size")
443
+
444
+ for (x,y) in zip(points, intensities):
445
+ axis, tmp = linefunc(x,y,width=width,start=start,stop=stop,step=step)
446
+ l.append(tmp)
447
+
448
+ return((axis,np.array(l).sum(axis=0)))
@@ -316,7 +316,7 @@ class WebMOREST:
316
316
  return r.json()["jobNumber"]
317
317
 
318
318
  async def display_job_property(self, job_number, property_name, property_index=1, peak_width=0.0, tms_shift=0.0, proton_coupling=0.0, nmr_field=400.0, x_range=None, y_range=None, width=400, height=400, background_color=(255,255,255), transparent_background=False, rotate=(0.,0.,0.)):
319
- """Uses Javascript and IPython to display and image of the specified molecule and property,
319
+ """Uses Javascript and IPython to display an image of the specified molecule and property,
320
320
  calculated from a previous WebMO job.
321
321
 
322
322
  This call outputs (via IPython) a PNG-formatted image of the molecule and property into the
@@ -706,45 +706,45 @@ class WebMOREST:
706
706
 
707
707
  return EmbeddedImage(data=decoded_image_data)
708
708
 
709
+ if has_ipython:
710
+ class EmbeddedImage(Image):
711
+ """The EmbeddedImage class is a IPython-displayable image object with additional functionality.
709
712
 
710
- class EmbeddedImage(Image):
711
- """The EmbeddedImage class is a IPython-displayable image object with additional functionality.
713
+ The EmbeddedImage class is a Jupyter-renderable image object, derived from IPython.display.image.
714
+ However, the EmbeddedImage also adds additional utility conversion methods.
715
+ """
716
+ def __init__(self, data):
717
+ super().__init__(data)
712
718
 
713
- The EmbeddedImage class is a Jupyter-renderable image object, derived from IPython.display.image.
714
- However, the EmbeddedImage also adds additional utility conversion methods.
715
- """
716
- def __init__(self, data):
717
- super().__init__(data)
719
+ def save(self, filename):
720
+ """Saves the EmbeddedImage to disk as a PNG-formatted image.
718
721
 
719
- def save(self, filename):
720
- """Saves the EmbeddedImage to disk as a PNG-formatted image.
722
+ This call saves the EmbeddedImage object to disk as PNG-formatted image.
721
723
 
722
- This call saves the EmbeddedImage object to disk as PNG-formatted image.
724
+ Arguments:
725
+ filename(str): The path to the target PNG file. A "png" extension is added, if not provided.
723
726
 
724
- Arguments:
725
- filename(str): The path to the target PNG file. A "png" extension is added, if not provided.
727
+ Returns:
728
+ None
729
+ """
730
+ if not filename.endswith(".png"):
731
+ filename += ".png"
732
+ with open(filename, 'wb') as fp:
733
+ fp.write(self.data)
726
734
 
727
- Returns:
728
- None
729
- """
730
- if not filename.endswith(".png"):
731
- filename += ".png"
732
- with open(filename, 'wb') as fp:
733
- fp.write(self.data)
735
+ def to_pil_image(self):
736
+ """Returns an equivalent Pillow (PIL) Image object.
734
737
 
735
- def to_pil_image(self):
736
- """Returns an equivalent Pillow (PIL) Image object.
738
+ This call converts and returns and equivalent Pillow (PIL) Image representation of the
739
+ current EmbeddedImage object, for further manipulation.
737
740
 
738
- This call converts and returns and equivalent Pillow (PIL) Image representation of the
739
- current EmbeddedImage object, for further manipulation.
741
+ Arguments:
742
+ None
740
743
 
741
- Arguments:
742
- None
743
-
744
- Returns:
745
- A Pillow PIL.Image.Image object.
746
- """
747
- from PIL import Image
748
- from io import BytesIO
744
+ Returns:
745
+ A Pillow PIL.Image.Image object.
746
+ """
747
+ from PIL import Image
748
+ from io import BytesIO
749
749
 
750
- return Image.open(BytesIO(self.data))
750
+ return Image.open(BytesIO(self.data))
@@ -1,11 +1,12 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: webmo
3
- Version: 1.1.4
3
+ Version: 1.2.0
4
4
  Summary: A Python-based interface to WebMO
5
5
  Home-page: https://github.com/jrschmidt2/webmo-python
6
- Download-URL: https://github.com/jrschmidt2/webmo-python/archive/refs/tags/1.1.4.tar.gz
6
+ Download-URL: https://github.com/jrschmidt2/webmo-python/archive/refs/tags/1.2.0.tar.gz
7
7
  Author: J.R. Schmidt
8
8
  Author-email: schmidt@webmo.net
9
9
  License: MIT
10
10
  Keywords: WEBMO,REST,API
11
+ Provides-Extra: spectrum
11
12
  License-File: LICENSE
@@ -3,6 +3,7 @@ README.md
3
3
  setup.cfg
4
4
  setup.py
5
5
  webmo/__init__.py
6
+ webmo/spectrum.py
6
7
  webmo/webmo_rest.py
7
8
  webmo.egg-info/PKG-INFO
8
9
  webmo.egg-info/SOURCES.txt
@@ -1,2 +1,5 @@
1
1
  requests
2
2
  websockets
3
+
4
+ [spectrum]
5
+ numpy
File without changes
File without changes
File without changes