Author: bugman
Date: Tue Sep 30 17:31:30 2014
New Revision: 26100
URL: http://svn.gna.org/viewcvs/relax?rev=26100&view=rev
Log:
Converted all of the pipe_control.strucuture.main functions to use the
check_structure() object.
This standardises and improves all of the checks.
Modified:
trunk/pipe_control/structure/main.py
Modified: trunk/pipe_control/structure/main.py
URL:
http://svn.gna.org/viewcvs/relax/trunk/pipe_control/structure/main.py?rev=26100&r1=26099&r2=26100&view=diff
==============================================================================
--- trunk/pipe_control/structure/main.py (original)
+++ trunk/pipe_control/structure/main.py Tue Sep 30 17:31:30 2014
@@ -29,7 +29,7 @@
from warnings import warn
# relax module imports.
-from lib.errors import RelaxError, RelaxFileError, RelaxNoPdbError,
RelaxNoSequenceError
+from lib.errors import RelaxError, RelaxFileError
from lib.io import get_file_path, open_write_file, write_data
from lib.sequence import write_spin_data
from lib.structure.internal.displacements import Displacements
@@ -40,7 +40,7 @@
from lib.warnings import RelaxWarning, RelaxNoPDBFileWarning,
RelaxZeroVectorWarning
from pipe_control import molmol, pipes
from pipe_control.interatomic import interatomic_loop
-from pipe_control.mol_res_spin import create_spin, exists_mol_res_spin_data,
generate_spin_id_unique, linear_ave, return_spin, spin_loop
+from pipe_control.mol_res_spin import check_mol_res_spin_data, create_spin,
generate_spin_id_unique, linear_ave, return_spin, spin_loop
from pipe_control.pipes import check_pipe
from pipe_control.structure.mass import pipe_centre_of_mass
from status import Status; status = Status()
@@ -456,12 +456,9 @@
@type ave_pos: bool
"""
- # Test if the current data pipe exists.
- check_pipe()
-
- # Test if the structure exists.
- if not hasattr(cdp, 'structure') or not cdp.structure.num_models() or not
cdp.structure.num_molecules():
- raise RelaxNoPdbError
+ # Checks.
+ check_pipe()
+ check_structure()
# The selection object.
selection = cdp.structure.selection(atom_id=spin_id)
@@ -556,12 +553,9 @@
@type ave_pos: bool
"""
- # Test if the current data pipe exists.
- check_pipe()
-
- # Test if the structure exists.
- if not hasattr(cdp, 'structure') or not cdp.structure.num_models() or not
cdp.structure.num_molecules():
- raise RelaxNoPdbError
+ # Checks.
+ check_pipe()
+ check_structure()
# Print out.
print("Adding the following spins to the relax data store.\n")
@@ -849,12 +843,9 @@
@type atom_id: str or None
"""
- # Test if the current data pipe exists.
- check_pipe()
-
- # Test if the structure exists.
- if not hasattr(cdp, 'structure') or not cdp.structure.num_models() or not
cdp.structure.num_molecules():
- raise RelaxNoPdbError
+ # Checks.
+ check_pipe()
+ check_structure()
# Set the origin if not supplied.
if origin == None:
@@ -962,12 +953,9 @@
@type atom_id: str or None
"""
- # Test if the current data pipe exists.
- check_pipe()
-
- # Test if the structure exists.
- if not hasattr(cdp, 'structure') or not cdp.structure.num_models() or not
cdp.structure.num_molecules():
- raise RelaxNoPdbError
+ # Checks.
+ check_pipe()
+ check_structure()
# Convert the args to numpy float data structures.
T = array(T, float64)
@@ -994,16 +982,10 @@
@type unit: bool
"""
- # Test if the current data pipe exists.
- check_pipe()
-
- # Test if the PDB file has been loaded.
- if not hasattr(cdp, 'structure'):
- raise RelaxNoPdbError
-
- # Test if sequence data is loaded.
- if not exists_mol_res_spin_data():
- raise RelaxNoSequenceError
+ # Checks.
+ check_pipe()
+ check_structure()
+ check_mol_res_spin_data()
# Print out.
if verbosity:
@@ -1140,12 +1122,9 @@
@type force: bool
"""
- # Test if the current data pipe exists.
- check_pipe()
-
- # Test if the structure exists.
- if not hasattr(cdp, 'structure') or not cdp.structure.num_models() or not
cdp.structure.num_molecules():
- raise RelaxNoPdbError
+ # Checks.
+ check_pipe()
+ check_structure()
# Validate the models.
cdp.structure.validate_models()
_______________________________________________
relax (http://www.nmr-relax.com)
This is the relax-commits mailing list
[email protected]
To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits