Hi,

This is closer, but you need to chase it back to the source - where
the NaN first appears.  This could be a divide by zero.  Or it could
be a Python list structure with None in it - converting to numpy will
produce NaNs.

Regards,

Edward


On 7 May 2014 18:32, Troels Emtekær Linnet <[email protected]> wrote:
> Hi Edward.
>
> Some test print shows this:
> In lib/ns_cpmg_2site_3d.py
>
>         print R*tcp[i]
> [[ NaN  NaN  NaN  NaN  NaN  NaN  NaN]
>  [ NaN  NaN  NaN  NaN  NaN  NaN  NaN]
>  [ NaN  NaN  NaN  NaN  NaN  NaN  NaN]
>  [ NaN  NaN  NaN  NaN  NaN  NaN  NaN]
>  [ NaN  NaN  NaN  NaN  NaN  NaN  NaN]
>  [ NaN  NaN  NaN  NaN  NaN  NaN  NaN]
>  [ NaN  NaN  NaN  NaN  NaN  NaN  NaN]]
>
> Error message:
>  Rexpo = matrix_exponential(R*tcp[i])
>   File 
> "/sbinlab2/tlinnet/software/NMR-relax/relax_trunk/lib/linear_algebra/matrix_exponential.py",
> line 46, in matrix_exponential
>     W, V = eig(A)
>   File "/usr/lib64/python2.6/site-packages/numpy/linalg/linalg.py",
> line 999, in eig
>     _assertFinite(a)
>   File "/usr/lib64/python2.6/site-packages/numpy/linalg/linalg.py",
> line 144, in _assertFinite
>     raise LinAlgError, "Array must not contain infs or NaNs"
> LinAlgError: Array must not contain infs or NaNs
>
>
>
> 2014-05-07 17:14 GMT+02:00 Edward d'Auvergne <[email protected]>:
>> Hi,
>>
>> This is part of the parameter checking required in the target function
>> code.  Something is producing a NaN, and this needs to be caught.
>> You'll see my attempts at catching these conditions by running the
>> following from the relax base directory:
>>
>> $ grep "if " lib/dispersion/* -A1
>>
>> Obviously something is not caught when it should be.  You can use the
>> --traceback and --numpy-raise relax options to better debug this.
>> Once you find the position in the code where the NaN (or Inf) arises,
>> you can then add such an 'if' condition to fix the bug.
>>
>> Regards,
>>
>> Edward
>>
>>
>>
>> On 7 May 2014 17:07, Troels E. Linnet <[email protected]> 
>> wrote:
>>> URL:
>>>   <http://gna.org/bugs/?22017>
>>>
>>>                  Summary: LinAlgError, for all numerical CPMG models.
>>>                  Project: relax
>>>             Submitted by: tlinnet
>>>             Submitted on: Wed 07 May 2014 03:07:49 PM UTC
>>>                 Category: relax's source code
>>> Specific analysis category: Relaxation dispersion
>>>                 Priority: 7 - High
>>>                 Severity: 4 - Important
>>>                   Status: None
>>>              Assigned to: None
>>>          Originator Name:
>>>         Originator Email:
>>>              Open/Closed: Open
>>>                  Release: Repository: trunk
>>>          Discussion Lock: Any
>>>         Operating System: All systems
>>>
>>>     _______________________________________________________
>>>
>>> Details:
>>>
>>> Hi Edward.
>>>
>>> The attached script, will make relax trip.
>>>
>>> I am reading in fake R2eff points, and then do a back calculation with:
>>>
>>>     sfrq_1 = 599.8908617*1E6
>>>     ncycs_1 = [2, 4, 8, 10, 20, 30, 40, 60]
>>>     sfrq_2 = 499.8908617*1E6
>>>     ncycs_2 = [2, 4, 8, 10, 30, 35, 40, 50]
>>>
>>> With the following dynamic parameters
>>> ['Ala', 1, 'N', {'r2': {r20_key_1:10, r20_key_2:11.5}, 'r2a': {r20_key_1:10,
>>> r20_key_2:11.5}, 'r2b': {r20_key_1:10, r20_key_2:11.5}, 'kex': 1000, 'pA':
>>> 0.99, 'dw': 2} ]
>>>
>>> #################3
>>> relax_disp.r2eff_read_spin(id='CPMG_599.9', spin_id=':1@N',
>>> file='CPMG_599.9_1_N.txt', dir=None, disp_point_col=1, offset_col=None,
>>> data_col=2, error_col=3, sep=None)
>>> Opening the file 'CPMG_599.9_1_N.txt' for reading.
>>> The following R2eff/R1rho data has been loaded into the relax data store:
>>>
>>> # R2eff_key                                 Disp_point              R2eff
>>>              R2eff_error
>>> sq_cpmg_599.89086170_0.000_33.333             33.333333333333336
>>> 1.000000000000000       0.100000000000000
>>> sq_cpmg_599.89086170_0.000_66.667             66.666666666666671
>>> 1.000000000000000       0.100000000000000
>>> sq_cpmg_599.89086170_0.000_133.333           133.333333333333343
>>> 1.000000000000000       0.100000000000000
>>> sq_cpmg_599.89086170_0.000_166.667           166.666666666666686
>>> 1.000000000000000       0.100000000000000
>>> sq_cpmg_599.89086170_0.000_333.333           333.333333333333371
>>> 1.000000000000000       0.100000000000000
>>> sq_cpmg_599.89086170_0.000_500.000           500.000000000000000
>>> 1.000000000000000       0.100000000000000
>>> sq_cpmg_599.89086170_0.000_666.667           666.666666666666742
>>> 1.000000000000000       0.100000000000000
>>> sq_cpmg_599.89086170_0.000_1000.000         1000.000000000000000
>>> 1.000000000000000       0.100000000000000
>>> Traceback (most recent call last):
>>>   File 
>>> "/sbinlab2/tlinnet/software/NMR-relax/relax_trunk/multi/processor.py",
>>> line 494, in run
>>>     self.callback.init_master(self)
>>>   File "/sbinlab2/tlinnet/software/NMR-relax/relax_trunk/multi/__init__.py",
>>> line 318, in default_init_master
>>>     self.master.run()
>>>   File "/sbinlab2/tlinnet/software/NMR-relax/relax_trunk/relax.py", line 
>>> 194,
>>> in run
>>>     self.interpreter.run(self.script_file)
>>>   File
>>> "/sbinlab2/tlinnet/software/NMR-relax/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
>>> "/sbinlab2/tlinnet/software/NMR-relax/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
>>> "/sbinlab2/tlinnet/software/NMR-relax/relax_trunk/prompt/interpreter.py", 
>>> line
>>> 468, in interact_script
>>>     exec_script(script_file, local)
>>>   File
>>> "/sbinlab2/tlinnet/software/NMR-relax/relax_trunk/prompt/interpreter.py", 
>>> line
>>> 347, in exec_script
>>>     runpy.run_module(module, globals)
>>>   File "/usr/lib64/python2.6/runpy.py", line 140, in run_module
>>>     fname, loader, pkg_name)
>>>   File "/usr/lib64/python2.6/runpy.py", line 34, in _run_code
>>>     exec code in run_globals
>>>   File
>>> "/sbinlab2/tlinnet/software/NMR-relax/relax_trunk/test_suite/system_tests/scripts/relax_disp/cpmg_synthetic.py",
>>> line 270, in <module>
>>>     r2effs = optimisation.back_calc_r2eff(spin=cur_spin, 
>>> spin_id=cur_spin_id)
>>>   File
>>> "/sbinlab2/tlinnet/software/NMR-relax/relax_trunk/specific_analyses/relax_disp/optimisation.py",
>>> line 188, in back_calc_r2eff
>>>     chi2 = model.func(param_vector)
>>>   File
>>> "/sbinlab2/tlinnet/software/NMR-relax/relax_trunk/target_functions/relax_disp.py",
>>> line 1419, in func_ns_cpmg_2site_3D
>>>     return self.calc_ns_cpmg_2site_3D_chi2(R20A=R20, R20B=R20, dw=dw, pA=pA,
>>> kex=kex)
>>>   File
>>> "/sbinlab2/tlinnet/software/NMR-relax/relax_trunk/target_functions/relax_disp.py",
>>> line 542, in calc_ns_cpmg_2site_3D_chi2
>>>     r2eff_ns_cpmg_2site_3D(r180x=self.r180x, M0=self.M0, 
>>> r20a=R20A[r20_index],
>>> r20b=R20B[r20_index], pA=pA, pB=pB, dw=dw_frq, k_AB=k_AB, k_BA=k_BA,
>>> inv_tcpmg=self.inv_relax_times[0][mi], tcp=self.tau_cpmg[0][mi],
>>> back_calc=self.back_calc[0][si][mi][0],
>>> num_points=self.num_disp_points[0][si][mi][0], power=self.power[0][mi])
>>>   File
>>> "/sbinlab2/tlinnet/software/NMR-relax/relax_trunk/lib/dispersion/ns_cpmg_2site_3d.py",
>>> line 115, in r2eff_ns_cpmg_2site_3D
>>>     Rexpo = matrix_exponential(R*tcp[i])
>>>   File
>>> "/sbinlab2/tlinnet/software/NMR-relax/relax_trunk/lib/linear_algebra/matrix_exponential.py",
>>> line 46, in matrix_exponential
>>>     W, V = eig(A)
>>>   File "/usr/lib64/python2.6/site-packages/numpy/linalg/linalg.py", line 
>>> 999,
>>> in eig
>>>     _assertFinite(a)
>>>   File "/usr/lib64/python2.6/site-packages/numpy/linalg/linalg.py", line 
>>> 144,
>>> in _assertFinite
>>>     raise LinAlgError, "Array must not contain infs or NaNs"
>>> LinAlgError: Array must not contain infs or NaNs
>>> #########################
>>>
>>>
>>>
>>>
>>>
>>>
>>>     _______________________________________________________
>>>
>>> File Attachments:
>>>
>>>
>>> -------------------------------------------------------
>>> Date: Wed 07 May 2014 03:07:49 PM UTC  Name: cpmg_synthetic.py  Size: 16kB
>>> By: tlinnet
>>>
>>> <http://gna.org/bugs/download.php?file_id=20667>
>>>
>>>     _______________________________________________________
>>>
>>> Reply to this item at:
>>>
>>>   <http://gna.org/bugs/?22017>
>>>
>>> _______________________________________________
>>>   Message sent via/by Gna!
>>>   http://gna.org/
>>>
>>>
>>> _______________________________________________
>>> relax (http://www.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

_______________________________________________
relax (http://www.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

Reply via email to