mailRe: r27012 - /branches/nmrglue/test_suite/system_tests/nmrglue.py


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

Header


Content

Posted by Edward d'Auvergne on December 08, 2014 - 18:05:
Hi Troels,

I'll also now stop making changes to your branch.  If you need
anything else, just say.  Note that the state.load user function is
much slower than state.save.  I'm not sure why that is.  But a little
bit of time can be saved if you don't compress the state files
(compress_type=0).

Regards,

Edward


On 8 December 2014 at 18:02, Edward d'Auvergne <edward@xxxxxxxxxxxxx> wrote:
I've updated most of the system tests.  However there are two that
show that the software verification tests will fail.  For example:

======================================================================
ERROR: test_plot_contour_cpmg (test_suite.system_tests.nmrglue.Nmrglue)
Test the plot_contour function in pipe_control.
----------------------------------------------------------------------

relax> pipe.create(pipe_name='mf', pipe_type='mf', bundle=None)

relax> spectrum.nmrglue_read(file='128_0_FT.ft2',
dir='/data/relax/branches/nmrglue/test_suite/shared_data/dispersion/repeated_analysis/SOD1/cpmg_disp_sod1d90a_060518/cpmg_disp_sod1d90a_060518_normal.fid/ft2_data',
nmrglue_id='128_0_FT')
Traceback (most recent call last):
  File "/data/relax/branches/nmrglue/test_suite/system_tests/nmrglue.py",
line 441, in test_plot_contour_cpmg
    self.setup_plot_contour_cpmg(show=False)
  File "/data/relax/branches/nmrglue/test_suite/system_tests/nmrglue.py",
line 192, in setup_plot_contour_cpmg
    ax = plot_contour(nmrglue_id=sp_id, contour_start=200000.,
contour_num=20, contour_factor=1.20, ppm=True, show=show)
  File "/data/relax/branches/nmrglue/pipe_control/nmrglue.py", line
158, in plot_contour
    ax = contour_plot(nmrglue_id=nmrglue_id,
contour_start=contour_start, contour_num=contour_num,
contour_factor=contour_factor, ppm=ppm, show=show)
  File "/data/relax/branches/nmrglue/lib/software/nmrglue.py", line
59, in contour_plot
    dic  = cdp.nmrglue_dic[nmrglue_id]
AttributeError: 'PipeContainer' object has no attribute 'nmrglue_dic'

----------------------------------------------------------------------

Here the lib.software.nmrglue module is not allowed to access the
relax data store, as it must be independent of it.  Instead, simply
pass in the dic, udic and data nmrglue objects from the data store
when needed.

Regards,

Edward





On 8 December 2014 at 17:53, Edward d'Auvergne <edward@xxxxxxxxxxxxx> wrote:
Hi Troels,

It's all done.  It took a while longer than I though.  That was my
fault, as I made the nmrglue objects of the relax data store a lot
more flexible.  Hence the commit is far more complicated than actually
required (http://article.gmane.org/gmane.science.nmr.relax.scm/24773).
You now have:

cdp.nmrglue -> data_store.nmrglue.Nmrglue_dict dictionary instance (it
inherits from data_store.data_classes.RelaxDictType).
cdp.nmrglue[key] -> data_store.nmrglue.Nmrglue instance (it inherits
from data_store.data_classes.Element).
cdp.nmrglue[key].dic -> the nmrglue dic object.
cdp.nmrglue[key].udic -> the nmrglue udic object.
cdp.nmrglue[key].data -> the nmrglue numpy.float32 data object.

The Nmrglue.test_save_state system test now passes.  Have a look at a
relax save file for what is now being created.

Regards,

Edward


On 8 December 2014 at 15:39, Edward d'Auvergne <edward@xxxxxxxxxxxxx> 
wrote:
Ok, so I'll start moving things around in your branch.

Regards,

Edward

On 8 December 2014 at 15:37, Troels Emtekær Linnet
<tlinnet@xxxxxxxxxxxxx> wrote:
That sound good !

2014-12-08 15:34 GMT+01:00 Edward d'Auvergne <edward@xxxxxxxxxxxxx>:

Hi,

I wouldn't bother with the matplotlib data storage.  If you like, I
could give this 10 minutes of work on the nmrglue branch and have the
Base64 string in XML storage fixed.  The system test is in place
already to implement this, and I know exactly what needs to be done,
so it won't take long.  Then we can keep the numpy format as is.  I'd
probably restore some of your original ideas and have all data in
cdp.nmrglue_data which a dictionary with
data_store.data_classes.Element instances as its elements, and then
write to_xml() and from_xml() methods to handle the numpy data as
Base64 and all other structures are passed to the Element base class
methods.

Regards,

Edward




On 8 December 2014 at 15:19, Troels Emtekær Linnet
<tlinnet@xxxxxxxxxxxxx> wrote:
Hi Edward.

I am trying to look at my data now with the plots I have in my mind.

The branch is actually in a state where I can use it.

The only trouble I have, is the storing of the numpy array.

I am actually not planning on saving the state, but will continuously
just
read from the original file.
But since the numpy array is saved in cdp, to get access, then storing
the
state should be possible.

All plots will just be made with matplotlib after the shuffling around
with
the numpy array.

Best
Troels



2014-12-08 15:14 GMT+01:00 Edward d'Auvergne <edward@xxxxxxxxxxxxx>:

Hi Troels,

I think I will have to leave the implementation in relax.

Would it take much to get the branch in a reasonable state for 
merging
back?  Even if not everything is implemented?  Well, apart from
bringing in nmrglue 0.5 when that is released.  I'm sure that in the
future some PhD student or postdoc will appreciate and take up what
you have already done and expand on it.  You've already put a lot of
polish on this, so it'd be a pity to not merge it.


Time goes away from pursuing the analysis, and goes into rather
annoying
stuff.

With coding, it's a bit hard to know what will be quick and what will
take a lot of time.  It's a problem I have too.


The idea is simple.
Load one or two spectrum.
Plot the contour, or histogram.
Or make a correlation plot of the two spectra.

Store the data.

Storing the data in any other format always takes more effort when
combining data from different sources/software.  But this is pretty
much sorted out for the nmrglue data.  You could even store the
nmrglue data in the relax data store as a Base64 string and a new
variable for the ndarray shape, as a shortcut.


Storing the axis plots is a different question.


http://stackoverflow.com/questions/7290370/store-and-reload-matplotlib-pyplot-object

I cannot actually do it at the moment.
So essentially, it just storing a numpy array

For matplotlib data, I don't think that storing these data structures
will ever be possible to implement in a compatible way.  The reason 
is
because matplotlib is too much of a moving target.  They do not have 
a
stable API!  So I would never recommend that you tackle such a 
problem
in this way.  That's just asking for pain ;)

There is a much better alternative which would be more compatible 
with
future matplotlib versions.  And that is that all the information
required to create the matplotlib plot is stored in a pure
data_store.data_classes.Element class container as simple variables
(str, bool, int, float, or a list, tuple or dict of these).  This is
similar to the GUI setting storage.  Then there could be a user
function to recreate the plot using the currently stored settings.
This would work much better.  And it would be orders of magnitude
quicker to implement than working with matplotlib data structures.

Regards,

Edward







Related Messages


Powered by MHonArc, Updated Mon Dec 08 18:20:14 2014