Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #105846 > unrolled thread

Help with python script for NMR

Started bymohamadmaaz5@gmail.com
First post2016-03-27 07:38 -0700
Last post2016-03-27 11:58 -0700
Articles 11 — 5 participants

Back to article view | Back to comp.lang.python


Contents

  Help with python script for NMR mohamadmaaz5@gmail.com - 2016-03-27 07:38 -0700
    Re: Help with python script for NMR Joel Goldstick <joel.goldstick@gmail.com> - 2016-03-27 10:49 -0400
      Re: Help with python script for NMR mohamadmaaz5@gmail.com - 2016-03-27 08:13 -0700
        Re: Help with python script for NMR Wildman <best_lay@yahoo.com> - 2016-03-27 11:07 -0500
          Re: Help with python script for NMR mohamadmaaz5@gmail.com - 2016-03-27 09:15 -0700
            Re: Help with python script for NMR Wildman <best_lay@yahoo.com> - 2016-03-27 11:27 -0500
              Re: Help with python script for NMR mohamadmaaz5@gmail.com - 2016-03-27 09:40 -0700
                Re: Help with python script for NMR Wildman <best_lay@yahoo.com> - 2016-03-27 12:07 -0500
        Re: Help with python script for NMR Peter Pearson <pkpearson@nowhere.invalid> - 2016-03-27 16:32 +0000
        Re: Help with python script for NMR Peter Otten <__peter__@web.de> - 2016-03-27 19:39 +0200
          Re: Help with python script for NMR mohamadmaaz5@gmail.com - 2016-03-27 11:58 -0700

#105846 — Help with python script for NMR

Frommohamadmaaz5@gmail.com
Date2016-03-27 07:38 -0700
SubjectHelp with python script for NMR
Message-ID<89a6c69e-5f60-47d7-99db-4004966fc7c5@googlegroups.com>
Hello there,
I found a python script in a scientific article that enables a simple calculation on an NMR spectrum.
I have no experience in programming and i would appreciate it if i can communicate with someone who can write this script and send it to me by mail in py format. It's a short script but i keep making alot of mistaken and it fails every time.
Anyone's interested in helping me ?
Thanks

[toc] | [next] | [standalone]


#105848

FromJoel Goldstick <joel.goldstick@gmail.com>
Date2016-03-27 10:49 -0400
Message-ID<mailman.86.1459090185.28225.python-list@python.org>
In reply to#105846
On Sun, Mar 27, 2016 at 10:38 AM, <mohamadmaaz5@gmail.com> wrote:

> Hello there,
> I found a python script in a scientific article that enables a simple
> calculation on an NMR spectrum.
> I have no experience in programming and i would appreciate it if i can
> communicate with someone who can write this script and send it to me by
> mail in py format. It's a short script but i keep making alot of mistaken
> and it fails every time.
> Anyone's interested in helping me ?
> Thanks
> --
> https://mail.python.org/mailman/listinfo/python-list
>

copy the code here.  You will get help, but people don't generally write
programs for others here

-- 
Joel Goldstick
http://joelgoldstick.com/ <http://joelgoldstick.com/stats/birthdays>
http://cc-baseballstats.info/

[toc] | [prev] | [next] | [standalone]


#105850

Frommohamadmaaz5@gmail.com
Date2016-03-27 08:13 -0700
Message-ID<5f7ff60d-0297-4bee-b3e4-3af0ca757dfe@googlegroups.com>
In reply to#105848
On Sunday, March 27, 2016 at 4:50:01 PM UTC+2, Joel Goldstick wrote:
> On Sun, Mar 27, 2016 at 10:38 AM, <mohamadmaaz5@gmail.com> wrote:
> 
> > Hello there,
> > I found a python script in a scientific article that enables a simple
> > calculation on an NMR spectrum.
> > I have no experience in programming and i would appreciate it if i can
> > communicate with someone who can write this script and send it to me by
> > mail in py format. It's a short script but i keep making alot of mistaken
> > and it fails every time.
> > Anyone's interested in helping me ?
> > Thanks
> > --
> > https://mail.python.org/mailman/listinfo/python-list
> >
> 
> copy the code here.  You will get help, but people don't generally write
> programs for others here
> 
> -- 
> Joel Goldstick
> http://joelgoldstick.com/ <http://joelgoldstick.com/stats/birthdays>
> http://cc-baseballstats.info/

this is the script. the thing is that i have zero experience in writing and i cant find the error. all i need is to embed this script to perfome a relatively simple calculation on a spectra. hope anyone can help. thanks

#! /usr /bin/envpython
#encoding:utf- 8
i m p o r tnmrtec . nmrNotebook . c o n t r o l l e r . C o n t r o l l e r as Cont
i m p o r tnmrtec . u t i l as u t i l
i m p o r tnmrtec . nmrNotebook . model . common .nmrCommon as nmrcom
c l a s sBarycentre :
"""
computesthebarycenterofeach
definedr e c t a n g l eanddeducesthe
p o l y d i s p e r s i t yindexofthes o l u t i o n
"""
d e fi n i t( s e l f ) :
"""
i n i t i a l i z e sandgetthei n t e g r a t i o ncoo rdin ates
"""
df =1.86#tobechangedf o reachtypeof...
... molecule
f r o mNNBlibimportDialogText , l i s t O f R e c t a n g l e s
s e l f . d a t a = NNB . l o a d C u r r e n t D a t a ( )
i f( getdim () != 2 ) :
s e l f . die (" Tobeappliedon2Donly" )
i flen ( listOfRectangles () ) == 1 :
s e l f . die (" Youmustaddarectangletodefineazoomregion. " )
i flen ( listOfRectangles () )>2 :
s e l f . die (" expectedtwozoomregion. %dzoomregionsweredefined. " % ...
...len ( listOfRectangles () ) )
f o riin[ 0 , 1 ] :
indexRect = listOfRectangles () [ i ]
dim (2)
s e l f . F1Left = int ( indexRect [ 0 ] )
s e l f . F1Right = int ( indexRect [ 2 ] )
s e l f . F2Left = int ( indexRect [ 1 ] )
s e l f . F2Right = int ( indexRect [ 3 ] )
i fi==0 :
b = s e l f . pointToDamping ( s e l f . barycenter () )
b = b* *(- df )
else:
a = s e l f . pointToDamping ( s e l f . barycenter () )
a = a * *(- df )
ip=a/b
i fip<1.0:
ip= 1/ ip
r e s u l t=" p o l y d i s p e r s i t yindex: %s" %ip
DialogText (" Resultat" , r e s u l t )
#---------------------------------------------------------------------------
defpointToDamping ( s e l f , value ) :
" " "
p o i n t T o D a m p i n gc o n v e r t sp o i n t su n i t si n t od i f f u s i o nu n i t s
"""
c = Cont . getCurrentControllerDeDocument ( )
f o l d = c . getCurrentNMRFolder ( )
nsa = f o l d . getNNBNMRSpectrum ( ) . getAxisF ( 1 )
p r i n tvalue
newdamping = u t i l . NMRUnitToolKit . pointToUnit (nmrcom . NMRUnit . ...
...UNITDAMPING, nsa , value )
r e t u r nnewdamping
#---------------------------------------------------------------------------
d e fbarycenter ( s e l f ) :
"""
r e a l i z ethei n t e g r a t i o noverthei n t e g r a t i o nzones (obtainedati n i t i a l i z a t i o n)
"""
#i n i t i a l i s a t i o ndud a t a b u f f e razero
dim ( 1 )
zero ( )
put (" data" )
#onmetl apremierecolonne
dim ( 2 )
c o l ( i n t ( s e l f . F2Left ) )
dim ( 1 )
put (" data" )
f o rcolumninrange ( s e l f . F2Left +1, s e l f . F2Right +1) :
dim ( 2 )
c o l ( i n t ( column ) )
dim ( 1 )
a d d d a t a ( )
p u t (" data" )
dim(1)
get (" data" )
m=0
n=0
f o riinrange ( s e l f . F1Left , s e l f . F1Right+1) :
m += float ( val1d ( i ) )*i
n += float ( val1d ( i ) )
b = m/n
returnb
#thenexecute
Barycentre ()
i fname==" main" :
try:
Barycentre ()
except:
fromNNBlibimportalert , formatExceptionInfo
try:
alert ( formatExceptionInfo () )
except:
raise" shouldneverhappen"

[toc] | [prev] | [next] | [standalone]


#105855

FromWildman <best_lay@yahoo.com>
Date2016-03-27 11:07 -0500
Message-ID<S_udnXfBSbSmmGXLnZ2dnUU7-QudnZ2d@giganews.com>
In reply to#105850
On Sun, 27 Mar 2016 08:13:49 -0700, mohamadmaaz5 wrote:

>> > Hello there,
>> > I found a python script

The formatting of the script is all wrong.  There are many
spaces that should not be there and no indentations.  It
could take a long time to figure it out.  It could be just
a copy/paste problem on the part of the website.  Do you
have the link to the original article?

-- 
<Wildman> GNU/Linux user #557453
The cow died so I don't need your bull!

[toc] | [prev] | [next] | [standalone]


#105857

Frommohamadmaaz5@gmail.com
Date2016-03-27 09:15 -0700
Message-ID<c84905e7-35c8-4b15-8315-6673b2fb3054@googlegroups.com>
In reply to#105855
On Sunday, March 27, 2016 at 6:07:43 PM UTC+2, Wildman wrote:
> On Sun, 27 Mar 2016 08:13:49 -0700, mohamadmaaz5 wrote:
> 
> >> > Hello there,
> >> > I found a python script
> 
> The formatting of the script is all wrong.  There are many
> spaces that should not be there and no indentations.  It
> could take a long time to figure it out.  It could be just
> a copy/paste problem on the part of the website.  Do you
> have the link to the original article?
> 
> -- 
> <Wildman> GNU/Linux user #557453
> The cow died so I don't need your bull!

yeah this is exactly the problem, and i eliminated the spaces but still failed. this is the article (script in supporting info):
http://www.sciencedirect.com/science/article/pii/S1090780711002072

[toc] | [prev] | [next] | [standalone]


#105858

FromWildman <best_lay@yahoo.com>
Date2016-03-27 11:27 -0500
Message-ID<3oWdnRJsGbqdl2XLnZ2dnUU7-eWdnZ2d@giganews.com>
In reply to#105857
On Sun, 27 Mar 2016 09:15:39 -0700, mohamadmaaz5 wrote:

> On Sunday, March 27, 2016 at 6:07:43 PM UTC+2, Wildman wrote:
>> On Sun, 27 Mar 2016 08:13:49 -0700, mohamadmaaz5 wrote:
>> 
>> >> > Hello there,
>> >> > I found a python script
>> 
>> The formatting of the script is all wrong.  There are many
>> spaces that should not be there and no indentations.  It
>> could take a long time to figure it out.  It could be just
>> a copy/paste problem on the part of the website.  Do you
>> have the link to the original article?
>> 
>> -- 
>> <Wildman> GNU/Linux user #557453
>> The cow died so I don't need your bull!
> 
> yeah this is exactly the problem, and i eliminated the spaces but still failed. this is the article (script in supporting info):
> http://www.sciencedirect.com/science/article/pii/S1090780711002072

I am not finding a link to the script.  The website says that I
have "Guest" access.  Does this mean I have to pay to see the
script?

-- 
<Wildman> GNU/Linux user #557453
The cow died so I don't need your bull!

[toc] | [prev] | [next] | [standalone]


#105861

Frommohamadmaaz5@gmail.com
Date2016-03-27 09:40 -0700
Message-ID<f0eafd84-7af9-45fe-a173-3a4714ebbd89@googlegroups.com>
In reply to#105858
On Sunday, March 27, 2016 at 6:27:59 PM UTC+2, Wildman wrote:
> On Sun, 27 Mar 2016 09:15:39 -0700, mohamadmaaz5 wrote:
> 
> > On Sunday, March 27, 2016 at 6:07:43 PM UTC+2, Wildman wrote:
> >> On Sun, 27 Mar 2016 08:13:49 -0700, mohamadmaaz5 wrote:
> >> 
> >> >> > Hello there,
> >> >> > I found a python script
> >> 
> >> The formatting of the script is all wrong.  There are many
> >> spaces that should not be there and no indentations.  It
> >> could take a long time to figure it out.  It could be just
> >> a copy/paste problem on the part of the website.  Do you
> >> have the link to the original article?
> >> 
> >> -- 
> >> <Wildman> GNU/Linux user #557453
> >> The cow died so I don't need your bull!
> > 
> > yeah this is exactly the problem, and i eliminated the spaces but still failed. this is the article (script in supporting info):
> > http://www.sciencedirect.com/science/article/pii/S1090780711002072
> 
> I am not finding a link to the script.  The website says that I
> have "Guest" access.  Does this mean I have to pay to see the
> script?
> 
> -- 
> <Wildman> GNU/Linux user #557453
> The cow died so I don't need your bull!

can you please give me your email to send you the article ?

[toc] | [prev] | [next] | [standalone]


#105863

FromWildman <best_lay@yahoo.com>
Date2016-03-27 12:07 -0500
Message-ID<P6qdncFqwITajmXLnZ2dnUU7-bmdnZ2d@giganews.com>
In reply to#105861
On Sun, 27 Mar 2016 09:40:57 -0700, mohamadmaaz5 wrote:

> On Sunday, March 27, 2016 at 6:27:59 PM UTC+2, Wildman wrote:
>> On Sun, 27 Mar 2016 09:15:39 -0700, mohamadmaaz5 wrote:
>> 
>> > On Sunday, March 27, 2016 at 6:07:43 PM UTC+2, Wildman wrote:
>> >> On Sun, 27 Mar 2016 08:13:49 -0700, mohamadmaaz5 wrote:
>> >> 
>> >> >> > Hello there,
>> >> >> > I found a python script
>> >> 
>> >> The formatting of the script is all wrong.  There are many
>> >> spaces that should not be there and no indentations.  It
>> >> could take a long time to figure it out.  It could be just
>> >> a copy/paste problem on the part of the website.  Do you
>> >> have the link to the original article?
>> >> 
>> >> -- 
>> >> <Wildman> GNU/Linux user #557453
>> >> The cow died so I don't need your bull!
>> > 
>> > yeah this is exactly the problem, and i eliminated the spaces but still failed. this is the article (script in supporting info):
>> > http://www.sciencedirect.com/science/article/pii/S1090780711002072
>> 
>> I am not finding a link to the script.  The website says that I
>> have "Guest" access.  Does this mean I have to pay to see the
>> script?
>> 
>> -- 
>> <Wildman> GNU/Linux user #557453
>> The cow died so I don't need your bull!
> 
> can you please give me your email to send you the article ?

The email address in my header is valid.

-- 
<Wildman> GNU/Linux user #557453
The cow died so I don't need your bull!

[toc] | [prev] | [next] | [standalone]


#105859

FromPeter Pearson <pkpearson@nowhere.invalid>
Date2016-03-27 16:32 +0000
Message-ID<dlqg93Fe2qqU1@mid.individual.net>
In reply to#105850
On Sun, 27 Mar 2016 08:13:49 -0700 (PDT), mohamadmaaz5@gmail.com wrote:
> On Sunday, March 27, 2016 at 4:50:01 PM UTC+2, Joel Goldstick wrote:
>> On Sun, Mar 27, 2016 at 10:38 AM, <mohamadmaaz5@gmail.com> wrote:
>> 
>> > Hello there,
>> > I found a python script in a scientific article that enables a simple
>> > calculation on an NMR spectrum.
>> > I have no experience in programming and i would appreciate it if i can
>> > communicate with someone who can write this script and send it to me by
>> > mail in py format. It's a short script but i keep making alot of mistaken
>> > and it fails every time.
>> > Anyone's interested in helping me ?
[snip]
>> 
>> copy the code here.  You will get help, but people don't generally write
>> programs for others here
>> 
>> -- 
>> Joel Goldstick
>> http://joelgoldstick.com/ <http://joelgoldstick.com/stats/birthdays>
>> http://cc-baseballstats.info/
>
> this is the script. the thing is that i have zero experience in
> writing and i cant find the error. all i need is to embed this script
> to perfome a relatively simple calculation on a spectra. hope anyone
> can help. thanks
>
> #! /usr /bin/envpython
> #encoding:utf- 8
> i m p o r tnmrtec . nmrNotebook . c o n t r o l l e r . C o n t r o [snip]
> i m p o r tnmrtec . u t i l as u t i l
> i m p o r tnmrtec . nmrNotebook . model . common .nmrCommon as nmrcom
> c l a s sBarycentre :
> """
> computesthebarycenterofeach
> definedr e c t a n g l eanddeducesthe
> p o l y d i s p e r s i t yindexofthes o l u t i o n
[snip]

It appears that spaces have been inserted and deleted at many points
in this code, and anybody deciding to help with your project will start
with the task of guessing where spaces need to be inserted and deleted
in order to restore the original code.  Since indentation is important
in Python, this will not be a trivial problem.  If the scientific article
that presented this script shows correct spacing, you should take your
best shot at correcting the spacing.

Also, it appears that several lines begin "import nmrtec", indicating
that this script requires a module named nmrtec.

-- 
To email me, substitute nowhere->runbox, invalid->com.

[toc] | [prev] | [next] | [standalone]


#105865

FromPeter Otten <__peter__@web.de>
Date2016-03-27 19:39 +0200
Message-ID<mailman.91.1459100387.28225.python-list@python.org>
In reply to#105850
mohamadmaaz5@gmail.com wrote:

> On Sunday, March 27, 2016 at 4:50:01 PM UTC+2, Joel Goldstick wrote:
>> On Sun, Mar 27, 2016 at 10:38 AM, <mohamadmaaz5@gmail.com> wrote:
>> 
>> > Hello there,
>> > I found a python script in a scientific article that enables a simple
>> > calculation on an NMR spectrum.
>> > I have no experience in programming and i would appreciate it if i can
>> > communicate with someone who can write this script and send it to me by
>> > mail in py format. It's a short script but i keep making alot of
>> > mistaken and it fails every time.
>> > Anyone's interested in helping me ?
>> > Thanks
>> > --
>> > https://mail.python.org/mailman/listinfo/python-list
>> >
>> 
>> copy the code here.  You will get help, but people don't generally write
>> programs for others here
>> 
>> --
>> Joel Goldstick
>> http://joelgoldstick.com/ <http://joelgoldstick.com/stats/birthdays>
>> http://cc-baseballstats.info/
> 
> this is the script. the thing is that i have zero experience in writing
> and i cant find the error. all i need is to embed this script to perfome a
> relatively simple calculation on a spectra. hope anyone can help. thanks
> 
> #! /usr /bin/envpython
> #encoding:utf- 8
> i m p o r tnmrtec . nmrNotebook . c o n t r o l l e r . C o n t r o l l e
> r as Cont i m p o r tnmrtec . u t i l as u t i l
> i m p o r tnmrtec . nmrNotebook . model . common .nmrCommon as nmrcom
> c l a s sBarycentre :

If you want to turn Annex B of www.theses.fr/2014STRAJ015.pdf into runnable 
Python please note

"""
Created by Marie−Aude Coutouly , Justine Vieville, Matthieu ...
...Tanty and Marc−Andre Delsuc on 2010−11−04
Copyright ( c ) 2010 NMRTEC and IGBMC. All rights Reserved .
""""

If you didn't already contact the author(s) you should try that first -- 
perhaps they can provide a copy of the original script.

[toc] | [prev] | [next] | [standalone]


#105867

Frommohamadmaaz5@gmail.com
Date2016-03-27 11:58 -0700
Message-ID<5a9af45e-c8f7-42f1-add5-0f795e7e102a@googlegroups.com>
In reply to#105865
On Sunday, March 27, 2016 at 7:40:06 PM UTC+2, Peter Otten wrote:
> mohamadmaaz5@gmail.com wrote:
> 
> > On Sunday, March 27, 2016 at 4:50:01 PM UTC+2, Joel Goldstick wrote:
> >> On Sun, Mar 27, 2016 at 10:38 AM, <mohamadmaaz5@gmail.com> wrote:
> >> 
> >> > Hello there,
> >> > I found a python script in a scientific article that enables a simple
> >> > calculation on an NMR spectrum.
> >> > I have no experience in programming and i would appreciate it if i can
> >> > communicate with someone who can write this script and send it to me by
> >> > mail in py format. It's a short script but i keep making alot of
> >> > mistaken and it fails every time.
> >> > Anyone's interested in helping me ?
> >> > Thanks
> >> > --
> >> > https://mail.python.org/mailman/listinfo/python-list
> >> >
> >> 
> >> copy the code here.  You will get help, but people don't generally write
> >> programs for others here
> >> 
> >> --
> >> Joel Goldstick
> >> http://joelgoldstick.com/ <http://joelgoldstick.com/stats/birthdays>
> >> http://cc-baseballstats.info/
> > 
> > this is the script. the thing is that i have zero experience in writing
> > and i cant find the error. all i need is to embed this script to perfome a
> > relatively simple calculation on a spectra. hope anyone can help. thanks
> > 
> > #! /usr /bin/envpython
> > #encoding:utf- 8
> > i m p o r tnmrtec . nmrNotebook . c o n t r o l l e r . C o n t r o l l e
> > r as Cont i m p o r tnmrtec . u t i l as u t i l
> > i m p o r tnmrtec . nmrNotebook . model . common .nmrCommon as nmrcom
> > c l a s sBarycentre :
> 
> If you want to turn Annex B of www.theses.fr/2014STRAJ015.pdf into runnable 
> Python please note
> 
> """
> Created by Marie-Aude Coutouly , Justine Vieville, Matthieu ...
> ...Tanty and Marc-Andre Delsuc on 2010-11-04
> Copyright ( c ) 2010 NMRTEC and IGBMC. All rights Reserved .
> """"
> 
> If you didn't already contact the author(s) you should try that first -- 
> perhaps they can provide a copy of the original script.

already sent a request and waiting, thank you

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web