Author: bugman Date: Thu Jan 10 16:06:50 2008 New Revision: 4589 URL: http://svn.gna.org/viewcvs/relax?rev=4589&view=rev Log: Wrote the AlignTensorList class for storing all of the alignment tensors for a single data pipe.
Modified: branches/N_state_model/data/align_tensor.py Modified: branches/N_state_model/data/align_tensor.py URL: http://svn.gna.org/viewcvs/relax/branches/N_state_model/data/align_tensor.py?rev=4589&r1=4588&r2=4589&view=diff ============================================================================== --- branches/N_state_model/data/align_tensor.py (original) +++ branches/N_state_model/data/align_tensor.py Thu Jan 10 16:06:50 2008 @@ -524,6 +524,30 @@ # Alignment tensor specific data. ################################# +class AlignTensorList(ListType): + """List type data container for holding all the alignment tensors. + + The elements of the list should be AlignTensorData instances. + """ + + def __repr__(self): + """Replacement function for displaying an instance of this class.""" + + text = "Alignment tensors.\n\n" + text = text + "%-8s%-20s\n" % ("Index", "Name") + for i in xrange(len(self)): + text = text + "%-8i%-20s\n" % (i, self[i].name) + text = text + "\nThese can be accessed by typing 'relax_data_store.align_tensor[index]'.\n" + return text + + + def add_item(self, name): + """Function for appending a new AlignTensorData instance to the list.""" + + self.append(AlignTensorData(name)) + + + class AlignTensorData(Element): """An empty data container for the alignment tensor elements.""" _______________________________________________ relax (http://nmr-relax.com) This is the relax-commits mailing list relax-commits@gna.org 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