Seb, I've noticed the introduction of a few bugs, please see below.
On Thu, Apr 3, 2008 at 5:19 AM, <[EMAIL PROTECTED]> wrote: > Author: semor > Date: Thu Apr 3 05:19:32 2008 > New Revision: 5252 > > URL: http://svn.gna.org/viewcvs/relax?rev=5252&view=rev > Log: > Continued the modifications to the new design for the set_selected_sim(), > sim_pack_data() and write_columnar_results() functions from > specific_fns.jw_mapping. > > Those changes are based on the work already done for the consistency_tests > code in the consistency_tests branch. > > > Modified: > 1.3/specific_fns/jw_mapping.py > > Modified: 1.3/specific_fns/jw_mapping.py > URL: > http://svn.gna.org/viewcvs/relax/1.3/specific_fns/jw_mapping.py?rev=5252&r1=5251&r2=5252&view=diff > > ============================================================================== > --- 1.3/specific_fns/jw_mapping.py (original) > +++ 1.3/specific_fns/jw_mapping.py Thu Apr 3 05:19:32 2008 > @@ -443,7 +443,7 @@ > return cdp.res[instance].jwh_sim > > > - def sim_return_selected(self, run, instance): > + def sim_return_selected(self, instance): > """Function for returning the array of selected simulation flags.""" > > # Alias the current data pipe. > @@ -453,17 +453,17 @@ > return cdp.res[instance].select_sim > > > - def set_selected_sim(self, run, instance, select_sim): > + def set_selected_sim(self, instance, select_sim): > """Function for returning the array of selected simulation flags.""" > > - # Arguments. > - self.run = run > + # Alias the current data pipe. > + cdp = relax_data_store[relax_data_store.current_pipe] > > # Multiple instances. > - relax_data_store.res[self.run][instance].select_sim = select_sim > - > - > - def sim_pack_data(self, run, i, sim_data): > + cdp.res[instance].select_sim = select_sim > + > + > + def sim_pack_data(self, spin, sim_data): > """Function for packing Monte Carlo simulation data.""" > > # Test if the simulation data already exists. > @@ -523,19 +523,19 @@ > file.write("\n") > > > - def write_columnar_results(self, file, run): > + def write_columnar_results(self, file): > """Function for printing the results into a file.""" > > - # Arguments. > - self.run = run > + # Alias the current data pipe. > + cdp = relax_data_store[relax_data_store.current_pipe] > > # Test if the run exists. > if not self.run in relax_data_store.run_names: > raise RelaxNoPipeError, self.run > > # Test if sequence data is loaded. > - if not relax_data_store.res.has_key(self.run): > - raise RelaxNoSequenceError, self.run > + if not exists_mol_res_spin_data(): > + raise RelaxNoSequenceError > > > # Header. > @@ -545,9 +545,9 @@ > ri = [] > ri_error = [] > if hasattr(relax_data_store, 'num_ri'): > - for i in xrange(relax_data_store.num_ri[self.run]): > - ri.append('Ri_(' + relax_data_store.ri_labels[self.run][i] > + "_" + > relax_data_store.frq_labels[self.run][relax_data_store.remap_table[self.run][i]] > + ")") > - ri_error.append('Ri_error_(' + > relax_data_store.ri_labels[self.run][i] + "_" + > relax_data_store.frq_labels[self.run][relax_data_store.remap_table[self.run][i]] > + ")") > + for i in xrange(cdp.num_ri): > + ri.append('Ri_(' + cdp.ri_labels[i] + "_" + > cdp.frq_labels[cdp.remap_table[i]] + ")") > + ri_error.append('Ri_error_(' + cdp.ri_labels[i] + "_" + > cdp.frq_labels[cdp.remap_table[i]] + ")") > > # Write the header line. > self.write_columnar_line(file=file, num='Num', name='Name', > select='Selected', data_set='Data_set', nucleus='Nucleus', > wH='Proton_frq_(MHz)', j0='J(0)', jwx='J(wX)', jwh='J(wH)', > r='Bond_length_(A)', csa='CSA_(ppm)', ri_labels='Ri_labels', > remap_table='Remap_table', frq_labels='Frq_labels', frq='Frequencies', ri=ri, > ri_error=ri_error) > @@ -560,14 +560,14 @@ > nucleus = self.relax.generic.nuclei.find_nucleus() > > # The proton frequency in MHz. > - wH = relax_data_store.jw_frq[self.run] / 1e6 > + wH = cdp.jw_frq / 1e6 > > # Relaxation data setup. > try: > - ri_labels = replace(`relax_data_store.ri_labels[self.run]`, ' > ', '') > - remap_table = replace(`relax_data_store.remap_table[self.run]`, > ' ', '') > - frq_labels = replace(`relax_data_store.frq_labels[self.run]`, ' > ', '') > - frq = replace(`relax_data_store.frq[self.run]`, ' ', '') > + ri_labels = replace(`cdp.ri_labels`, ' ', '') > + remap_table = replace(`cdp.remap_table`, ' ', '') > + frq_labels = replace(`cdp.frq_labels`, ' ', '') > + frq = replace(`cdp.frq`, ' ', '') > except AttributeError: > ri_labels = `None` > remap_table = `None` > @@ -575,9 +575,9 @@ > frq = `None` > > # Loop over the sequence. > - for i in xrange(len(relax_data_store.res[self.run])): > + for i in xrange(len(cdp.res)): > # Reassign data structure. > - data = relax_data_store.res[self.run][i] > + data = cdp.res[i] Well, this isn't really a bug, but the code will not be functional. Here the spin_loop() should be used. > # J(0). > j0 = None > @@ -607,18 +607,18 @@ > # Relaxation data and errors. > ri = [] > ri_error = [] > - if hasattr(relax_data_store, 'num_ri'): > - for i in xrange(relax_data_store.num_ri[self.run]): > + if hasattr(cdp, 'num_ri'): > + for i in xrange(cdp.num_ri): > try: > # Find the residue specific data corresponding to i. > index = None > for j in xrange(data.num_ri): > - if data.ri_labels[j] == > relax_data_store.ri_labels[self.run][i] and > data.frq_labels[data.remap_table[j]] == > relax_data_store.frq_labels[self.run][relax_data_store.remap_table[self.run][i]]: > + if data.ri_labels[j] == cdp.ri_labels[i] and > data.frq_labels[data.remap_table[j]] == cdp.frq_labels[cdp.remap_table[i]]: > index = j > > # Data exists for this data type. > - ri.append(`data.relax_data[index]`) > - ri_error.append(`data.relax_error[index]`) > + ri.append(spin) > + ri_error.append(spin) The last two lines here introduce the bug. The code should be: + ri.append(spin.relax_data[index]) + ri_error.append(spin.relax_error[index]) > > # No data exists for this data type. > except: > @@ -633,15 +633,15 @@ > ######### > > # Skip this section and the next if no simulations have been setup. > - if not hasattr(relax_data_store, 'sim_state'): > + if not hasattr(cdp, 'sim_state'): > return > - elif relax_data_store.sim_state[self.run] == 0: > + elif cdp.sim_state == 0: > return > > # Loop over the sequence. > - for i in xrange(len(relax_data_store.res[self.run])): > + for i in xrange(len(cdp.res)): > # Reassign data structure. > - data = relax_data_store.res[self.run][i] > + data = cdp.res[i] Here, again, the spin_loop() needs to be used to get the SpinContainer objects. > # J(0). > j0 = None > @@ -671,7 +671,7 @@ > # Relaxation data and errors. > ri = [] > ri_error = [] > - for i in xrange(relax_data_store.num_ri[self.run]): > + for i in xrange(cdp.num_ri): > ri.append(None) > ri_error.append(None) > > @@ -683,11 +683,11 @@ > #################### > > # Loop over the simulations. > - for i in xrange(relax_data_store.sim_number[self.run]): > + for i in xrange(cdp.sim_number): > # Loop over the sequence. > - for j in xrange(len(relax_data_store.res[self.run])): > + for j in xrange(len(cdp.res)): > # Reassign data structure. > - data = relax_data_store.res[self.run][j] > + data = cdp.res[j] Again the spin_loop() should be used to avoid getting into the sequence specific structures in cdp.mol[i].res[j].spin[k]. This spin_loop() generator function will allow the relax data store to evolve if necessary without requiring any changes to these parts of the relax code base. > # J(0). > j0 = None > @@ -717,18 +717,18 @@ > # Relaxation data and errors. > ri = [] > ri_error = [] > - if hasattr(self.relax.data, 'num_ri'): > - for k in xrange(relax_data_store.num_ri[self.run]): > + if hasattr(cdp, 'num_ri'): > + for k in xrange(cdp.num.ri): > try: > # Find the residue specific data corresponding > to k. > index = None > for l in xrange(data.num_ri): > - if data.ri_labels[l] == > relax_data_store.ri_labels[self.run][k] and > data.frq_labels[data.remap_table[l]] == > relax_data_store.frq_labels[self.run][relax_data_store.remap_table[self.run][k]]: > + if data.ri_labels[l] == cdp.ri_labels[k] > and data.frq_labels[data.remap_table[l]] == > cdp.frq_labels[cdp.remap_table[k]]: > index = l > > # Data exists for this data type. > - ri.append(`data.relax_sim_data[i][index]`) > - ri_error.append(`data.relax_error[index]`) > + ri.append(spin) > + ri_error.append(spin) This is the same bug as before. The code should be: + ri.append(`spin.relax_sim_data[i][index]`) + ri_error.append(`spin.relax_error[index]`) Cheers, Edward _______________________________________________ relax (http://nmr-relax.com) This is the relax-devel 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-devel

