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


Groups > comp.lang.python > #46589

Re: Finding Relative Maxima in Python3

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin3!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <chris@rebertia.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.014
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'encoding': 0.05; 'scipy': 0.05; 'attribute': 0.07; 'python3': 0.07; 'seemed': 0.09; 'subject:Python3': 0.09; 'cc:addr:python-list': 0.11; 'numpy': 0.16; 'wanted.': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'all,': 0.19; 'skip:f 30': 0.19; 'work,': 0.20; 'import': 0.22; 'email addr:gmail.com&gt;': 0.22; 'cc:addr:python.org': 0.22; 'error': 0.23; '31,': 0.24; 'script.': 0.24; 'cheers,': 0.24; 'cc:2**0': 0.24; "i've": 0.25; 'script': 0.25; '&gt;': 0.26; '15,': 0.26; 'shown': 0.26; 'skip:" 20': 0.27; 'values': 0.27; 'header:In- Reply-To:1': 0.27; 'function': 0.29; 'wondering': 0.29; 'chris': 0.29; 'am,': 0.29; 'relative': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; '(which': 0.31; 'code': 0.31; 'file': 0.32; 'probably': 0.32; '(most': 0.33; 'skip:& 30': 0.33; 'maybe': 0.34; 'could': 0.34; 'problem': 0.35; "can't": 0.35; 'skip:s 30': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'opposed': 0.36; 'set.': 0.36; 'url:org': 0.36; 'being': 0.38; 'skip:& 10': 0.38; 'recent': 0.39; 'skip:& 20': 0.39; 'does': 0.39; 'called': 0.40; 'days': 0.60; 'then,': 0.60; 'maximum': 0.63; 'different': 0.65; 'to:addr:gmail.com': 0.65; 'series': 0.66; 'here': 0.66; 'forums': 0.68; 'below.': 0.71; 'resides': 0.84; 'sender:addr:chris': 0.84; 'url:reference': 0.84; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=rebertia.com; s=google; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=Y5FVhbh9vwtn7BxgJ91Tf0Yo0TvwaglB5eNASnc3wmQ=; b=WFfifxI64rhBaAic94SyEXuxNL2SuAA5G3wY7IFV+6wzJqoawchcwyWfH/zBSlk1yt a1EBKiADZ+NzFHOGsj/8WgFLCkLyv+TJ1FiSHoIPe+ulmd0+AggMhS0Yw0v1+fRRupY1 9fHFIwAHYKJJvT18d07nTrv1rA5dYTVgLsccc=
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :x-gm-message-state; bh=Y5FVhbh9vwtn7BxgJ91Tf0Yo0TvwaglB5eNASnc3wmQ=; b=KHakkHow6hbx3qCg5dc9znKMdvScybhcltYcrj26nzstI67NySk1yh4PmdKzYJnNJf Qp6ExpDWBwjmAmlNcuTt3rJ/R2Xl2kc54+ocua10O9xmoH7AHmdpU2BD1KFSJoEDL5dK 4JkcKPlAKQfkCiNEQG6MGjgqtNG3+vx575qq0LZFAcmb8LksMQmH0Tsq1uTxhvu9FpTN SlTs4EKThSKzpkWbOrd8QvAzBSVdssIqvyDgwnmQiYreYFFS1zWnQa93364atUavNLLs Nv5bNHCa9YY7pZTISVT2pappET6iI1hOi2CjTlP65ysuXrbao6aWDXnzOQVNxzEAvWMs P59g==
MIME-Version 1.0
X-Received by 10.50.62.68 with SMTP id w4mr1325031igr.55.1369994078270; Fri, 31 May 2013 02:54:38 -0700 (PDT)
Sender chris@rebertia.com
In-Reply-To <6acf9ce5-eed1-4115-aa93-71d2e182db79@googlegroups.com>
References <6acf9ce5-eed1-4115-aa93-71d2e182db79@googlegroups.com>
Date Fri, 31 May 2013 02:54:38 -0700
X-Google-Sender-Auth 2z3TIvuaTn2MCZQZ_eIARAy_Sjc
Subject Re: Finding Relative Maxima in Python3
From Chris Rebert <clp2@rebertia.com>
To lourensjan.ugen@gmail.com
Content-Type multipart/alternative; boundary=047d7bdc0d2c614e6f04de009adf
X-Gm-Message-State ALoCoQmcEEHU4UyTuJK/WsmZc1lqpq5Op4DQ231qj71VZGIN4J7mOyKjbqAFkzOiFO6E3cz3lWrj
Cc Python <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2481.1369994087.3114.python-list@python.org> (permalink)
Lines 98
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1369994087 news.xs4all.nl 15929 [2001:888:2000:d::a6]:56929
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:46589

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

On May 31, 2013 2:46 AM, "Lourens-Jan Ugen" <lourensjan.ugen@gmail.com>
wrote:
>
> Hi all,
>
> The last few days I've been working on a script to manipulate some
scientific data. One thing I would like to be able to do is find relative
maxima in a data set.
> I'm using numpy in python3 (which I think I can't do without because of
utf16 encoding of my data source) and a series of np.arrays. When looking
around the web and some forums I came across the scipy function
argrelextrema, which seemed to do just what I wanted. The problem is that I
can't get the function to work, probably because scipy in python3 does not
yet support the argrelextrema function. I can however, not find a reference
to this really being the problem, and was wondering if someone here could
maybe help me out.
> The code I used is shown below. The function to return the maximum values
is called by a different script. Then, when running, it returns an error
like the one below the code.
>
> Script:
> import numpy as np
> import scipy as sp
<snip>
> Error message:
> Traceback (most recent call last):
>   File "MyScript.py", line 15, in <module>
>     Varrr = FD.max_in_array_range(CalcAndDiffArray, 5 ,MyBound)
>   File "/MyPath/Script.py", line 82, in max_in_array_range
>     return sp.argrelmax(TempArray[LowBound:], np.greater)
> AttributeError: 'module' object has no attribute 'argrelmax'

The docs would seem to indicate that that function resides in the "signal"
submodule of scipy:
http://docs.scipy.org/doc/scipy-dev/reference/generated/scipy.signal.argrelmax.html#scipy.signal.argrelmax

Hence, it would be sp.signal.argrelmax() as opposed to just sp.argrelmax()

Cheers,
Chris

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Finding Relative Maxima in Python3 Lourens-Jan Ugen <lourensjan.ugen@gmail.com> - 2013-05-31 02:41 -0700
  Re: Finding Relative Maxima in Python3 Chris Rebert <clp2@rebertia.com> - 2013-05-31 02:54 -0700

csiph-web