This is the mail archive of the
davenport@berkshire.net
mailing list for the Davenport project.
Re: DAVENPORT: language support
> Could you send along some examples of Python classes and the
> corresponding extended DocBook markup that you used to document
> them? Just a few of the more complex classes would be very handy.
Sure! Here's an example from the ScientificPython manual, which uses
all the additional markup I have defined:
<classdescription role="Python">
<classdef><class>InterpolatingFunction</class>
<classinfo>Function defined by values on a grid using interpolation
</classinfo>
</classdef>
<para>An interpolating function of n variables with m-dimensional values
is defined by an (n+m)-dimensional array of values and n
one-dimensional arrays that define the variables values
corresponding to the grid points. The grid does not have to be
equidistant.
</para>
<para>Constructor: InterpolatingFunction(<parameter>axes</parameter>,
<parameter>values</parameter>, <parameter>default</parameter>=None)
</para>
<para>
<variablelist>
<varlistentry><term><parameter>axes</parameter></term>
<listitem>
<para>a sequence of one-dimensional arrays, one for each
variable, specifying the values of the variables at
the grid points</para>
</listitem>
</varlistentry>
<varlistentry><term><parameter>values</parameter></term>
<listitem>
<para>an array containing the function values on the grid
</para></listitem></varlistentry>
<varlistentry><term><parameter>default</parameter></term>
<listitem>
<para>the value of the function outside the grid. A value
of <literal role="Python">None</literal> means that the
function is undefined outside the grid and that any attempt
to evaluate it there yields an exception.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<para>Evaluation: <literal role="Python">function(x1, x2, ...)</literal>
yields the function value obtained by linear interpolation.
</para>
<methoddescription><methoddef><method>selectInterval</method></methoddef>
<paramdef><parameter>first</parameter></paramdef>
<paramdef><parameter>last</parameter></paramdef>
<paramdef><parameter>variable</parameter>
<defaultvalue>0</defaultvalue>
</paramdef>
<para>Returns a new InterpolatingFunction whose grid is restricted
to the interval from <parameter>first</parameter> to
<parameter>last</parameter> along the variable
whose number is <parameter>variable</parameter>.
</para>
</methoddescription>
<methoddescription><methoddef><method>derivative</method></methoddef>
<paramdef><parameter>variable</parameter>
<defaultvalue>0</defaultvalue>
</paramdef>
<para>Returns a new InterpolatingFunction describing the derivative
with respect to <parameter>variable</parameter> (an integer).
</para>
</methoddescription>
<methoddescription><methoddef><method>integral</method></methoddef>
<paramdef><parameter>variable</parameter>
<defaultvalue>0</defaultvalue>
</paramdef>
<para>Returns a new InterpolatingFunction describing the integral
with respect to <parameter>variable</parameter> (an integer). The integration
constant is defined in such a way that the value of the integral at the
first grid point along <parameter>variable</parameter> is zero.
</para>
</methoddescription>
<methoddescription><methoddef><method>definiteIntegral</method></methoddef>
<paramdef><parameter>variable</parameter>
<defaultvalue>0</defaultvalue>
</paramdef>
<para>Returns a new InterpolatingFunction describing the definite integral
with respect to <parameter>variable</parameter> (an integer). The integration
constant is defined in such a way that the value of the integral at the
first grid point along <parameter>variable</parameter> is zero. In the case
of a function of one variable, the definite integral is a number.
</para>
</methoddescription>
<methoddescription><methoddef><method>fitPolynomial</method></methoddef>
<paramdef><parameter>order</parameter></paramdef>
<para>Returns a polynomial of <parameter>order</parameter> with parameters
obtained from a least-squares fit to the grid values.
</para>
</methoddescription>
</classdescription>
--
-------------------------------------------------------------------------------
Konrad Hinsen | E-Mail: hinsen@cnrs-orleans.fr
Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.55.69
Rue Charles Sadron | Fax: +33-2.38.63.15.17
45071 Orleans Cedex 2 | Deutsch/Esperanto/English/
France | Nederlands/Francais
-------------------------------------------------------------------------------