Class BrukerReader

java.lang.Object
jspecview.source.BrukerReader

public class BrukerReader extends Object
A class to read Bruker ZIP files and directories. The first acqus file found in a ZIP file sets the spectrum for pdata/1. In the case of a (Java) file directory, any(?) file in the main (numbered) Bruker directory or any pdata directory can be targeted. The File...Add File... chooser in Java now accepts directories and in that case assumes they are Bruker directories. (There had been some code in here for reading ZIP files as collections of JDX spectra, but we can't remember why that was there, and actually it didn't work anyway.) 2D data may be off by a fraction of a Hz in the F1 (outer) dimension. This is because I did not figure out how Bruker is arriving at FREQUENCY1.first. Tests showed a 0.3 Hz offset. This is in the 6th or 7th decimal place, so presumably that is not significant. 2D reading has (never) been checked for cases where the Y axis is J. JavaScript will receive bytes only
Author:
hansonr
  • Constructor Details

    • BrukerReader

      public BrukerReader()
  • Method Details

    • readBrukerZip

      public JDXSource readBrukerZip(byte[] bytes, String fullPath) throws FileNotFoundException, Exception
      Read through a ZIP file (Java or JavaScript) looking for title, acqus, procs, 1r, 1i, 2rr. Parameters from title, acqus, and procs are put into a Map. 1r, 1i, and 2rr are read as raw bytes and converted to doubles later. An attempt is made to retreive files from the same folder holding acqu. Currently, we are skipping 1i.
      Parameters:
      bytes - raw ZIP byte data
      fullPath -
      Returns:
      a JDXSource, which may hold multiple subspectra
      Throws:
      FileNotFoundException
      Exception
    • readBrukerDir

      public JDXSource readBrukerDir(String fullPath) throws FileNotFoundException, Exception
      Read through a Bruker directory (Java only) looking for title, acqus, procs, 1r, 1i, 2rr. Parameters from title, acqus, and procs are put into a Map. 1r, 1i, and 2rr are read as raw bytes and converted to doubles later. An attempt is made to retreive files from the same folder holding acqu. Currently, we are skipping 1i.
      Parameters:
      fullPath -
      Returns:
      a JDXSource, which may hold multiple subspectra
      Throws:
      FileNotFoundException
      Exception