Author: bugman Date: Fri Mar 6 11:33:35 2009 New Revision: 8912 URL: http://svn.gna.org/viewcvs/relax?rev=8912&view=rev Log: Added checks for the residue names and numbers, and atom names. They should not be None. Modified: branches/bmrb/bmrblib/kinetics/heteronucl_NOEs.py branches/bmrb/bmrblib/kinetics/heteronucl_T1_relaxation.py branches/bmrb/bmrblib/kinetics/heteronucl_T2_relaxation.py branches/bmrb/bmrblib/misc.py Modified: branches/bmrb/bmrblib/kinetics/heteronucl_NOEs.py URL: http://svn.gna.org/viewcvs/relax/branches/bmrb/bmrblib/kinetics/heteronucl_NOEs.py?rev=8912&r1=8911&r2=8912&view=diff ============================================================================== --- branches/bmrb/bmrblib/kinetics/heteronucl_NOEs.py (original) +++ branches/bmrb/bmrblib/kinetics/heteronucl_NOEs.py Fri Mar 6 11:33:35 2009 @@ -27,7 +27,7 @@ """ # relax module imports. -from bmrblib.misc import translate +from bmrblib.misc import no_missing, translate from bmrblib.tag_category import TagCategory from pystarlib.SaveFrame import SaveFrame from pystarlib.TagTable import TagTable @@ -74,6 +74,11 @@ @type errors: list of float """ + # Check the ID info. + no_missing(res_nums, 'residue numbers of the ' + `int(frq*1e-6)` + ' MHz NOE data') + no_missing(res_names, 'residue names of the ' + `int(frq*1e-6)` + ' MHz NOE data') + no_missing(atom_names, 'atom names of the ' + `int(frq*1e-6)` + ' MHz NOE data') + # Place the args into the namespace. self.frq = frq self.res_nums = translate(res_nums) Modified: branches/bmrb/bmrblib/kinetics/heteronucl_T1_relaxation.py URL: http://svn.gna.org/viewcvs/relax/branches/bmrb/bmrblib/kinetics/heteronucl_T1_relaxation.py?rev=8912&r1=8911&r2=8912&view=diff ============================================================================== --- branches/bmrb/bmrblib/kinetics/heteronucl_T1_relaxation.py (original) +++ branches/bmrb/bmrblib/kinetics/heteronucl_T1_relaxation.py Fri Mar 6 11:33:35 2009 @@ -27,7 +27,7 @@ """ # relax module imports. -from bmrblib.misc import translate +from bmrblib.misc import no_missing, translate from bmrblib.tag_category import TagCategory from pystarlib.SaveFrame import SaveFrame from pystarlib.TagTable import TagTable @@ -74,6 +74,11 @@ @type errors: list of float """ + # Check the ID info. + no_missing(res_nums, 'residue numbers of the ' + `int(frq*1e-6)` + ' MHz NOE data') + no_missing(res_names, 'residue names of the ' + `int(frq*1e-6)` + ' MHz NOE data') + no_missing(atom_names, 'atom names of the ' + `int(frq*1e-6)` + ' MHz NOE data') + # Place the args into the namespace. self.frq = frq self.res_nums = translate(res_nums) Modified: branches/bmrb/bmrblib/kinetics/heteronucl_T2_relaxation.py URL: http://svn.gna.org/viewcvs/relax/branches/bmrb/bmrblib/kinetics/heteronucl_T2_relaxation.py?rev=8912&r1=8911&r2=8912&view=diff ============================================================================== --- branches/bmrb/bmrblib/kinetics/heteronucl_T2_relaxation.py (original) +++ branches/bmrb/bmrblib/kinetics/heteronucl_T2_relaxation.py Fri Mar 6 11:33:35 2009 @@ -27,7 +27,7 @@ """ # relax module imports. -from bmrblib.misc import translate +from bmrblib.misc import no_missing, translate from bmrblib.tag_category import TagCategory from pystarlib.SaveFrame import SaveFrame from pystarlib.TagTable import TagTable @@ -74,6 +74,11 @@ @type errors: list of float """ + # Check the ID info. + no_missing(res_nums, 'residue numbers of the ' + `int(frq*1e-6)` + ' MHz NOE data') + no_missing(res_names, 'residue names of the ' + `int(frq*1e-6)` + ' MHz NOE data') + no_missing(atom_names, 'atom names of the ' + `int(frq*1e-6)` + ' MHz NOE data') + # Place the args into the namespace. self.frq = frq self.res_nums = translate(res_nums) Modified: branches/bmrb/bmrblib/misc.py URL: http://svn.gna.org/viewcvs/relax/branches/bmrb/bmrblib/misc.py?rev=8912&r1=8911&r2=8912&view=diff ============================================================================== --- branches/bmrb/bmrblib/misc.py (original) +++ branches/bmrb/bmrblib/misc.py Fri Mar 6 11:33:35 2009 @@ -24,6 +24,34 @@ """Functions for manipulating NMR-STAR dictionary data.""" +def no_missing(data, name): + """Check that there are no None values in the data. + + @param data: The data to check. + @type data: anything + @param name: The name associated with the data. + @type name: str + """ + + # Init. + missing = False + + # List data. + if type(data) == list: + # Loop over the data. + for i in range(len(data)): + if data[i] == None or data[i] == 'None': + missing = True + + # None. + if data == None: + missing = True + + # Fail. + if missing: + raise NameError, "Data is missing from the " + name + '.' + + def translate(data): """Translate all None values into the '?' string.