What do you get if you print numerix.array(S).dtype? On Thu, May 19, 2011 at 9:13 AM, Marc Saudreau <marc.saudr...@clermont.inra.fr> wrote: > > Hi Daniel, > > thanks a lot. Your example works fine when I use it alone. But when I want > to use it in > my code, an error occurs with the instruction v([S, S], order=1) : > __call__ C:\FiPy-2.1.2\fipy\variables\cellVariable.py 205 > IndexError: arrays used as indices must be of integer (or boolean) type > > I tried to get the solution by myself but to be honest this one is a little > bit disturbing. > Any solution ? > > Thanks again for your help and time > > Marc > > > Daniel Wheeler <daniel.wheel...@gmail.com> a écrit : > >> >> Hi Marc, >> >> CellVariable's __call__ method extracts data. So you can do the following: >> >> from fipy import * >> import pylab >> >> L = 1. >> n = 10 >> m = Grid2D(nx=n, ny=n, dx=L / n, dy=L / n) >> x, y = m.cellCenters >> v = CellVariable(mesh=m, value = x * y) >> N = 50 >> S = numerix.arange(N) / float(N - 1) * L >> pylab.plot(S, v([S, S], order=1)) >> pylab.show() >> raw_input('stopped') >> >> Basically, you can extract any data from "v" with "v([x, y])" where >> "x" and "y" define a set of coordinates. >> >> Cheers >> >> On Tue, May 17, 2011 at 4:47 AM, Marc Saudreau >> <marc.saudr...@clermont.inra.fr> wrote: >>> >>> Hi everyone, >>> >>> I'm trying to use Fipy to solve a 2D heat transfer problem, and I need >>> to >>> extract from my 2D grid, some 1D profiles. For instance I need to plot >>> temperature versus y axis for x given. >>> I had a look at Fipy examples but I did not find any way to do it. >>> Thanks a lot for any help. >>> >>> Best regards, >>> >>> Marc >>> >>> >> >> >> >> -- >> Daniel Wheeler >> >> >> > > > >
-- Daniel Wheeler