generate_spectrum
Draw IR, ¹H/¹³C NMR, MS, UV/Vis, Raman, NIR, fluorescence, ORD or CD spectra as PNG/SVG panels from supplied peak lists, with correct axis conventions for each spectrum type.
Instructions
Draw a spectrum — IR, ¹H/¹³C NMR, mass spectrum (MS), UV/Vis, Raman, NIR, fluorescence, ORD or CD — as PNG/SVG files with a panel.
Any request to draw, sketch, plot or show a spectrum is this tool, including a "schematic" spectrum of a named compound ("aspirin IR spectrum schematic") and requests with no peak values: then supply typical literature peak positions yourself (aspirin IR: C=O ~1750 and ~1690 cm⁻¹, broad O–H ~2500–3300 cm⁻¹). Use it instead of drawing the spectrum as a generic chart or visualization — this tool gets the axis conventions right (IR: inverted wavenumber axis with transmission dips; NMR: ppm right to left; MS: bars). It draws exactly the peaks it is given; it predicts nothing.
Not this tool for: working out WHICH bands to expect, or what a measured wavenumber belongs to (use predict_spectrum — its band list can then be drawn here), or the compound's structure formula (use generate_molecule).
Args: spectrum_type: One of "ir", "nir", "raman", "uv_vis", "fluorescence", "ord", "cd", "nmr_1h", "nmr_13c", "ms". peaks: Peak list. position uses the type's natural unit (cm⁻¹ for ir/nir/raman, nm for uv_vis/fluorescence/ord/cd, ppm for NMR, m/z for ms). intensity is relative on any scale (negative values only for ord/cd). width (optional) is the half-width in x-units; label (optional) annotates the peak in the plot (e.g. "C=O"). title: Display name shown in the plot title, also used for the filename (can be localized, e.g. "Aspirin IR"). formats: Output file formats, any of "png", "svg" (default: both). CDXML is not available for spectra.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| peaks | Yes | ||
| title | No | ||
| formats | No | ||
| spectrum_type | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| svg | No | ||
| name | No | ||
| type | No | spectrum | |
| files | No | ||
| spectrum_type | Yes |