Author: bugman Date: Wed Aug 21 16:23:15 2013 New Revision: 20669 URL: http://svn.gna.org/viewcvs/relax?rev=20669&view=rev Log: Implemented the reading of chemical shifts in the lib.spectrum.nmrview.read_list() function. Modified: trunk/lib/spectrum/nmrview.py Modified: trunk/lib/spectrum/nmrview.py URL: http://svn.gna.org/viewcvs/relax/trunk/lib/spectrum/nmrview.py?rev=20669&r1=20668&r2=20669&view=diff ============================================================================== --- trunk/lib/spectrum/nmrview.py (original) +++ trunk/lib/spectrum/nmrview.py Wed Aug 21 16:23:15 2013 @@ -55,6 +55,10 @@ # Strip the data. file_data = strip(file_data) + # The chemical shift columns. + w2_col = 2 + w1_col = 9 + # The peak intensity column. if int_col == None: int_col = 16 @@ -94,6 +98,20 @@ name1 = name1.split('.') name1 = name1[1] + # Chemical shifts. + w1 = None + w2 = None + if w1_col != None: + try: + w1 = float(line[w1_col]) + except ValueError: + raise RelaxError("The chemical shift from the line %s is invalid." % line) + if w2_col != None: + try: + w2 = float(line[w2_col]) + except ValueError: + raise RelaxError("The chemical shift from the line %s is invalid." % line) + # Intensity. try: intensity = float(line[int_col]) @@ -101,4 +119,4 @@ raise RelaxError("The peak intensity value " + repr(intensity) + " from the line " + repr(line) + " is invalid.") # Add the assignment to the peak list object. - peak_list.add(res_nums=[res_num, res_num], spin_names=[name1, name2], intensity=intensity) + peak_list.add(res_nums=[res_num, res_num], spin_names=[name1, name2], shifts=[w1, w2], intensity=intensity)