Spectra module¶
SpectraTask¶
-
class
esteem.tasks.spectra.
SpectraTask
(**kwargs)[source]¶ -
run
(fig=None, ax=None, plotlabel=None, rgb=array([0., 0., 0.]), linestyle='solid')[source]¶ Main routine for plotting a spectrum. Capable of applying Gaussian broadening to a stick spectrum to produce a broadened spectrum, and also of applying spectral warping to shift/scale the stick spectrum.
Arguments:
- self: class
- All arguments for the job - see documentation below.
- fig, ax: matplotlib objects
- Figure and axis objects for matplotlib.pyplot. Initialised anew if they have value None on entry.
- plotlabel:
- Label to add the key for this dataset.
- rgb:
- Colour of the line/points for this dataset. If set to (-1.0,-1.0,-1.0), the RGB colour will be calculated from the spectrum.
Returns:
broad_spectrum,spec_plot,fig,ax,all_transition_originsOutput:
Plots the spectrum to ‘self.output’ as a png file if requested.
-
Task Arguments¶
usage: __main__.py [-h] [--files [FILES ...]] [--vib_files [VIB_FILES ...]]
[--trajectory [TRAJECTORY ...]] [--max_frames MAX_FRAMES]
[--start_frame START_FRAME] [--stride_frames STRIDE_FRAMES]
[--wavelength WAVELENGTH WAVELENGTH WAVELENGTH]
[--energies ENERGIES ENERGIES ENERGIES]
[--warp_params [WARP_PARAMS]] [--warp_scheme [WARP_SCHEME]]
[--broad BROAD] [--mode MODE] [--renorm RENORM]
[--inputformat INPUTFORMAT] [--output OUTPUT]
[--verbosity VERBOSITY] [--illuminant ILLUMINANT]
[--XYZresponse XYZRESPONSE] [--exc_suffix [EXC_SUFFIX]]
[--warp_broad [WARP_BROAD]]
[--warp_origin_ref_peak_range [WARP_ORIGIN_REF_PEAK_RANGE]]
[--warp_dest_ref_peak_range [WARP_DEST_REF_PEAK_RANGE]]
[--warp_inputformat [WARP_INPUTFORMAT]]
[--warp_dest_files WARP_DEST_FILES]
[--warp_origin_files WARP_ORIGIN_FILES]
[--line_colours [LINE_COLOURS]]
[--merge_solutes MERGE_SOLUTES]
Named Arguments¶
--files, -f | List of output files from which to generate spectrum Default: [] |
--vib_files, -v | |
List of output files from which to generate spectrum | |
--trajectory, -t | |
Trajectory file for input | |
--max_frames, -M | |
Maximum number of frames to process | |
--start_frame, -S | |
Starting point of frames to process Default: 0 | |
--stride_frames, -F | |
Stride for frames to process Default: 1 | |
--wavelength, -w | |
List of minimum, maximum wavelength and step Default: [200.0, 800.0, 1.0] | |
--energies, -E | List of minimum, maximum energies and step |
--warp_params, -s | |
Parameters for spectral warp - meaning differs depending on warp_scheme argument Default: [0.0] | |
--warp_scheme | Scheme for spectral warp (beta,alphabeta or betabeta) Default: “beta” |
--broad, -b | Broadening for spectrum, in eV Default: 0.05 |
--mode, -m | Default: “absorption” |
--renorm, -R | Renormalise spectrum so that highest peak is at 1.0 Default: True |
--inputformat, -i | |
Expected format of output files | |
--output, -o | File to write final plots to |
--verbosity, -V | |
Level of output Default: “normal” | |
--illuminant, -I | |
Spectrum of illuminant for calculating RGB colour Default: “D65_illuminant.txt” | |
--XYZresponse, -X | |
Response spectrum X, Y and Z functions for calculating RGB colour Default: “XYZ_response.txt” | |
--exc_suffix, -e | |
Suffix of excitation calculation directories Default: “exc” | |
--warp_broad | Broadening to apply when calculating warp parameters |
--warp_origin_ref_peak_range | |
Wavelength range in origin spectrum to be included in finding peaks for spectral warping | |
--warp_dest_ref_peak_range | |
Wavelength range in destination spectrum to be included in finding peaks for spectral warping | |
--warp_inputformat | |
Expected format of output files for calculating spectral warp parameters Default: “nwchem” | |
--warp_dest_files | |
Files for calculating spectral warp parameters Default: “PBE0/is_tddft_{solv}/{solu}/tddft.nwo” | |
--warp_origin_files | |
Files for calculating spectral warp parameters Default: “PBE/is_tddft_{solv}/{solu}/tddft.nwo” | |
--line_colours | Line colours for final plot |
--merge_solutes | |
Dictionary of solutes that should be merged into each key Default: {} |
Standalone module routines¶
Task that generates and plots uv/vis Spectra for solutes in solvent. Also contains routines to calculate spectral warp parameters and RGB colours from spectra
-
esteem.tasks.spectra.
find_spectral_warp_params
(args, dest_spectrum, origin_spectrum, arrow1_pos=None, arrow2_pos=None)[source]¶ Finds spectral warping parameters via a range of schemes. See spectra documentation page for more detail.
Arguments
- dest_spectrum: numpy array of floats
- Contains the spectral warp ‘destination’ spectrum (usually a high level of theory that can only be afforded for the solute molecule)
- origin_spectrum: numpy array of floats
- Contains the spectral warp ‘origin’ spectrum (usually a cheap level of theory, same as in the Clusters job)
- args.warp_scheme: str
- The scheme used for the warping. Allowed values: ‘beta’, ‘alphabeta’, ‘betabeta’
- args.warp_origin_ref_peak_range: list of 2 floats
- Peak range searched when looking for ‘reference’ peaks in the origin spectrum for spectral warping.
- args.warp_dest_ref_peak_range: list of 2 floats
- Peak range searched when looking for ‘reference’ peaks in the destination spectrum for spectral warping.
- args.broad:
- Energy gaussian broadening applied to the stick spectra, useful to merge peaks that you want to treat as one peak in spectral warping.
Returns
[beta], [alpha, beta], [beta1, beta2, omega1o, omega2o]: floats describing spectral warp parameters
Also sets arrow1_pos, arrow2_pos for use in spectral warp plots.
-
esteem.tasks.spectra.
RGB_colour
(spectrum, args)[source]¶ Finds the RGB colour corresponding to a given absorption spectrum and illumination.
- spectrum: numpy array
- Spectrum for which to find the colour
- args: namespace or class
Full set of arguments for the spectra task. Relevant to this routine are:
args.XYZresponse
andargs.illuminant
which supply the Color Space XYZ response spectra and the illuminant spectrum, respectively.These must be on the same wavelength scale as the spectrum.