Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #17954
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'desired.': 0.07; 'transform': 0.07; 'filename': 0.09; 'graph': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; '25,': 0.12; 'am,': 0.12; 'def': 0.13; '[[],': 0.16; 'already.': 0.16; 'filenames': 0.16; 'numpy': 0.16; 'pyplot': 0.16; 'rectangle': 0.16; 'smoothly,': 0.16; "wouldn't": 0.17; 'wrote:': 0.18; '>>>': 0.18; 'interesting.': 0.18; 'convert': 0.19; 'seems': 0.20; 'trying': 0.21; 'dec': 0.22; 'header:In-Reply-To:1': 0.22; 'produces': 0.23; 'scale': 0.25; '(like': 0.26; 'import': 0.27; 'all,': 0.28; 'weird': 0.29; 'looks': 0.29; 'pm,': 0.29; 'efficiently': 0.30; 'header:User-Agent:1': 0.33; 'header:X -Complaints-To:1': 0.33; 'to:addr:python-list': 0.34; 'things': 0.34; 'anything': 0.34; 'leaves': 0.34; 'something': 0.35; 'be.': 0.35; 'supposed': 0.35; 'apply': 0.35; 'test': 0.35; 'file': 0.36; 'received:au': 0.36; 'but': 0.37; 'run': 0.37; 'signal': 0.38; 'received:org': 0.38; 'should': 0.39; 'data,': 0.39; 'johnson': 0.39; 'to:addr:python.org': 0.40; 'might': 0.40; 'more': 0.61; 'your': 0.61; 'lower': 0.64; 'url:tinypic': 0.91; 'received:110': 0.95 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Lie Ryan <lie.1296@gmail.com> |
| Subject | Re: Plot seems weird |
| Date | Mon, 26 Dec 2011 20:28:14 +1100 |
| References | <880a2ed3-1a3f-45e7-b439-e87289403fd9@t16g2000vba.googlegroups.com> <c1ae9905-da26-4513-a456-99941ac53036@dp8g2000vbb.googlegroups.com> <4f709686-4b07-4096-a87c-3e4bf8571c73@v13g2000yqc.googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | 110-175-240-90.static.tpgi.com.au |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111124 Thunderbird/8.0 |
| In-Reply-To | <4f709686-4b07-4096-a87c-3e4bf8571c73@v13g2000yqc.googlegroups.com> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| 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.4099.1324891710.27778.python-list@python.org> (permalink) |
| Lines | 55 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1324891710 news.xs4all.nl 6983 [2001:888:2000:d::a6]:52591 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:17954 |
Show key headers only | View raw
On 12/26/2011 05:27 AM, Yigit Turgut wrote:
> On Dec 25, 7:06 pm, Rick Johnson<rantingrickjohn...@gmail.com> wrote:
>> On Dec 25, 9:33 am, Yigit Turgut<y.tur...@gmail.com> wrote:
>>> Hi all,
>>
>>> I have a text file as following;
>>
>>> 0.200047 0.000000
>>> 0.200053 0.160000
>>> 0.200059 0.000000
>>> 0.200065 0.080000
>>> 0.200072 0.000000
>>> 0.200078 0.160000
>>
>>> And I am trying to plot it with ;
>>
>>> filenames = sys.argv[1:]
>>> if len(filenames) == 0:
>>> filenames = [sys.stdin]
>>> for filename in filenames:
>>> t,y1 = numpy.genfromtxt(filename, unpack=True)
>>> pyplot.plot(t,y1)
>>> pyplot.show()
>>
>>> But graph seems weird, not as it supposed to be. Any ideas ?
>>
>> Interesting. Of course "weird" leaves a LOT to be desired. On a scale
>> of 1-10, how "weird" is the result?
>
> I apply a 1Khz test signal just to see if things run smoothly, but I
> see spikes at lower and higher ends (logic 0,1) where I should see a
> clean rectangle pwm signal. By the look of it I say weirdness is
> around 3/10.
What are you expecting? Your data produces something that looks like the
plot on the right of this screenshot
(http://i44.tinypic.com/wwhlvp.jpg), I don't see anything weird with
that; if you are expecting a square-wave-like plot (like on the left),
then you should use a square-wave-like data, pyplot wouldn't magically
transform a spiked-plot to squared-plot.
Here's what I use to convert the data on right plot to data on left
plot, I don't know much about numpy so it might be possible to do it
more efficiently or numpy might even have something like it already.
from itertools import izip_longest
def to_square(t, y1):
sq_data = [[], []]
for x,y, xn in izip_longest(data[0], data[1], data[0][1:]):
sq_data[0].append(x)
sq_data[1].append(y)
sq_data[0].append(xn)
sq_data[1].append(y)
return numpy.array(sq_data, dtype=float)
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Plot seems weird Yigit Turgut <y.turgut@gmail.com> - 2011-12-25 07:33 -0800
Re: Plot seems weird Rick Johnson <rantingrickjohnson@gmail.com> - 2011-12-25 09:06 -0800
Re: Plot seems weird Yigit Turgut <y.turgut@gmail.com> - 2011-12-25 10:27 -0800
Re: Plot seems weird Lie Ryan <lie.1296@gmail.com> - 2011-12-26 20:28 +1100
Re: Plot seems weird Yigit Turgut <y.turgut@gmail.com> - 2011-12-26 09:08 -0800
Re: Plot seems weird Lie Ryan <lie.1296@gmail.com> - 2011-12-27 05:58 +1100
Re: Plot seems weird Yigit Turgut <y.turgut@gmail.com> - 2011-12-26 11:14 -0800
Re: Plot seems weird Lie Ryan <lie.1296@gmail.com> - 2011-12-27 21:54 +1100
csiph-web