orto 1.4.0__py3-none-any.whl → 1.5.0__py3-none-any.whl
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/__version__.py +1 -1
- orto/cli.py +288 -8
- orto/extractor.py +66 -0
- orto/plotter.py +16 -6
- {orto-1.4.0.dist-info → orto-1.5.0.dist-info}/METADATA +1 -1
- orto-1.5.0.dist-info/RECORD +15 -0
- orto-1.4.0.dist-info/RECORD +0 -15
- {orto-1.4.0.dist-info → orto-1.5.0.dist-info}/WHEEL +0 -0
- {orto-1.4.0.dist-info → orto-1.5.0.dist-info}/entry_points.txt +0 -0
- {orto-1.4.0.dist-info → orto-1.5.0.dist-info}/top_level.txt +0 -0
orto/__version__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = '1.
|
|
1
|
+
__version__ = '1.5.0'
|
orto/cli.py
CHANGED
|
@@ -554,6 +554,127 @@ def gen_job_func(uargs):
|
|
|
554
554
|
return
|
|
555
555
|
|
|
556
556
|
|
|
557
|
+
def plot_xes_func(uargs):
|
|
558
|
+
'''
|
|
559
|
+
Wrapper for CLI plot xes call
|
|
560
|
+
|
|
561
|
+
Parameters
|
|
562
|
+
----------
|
|
563
|
+
uargs : argparser object
|
|
564
|
+
User arguments
|
|
565
|
+
|
|
566
|
+
Returns
|
|
567
|
+
-------
|
|
568
|
+
None
|
|
569
|
+
'''
|
|
570
|
+
import matplotlib.pyplot as plt
|
|
571
|
+
import matplotlib as mpl
|
|
572
|
+
from . import plotter
|
|
573
|
+
from . import extractor as oe
|
|
574
|
+
|
|
575
|
+
# Set user specified font name
|
|
576
|
+
if os.getenv('orto_fontname'):
|
|
577
|
+
try:
|
|
578
|
+
plt.rcParams['font.family'] = os.getenv('orto_fontname')
|
|
579
|
+
except ValueError:
|
|
580
|
+
ut.cprint('Error in orto_fontname environment variable', 'red')
|
|
581
|
+
sys.exit(1)
|
|
582
|
+
|
|
583
|
+
# Change matplotlib font size to be larger
|
|
584
|
+
mpl.rcParams.update({'font.size': 12})
|
|
585
|
+
|
|
586
|
+
version = oe.OrcaVersionExtractor.extract(uargs.output_file)
|
|
587
|
+
|
|
588
|
+
if not len(version):
|
|
589
|
+
ut.cprint(
|
|
590
|
+
'Warning: Cannot find version number in Orca output file',
|
|
591
|
+
'black_yellowbg'
|
|
592
|
+
)
|
|
593
|
+
version = [6, 0, 0]
|
|
594
|
+
|
|
595
|
+
if version[0] >= 6:
|
|
596
|
+
if uargs.intensities == 'electric':
|
|
597
|
+
all_data = oe.XESElectricDipoleExtractor.extract(
|
|
598
|
+
uargs.output_file
|
|
599
|
+
)
|
|
600
|
+
elif uargs.intensities == 'velocity':
|
|
601
|
+
all_data = oe.XESVelocityDipoleExtractor.extract(
|
|
602
|
+
uargs.output_file
|
|
603
|
+
)
|
|
604
|
+
elif uargs.intensities == 'semi-classical':
|
|
605
|
+
all_data = oe.XESSemiClassicalDipoleExtractor.extract(
|
|
606
|
+
uargs.output_file
|
|
607
|
+
)
|
|
608
|
+
elif uargs.intensities == 'so_electric':
|
|
609
|
+
all_data = oe.SOXESElectricDipoleExtractor.extract(
|
|
610
|
+
uargs.output_file
|
|
611
|
+
)
|
|
612
|
+
elif uargs.intensities == 'so_velocity':
|
|
613
|
+
all_data = oe.SOXESVelocityDipoleExtractor.extract(
|
|
614
|
+
uargs.output_file
|
|
615
|
+
)
|
|
616
|
+
elif uargs.intensities == 'so_semi-classical':
|
|
617
|
+
all_data = oe.SOXESSemiClassicalDipoleExtractor.extract(
|
|
618
|
+
uargs.output_file
|
|
619
|
+
)
|
|
620
|
+
elif version[0] < 6:
|
|
621
|
+
ut.cprint('Unsupported version of Orca for XES extraction', 'red')
|
|
622
|
+
|
|
623
|
+
ut.cprint('Using intensities: {}'.format(uargs.intensities), 'cyan')
|
|
624
|
+
|
|
625
|
+
# Plot each section
|
|
626
|
+
for it, data in enumerate(all_data):
|
|
627
|
+
|
|
628
|
+
if len(all_data) > 1:
|
|
629
|
+
save_name = f'emission_spectrum_section_{it:d}.png'
|
|
630
|
+
else:
|
|
631
|
+
save_name = 'emission_spectrum.png'
|
|
632
|
+
|
|
633
|
+
if uargs.x_unit == 'wavenumber':
|
|
634
|
+
x_values = np.asarray(data['energy (cm^-1)'])
|
|
635
|
+
elif uargs.x_unit == 'wavelength':
|
|
636
|
+
x_values = 1E7 / np.asarray(data['energy (cm^-1)'])
|
|
637
|
+
elif uargs.x_unit == 'energy':
|
|
638
|
+
x_values = np.asarray(data['energy (ev)'])
|
|
639
|
+
|
|
640
|
+
data['fosc'] = np.asarray(data['fosc'])
|
|
641
|
+
|
|
642
|
+
# Remove transitions with zero oscillator strength from
|
|
643
|
+
# beginning and end of spectrum
|
|
644
|
+
if not uargs.no_trim:
|
|
645
|
+
# Find first non-zero oscillator strength
|
|
646
|
+
first_nonzero = np.where(data['fosc'] > 1E-6)[0][0]
|
|
647
|
+
# Find last non-zero oscillator strength
|
|
648
|
+
last_nonzero = np.where(data['fosc'] > 1E-6)[0][-1]
|
|
649
|
+
|
|
650
|
+
# Trim data
|
|
651
|
+
x_values = x_values[first_nonzero:last_nonzero + 1]
|
|
652
|
+
data['fosc'] = data['fosc'][first_nonzero:last_nonzero + 1]
|
|
653
|
+
|
|
654
|
+
# Plot emission spectrum
|
|
655
|
+
fig, ax = plotter.plot_abs(
|
|
656
|
+
x_values,
|
|
657
|
+
uargs.x_unit,
|
|
658
|
+
data['fosc'],
|
|
659
|
+
show=_SHOW_CONV[uargs.plot],
|
|
660
|
+
save=_SAVE_CONV[uargs.plot],
|
|
661
|
+
save_name=save_name,
|
|
662
|
+
x_lim=uargs.x_lim,
|
|
663
|
+
y_lim=uargs.y_lim,
|
|
664
|
+
x_shift=uargs.shift,
|
|
665
|
+
linewidth=uargs.linewidth,
|
|
666
|
+
lineshape=uargs.lineshape,
|
|
667
|
+
window_title=f'Emission Spectrum from {uargs.output_file}',
|
|
668
|
+
osc_style=uargs.osc_style,
|
|
669
|
+
normalise=uargs.normalise,
|
|
670
|
+
plot_type='emission'
|
|
671
|
+
)
|
|
672
|
+
|
|
673
|
+
if uargs.x_unit == 'wavenumber':
|
|
674
|
+
ax[0].set_xlim([0, 50000])
|
|
675
|
+
plt.show()
|
|
676
|
+
|
|
677
|
+
|
|
557
678
|
def plot_abs_func(uargs):
|
|
558
679
|
'''
|
|
559
680
|
Wrapper for CLI plot abs call
|
|
@@ -626,11 +747,25 @@ def plot_abs_func(uargs):
|
|
|
626
747
|
save_name = 'absorption_spectrum.png'
|
|
627
748
|
|
|
628
749
|
if uargs.x_unit == 'wavenumber':
|
|
629
|
-
x_values = data['energy (cm^-1)']
|
|
750
|
+
x_values = np.asarray(data['energy (cm^-1)'])
|
|
630
751
|
elif uargs.x_unit == 'wavelength':
|
|
631
|
-
x_values = 1E7 / data['energy (cm^-1)']
|
|
752
|
+
x_values = 1E7 / np.asarray(data['energy (cm^-1)'])
|
|
632
753
|
elif uargs.x_unit == 'energy':
|
|
633
|
-
x_values = data['energy (ev)']
|
|
754
|
+
x_values = np.asarray(data['energy (ev)'])
|
|
755
|
+
|
|
756
|
+
data['fosc'] = np.asarray(data['fosc'])
|
|
757
|
+
|
|
758
|
+
# Remove transitions with zero oscillator strength from
|
|
759
|
+
# beginning and end of spectrum
|
|
760
|
+
if not uargs.no_trim:
|
|
761
|
+
# Find first non-zero oscillator strength
|
|
762
|
+
first_nonzero = np.where(data['fosc'] > 1E-6)[0][0]
|
|
763
|
+
# Find last non-zero oscillator strength
|
|
764
|
+
last_nonzero = np.where(data['fosc'] > 1E-6)[0][-1]
|
|
765
|
+
|
|
766
|
+
# Trim data
|
|
767
|
+
x_values = x_values[first_nonzero:last_nonzero + 1]
|
|
768
|
+
data['fosc'] = data['fosc'][first_nonzero:last_nonzero + 1]
|
|
634
769
|
|
|
635
770
|
# Plot absorption spectrum
|
|
636
771
|
fig, ax = plotter.plot_abs(
|
|
@@ -647,7 +782,7 @@ def plot_abs_func(uargs):
|
|
|
647
782
|
lineshape=uargs.lineshape,
|
|
648
783
|
window_title=f'Absorption Spectrum from {uargs.output_file}',
|
|
649
784
|
osc_style=uargs.osc_style,
|
|
650
|
-
normalise=uargs.
|
|
785
|
+
normalise=uargs.normalise
|
|
651
786
|
)
|
|
652
787
|
|
|
653
788
|
if uargs.x_unit == 'wavenumber':
|
|
@@ -1633,7 +1768,7 @@ def read_args(arg_list=None):
|
|
|
1633
1768
|
default='combined',
|
|
1634
1769
|
help=(
|
|
1635
1770
|
'Style of oscillators to plot\n'
|
|
1636
|
-
' - \'separate\' plots oscillator strengths as stems on separate axis\n'
|
|
1771
|
+
' - \'separate\' plots oscillator strengths as stems on separate axis\n' # noqa
|
|
1637
1772
|
' - \'combined\' plots oscillator strengths on intensity axis\n'
|
|
1638
1773
|
' - \'off\' does not plot oscillator strengths\n'
|
|
1639
1774
|
'Default: %(default)s'
|
|
@@ -1684,6 +1819,16 @@ def read_args(arg_list=None):
|
|
|
1684
1819
|
)
|
|
1685
1820
|
)
|
|
1686
1821
|
|
|
1822
|
+
plot_abs.add_argument(
|
|
1823
|
+
'--no_trim',
|
|
1824
|
+
action='store_true',
|
|
1825
|
+
default=False,
|
|
1826
|
+
help=(
|
|
1827
|
+
'Do not trim spectrum to non-zero oscillator strength\n'
|
|
1828
|
+
'Default: %(default)s'
|
|
1829
|
+
)
|
|
1830
|
+
)
|
|
1831
|
+
|
|
1687
1832
|
plot_abs.add_argument(
|
|
1688
1833
|
'--x_lim',
|
|
1689
1834
|
nargs=2,
|
|
@@ -1699,12 +1844,147 @@ def read_args(arg_list=None):
|
|
|
1699
1844
|
)
|
|
1700
1845
|
|
|
1701
1846
|
plot_abs.add_argument(
|
|
1702
|
-
'--
|
|
1703
|
-
'-
|
|
1847
|
+
'--normalise',
|
|
1848
|
+
'-n',
|
|
1849
|
+
action='store_true',
|
|
1850
|
+
default=False,
|
|
1851
|
+
help=(
|
|
1852
|
+
'Normalises spectrum to maximum value\n'
|
|
1853
|
+
'Default: %(default)s'
|
|
1854
|
+
)
|
|
1855
|
+
)
|
|
1856
|
+
|
|
1857
|
+
plot_xes = plot_parser.add_parser(
|
|
1858
|
+
'xes',
|
|
1859
|
+
description='Plots XES from CI calculation output',
|
|
1860
|
+
usage=ut.cstring('orto plot xes <output_file>', 'cyan'),
|
|
1861
|
+
formatter_class=argparse.RawTextHelpFormatter
|
|
1862
|
+
)
|
|
1863
|
+
plot_xes._positionals.title = 'Mandatory Arguments'
|
|
1864
|
+
|
|
1865
|
+
plot_xes.set_defaults(func=plot_xes_func)
|
|
1866
|
+
|
|
1867
|
+
plot_xes.add_argument(
|
|
1868
|
+
'output_file',
|
|
1869
|
+
type=pathlib.Path,
|
|
1870
|
+
help='Orca output file name'
|
|
1871
|
+
)
|
|
1872
|
+
|
|
1873
|
+
plot_xes.add_argument(
|
|
1874
|
+
'--intensities',
|
|
1875
|
+
'-i',
|
|
1876
|
+
type=str,
|
|
1877
|
+
choices=[
|
|
1878
|
+
'velocity',
|
|
1879
|
+
'electric',
|
|
1880
|
+
'semi-classical',
|
|
1881
|
+
'so_velocity',
|
|
1882
|
+
'so_electric',
|
|
1883
|
+
'so_semi-classical',
|
|
1884
|
+
],
|
|
1885
|
+
default='electric',
|
|
1886
|
+
help='Type of intensity to plot (orca_mapspc uses electric)'
|
|
1887
|
+
)
|
|
1888
|
+
|
|
1889
|
+
plot_xes.add_argument(
|
|
1890
|
+
'--linewidth',
|
|
1891
|
+
'-lw',
|
|
1892
|
+
type=float,
|
|
1893
|
+
default=2000,
|
|
1894
|
+
help=(
|
|
1895
|
+
'Width of signal (FWHM for Gaussian, Width for Lorentzian),'
|
|
1896
|
+
' in Wavenumbers'
|
|
1897
|
+
)
|
|
1898
|
+
)
|
|
1899
|
+
|
|
1900
|
+
plot_xes.add_argument(
|
|
1901
|
+
'--osc_style',
|
|
1902
|
+
type=str,
|
|
1903
|
+
default='combined',
|
|
1904
|
+
help=(
|
|
1905
|
+
'Style of oscillators to plot\n'
|
|
1906
|
+
' - \'separate\' plots oscillator strengths as stems on separate axis\n' # noqa
|
|
1907
|
+
' - \'combined\' plots oscillator strengths on intensity axis\n'
|
|
1908
|
+
' - \'off\' does not plot oscillator strengths\n'
|
|
1909
|
+
'Default: %(default)s'
|
|
1910
|
+
)
|
|
1911
|
+
)
|
|
1912
|
+
|
|
1913
|
+
plot_xes.add_argument(
|
|
1914
|
+
'--plot',
|
|
1915
|
+
'-p',
|
|
1916
|
+
choices=['on', 'show', 'save', 'off'],
|
|
1917
|
+
metavar='<str>',
|
|
1918
|
+
type=str,
|
|
1919
|
+
default='on',
|
|
1920
|
+
help=(
|
|
1921
|
+
'Controls plot appearance/save \n'
|
|
1922
|
+
' - \'on\' shows and saves the plots\n'
|
|
1923
|
+
' - \'show\' shows the plots\n'
|
|
1924
|
+
' - \'save\' saves the plots\n'
|
|
1925
|
+
' - \'off\' neither shows nor saves\n'
|
|
1926
|
+
'Default: %(default)s'
|
|
1927
|
+
)
|
|
1928
|
+
)
|
|
1929
|
+
|
|
1930
|
+
plot_xes.add_argument(
|
|
1931
|
+
'--lineshape',
|
|
1932
|
+
'-ls',
|
|
1933
|
+
type=str,
|
|
1934
|
+
choices=['gaussian', 'lorentzian'],
|
|
1935
|
+
default='lorentzian',
|
|
1936
|
+
help='Lineshape to use for each signal'
|
|
1937
|
+
)
|
|
1938
|
+
|
|
1939
|
+
plot_xes.add_argument(
|
|
1940
|
+
'--x_unit',
|
|
1941
|
+
type=str,
|
|
1942
|
+
choices=['wavenumber', 'energy', 'wavelength'],
|
|
1943
|
+
default='wavenumber',
|
|
1944
|
+
help='x units to use for spectrum'
|
|
1945
|
+
)
|
|
1946
|
+
|
|
1947
|
+
plot_xes.add_argument(
|
|
1948
|
+
'--shift',
|
|
1949
|
+
type=float,
|
|
1950
|
+
default=0.,
|
|
1951
|
+
help=(
|
|
1952
|
+
'Shift spectrum by this amount in x units\n'
|
|
1953
|
+
'Default: %(default)s'
|
|
1954
|
+
)
|
|
1955
|
+
)
|
|
1956
|
+
|
|
1957
|
+
plot_xes.add_argument(
|
|
1958
|
+
'--no_trim',
|
|
1959
|
+
action='store_true',
|
|
1960
|
+
default=False,
|
|
1961
|
+
help=(
|
|
1962
|
+
'Do not trim spectrum to non-zero oscillator strength\n'
|
|
1963
|
+
'Default: %(default)s'
|
|
1964
|
+
)
|
|
1965
|
+
)
|
|
1966
|
+
|
|
1967
|
+
plot_xes.add_argument(
|
|
1968
|
+
'--x_lim',
|
|
1969
|
+
nargs=2,
|
|
1970
|
+
default=['auto', 'auto'],
|
|
1971
|
+
help='x limits of spectrum'
|
|
1972
|
+
)
|
|
1973
|
+
|
|
1974
|
+
plot_xes.add_argument(
|
|
1975
|
+
'--y_lim',
|
|
1976
|
+
nargs=2,
|
|
1977
|
+
default=[0., 'auto'],
|
|
1978
|
+
help='Epsilon limits of spectrum in cm^-1 mol^-1 L'
|
|
1979
|
+
)
|
|
1980
|
+
|
|
1981
|
+
plot_xes.add_argument(
|
|
1982
|
+
'--normalise',
|
|
1983
|
+
'-n',
|
|
1704
1984
|
action='store_true',
|
|
1705
1985
|
default=False,
|
|
1706
1986
|
help=(
|
|
1707
|
-
'Normalises
|
|
1987
|
+
'Normalises spectrum to maximum value\n'
|
|
1708
1988
|
'Default: %(default)s'
|
|
1709
1989
|
)
|
|
1710
1990
|
)
|
orto/extractor.py
CHANGED
|
@@ -1575,6 +1575,72 @@ class OldAbsorptionVelocityDipoleExtractor(OldAbsorptionElectricDipoleExtractor)
|
|
|
1575
1575
|
END_PATTERN = rb'(?=-{77})'
|
|
1576
1576
|
|
|
1577
1577
|
|
|
1578
|
+
class XESElectricDipoleExtractor(AbsorptionElectricDipoleExtractor):
|
|
1579
|
+
'''
|
|
1580
|
+
Extracts X-RAY EMISSION SPECTRUM VIA TRANSITION ELECTRIC DIPOLE MOMENTS table\n # noqa
|
|
1581
|
+
from ORCA output file for versions newer than 6.
|
|
1582
|
+
'''
|
|
1583
|
+
|
|
1584
|
+
# Regex Start Pattern
|
|
1585
|
+
START_PATTERN = rb'(?<= X-RAY EMISSION SPECTRUM VIA TRANSITION VELOCITY DIPOLE MOMENTS\s[\S\s]{408}\s)' # noqa
|
|
1586
|
+
|
|
1587
|
+
# Regex End Pattern
|
|
1588
|
+
END_PATTERN = rb'(?=-{77})'
|
|
1589
|
+
|
|
1590
|
+
|
|
1591
|
+
class XESVelocityDipoleExtractor(AbsorptionElectricDipoleExtractor):
|
|
1592
|
+
'''
|
|
1593
|
+
Extracts X-RAY EMISSION SPECTRUM VIA TRANSITION VELOCITY DIPOLE MOMENTS table\n # noqa
|
|
1594
|
+
from ORCA output file for versions newer than 6.
|
|
1595
|
+
'''
|
|
1596
|
+
|
|
1597
|
+
# Regex Start Pattern
|
|
1598
|
+
START_PATTERN = rb'(?<= X-RAY EMISSION SPECTRUM VIA TRANSITION VELOCITY DIPOLE MOMENTS\s[\S\s]{415}\s)' # noqa
|
|
1599
|
+
|
|
1600
|
+
|
|
1601
|
+
class SOXESElectricDipoleExtractor(AbsorptionElectricDipoleExtractor):
|
|
1602
|
+
'''
|
|
1603
|
+
Extracts SPIN-ORBIT X-RAY EMISSION SPECTRUM VIA TRANSITION ELECTRIC DIPOLE MOMENTS table\n # noqa
|
|
1604
|
+
from ORCA output file for versions newer than 6.
|
|
1605
|
+
'''
|
|
1606
|
+
|
|
1607
|
+
# Regex Start Pattern
|
|
1608
|
+
START_PATTERN = rb'(?<=SPIN-ORBIT X-RAY EMISSION SPECTRUM VIA TRANSITION ELECTRIC DIPOLE MOMENTS\s[\S\s]{415}\s)' # noqa
|
|
1609
|
+
|
|
1610
|
+
# Regex End Pattern
|
|
1611
|
+
END_PATTERN = rb'(?=-{77})'
|
|
1612
|
+
|
|
1613
|
+
|
|
1614
|
+
class SOXESVelocityDipoleExtractor(AbsorptionElectricDipoleExtractor):
|
|
1615
|
+
'''
|
|
1616
|
+
Extracts SPIN-ORBIT X-RAY EMISSION SPECTRUM VIA TRANSITION VELOCITY DIPOLE MOMENTS table\n # noqa
|
|
1617
|
+
from ORCA output file for versions newer than 6.
|
|
1618
|
+
'''
|
|
1619
|
+
|
|
1620
|
+
# Regex Start Pattern
|
|
1621
|
+
START_PATTERN = rb'(?<=SPIN-ORBIT X-RAY EMISSION SPECTRUM VIA TRANSITION VELOCITY DIPOLE MOMENTS\s[\S\s]{408}\s)' # noqa
|
|
1622
|
+
|
|
1623
|
+
|
|
1624
|
+
class XESSemiClassicalDipoleExtractor(AbsorptionSemiClassicalDipoleExtractor):
|
|
1625
|
+
'''
|
|
1626
|
+
Extracts X-RAY EMISSION SPECTRUM VIA FULL SEMI-CLASSICAL FORMULATION table\n # noqa
|
|
1627
|
+
from ORCA output file for versions newer than 6.
|
|
1628
|
+
'''
|
|
1629
|
+
|
|
1630
|
+
# Regex Start Pattern
|
|
1631
|
+
START_PATTERN = rb'(?<= X-RAY EMISSION SPECTRUM VIA FULL SEMI-CLASSICAL FORMULATION\s[\S\s]{408}\s)' # noqa
|
|
1632
|
+
|
|
1633
|
+
|
|
1634
|
+
class SOXESSemiClassicalDipoleExtractor(AbsorptionSemiClassicalDipoleExtractor): # noqa
|
|
1635
|
+
'''
|
|
1636
|
+
Extracts SPIN-ORBIT X-RAY EMISSION SPECTRUM VIA TRANSITION VELOCITY DIPOLE MOMENTS table\n # noqa
|
|
1637
|
+
from ORCA output file for versions newer than 6.
|
|
1638
|
+
'''
|
|
1639
|
+
|
|
1640
|
+
# Regex Start Pattern
|
|
1641
|
+
START_PATTERN = rb'(?<= SPIN-ORBIT X-RAY EMISSION SPECTRUM VIA FULL SEMI-CLASSICAL FORMULATION\s[\S\s]{408}\s)' # noqa
|
|
1642
|
+
|
|
1643
|
+
|
|
1578
1644
|
class HessNameInputExtractor(extto.LineExtractor):
|
|
1579
1645
|
'''
|
|
1580
1646
|
Extracts Hessian file name from %mtr block of input file
|
orto/plotter.py
CHANGED
|
@@ -85,7 +85,8 @@ def plot_abs(x_values: ArrayLike, x_type: str, foscs: ArrayLike,
|
|
|
85
85
|
osc_style: str = 'separate', save: bool = False,
|
|
86
86
|
save_name: str = 'absorption_spectrum.png', show: bool = False,
|
|
87
87
|
verbose: bool = True,
|
|
88
|
-
window_title: str = 'Absorption Spectrum'
|
|
88
|
+
window_title: str = 'Absorption Spectrum',
|
|
89
|
+
plot_type: str = 'absorption') -> tuple[plt.Figure, list[plt.Axes]]: # noqa
|
|
89
90
|
'''
|
|
90
91
|
Plots absorption spectrum with intensity specified by oscillator strength.\n # noqa
|
|
91
92
|
Spectrum is computed as a sum of Gaussian or Lorentzian lineshapes.\n
|
|
@@ -129,6 +130,8 @@ def plot_abs(x_values: ArrayLike, x_type: str, foscs: ArrayLike,
|
|
|
129
130
|
If True, plot file location is written to terminal
|
|
130
131
|
window_title: str, default 'UV-Visible Absorption Spectrum'
|
|
131
132
|
Title of figure window, not of plot
|
|
133
|
+
plot_type: str, default 'absorption'
|
|
134
|
+
Type of plot to create, either 'absorption' or 'emission'.
|
|
132
135
|
|
|
133
136
|
Returns
|
|
134
137
|
-------
|
|
@@ -204,7 +207,11 @@ def plot_abs(x_values: ArrayLike, x_type: str, foscs: ArrayLike,
|
|
|
204
207
|
if normalise:
|
|
205
208
|
# Normalise the spectrum to the maximum value
|
|
206
209
|
spectrum /= np.max(spectrum)
|
|
207
|
-
ax.set_ylabel(
|
|
210
|
+
ax.set_ylabel(
|
|
211
|
+
'Normalised {} (arbitrary units)'.format(
|
|
212
|
+
plot_type.capitalize()
|
|
213
|
+
)
|
|
214
|
+
) # noqa
|
|
208
215
|
else:
|
|
209
216
|
ax.set_ylabel(r'$\epsilon$ (cm$^\mathregular{-1}$ mol$^\mathregular{-1}$ L)') # noqa
|
|
210
217
|
|
|
@@ -213,11 +220,11 @@ def plot_abs(x_values: ArrayLike, x_type: str, foscs: ArrayLike,
|
|
|
213
220
|
_txt_save_name,
|
|
214
221
|
np.vstack([x_grid, spectrum]).T,
|
|
215
222
|
fmt='%.5f',
|
|
216
|
-
header='
|
|
223
|
+
header=f'{plot_type.capitalize()} spectrum data\nx (wavenumber, wavelength or energy), y (absorbance)' # noqa
|
|
217
224
|
)
|
|
218
225
|
if verbose:
|
|
219
226
|
ut.cprint(
|
|
220
|
-
f'\
|
|
227
|
+
f'\n{plot_type.capitalize()} spectrum data saved to\n {_txt_save_name}', # noqa
|
|
221
228
|
'cyan'
|
|
222
229
|
)
|
|
223
230
|
|
|
@@ -278,8 +285,11 @@ def plot_abs(x_values: ArrayLike, x_type: str, foscs: ArrayLike,
|
|
|
278
285
|
if save:
|
|
279
286
|
plt.savefig(save_name, dpi=500)
|
|
280
287
|
if verbose:
|
|
281
|
-
ut.cprint(
|
|
282
|
-
|
|
288
|
+
ut.cprint(
|
|
289
|
+
f'\n{plot_type.capitalize()} spectrum saved to\n {save_name}',
|
|
290
|
+
'cyan'
|
|
291
|
+
)
|
|
292
|
+
|
|
283
293
|
if show:
|
|
284
294
|
plt.show()
|
|
285
295
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
orto/__init__.py,sha256=IedlltYr3qYZxChNUdz62qogXA9Pos_MUvXdGXqAa0E,41
|
|
2
|
+
orto/__version__.py,sha256=wShy9YfBfroz0HjRH_aNNehkEu1_PLsd_GjTU5aCDPk,22
|
|
3
|
+
orto/cli.py,sha256=D7UIJbMlLERhOUwg4Fm2QEeejvU_NKfVvSzcXZ8ards,71649
|
|
4
|
+
orto/constants.py,sha256=2obWYg306Lce4U9Qs4MHg1yZq7SHFkazG-cnkD5svpo,343
|
|
5
|
+
orto/exceptions.py,sha256=D7oNeAEGeJNt5thzt6PaCn5FY6JcbJOWUE1N1LVhhuE,159
|
|
6
|
+
orto/extractor.py,sha256=4n996-cZ_mLT65fheaou2zA3TiOAcOnClEUQa9-c8lE,72030
|
|
7
|
+
orto/input.py,sha256=N8JbySSVEC_qmXZ7ppJsZ7Z1qel6PfalGYRtnX1hJ6U,9900
|
|
8
|
+
orto/job.py,sha256=SM0nlc_bqhhPvfuuykhMvaUnkwC3Gp-6RvYw_a0TyGc,5855
|
|
9
|
+
orto/plotter.py,sha256=5QbLnrWzITuSWRklhmHvYnb8NfAPTdGevB3g1WzTjCY,19136
|
|
10
|
+
orto/utils.py,sha256=gVfGplkfc6xGYgLMi_7I_yAdWG-QKRaqQdy9v5F4Mck,7279
|
|
11
|
+
orto-1.5.0.dist-info/METADATA,sha256=_d4YzeA-fveynM-q4t0-6X2MoinbvEsH1qnc03bX2cM,1140
|
|
12
|
+
orto-1.5.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
13
|
+
orto-1.5.0.dist-info/entry_points.txt,sha256=HXenCglMp_03JkN34pK2phkjXK9CFcXTGHKv5QaVY8I,39
|
|
14
|
+
orto-1.5.0.dist-info/top_level.txt,sha256=hQ-z28gTN_FZ2B5Kiwxr_9cUTcCoib9W5HjbkceDXw4,5
|
|
15
|
+
orto-1.5.0.dist-info/RECORD,,
|
orto-1.4.0.dist-info/RECORD
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
orto/__init__.py,sha256=IedlltYr3qYZxChNUdz62qogXA9Pos_MUvXdGXqAa0E,41
|
|
2
|
-
orto/__version__.py,sha256=EyMGX1ADFzN6XVXHWbJUtKPONYKeFkvWoKIFPDDB2I8,22
|
|
3
|
-
orto/cli.py,sha256=CvRhsHcUs0PjoxqqxKiCkqNZySn8z1HfbBBoi9JbLDc,63487
|
|
4
|
-
orto/constants.py,sha256=2obWYg306Lce4U9Qs4MHg1yZq7SHFkazG-cnkD5svpo,343
|
|
5
|
-
orto/exceptions.py,sha256=D7oNeAEGeJNt5thzt6PaCn5FY6JcbJOWUE1N1LVhhuE,159
|
|
6
|
-
orto/extractor.py,sha256=NJaqpH6iLtzEMuYGJrpbZ5vKJrtE5rQOXLLPjm0acGQ,69536
|
|
7
|
-
orto/input.py,sha256=N8JbySSVEC_qmXZ7ppJsZ7Z1qel6PfalGYRtnX1hJ6U,9900
|
|
8
|
-
orto/job.py,sha256=SM0nlc_bqhhPvfuuykhMvaUnkwC3Gp-6RvYw_a0TyGc,5855
|
|
9
|
-
orto/plotter.py,sha256=onvevzjbhsb18DY8DiMGuDOLOjQ-Ore6eBybMkIUs7U,18817
|
|
10
|
-
orto/utils.py,sha256=gVfGplkfc6xGYgLMi_7I_yAdWG-QKRaqQdy9v5F4Mck,7279
|
|
11
|
-
orto-1.4.0.dist-info/METADATA,sha256=TFoHVG_EWEI1lBEltHKXyQ7AnUw3b5yYZeT6MJq8JyU,1140
|
|
12
|
-
orto-1.4.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
13
|
-
orto-1.4.0.dist-info/entry_points.txt,sha256=HXenCglMp_03JkN34pK2phkjXK9CFcXTGHKv5QaVY8I,39
|
|
14
|
-
orto-1.4.0.dist-info/top_level.txt,sha256=hQ-z28gTN_FZ2B5Kiwxr_9cUTcCoib9W5HjbkceDXw4,5
|
|
15
|
-
orto-1.4.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|