<commit_before>// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
// $Id: bruker2DFile.h,v 1.21 2003/06/01 09:13:41 oliver Exp $
//

#ifndef BALL_FORMAT_BRUKER2DFILE_H
#define BALL_FORMAT_BRUKER2DFILE_H

#ifndef BALL_SYSTEM_FILE_H
# include <BALL/SYSTEM/file.h>
#endif

#ifndef BALL_DATATYPE_STRING_H
# include <BALL/DATATYPE/string.h>
#endif

#ifndef BALL_FORMAT_JCAMPFILE_H
# include <BALL/FORMAT/JCAMPFile.h>
#endif

#ifndef BALL_DATATYPE_STRING_H
# include <BALL/DATATYPE/string.h>
#endif

#ifndef BALL_FORMAT_JCAMPFILE_H
# include <BALL/FORMAT/JCAMPFile.h>
#endif

#ifndef BALL_DATATYPE_REGULARDATA2D_H
# include <BALL/DATATYPE/regularData2D.h>
#endif

#include <vector>
#include <list>


namespace BALL
{
	/**	Bruker 2D spectrum format.
			A class for reading Bruker two-dimensional NMR spectra.
			 \par
			
    	\ingroup  NMRFileFormats
	*/
	// ?????
	class Bruker2D 
		: public File
	{
	 public:

		/** Default constructor.
		 */
		Bruker2D();

		/**	Constructor.
				@param name important: name of the Bruker-*directory*
		*/
		Bruker2D(const String& name, OpenMode open_mode = std::ios::in | std::ios::binary)
			throw(Exception::FileNotFound);

		/**	Copy-Constructor.
		*/
		Bruker2D(const Bruker2D& file)
			throw(Exception::FileNotFound);

		/**	Destructor.
		*/
		~Bruker2D()
			throw();

		/** Read a spectrum. 
				It will be stored in spectrum_;
		*/
		void read();

		/** Read a spectrum from "name". 
				It will be stored in spectrum_;
		*/
		void read(const String &name);

		/// Return a reference to the spectrum.
		const RegularData2D getData() const { return spectrum_; }
		///
		RegularData2D getData() { return spectrum_; }

		/**	Returns a list of peaks found in the spectrum.
		*/
		std::list<std::pair<int, int> > getPeakList() const;

		/** Returns the shift corresponding to a position in the bitmap.
		*/
		std::pair<double, double> getShift(Position x, Position y);

		/** Returns the coordinates of a point in the original data next to the given coordinates.
		*/
		std::pair<Position, Position> getPosition(double x, double y);

		/** Set the parameters needed for conversion index<->shift.
		*/
		void setShiftRange(double offsetf1, double offsetf2, double swidthf1, double swidthf2, 
											 double bfreqf1, double bfreqf2, double spointnumf1, double spointnumf2);

	  protected:
		/// These classes give access to the parameters used in aqcuiring the spectrum.
		JCAMPFile parsf1_;
		JCAMPFile parsf2_;<commit_msg>fixed: adapted to new interface of JCAMPFile<commit_after>// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
// $Id: bruker2DFile.h,v 1.22 2003/06/01 17:07:10 oliver Exp $
//

#ifndef BALL_FORMAT_BRUKER2DFILE_H
#define BALL_FORMAT_BRUKER2DFILE_H

#ifndef BALL_SYSTEM_FILE_H
# include <BALL/SYSTEM/file.h>
#endif

#ifndef BALL_DATATYPE_STRING_H
# include <BALL/DATATYPE/string.h>
#endif

#ifndef BALL_FORMAT_JCAMPFILE_H
# include <BALL/FORMAT/JCAMPFile.h>
#endif

#ifndef BALL_DATATYPE_STRING_H
# include <BALL/DATATYPE/string.h>
#endif

#ifndef BALL_FORMAT_JCAMPFILE_H
# include <BALL/FORMAT/JCAMPFile.h>
#endif

#ifndef BALL_DATATYPE_REGULARDATA2D_H
# include <BALL/DATATYPE/regularData2D.h>
#endif

#include <vector>
#include <list>


namespace BALL
{
	/**	Bruker 2D spectrum format.
			A class for reading Bruker two-dimensional NMR spectra.
			 \par
			
    	\ingroup  NMRFileFormats
	*/
	class Bruker2DFile
		: public File
	{
	 public:

		/** Default constructor.
		 */
		Bruker2DFile();

		/**	Constructor.
				@param name important: name of the Bruker-*directory*
		*/
		Bruker2DFile(const String& name, OpenMode open_mode = std::ios::in | std::ios::binary)
			throw(Exception::FileNotFound);

		/**	Copy-Constructor.
		*/
		Bruker2DFile(const Bruker2DFile& file)
			throw(Exception::FileNotFound);

		/**	Destructor.
		*/
		virtual ~Bruker2DFile()
			throw();

		/** Read a spectrum. 
				It will be stored in spectrum_;
		*/
		void read();

		/** Read a spectrum from "name". 
				It will be stored in spectrum_;
		*/
		void read(const String &name);

		/// Return a reference to the spectrum.
		const RegularData2D& getData() const { return spectrum_; }
		///
		RegularData2D& getData() { return spectrum_; }

		/**	Returns a list of peaks found in the spectrum.
		*/
		std::list<std::pair<int, int> > getPeakList() const;

		/** Returns the shift corresponding to a position in the bitmap.
		*/
		std::pair<double, double> getShift(Position x, Position y);

		/** Returns the coordinates of a point in the original data next to the given coordinates.
		*/
		std::pair<Position, Position> getPosition(double x, double y);

		/** Set the parameters needed for conversion index<->shift.
		*/
		void setShiftRange(double offsetf1, double offsetf2, double swidthf1, double swidthf2, 
											 double bfreqf1, double bfreqf2, double spointnumf1, double spointnumf2);

	  protected:
		/// These classes give access to the parameters used in aqcuiring the spectrum.
		JCAMPFile parsf1_;
		JCAMPFile parsf2_;
{'fraction_non_alphanumeric': 0.11802488960256925, 'fraction_numerical': 0.017262143717382578, 'mean_word_length': 3.6310408921933086, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3811437', 'n_tokens_mistral': 1945, 'n_tokens_neox': 1712, 'n_words': 476}