Help:Using the spectral display tool
From Learn Chemistry Wiki
The DisplaySpectrum extension was created by User:Daya to allow spectra from ChemSpider to be displayed inside this wiki. The spectra are usually not image files but "live", allowing the user to zoom in on certain parts of the spectra, analyse data, etc.
To display a spectrum on a wiki page
Several steps are involved:
- First, you need to find if a suitable spectrum is available inside ChemSpider. This can be done (a) by searching for your "target" compound inside ChemSpider, and seeing if a spectrum is displayed, or (b) searching inside this site for your "target" compound, and checking to see if a link is given to a ChemSpider spectrum. See this example.
- Having found a suitable substance with a spectrum, you must read the spectrumID, shown next to the spectrum. For example on this page the spectrumID is shown as 1489.
- Insert the code into the wiki page to display the relevant spectrum. For SpectrumID 1489 this can be done by entering:
- <DisplaySpectrum spid="1489"/>
This should display the spectrum like this:
Locating suitable spectra
Many of the spectra we use come from RSC SpectraSchool. A list of the SpectraSchool spectra is available on that site (IR, UV, MS, 1H and 13C NMR).
- in Chrome and Firefox it uses the ChemDoodle widget, but in Internet Explorer it uses the JSpecView applet, but this may vary for you depending what versions of these browsers you have. Basically the extension checks to see whether the browser supports canvases and if it does then it uses ChemDoodle, but if not JSpecView.
- While in theory you can put multiple JCamp spectra in the same page, sometimes when the page is viewed in Internet explorer the applet won’t load (just shows the loading for ages), but not all the time.
- While the extension was designed to show spectra in ChemSpider which are in JCamp format, it will also retrieve those which are just in as images (without resizing them). The spectrum needs to be in one of the following formats: JCamp format (with extension .jdx, .dx), or an image format .bmp, .gif, .jpg or .png. PDF spectra are not readable using this extension, but these should be quite rare.
- If the spectrum file extension is .jdx or .dx then the DisplaySpectrum extension will retrieve the spectrum file from ChemSpider, store it locally on the mediawiki server and render this local copy of the file. Most of the time it will not be necessary to refetch it again (since it isn't possible for people who aren't developers to edit spectra files already in ChemSpider), but if for any reason you do want to refetch a spectrum from ChemSpider then edit the mediawiki source page to:
- <DisplaySpectrum spid="103" reload="true"/>
And this will force the spectrum file to be fetched again. If you do use this option then make sure that after you are happy with the new spectrum file, that you edit the source of the mediawiki page to remove the reload="true" option out again, so that it isn't refetched every time anyone views that page again.
- If the spectrum filetype is an image rather than a JCamp file then the DisplaySpectrum extension will simply render it as an image with the same file dimensions as the original file.