CcpnForum
Copy Contour Base Levels - Printable Version

+- CcpnForum (https://www.ccpn.ac.uk/forums)
+-- Forum: CcpNmr Analysis Version 3 (https://www.ccpn.ac.uk/forums/forumdisplay.php?fid=4)
+--- Forum: V3 Macros (https://www.ccpn.ac.uk/forums/forumdisplay.php?fid=14)
+--- Thread: Copy Contour Base Levels (/showthread.php?tid=55)



Copy Contour Base Levels - VickyH - 11-26-2019

Dear All,

here is a small macro which will allow you to copy the contour levels from one spectrum to a number of other spectra.
The macro will act on the spectra in the "current" or active strip, i.e. the strip with (blue or green) highlighted axes. The contour levels will be copied from the first spectrum in the display (i.e. the left-hand spectrum in the spectrum toolbar) to all other spectra in that display (whether they are visible or not). Note that you can change the order of spectra in a Spectrum Display by dragging the spectrum buttons in the spectrum tool bar with the middle mouse button.

If you are working with Bruker data, you may have to ensure that the spectra have all been processed with the same ncproc value, in order for the spectra truly to display the same contour levels.

Python
  1. # Macro to copy the Contour Base level from the first spectrum in the active strip to
  2. # all other spectra in that strip.
  3.  
  4. sd = current.strip.spectrumDisplay
  5. sp1 = sd.orderedSpectrumViews(current.strip.spectra)
  6.  
  7. for spectrum in sp1[1:]:
  8. spectrum.positiveContourBase = sp1[0].positiveContourBase
  9. spectrum.negativeContourBase = sp1[0].negativeContourBase



To run this, simply go to Macro / New and copy and paste the code above. Save it to a file and press run. You can associate it with a keyboard shortcut by going to Macro / Define Macro Shortcuts... and associating the macro file you have just saved with one of the shortcuts available.

Vicky