Exemple #1
0
void Nmr::updatePlot()
{
   m_plot->clearGraphs();

   QList<double> data;
   QString isotope(currentIsotope());

   if (isotope.isEmpty()) {
      data = m_data.shieldings();
      m_plot->xAxis->setLabel("Nuclear Shielding (ppm)");
   }else {
      data = computeShifts(currentReference(), isotope);
      m_plot->xAxis->setLabel("Chemical Shift (ppm)");
   }

   if (m_ui->impulseButton->isChecked()) {
      // the range is really determining the resolution here
      plotImpulse(data, standardRange(isotope));
   }else if (m_ui->lorentzianButton->isChecked()) {
      // There has to be an easier way
      double min(m_plot->xAxis->pixelToCoord(m_plot->axisRect()->right())); 
      double max(m_plot->xAxis->pixelToCoord(m_plot->axisRect()->left())); 
      plotSpectrum(data, qMakePair(min, max));
   }

   m_plot->replot();
}
void ExcitedStates::updateSpectrum()
{
   m_spectrum->clearGraphs();
   double width(m_configurator.widthSlider->value());

   if (m_configurator.impulseButton->isChecked()) {
      plotImpulse();
      m_spectrum->yAxis->setLabel("Strength");

   }else if (m_configurator.gaussianButton->isChecked()) {
      plotSpectrum(Gaussian, width);
      m_spectrum->yAxis->setLabel("Rel. Strength");

   }else if (m_configurator.lorentzianButton->isChecked()) {
      plotSpectrum(Lorentzian, width);
      m_spectrum->yAxis->setLabel("Rel. Strength");
   }

   m_spectrum->replot();
}
void Frequencies::updatePlot()
{
   m_customPlot->clearGraphs();
   double scale(m_configurator.scaleFactor->value());
   double width(m_configurator.widthSlider->value());

   if (m_configurator.impulseButton->isChecked()) {
      plotImpulse(scale);
      m_customPlot->yAxis->setLabel("Intensity");

   }else if (m_configurator.gaussianButton->isChecked()) {
      plotSpectrum(Gaussian, scale, width);
      m_customPlot->yAxis->setLabel("Rel. Intensity");

   }else if (m_configurator.lorentzianButton->isChecked()) {
      plotSpectrum(Lorentzian, scale, width);
      m_customPlot->yAxis->setLabel("Rel. Intensity");

   }

   m_customPlot->replot();
}