Author: bugman Date: Fri Mar 20 09:49:03 2009 New Revision: 8982 URL: http://svn.gna.org/viewcvs/relax?rev=8982&view=rev Log: Added the Bruker ncproc parameter to handle Topspin's integer scaling of FID intensities. The data is now internally scaled by 2**ncproc. Modified: 1.3/generic_fns/spectrum.py 1.3/prompt/spectrum.py Modified: 1.3/generic_fns/spectrum.py URL: http://svn.gna.org/viewcvs/relax/1.3/generic_fns/spectrum.py?rev=8982&r1=8981&r2=8982&view=diff ============================================================================== --- 1.3/generic_fns/spectrum.py (original) +++ 1.3/generic_fns/spectrum.py Fri Mar 20 09:49:03 2009 @@ -701,7 +701,7 @@ return header_lines -def read(file=None, dir=None, spectrum_id=None, heteronuc=None, proton=None, int_col=None, int_method=None, mol_name_col=None, res_num_col=None, res_name_col=None, spin_num_col=None, spin_name_col=None, sep=None): +def read(file=None, dir=None, spectrum_id=None, heteronuc=None, proton=None, int_col=None, int_method=None, mol_name_col=None, res_num_col=None, res_name_col=None, spin_num_col=None, spin_name_col=None, sep=None, ncproc=None): """Read the peak intensity data. @keyword file: The name of the file containing the peak intensities. @@ -720,18 +720,20 @@ @type int_col: int @keyword int_method: The integration method, one of 'height', 'point sum' or 'other'. @type int_method: str - @param mol_name_col: The column containing the molecule name information. + @keyword mol_name_col: The column containing the molecule name information. @type mol_name_col: int or None - @param res_name_col: The column containing the residue name information. + @keyword res_name_col: The column containing the residue name information. @type res_name_col: int or None - @param res_num_col: The column containing the residue number information. + @keyword res_num_col: The column containing the residue number information. @type res_num_col: int or None - @param spin_name_col: The column containing the spin name information. + @keyword spin_name_col: The column containing the spin name information. @type spin_name_col: int or None - @param spin_num_col: The column containing the spin number information. + @keyword spin_num_col: The column containing the spin number information. @type spin_num_col: int or None - @param sep: The column seperator which, if None, defaults to whitespace. + @keyword sep: The column separator which, if None, defaults to whitespace. @type sep: str or None + @keyword ncproc: The Bruker ncproc binary intensity scaling factor. + @type ncproc: int or None """ # Test if the current data pipe exists. @@ -814,13 +816,17 @@ if format == 'xeasy': det_dimensions(file_data=file_data, proton=proton, heteronuc=heteronuc, int_col=int_col) - # Add the spectrum id to the relax data store. + # Add the spectrum id (and ncproc) to the relax data store. if not hasattr(cdp, 'spectrum_ids'): cdp.spectrum_ids = [] + if ncproc != None: + cdp.ncproc = {} if spectrum_id in cdp.spectrum_ids: raise RelaxError, "The spectrum identification string '%s' already exists." % spectrum_id else: cdp.spectrum_ids.append(spectrum_id) + if ncproc != None: + cdp.ncproc[spectrum_id] = ncproc # Loop over the peak intensity data. for i in xrange(len(file_data)): @@ -845,6 +851,10 @@ # Initialise. if not hasattr(spin, 'intensities'): spin.intensities = [] + + # Intensity scaling. + if ncproc != None: + intensity = intensity / float(2**ncproc) # Add the data. if format == 'generic': Modified: 1.3/prompt/spectrum.py URL: http://svn.gna.org/viewcvs/relax/1.3/prompt/spectrum.py?rev=8982&r1=8981&r2=8982&view=diff ============================================================================== --- 1.3/prompt/spectrum.py (original) +++ 1.3/prompt/spectrum.py Fri Mar 20 09:49:03 2009 @@ -290,7 +290,7 @@ spectrum.integration_points(N=N, spectrum_id=spectrum_id, spin_id=spin_id) - def read_intensities(self, file=None, dir=None, spectrum_id=None, heteronuc='N', proton='HN', int_col=None, int_method='height', mol_name_col=None, res_num_col=None, res_name_col=None, spin_num_col=None, spin_name_col=None, sep=None): + def read_intensities(self, file=None, dir=None, spectrum_id=None, heteronuc='N', proton='HN', int_col=None, int_method='height', mol_name_col=None, res_num_col=None, res_name_col=None, spin_num_col=None, spin_name_col=None, sep=None, ncproc=None): """Function for reading peak intensities from a file for NOE calculations. Keyword Arguments @@ -321,6 +321,8 @@ spin_name_col: The spin name column used by the generic intensity file format. sep: The column separator used by the generic intensity format (defaults to white space). + + ncproc: The Bruker specific FID intensity scaling factor. Description @@ -343,6 +345,15 @@ summation, with no deconvolution algorithms or other methods affecting peak heights, then the argument should be set to 'point sum'. All other volume integration methods, e.g. line shape fitting, the argument should be set to 'other'. + + If a series of intensities extracted from Bruker FID files processed in Topspin or XWinNMR + are to be compared, the ncproc parameter may need to be supplied. This is because this FID + is stored using integer representation and is scaled using ncproc to avoid numerical + truncation artifacts. If two spectra have significantly different maximal intensities, then + ncproc will be different for both. The intensity scaling is binary, i.e. 2**ncproc. + Therefore if spectrum A has an ncproc of 6 and and spectrum B a value of 7, then a reference + intensity in B will be double that of A. Internally, relax stores the intensities scaled by + 2**ncproc. File formats @@ -474,8 +485,12 @@ if sep != None and type(sep) != str: raise RelaxNoneStrError, ('column separator', sep) + # Bruker ncproc parameter. + if ncproc != None and type(ncproc) != int: + raise RelaxNoneIntError, ('Bruker ncproc parameter', ncproc) + # Execute the functional code. - spectrum.read(file=file, dir=dir, spectrum_id=spectrum_id, heteronuc=heteronuc, proton=proton, int_col=int_col, int_method=int_method, mol_name_col=mol_name_col, res_num_col=res_num_col, res_name_col=res_name_col, spin_num_col=spin_num_col, spin_name_col=spin_name_col, sep=sep) + spectrum.read(file=file, dir=dir, spectrum_id=spectrum_id, heteronuc=heteronuc, proton=proton, int_col=int_col, int_method=int_method, mol_name_col=mol_name_col, res_num_col=res_num_col, res_name_col=res_name_col, spin_num_col=spin_num_col, spin_name_col=spin_name_col, sep=sep, ncproc=ncproc) def replicated(self, spectrum_ids=None):