转向numpy和失败,一个用户故事 [英] switching to numpy and failing, a user story

查看:61
本文介绍了转向numpy和失败,一个用户故事的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用数字近十年之后,我决定尝试将
切换为使用numpy的大型代码库(python和C ++)。这里是

关于它是如何发生的一些评论。


- 自动切换python东西的代码只是一种

有效。但这是一个90%的解决方案,我可以手工完成剩下的工作。

当然,问题是代码仍在使用旧的
数字API,因此它不是一个长期的解决方案。不幸的是,要将

切换到numpy API,需要文档,这是一个问题;请看下面的



- 好吧,好吧,自动切换代码并没有真正起作用

。 ..我对RandomArray的使用仍然有效,但它们产生不同的

数字。底层随机数生成器必须已更改。我是

肯定它是更好的现在,但它有所不同。对于我的回归测试来说,这是一个很大的痛苦,这取决于播种随机数

发电机并获得特定结果。但是没关系,我可以更新

新RNG的回归。


- 我的扩展模块因为新的而不能构建numpy stuff

住在与Numeric过去住的地方不同的地方。我可能会解决这个问题,但是如果没有文档,我就无法确定如何做到这一点。我还需要弄清楚如何将我的代码移植到

使用新的numpy API而不是兼容层,但是我不能这样做b $ b没有文档。


- 我想我应该买文档。我不喜欢这个想法,

因为我觉得这个项目要付费软件会产生反效果

docs(如果你有Python会成功吗?购买文件?我不想这么做,但这就是这个项目的方式。我很高兴

对此感到不满,因为他们的支付系统正在使用Paypal而且我不会支付PayPal,但我觉得这只是'它的方式。哦,

等等,我*不能*购买文档,因为我不在美国并且付款

页面需要美国地址。我放弃;我想NumPy只适用于居住在美国的人们




我想我会在2010年回到NumPy,当时有文件可用。


-greg

解决方案

gr ********** @ gmail.com 写道:


使用数字近十年之后,我决定尝试将
切换为使用numpy的大型代码库(python和C ++)。这里是

关于它是如何发生的一些评论。


- 自动切换python东西的代码只是一种

有效。但这是一个90%的解决方案,我可以手工完成剩下的工作。

当然,问题是代码仍在使用旧的
数字API,因此它不是一个长期的解决方案。不幸的是,要将

切换到numpy API,需要文档,这是一个问题;见下面的



实际上,使用源代码

和利用邮件列表附带的文件并不难。我已经转换了很多代码而没有

引用_The NumPy_指南。


- 好吧,好吧,自动切换代码并没有真正起作用

很好......我对RandomArray的使用仍然有效,但它们产生了不同的

数字。底层随机数生成器必须已更改。我是

肯定它是更好的现在,但它有所不同。对于我的回归测试来说,这是一个很大的痛苦,这取决于播种随机数

发电机并获得特定结果。但是没关系,我可以更新

新RNG的回归。



很抱歉,旧的PRNG代码有一个禁止商业用途的非开源许可证,必须更换。


- 我的扩展模块只是不会构建,因为新的numpy东西

生活在与Numeric过去生活的不同位置。我可能会解决这个问题,但是如果没有文档,我就无法确定如何做到这一点。



这是在源附带的文件中记录的。或者你可以在numpy邮件列表上告诉我们
。简而言之,如果您使用numpy.distutils,

一切都会为您照顾;否则,numpy.get_include()

将为您提供标题的位置。


- 我想我应该购买文档。我不喜欢这个想法,

因为我觉得这个项目对付费软件会产生反作用

docs



< shrug否则文档根本就没有写过。而且很可能,

numpy也不存在。


(如果你不得不购买文件,Python会成功吗?我不认为这是b $ b,但这就是这个项目的方式。我很高兴

对此感到不满,因为他们的支付系统正在使用Paypal而且我不会支付PayPal,但我觉得这只是'它的方式。哦,

等等,我*不能*购买文档,因为我不在美国并且付款

页面需要美国地址。我放弃;我想NumPy只适用于居住在美国的人们。



或者你可以通过电子邮件发送Travis,他本可以解决这个问题。


对不起你有这样的问题,但如果你早点告诉我们

,我们可以帮你解决。


-

Robert Kern


我开始相信整个世界都是一个谜,一个无害的谜团

我们自己做得很糟糕疯狂地试图解释它,好像它有一个潜在的真相。

- Umberto Eco


blockquote>

gr**********@gmail.com 写道:


使用数字近十年之后,我决定尝试将
切换为使用numpy的大型代码库(python和C ++)。这里是

关于它是如何发生的一些评论。


- 自动切换python东西的代码只是一种

有效。但这是一个90%的解决方案,我可以手工完成剩下的工作。

当然,问题是代码仍在使用旧的
数字API,因此它不是一个长期的解决方案。不幸的是,要将

切换到numpy API,需要文档,这是一个问题;见下面的



我很高兴听到你的经历(好的和坏的)。我们需要完全来自像您这样的用户的反馈

才能改进。是的,代码

转换器是一个80%的解决方案,但它确实有效。改进总是

欢迎。


>

- 好吧,好吧,自动切换代码没有'我真的很好用

......我对RandomArray的使用仍然有效,但它们产生了不同的

数字。底层随机数生成器必须已更改。我是

肯定它是更好的现在,但它有所不同。对于我的回归测试来说,这是一个很大的痛苦,这取决于播种随机数

发电机并获得特定结果。但是没关系,我可以更新

新RNG的回归。



你绝对不能指望相同随机数发生器。新的

一个(感谢Robert Kern)非常好。


- 我的扩展模块刚好不会建造,因为新的numpy东西

住在与Numeric过去住的地方不同的地方。



这是一个简单的,并记录在新的很多地方
http://www.scipy.org 网站。另外,如果你问的话,人们总是乐于帮助你支付b $ b。 numpy-discussion列表非常活跃。不要

害羞。


- 我想我应该买文件。我不喜欢这个想法,

因为我觉得这个项目要付费软件会产生反效果

docs(如果你有Python会成功吗?购买文件?我不想这么做,但这就是这个项目的方式。



称它为完整文档可能更好。正常

开源文档可从 http://www.scipy获取。组织

有很多人帮助了它。我必须做点什么才能最好地假装NumPy把我带到那些关心我如何花时间(包括我的家人)的人身上的时间。这是我能想出的最好的



我是双倍的


对此感到不满,因为他们的支付系统正在使用Paypal而且我根本不喜欢Paypal,但我猜这就是它的方式。哦,

等等,我*不能*购买文档,因为我不在美国并且付款

页面需要美国地址。



这是真的吗?很多不住在美国的人已经成功使用了贝宝。当遇到困难时,与我沟通

你的困难通常很有效。


我放弃了;我想NumPy仅适用于居住在美国的人。


绝对不是真的。新加坡,日本,加纳,南非的人们,

法国,德国,新西兰,澳大利亚和许多其他国家/地区都是成功使用NumPy的b $ b。感激不尽,有些人通过购买这本书来购买

,但还有更多人下载并成功使用它。


我很抱歉你的经验,你绝对没有*购买

书来使用NumPy。就像你没有*购买任何Python书一样,使用Python来支付
。 NumPy的文档数量正在增长,我希望这种趋势能够持续下去。

源文件中有很多信息。


>

我想我是'' 2010年,当文档可用时,我会回到NumPy。



或者只是在邮件列表上询问,使用numpy.oldnumeric界面

(差异都记录在我书的前几页

现在免费提供)。


谢谢,


-Travis




Travis E. Oliphant写道:


绝对不是真的。新加坡,日本,加纳,南非的人们,

法国,德国,新西兰,澳大利亚和许多其他国家/地区都是成功使用NumPy的b $ b。感激不尽,有些人通过购买这本书来做出贡献,但还有更多人下载并成功使用它。


>从PayPal网站购买您的图书:选择付款方式:



没有PayPal账户?你不需要一个帐户。使用信用卡安全支付

。我使用我的信用卡

卡从挪威购买了这本书,并很快收到了pdf文件。显然,这本书可以在没有PayPal账户或美国账单地址的情况下购买。


NumPy是我使用过的最通用的阵列类型,包括<来自Matlab和Fortran 95的那些
。特别是,使用了matlab的爆炸性内存来避免使用
。保持良好的工作!


After using numeric for almost ten years, I decided to attempt to
switch a large codebase (python and C++) to using numpy. Here''s are
some comments about how that went.

- The code to automatically switch python stuff over just kind of
works. But it was a 90% solution, I could do the rest by hand. Of
course, the problem is that then the code is still using the old
numeric API, so it''s not a long term solution. Unfortunately, to switch
to the numpy API one needs documentation, which is a problem; see
below.

- Well, ok, the automatic switching code doesn''t really work all that
well... my uses of RandomArray still work, but they generate different
numbers. The underlying random-number generator must have changed. I''m
sure that it''s "better" now, but it''s different. This is a major pain
for my regression tests that rely on seeding the random number
generator and getting particular results. But that''s ok, I can update
the regressions for the new RNG.

- My extension modules just won''t build because the new numpy stuff
lives in a different location from where Numeric used to live. I
probably could fix this, but without the documentation I can''t figure
out how to do that. I''d also need to figure out how to port my code to
use the new numpy API instead of the compatibility layer, but I can''t
do that without docs either.

- I guess I should just buy the documentation. I don''t like this idea,
because I think it''s counter-productive to the project to have payware
docs (would Python be successful if you had to buy the documentation? I
don''t think so), but that''s the way this project goes. I''m doubly
unhappy about it because they payment system is using Paypal and I
don''t like Paypal at all, but I guess that''s just the way it goes. Oh,
wait, I *can''t* buy the docs because I''m not in the US and the payment
page requires a US address. I give up; I guess NumPy is only for people
living in the US.

I guess I''ll come back to NumPy in 2010, when the docs are available.

-greg

解决方案

gr**********@gmail.com wrote:

After using numeric for almost ten years, I decided to attempt to
switch a large codebase (python and C++) to using numpy. Here''s are
some comments about how that went.

- The code to automatically switch python stuff over just kind of
works. But it was a 90% solution, I could do the rest by hand. Of
course, the problem is that then the code is still using the old
numeric API, so it''s not a long term solution. Unfortunately, to switch
to the numpy API one needs documentation, which is a problem; see
below.

Actually, it''s not too hard to do so with the files that come with the source
and utilizing the mailing list. I''ve converted quite a lot of code without
reference to _The Guide to NumPy_.

- Well, ok, the automatic switching code doesn''t really work all that
well... my uses of RandomArray still work, but they generate different
numbers. The underlying random-number generator must have changed. I''m
sure that it''s "better" now, but it''s different. This is a major pain
for my regression tests that rely on seeding the random number
generator and getting particular results. But that''s ok, I can update
the regressions for the new RNG.

Sorry, but the old PRNG code had an non-open source license that prohibited
commercial use, and it had to be replaced.

- My extension modules just won''t build because the new numpy stuff
lives in a different location from where Numeric used to live. I
probably could fix this, but without the documentation I can''t figure
out how to do that.

That is documented in the files that come with the source. Or you could have
asked us on the numpy mailing list. In short, if you use numpy.distutils,
everything would have been taken care of for you; otherwise, numpy.get_include()
will give you the location of the headers.

- I guess I should just buy the documentation. I don''t like this idea,
because I think it''s counter-productive to the project to have payware
docs

<shrugOtherwise the docs wouldn''t have been written at all. And most likely,
numpy wouldn''t exist, either.

(would Python be successful if you had to buy the documentation? I
don''t think so), but that''s the way this project goes. I''m doubly
unhappy about it because they payment system is using Paypal and I
don''t like Paypal at all, but I guess that''s just the way it goes. Oh,
wait, I *can''t* buy the docs because I''m not in the US and the payment
page requires a US address. I give up; I guess NumPy is only for people
living in the US.

Or you could have emailed Travis, and he would have worked around the issue.

I''m sorry that you had such problems, but if you had let us know about them
earlier, we could have helped you out.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco


gr**********@gmail.com wrote:

After using numeric for almost ten years, I decided to attempt to
switch a large codebase (python and C++) to using numpy. Here''s are
some comments about how that went.

- The code to automatically switch python stuff over just kind of
works. But it was a 90% solution, I could do the rest by hand. Of
course, the problem is that then the code is still using the old
numeric API, so it''s not a long term solution. Unfortunately, to switch
to the numpy API one needs documentation, which is a problem; see
below.

I''m glad to hear of your experiences (good and bad). We need feedback
exactly from users like you in order to improve things. Yep, the code
converter is a 80% solution, but it does work. Improvements are always
welcome.

>
- Well, ok, the automatic switching code doesn''t really work all that
well... my uses of RandomArray still work, but they generate different
numbers. The underlying random-number generator must have changed. I''m
sure that it''s "better" now, but it''s different. This is a major pain
for my regression tests that rely on seeding the random number
generator and getting particular results. But that''s ok, I can update
the regressions for the new RNG.

You definitely can''t expect the same random number generator. The new
one (thanks to Robert Kern) is quite good.

- My extension modules just won''t build because the new numpy stuff
lives in a different location from where Numeric used to live.

This is an easy one and is documented in lots of places on the new
http://www.scipy.org site. Plus, people are always willing to help out
if you just ask. The numpy-discussion list is quite active. Don''t be
shy.

- I guess I should just buy the documentation. I don''t like this idea,
because I think it''s counter-productive to the project to have payware
docs (would Python be successful if you had to buy the documentation? I
don''t think so), but that''s the way this project goes.

It''s probably better to call it "complete documentation." Normal
open-source documentation is available from http://www.scipy.org. There
are lots of people who have helped it. I had to do something to at
least pretend to justify the time NumPy took me to the people who care
about how I spend my time (including my family). This was the best I
could come up with.

I''m doubly

unhappy about it because they payment system is using Paypal and I
don''t like Paypal at all, but I guess that''s just the way it goes. Oh,
wait, I *can''t* buy the docs because I''m not in the US and the payment
page requires a US address.

Is that really true? A lot of people not living in the U.S. have used
Paypal successfully. When difficulties arise, communicating with me
your difficulty is usually productive.

I give up; I guess NumPy is only for people living in the US.

Definitely not true. People in Singapore, Japan, Ghana, South Africa,
France, Germany, New Zealand, Australia, and many other countries are
using NumPy successfully. Gratefully, a few have contributed by buying
the book, but a lot more have downloaded and are successfully using it.

I''m sorry about your experience, you definitely don''t *have* to buy the
book to use NumPy. Just like you don''t *have* to buy any Python book to
use Python. The amount of documentation for NumPy is growing and I
expect that trend to continue. There is a lot of information in the
source file.

>
I guess I''ll come back to NumPy in 2010, when the docs are available.

Or just ask on the mailing lists, use the numpy.oldnumeric interface
(the differences are all documented in the first few pages of my book
which is available for free now).

Thanks,

-Travis



Travis E. Oliphant wrote:

Definitely not true. People in Singapore, Japan, Ghana, South Africa,
France, Germany, New Zealand, Australia, and many other countries are
using NumPy successfully. Gratefully, a few have contributed by buying
the book, but a lot more have downloaded and are successfully using it.

>From the PayPal site for purchasing your book: "Select Payment Type:

Don''t have a PayPal account? You don''t need an account. Pay securely
using your credit card." I bought the book from Norway using my credit
card, and received the pdf file soon afterwards. Obviously the book can
be bought without a PayPal account or a us billing address.

NumPy is the most versatile array type I have worked with, including
those of Matlab and Fortran 95. In particular, the explosive memory use
of Matlab is avoided. Keep up the good work!


这篇关于转向numpy和失败,一个用户故事的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆