From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: [babel] Problems assigning tables as variables using #+CALL and using properties in code blocks and sbe calls Date: Thu, 18 Jul 2013 19:06:24 -0600 Message-ID: <871u6ve4tr.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47306) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UzzBK-0000Vb-Rk for emacs-orgmode@gnu.org; Thu, 18 Jul 2013 21:08:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UzzBJ-0001CX-Jf for emacs-orgmode@gnu.org; Thu, 18 Jul 2013 21:08:26 -0400 Received: from mail-pb0-x229.google.com ([2607:f8b0:400e:c01::229]:42222) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UzzBJ-0001CT-D0 for emacs-orgmode@gnu.org; Thu, 18 Jul 2013 21:08:25 -0400 Received: by mail-pb0-f41.google.com with SMTP id rp16so3811841pbb.14 for ; Thu, 18 Jul 2013 18:08:24 -0700 (PDT) In-Reply-To: (Torsten Wagner's message of "Fri, 19 Jul 2013 02:34:20 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Torsten Wagner Cc: Org Mode Mailing List --=-=-= Content-Type: text/plain Torsten Wagner writes: > Hi, > I have a tables like this: > > #+TBLNAME: tablename > | a | b |c | d | > | 1 | 2 |3 |4 | > | z | x | y |w| > > #+TBLNAME: othertablename > | a | b |c | d | > | 1 | 2 |3 |4 | > | z | x | y |w| > > I have the following code block > > #+name: test > #+begin_src python :var table=tablename :exports results > import numpy as np > tab = np.array(table) > return np.array([tab[:,1], tab[:,-1]]).T > #+end_src > > If I call that function the result is correct > > However using > > #+CALL: aushang[:var table=othertablename]() :exports results > or > #+CALL: aushang(table=othertablename) :exports results > > does not work. It seem the babel block does not get the table but something > else in case its called by #+CALL:. > In general, how-to refer to a table in #+CALL blocks? > Your tables are identical, and you're not calling the test function in your call blocks. A more reasonable (to me) version of your example works as expected. --=-=-= Content-Type: text/x-org Content-Disposition: inline; filename=table-call.org #+TBLNAME: tablename | a | b | c | d | | 1 | 2 | 3 | 4 | | z | x | y | w | #+TBLNAME: othertablename | a | b | c | d | | 4 | 3 | 2 | 1 | | z | x | y | w | I have the following code block #+name: test #+begin_src python :var table=tablename :exports results import numpy as np tab = np.array(table) return np.array([tab[:,1], tab[:,-1]]).T #+end_src #+RESULTS: test | b | d | | 2 | 4 | | x | w | If I call that function the result is correct However using #+CALL: test[:var table=othertablename]() :exports results #+RESULTS: | b | d | | 3 | 1 | | x | w | #+CALL: test(table=othertablename) :exports results #+RESULTS: | b | d | | 3 | 1 | | x | w | --=-=-= Content-Type: text/plain > > On a similar line: I used $PROP_name to use property values within the > sbe function. However, how to use the same property as input to a > code-block? > > +begin_src python :var x=$PROP_name :exports results > and > +begin_src python :var x=name :exports results > > did not work > > Any ideas? > I don't understand the later part of this email, perhaps an example would clarify. Also, it might be worth looking in the following to see if something matching your use case appears. http://eschulte.github.io/org-scraps/ Cheers, > > Thanks > > Torsten -- Eric Schulte http://cs.unm.edu/~eschulte --=-=-=--