mailRe: r22958 - /trunk/specific_analyses/relax_disp/api.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by Edward d'Auvergne on May 05, 2014 - 17:44:
Unfortuanately I cannot for the life of me replicate this error you're
seeing.  Anyway, I see the where problem is likely to be.  The code in
the Map.map_3D_text() method of the pipe_control.opendx module is
incorrect!  It's quite bad actually!  This is because it is incomplete
- I remember not finishing it as it was good enough to produce the
figures for my PhD thesis and papers.  That was almost a decade ago ;)

Maybe we need a model_loop() call in here.  But then we also need to
handle the fact that there might be multiple iterations from
model_loop().  The current code assumes one map for the dx.map uesr
function call.  But this is not the case.

Another, possibly better way would be to enforce the spin_id argument
for the dx.map call.  I.e. the model_loop() is called in map_3D_text()
with the spin_id argument, and then we check that only one iteration
of the loop occurs, raising a RelaxError otherwise.  If this is ok,
then we use the model_info data returned from the first iteration of
the model_loop() to pass into the subsequent model_statistics() call.
This logic should fix the problem (but may reveal a few more minor
deficiencies as well).  In any case, the problem is not in the
model_statistics() API method.

Regards,

Edward







On 5 May 2014 17:36, Troels Emtekær Linnet <tlinnet@xxxxxxxxxxxxx> wrote:
Hi Edward.

Sorry for being unclear.

It is this comment:
https://gna.org/bugs/?22012#comment3



dx.map(params=['dw', 'pA', 'kex'], map_type='Iso3D', spin_id=':1@N',
inc=20, lower=None, upper=None, axis_incs=5, file_prefix='map',
dir=None, point=None, point_file='point', remap=None)

Creating the OpenDX .net program file.
Opening the file 'map.net' for writing.

Creating the OpenDX .cfg program configuration file.
Opening the file 'map.cfg' for writing.

Creating the OpenDX .general file.
Opening the file 'map.general' for writing.

Creating the map.
Opening the file 'map' for writing.
Progress: 0.000%
RelaxWarning: invalid value encountered in double_scalars
debug> Execution lock: Release by 'script UI' ('script' mode).
Traceback (most recent call last):
File "/Users/tlinnet/software/relax_trunk/multi/processor.py", line 494, in 
run
self.callback.init_master(self)
File "/Users/tlinnet/software/relax_trunk/multi/__init__.py", line
318, in default_init_master
self.master.run()
File "/Users/tlinnet/software/relax_trunk/relax.py", line 194, in run
self.interpreter.run(self.script_file)
File "/Users/tlinnet/software/relax_trunk/prompt/interpreter.py", line
275, in run
return run_script(intro=self.__intro_string, local=locals(),
script_file=script_file, show_script=self.__show_script,
raise_relax_error=self.__raise_relax_error)
File "/Users/tlinnet/software/relax_trunk/prompt/interpreter.py", line
569, in run_script
return console.interact(intro, local, script_file,
show_script=show_script, raise_relax_error=raise_relax_error)
File "/Users/tlinnet/software/relax_trunk/prompt/interpreter.py", line
468, in interact_script
exec_script(script_file, local)
File "/Users/tlinnet/software/relax_trunk/prompt/interpreter.py", line
347, in exec_script
runpy.run_module(module, globals)
File 
"/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/runpy.py",
line 180, in run_module
fname, loader, pkg_name)
File 
"/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/runpy.py",
line 72, in _run_code
exec code in run_globals
File 
"/Users/tlinnet/software/relax_trunk/test_suite/system_tests/scripts/relax_disp/cpmg_synthetic.py",
line 277, in <module>
dx.map(params=['dw', 'pA', 'kex'], map_type='Iso3D', spin_id=":1@N",
inc=20, lower=None, upper=None, axis_incs=5, file_prefix='map',
dir=ds.resdir, point=None, point_file='point', remap=None)
File "/Users/tlinnet/software/relax_trunk/prompt/uf_objects.py", line
221, in _call_
self._backend(*new_args, **uf_kargs)
File "/Users/tlinnet/software/relax_trunk/pipe_control/opendx.py",
line 88, in map
Map(params, spin_id, inc, lower, upper, axis_incs, file_prefix, dir,
point, point_file, remap)
File "/Users/tlinnet/software/relax_trunk/pipe_control/opendx.py",
line 184, in _init_
self.create_map()
File "/Users/tlinnet/software/relax_trunk/pipe_control/opendx.py",
line 197, in create_map
self.map_3D_text(map_file)
File "/Users/tlinnet/software/relax_trunk/pipe_control/opendx.py",
line 255, in map_3D_text
k, n, chi2 = self.model_statistics(spin_id=self.spin_id)
File 
"/Users/tlinnet/software/relax_trunk/specific_analyses/relax_disp/api.py",
line 683, in model_statistics
spins = spin_ids_to_containers(spin_ids)
File 
"/Users/tlinnet/software/relax_trunk/specific_analyses/relax_disp/data.py",
line 3620, in spin_ids_to_containers
for id in spin_ids:
TypeError: 'NoneType' object is not iterable

2014-05-05 17:27 GMT+02:00 Edward d'Auvergne <edward@xxxxxxxxxxxxx>:
The argument checking is reasonable, but the code:

+        #spins = spin_ids_to_containers(spin_ids)
+
+        spins_list = []
+        for spin_id in self.model_loop():
+            spins_list.append(spin_id[0])
+
+        spins = spin_ids_to_containers(spins_list)

breaks the logic.  This cannot be done, as the code calling
model_statistics() must be looping over the models (i.e. the
model_loop()), so you cannot have the model_loop() inside it.  Any API
method which accepts the model_info argument will follow this logic.

Regards,

Edward



On 5 May 2014 17:23, Edward d'Auvergne <edward@xxxxxxxxxxxxx> wrote:
The original code was correct.  The full test suite passes when this
change is not included.  Why did you make this change?  What was the
purpose?  I'm a little confused.

Regards,

Edward



On 5 May 2014 17:15, Troels Emtekær Linnet <tlinnet@xxxxxxxxxxxxx> wrote:
Ehhhh.

Can you suggest a change?

Best
Troels

2014-05-05 17:05 GMT+02:00 Edward d'Auvergne <edward@xxxxxxxxxxxxx>:
Hi,

I now have the failure when running:

$ ./relax -s Relax_disp.test_hansen_cpmg_data_auto_analysis

This is because the change is incorrect.  The model_statistics()
method is called once for each individual model - for each iteration
of the model_loop(), which for the dispersion analysis is each spin
cluster (or individual spins).  The logic:

        spins_list = []
        for spin_id in self.model_loop():
            spins_list.append(spin_id[0])

        spins = spin_ids_to_containers(spins_list)

is incorrect as the model_loop() loops over all spin clusters.
Therefore the 'spins' object will now be a list of the first spin
system from all clusters.  Previously it was simply a list of all the
spins for the current spin cluster.  I hope this makes sense.

Regards,

Edward



On 5 May 2014 16:52, Troels Emtekær Linnet <tlinnet@xxxxxxxxxxxxx> 
wrote:
Now ready to be tested with:

relax -s Relax_disp.test_hansen_cpmg_data_auto_analysis -d


---------- Forwarded message ----------
From:  <tlinnet@xxxxxxxxxxxxx>
Date: 2014-05-05 16:46 GMT+02:00
Subject: r22958 - /trunk/specific_analyses/relax_disp/api.py
To: relax-commits@xxxxxxx


Author: tlinnet
Date: Mon May  5 16:46:10 2014
New Revision: 22958

URL: http://svn.gna.org/viewcvs/relax?rev=22958&view=rev
Log:
Inserted commit r22954 to fix the AIC method selection.

The command used was:
svn merge -r22953:r22954 .

.....
    Attempt to fix function model_statistics() in API for relax_disp.

    bug #22012(https://gna.org/bugs/?22012): dx.map not implemented
for pipe type relax_disp.

    Modified:
        trunk/specific_analyses/relax_disp/api.py
.....


Modified:
    trunk/specific_analyses/relax_disp/api.py

Modified: trunk/specific_analyses/relax_disp/api.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/specific_analyses/relax_disp/api.py?rev=22958&r1=22957&r2=22958&view=diff
==============================================================================
--- trunk/specific_analyses/relax_disp/api.py   (original)
+++ trunk/specific_analyses/relax_disp/api.py   Mon May  5 16:46:10 
2014
@@ -678,9 +678,21 @@
         @rtype:                 tuple of (int, int, float)
         """

+        # Bad argument combination.
+        if model_info == None and spin_id == None:
+            raise RelaxError("Either the model_info or spin_id
argument must be supplied.")
+        elif model_info != None and spin_id != None:
+            raise RelaxError("The model_info arg " + repr(model_info)
+ " and spin_id arg " + repr(spin_id) + " clash.  Only one should be
supplied.")
+
         # Unpack the data.
         spin_ids = model_info
-        spins = spin_ids_to_containers(spin_ids)
+        #spins = spin_ids_to_containers(spin_ids)
+
+        spins_list = []
+        for spin_id in self.model_loop():
+            spins_list.append(spin_id[0])
+
+        spins = spin_ids_to_containers(spins_list)

         # The number of parameters for the cluster.
         k = param_num(spins=spins)


_______________________________________________
relax (http://www.nmr-relax.com)

This is the relax-commits mailing list
relax-commits@xxxxxxx

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

_______________________________________________
relax (http://www.nmr-relax.com)

This is the relax-devel mailing list
relax-devel@xxxxxxx

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



Related Messages


Powered by MHonArc, Updated Tue May 06 00:00:09 2014