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 <edw...@nmr-relax.com> 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
> <tlin...@nmr-relax.com> wrote:
>> That sound good !
>>
>> 2014-12-08 15:34 GMT+01:00 Edward d'Auvergne <edw...@nmr-relax.com>:
>>>
>>> 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
>>> <tlin...@nmr-relax.com> 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 <edw...@nmr-relax.com>:
>>> >>
>>> >> 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
>>> >
>>> >
>>
>>

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

This is the relax-devel mailing list
relax-devel@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-devel

Reply via email to