orto 1.3.0__tar.gz → 1.4.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.
- {orto-1.3.0 → orto-1.4.0}/PKG-INFO +1 -1
- orto-1.4.0/orto/__version__.py +1 -0
- {orto-1.3.0 → orto-1.4.0}/orto/cli.py +17 -10
- {orto-1.3.0 → orto-1.4.0}/orto/plotter.py +42 -8
- {orto-1.3.0 → orto-1.4.0}/orto.egg-info/PKG-INFO +1 -1
- {orto-1.3.0 → orto-1.4.0}/setup.py +1 -1
- orto-1.3.0/orto/__version__.py +0 -1
- {orto-1.3.0 → orto-1.4.0}/README.md +0 -0
- {orto-1.3.0 → orto-1.4.0}/orto/__init__.py +0 -0
- {orto-1.3.0 → orto-1.4.0}/orto/constants.py +0 -0
- {orto-1.3.0 → orto-1.4.0}/orto/exceptions.py +0 -0
- {orto-1.3.0 → orto-1.4.0}/orto/extractor.py +0 -0
- {orto-1.3.0 → orto-1.4.0}/orto/input.py +0 -0
- {orto-1.3.0 → orto-1.4.0}/orto/job.py +0 -0
- {orto-1.3.0 → orto-1.4.0}/orto/utils.py +0 -0
- {orto-1.3.0 → orto-1.4.0}/orto.egg-info/SOURCES.txt +0 -0
- {orto-1.3.0 → orto-1.4.0}/orto.egg-info/dependency_links.txt +0 -0
- {orto-1.3.0 → orto-1.4.0}/orto.egg-info/entry_points.txt +0 -0
- {orto-1.3.0 → orto-1.4.0}/orto.egg-info/requires.txt +0 -0
- {orto-1.3.0 → orto-1.4.0}/orto.egg-info/top_level.txt +0 -0
- {orto-1.3.0 → orto-1.4.0}/pyproject.toml +0 -0
- {orto-1.3.0 → orto-1.4.0}/setup.cfg +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '1.4.0'
|
|
@@ -593,28 +593,30 @@ def plot_abs_func(uargs):
|
|
|
593
593
|
version = [6, 0, 0]
|
|
594
594
|
|
|
595
595
|
if version[0] < 6:
|
|
596
|
-
if uargs.
|
|
596
|
+
if uargs.intensities == 'electric':
|
|
597
597
|
all_data = oe.OldAbsorptionElectricDipoleExtractor.extract(
|
|
598
598
|
uargs.output_file
|
|
599
599
|
)
|
|
600
|
-
elif uargs.
|
|
600
|
+
elif uargs.intensities == 'velocity':
|
|
601
601
|
all_data = oe.OldAbsorptionVelocityDipoleExtractor.extract(
|
|
602
602
|
uargs.output_file
|
|
603
603
|
)
|
|
604
604
|
elif version[0] >= 6:
|
|
605
|
-
if uargs.
|
|
605
|
+
if uargs.intensities == 'electric':
|
|
606
606
|
all_data = oe.AbsorptionElectricDipoleExtractor.extract(
|
|
607
607
|
uargs.output_file
|
|
608
608
|
)
|
|
609
|
-
elif uargs.
|
|
609
|
+
elif uargs.intensities == 'velocity':
|
|
610
610
|
all_data = oe.AbsorptionVelocityDipoleExtractor.extract(
|
|
611
611
|
uargs.output_file
|
|
612
612
|
)
|
|
613
|
-
elif uargs.
|
|
613
|
+
elif uargs.intensities == 'semi-classical':
|
|
614
614
|
all_data = oe.AbsorptionSemiClassicalDipoleExtractor.extract(
|
|
615
615
|
uargs.output_file
|
|
616
616
|
)
|
|
617
617
|
|
|
618
|
+
ut.cprint('Using intensities: {}'.format(uargs.intensities), 'cyan')
|
|
619
|
+
|
|
618
620
|
# Plot each section
|
|
619
621
|
for it, data in enumerate(all_data):
|
|
620
622
|
|
|
@@ -644,7 +646,7 @@ def plot_abs_func(uargs):
|
|
|
644
646
|
linewidth=uargs.linewidth,
|
|
645
647
|
lineshape=uargs.lineshape,
|
|
646
648
|
window_title=f'Absorption Spectrum from {uargs.output_file}',
|
|
647
|
-
|
|
649
|
+
osc_style=uargs.osc_style,
|
|
648
650
|
normalise=uargs.normalise_absorption
|
|
649
651
|
)
|
|
650
652
|
|
|
@@ -1606,7 +1608,7 @@ def read_args(arg_list=None):
|
|
|
1606
1608
|
)
|
|
1607
1609
|
|
|
1608
1610
|
plot_abs.add_argument(
|
|
1609
|
-
'--
|
|
1611
|
+
'--intensities',
|
|
1610
1612
|
'-i',
|
|
1611
1613
|
type=str,
|
|
1612
1614
|
choices=['velocity', 'electric', 'semi-classical'],
|
|
@@ -1626,10 +1628,15 @@ def read_args(arg_list=None):
|
|
|
1626
1628
|
)
|
|
1627
1629
|
|
|
1628
1630
|
plot_abs.add_argument(
|
|
1629
|
-
'--
|
|
1630
|
-
|
|
1631
|
+
'--osc_style',
|
|
1632
|
+
type=str,
|
|
1633
|
+
default='combined',
|
|
1631
1634
|
help=(
|
|
1632
|
-
'
|
|
1635
|
+
'Style of oscillators to plot\n'
|
|
1636
|
+
' - \'separate\' plots oscillator strengths as stems on separate axis\n'
|
|
1637
|
+
' - \'combined\' plots oscillator strengths on intensity axis\n'
|
|
1638
|
+
' - \'off\' does not plot oscillator strengths\n'
|
|
1639
|
+
'Default: %(default)s'
|
|
1633
1640
|
)
|
|
1634
1641
|
)
|
|
1635
1642
|
|
|
@@ -4,6 +4,7 @@ from matplotlib.ticker import AutoMinorLocator
|
|
|
4
4
|
import numpy as np
|
|
5
5
|
from numpy.typing import ArrayLike, NDArray
|
|
6
6
|
import itertools
|
|
7
|
+
import pathlib
|
|
7
8
|
|
|
8
9
|
from . import utils as ut
|
|
9
10
|
|
|
@@ -81,8 +82,9 @@ def plot_abs(x_values: ArrayLike, x_type: str, foscs: ArrayLike,
|
|
|
81
82
|
abs_type: str = 'napierian',
|
|
82
83
|
y_lim: list[float] = [0., 'auto'],
|
|
83
84
|
x_shift: float = 0., normalise: bool = False,
|
|
84
|
-
|
|
85
|
+
osc_style: str = 'separate', save: bool = False,
|
|
85
86
|
save_name: str = 'absorption_spectrum.png', show: bool = False,
|
|
87
|
+
verbose: bool = True,
|
|
86
88
|
window_title: str = 'Absorption Spectrum') -> tuple[plt.Figure, list[plt.Axes]]: # noqa
|
|
87
89
|
'''
|
|
88
90
|
Plots absorption spectrum with intensity specified by oscillator strength.\n # noqa
|
|
@@ -112,14 +114,19 @@ def plot_abs(x_values: ArrayLike, x_type: str, foscs: ArrayLike,
|
|
|
112
114
|
Absorbance (and epsilon) type to use. Orca_mapspc uses napierian
|
|
113
115
|
normalise: bool, default False
|
|
114
116
|
If True, normalise the absorption spectrum to the maximum value.
|
|
115
|
-
|
|
116
|
-
|
|
117
|
+
osc_style: str, default 'separate'
|
|
118
|
+
Style of oscillator strength plots:
|
|
119
|
+
- 'separate': plots oscillator strengths as stems on separate axis
|
|
120
|
+
- 'combined': plots oscillator strengths on intensity axis
|
|
121
|
+
- 'off': does not plot oscillator strengths
|
|
117
122
|
save: bool, default False
|
|
118
123
|
If True, plot is saved to save_name
|
|
119
|
-
save_name: str
|
|
124
|
+
save_name: str | pathlib.Path, default 'absorption_spectrum.png'
|
|
120
125
|
If save is True, plot is saved to this location/filename
|
|
121
126
|
show: bool, default False
|
|
122
127
|
If True, plot is shown on screen
|
|
128
|
+
verbose: bool, default True
|
|
129
|
+
If True, plot file location is written to terminal
|
|
123
130
|
window_title: str, default 'UV-Visible Absorption Spectrum'
|
|
124
131
|
Title of figure window, not of plot
|
|
125
132
|
|
|
@@ -132,6 +139,8 @@ def plot_abs(x_values: ArrayLike, x_type: str, foscs: ArrayLike,
|
|
|
132
139
|
Matplotlib Axis object for twinx oscillator strength axis
|
|
133
140
|
'''
|
|
134
141
|
|
|
142
|
+
save_name = pathlib.Path(save_name)
|
|
143
|
+
|
|
135
144
|
x_values = np.asarray(x_values) + x_shift
|
|
136
145
|
foscs = np.asarray(foscs)
|
|
137
146
|
if len(x_values) != len(foscs):
|
|
@@ -199,20 +208,43 @@ def plot_abs(x_values: ArrayLike, x_type: str, foscs: ArrayLike,
|
|
|
199
208
|
else:
|
|
200
209
|
ax.set_ylabel(r'$\epsilon$ (cm$^\mathregular{-1}$ mol$^\mathregular{-1}$ L)') # noqa
|
|
201
210
|
|
|
202
|
-
|
|
211
|
+
_txt_save_name = save_name.with_suffix('.txt')
|
|
212
|
+
np.savetxt(
|
|
213
|
+
_txt_save_name,
|
|
214
|
+
np.vstack([x_grid, spectrum]).T,
|
|
215
|
+
fmt='%.5f',
|
|
216
|
+
header='Absorption spectrum data\nx (wavenumber, wavelength or energy), y (absorbance)' # noqa
|
|
217
|
+
)
|
|
218
|
+
if verbose:
|
|
219
|
+
ut.cprint(
|
|
220
|
+
f'\nAbsorption spectrum data saved to\n {_txt_save_name}',
|
|
221
|
+
'cyan'
|
|
222
|
+
)
|
|
203
223
|
|
|
204
224
|
# Main spectrum
|
|
205
225
|
ax.plot(x_grid, spectrum, color='k')
|
|
206
226
|
|
|
207
|
-
if
|
|
227
|
+
if osc_style == 'separate':
|
|
208
228
|
fax = ax.twinx()
|
|
209
229
|
# Oscillator strength twin axis
|
|
210
|
-
|
|
230
|
+
fax.stem(x_values, foscs, basefmt=' ', markerfmt=' ')
|
|
211
231
|
fax.yaxis.set_minor_locator(AutoMinorLocator())
|
|
212
232
|
fax.set_ylabel(r'$f_\mathregular{osc}$')
|
|
213
233
|
fax.set_ylim([0., fax.get_ylim()[1]])
|
|
234
|
+
elif osc_style == 'combined':
|
|
235
|
+
fax = None
|
|
236
|
+
plt.subplots_adjust(right=0.2)
|
|
237
|
+
ax.stem(
|
|
238
|
+
x_values,
|
|
239
|
+
foscs/np.max(foscs) * np.max(spectrum),
|
|
240
|
+
basefmt=' ',
|
|
241
|
+
markerfmt=' '
|
|
242
|
+
)
|
|
243
|
+
ax.spines['right'].set_visible(False)
|
|
244
|
+
ax.spines['top'].set_visible(False)
|
|
214
245
|
else:
|
|
215
246
|
fax = None
|
|
247
|
+
# No oscillator strength plot
|
|
216
248
|
plt.subplots_adjust(right=0.2)
|
|
217
249
|
ax.spines['right'].set_visible(False)
|
|
218
250
|
ax.spines['top'].set_visible(False)
|
|
@@ -245,7 +277,9 @@ def plot_abs(x_values: ArrayLike, x_type: str, foscs: ArrayLike,
|
|
|
245
277
|
|
|
246
278
|
if save:
|
|
247
279
|
plt.savefig(save_name, dpi=500)
|
|
248
|
-
|
|
280
|
+
if verbose:
|
|
281
|
+
ut.cprint(f'\nAbsorption spectrum saved to\n {save_name}', 'cyan')
|
|
282
|
+
|
|
249
283
|
if show:
|
|
250
284
|
plt.show()
|
|
251
285
|
|
orto-1.3.0/orto/__version__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = '1.3.0'
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|