mailRe: generic_fns.relaxation_data.delete()


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

Header


Content

Posted by Petr Novak on January 19, 2009 - 23:19:

Edward d'Auvergne wrote:

Hi,

Welcome to the relax development circles.  I hope I can help you
through getting your and Pavel's ideas ported into the 1.3 line, so
that they stay permanently within the relax code base for others to
enjoy.  For becoming accepted as a relax developer, which takes place
as a vote by the current relax developers, you first need to submit
code as patches that I can then incorporate into the 'cst' branch of
the 1.3 line.  For this, I have created you the following task to
which you can attach your patch files:

https://gna.org/task/?6397

Once enough of your code has been accepted and the relax developers
decide that your code is of high quality (the vote), then you can be
granted commit access to the relax source code repository.  Please see
below as I have more comments.


On Mon, Jan 19, 2009 at 7:54 PM, Petr Novak <shaman@xxxxxxxxxxxxxxxxxx> wrote:
Hi,

I am working with Pavel Kaderavek on 'relax_csa' branch. Since I am not
experienced coder I use existing code as an inspiration and sort of
'template code' for our own changes/features. Just now I am trying to
implement functions for manipulating with chemical shift tensor data
(cs_tensor.read/copy/delete/display()) to generic_fns. As a template for
these functions I've taken generic_fns/relaxation_data.py. When I got to
delete() and display() I found this in code:

Coding by replication is also how I do most of my coding in relax
nowadays, even for core infrastructure changes.  A lot of new
functionality is very similar to the current code, so this makes life
much easier.

As for taking 'generic_fns/relax_data.py' (I'm assuming this is the
file and not 'generic_fns/relaxation_data.py'), is this actually the
best starting point?  It gives you code which works at the spin system
level, which is what you need, but the concepts and code in
'generic_fns/diffusion_tensor.py' will also be extremely useful.

Exactly as you said. 'generic_fns/relax_data.py' is template for
spin-level functionality and 'generic_fns/diffusion_tensor.py'
inspiration for tensor-related functionality.

If 'generic_fns/relax_data.py' is the best, then I will use the
subversion command 'svn cp' to copy 'generic_fns/relax_data.py' to
some other file for you.  This preserves the historic links between
the files in the repository so developers now and in the future can
see where you started from - this is essential.  So I need to know
what you would like to call the new file.  Once I have made the copy,
you can use 'svn up' on your checked out copy of the 'cst' branch to
get the code.


Aforementioned 'duality' in the templates makes me hasitate which file
should be the copied ('generic_fns/relax_data.py' or
'generic_fns/diffusion_tensor.py'). Is it good idea to simply add
'_cst', e.g. 'generic_fns/relax_data_cst.py' ?

def delete(ri_label=None, frq_label=None):
  """Function for deleting relaxation data corresponding to ri_label
and frq_label."""

  # Arguments.
  self.run = run
  self.ri_label = ri_label
  self.frq_label = frq_label

... and so on


I kinda got suspicious about this part (e.g. why self.something is
defined here and where do I get 'run'). So I tried to use this function
in relax script and I got an error:

Your suspicions are correct, this is bad code.  It is a relic of the
old 1.2 line design.  The 1.3 line is not 100% converted to the new
design yet:

https://mail.gna.org/public/relax-devel/2006-10/msg00053.html
(Message-id: <1160550133.9523.54.camel@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>).

Did you get my message titled "relax_csa" sent to Pavel and the
relax-devel mailing list?  If not, I'll forward it to you.  The code
here is the old 1.2 line code - there is no such thing as a 'run' any
more.


Yes, I got it.

relax> relax_data.delete(ri_label='R1', frq_label='600')
Traceback (most recent call last):
File "<console>", line 1, in ?
File "/home/shaman/relax/prompt/relax_data.py", line 195, in delete
  relax_data.delete(ri_label=ri_label, frq_label=frq_label)
File "/home/shaman/relax/generic_fns/relax_data.py", line 410, in delete
  self.run = run
NameError: global name 'run' is not defined

And this is the result.  The relaxation data deletion code is
currently non-functional in the 1.3 line.  It's not used much and is
not in a system test, hence why it hasn't been converted yet.  But if
you convert it for your code, that will be very good for learning the
differences between the two lines.
Yes, I did the conversion for delete() function and after finishing this
email I will do the same for display() function. Do you want me to post
it here or should it be included in our patch ?

Was it you that coded the original
version of the ellipsoidal CS tensor, based on the 1.2 line code?
Yes, it was me. Pavel did implementation of code for equations and I did
the code dealing with reading/handling/writing of data.


My theory about this is:
a) I missed something important in my python self.education :-) (I
deserted from biochemistry field so it is very probable)

This is relax's design, and nothing to do with python.  And my
undergrad background is pure biochemistry as well ;)  No chemistry,
physics, maths, statistics, or coding (well apart from first year
classes for all but the coding).

Well, knowing that this "conversion" is doable is inspiring and
motivating :-)

b) It could be remnant of an old 'run' philosophy and wasn't fixed yet
because it's not being used at all.

Exactly!


c) There is always some other option :-P :-)

I'm too slow converting the entire code base :)


As I understood it's now way bigger then original "script" for executing
Model free program and reading its results :-)

Can you please comment on this ? Btw do you think it should be deleted
from every pipe or just from 'cdp' ( = pipes.get_pipe() ).

I hope the comments above cover it all.  If not, feel free to ask
about anything on this list.

Cheers,

Edward

Thanks for your valuable comments and I'll get back to coding :-)

C u
Petr




Related Messages


Powered by MHonArc, Updated Tue Jan 20 00:00:13 2009