Class Spectrum


public class Spectrum extends JDXDataObject
JDXSpectrum implements the Interface Spectrum for the display of JDX Files.
Author:
Bob Hanson, Debbie-Ann Facey, Khari A. Bryan, Prof Robert J. Lancashire
  • Field Details

  • Constructor Details

    • Spectrum

      public Spectrum()
      Constructor
  • Method Details

    • dispose

      public void dispose()
    • isForcedSubset

      public boolean isForcedSubset()
    • setId

      public void setId(String id)
    • copy

      public Spectrum copy()
      specifically for Abs/Trans conversion. Note that we do NOT carry over piUnitsY
      Returns:
      a copy of this JDXSpectrum
    • getXYCoords

      public Coordinate[] getXYCoords()
      Returns the array of coordinates
      Returns:
      the array of coordinates
    • getPeakList

      public Lst<PeakInfo> getPeakList()
    • setPeakList

      public int setPeakList(Lst<PeakInfo> list, String peakXLabel, String peakYLabel)
    • selectPeakByFileIndex

      public PeakInfo selectPeakByFileIndex(String filePath, String index, String atomKey)
    • selectPeakByFilePathTypeModel

      public PeakInfo selectPeakByFilePathTypeModel(String filePath, String type, String model)
    • matchesPeakTypeModel

      public boolean matchesPeakTypeModel(String type, String model)
      Find a matching spectrum by type (IR, 1HNMR,...) and model name
      Parameters:
      type - if null, then model is a sourceID to match
      model -
      Returns:
      true for match
    • setSelectedPeak

      public void setSelectedPeak(PeakInfo peak)
    • setHighlightedPeak

      public void setHighlightedPeak(PeakInfo peak)
    • getSelectedPeak

      public PeakInfo getSelectedPeak()
    • getModelPeakInfoForAutoSelectOnLoad

      public PeakInfo getModelPeakInfoForAutoSelectOnLoad()
    • getAssociatedPeakInfo

      public PeakInfo getAssociatedPeakInfo(int xPixel, Coordinate coord)
    • findPeakByCoord

      public PeakInfo findPeakByCoord(int xPixel, Coordinate coord)
    • getPeakTitle

      public String getPeakTitle()
    • getTitleLabel

      public String getTitleLabel()
    • setNextPeak

      public int setNextPeak(Coordinate coord, int istep)
    • getPercentYValueAt

      public double getPercentYValueAt(double x)
    • getYValueAt

      public double getYValueAt(double x)
    • setUserYFactor

      public void setUserYFactor(double userYFactor)
      Set by JSViewer
      Parameters:
      userYFactor -
    • getUserYFactor

      public double getUserYFactor()
    • getConvertedSpectrum

      public Spectrum getConvertedSpectrum()
    • setConvertedSpectrum

      public void setConvertedSpectrum(Spectrum spectrum)
    • taConvert

      public static Spectrum taConvert(Spectrum spectrum, Spectrum.IRMode mode)
    • newSpectrum

      public static Spectrum newSpectrum(Spectrum spectrum, Coordinate[] newXYCoords, String units)
      copy spectrum with new coordinates
      Parameters:
      spectrum -
      newXYCoords -
      units -
      Returns:
      new spectrum
    • process

      public static boolean process(Lst<Spectrum> specs, Spectrum.IRMode irMode)
    • getSubSpectra

      public Lst<Spectrum> getSubSpectra()
    • getCurrentSubSpectrum

      public Spectrum getCurrentSubSpectrum()
    • advanceSubSpectrum

      public int advanceSubSpectrum(int dir)
    • setCurrentSubSpectrum

      public int setCurrentSubSpectrum(int n)
    • addSubSpectrum

      public boolean addSubSpectrum(Spectrum spectrum, boolean forceSub)
      adds an nD subspectrum and titles it "Subspectrum " These spectra can be iterated over using the UP and DOWN keys.
      Parameters:
      spectrum -
      forceSub -
      Returns:
      true if was possible
    • getSubIndex

      public int getSubIndex()
    • setExportXAxisDirection

      public void setExportXAxisDirection(boolean leftToRight)
    • isExportXAxisLeftToRight

      public boolean isExportXAxisLeftToRight()
    • getInfo

      public Map<String,Object> getInfo(String key)
    • findMatchingPeakInfo

      public PeakInfo findMatchingPeakInfo(PeakInfo pi)
    • getBasePeakInfo

      public PeakInfo getBasePeakInfo()
    • getAxisLabel

      public String getAxisLabel(boolean isX)
      checks in order: (1) Peaks tag attribute xUnits/yUnits, then (2) ##XLABEL/##YLABEL, then (3) ##XUNITS/##YUNITS
      Parameters:
      isX -
      Returns:
      suitable label or ""
    • findXForPeakNearest

      public double findXForPeakNearest(double x)
    • addSpecShift

      public double addSpecShift(double dx)
    • allowSubSpec

      public static boolean allowSubSpec(Spectrum s1, Spectrum s2)
    • areXScalesCompatible

      public static boolean areXScalesCompatible(Spectrum s1, Spectrum s2, boolean isSubspecCheck, boolean isLinkCheck)
    • areLinkableX

      public static boolean areLinkableX(Spectrum s1, Spectrum s2)
    • areLinkableY

      public static boolean areLinkableY(Spectrum s1, Spectrum s2)
    • getPeakWidth

      public float getPeakWidth()
    • setSimulated

      public void setSimulated(String filePath)
    • setFillColor

      public void setFillColor(GenericColor color)
    • toString

      public String toString()
      Overrides:
      toString in class Object