[Yt-svn] yt: 7 new changesets

hg at spacepope.org hg at spacepope.org
Tue Jun 1 09:52:00 PDT 2010


hg Repository: yt
details:   yt/rev/f6c1d8462dad
changeset: 1713:f6c1d8462dad
user:      mturk
date:
Wed May 26 15:47:15 2010 -0700
description:
[svn r1732] Fixing a bug in the Volume Renderer where waffle-like images were generated
because of a systematic reduction-by-one of the number of samples taken.

Also added a very simple slicer to the OpenGL module.

hg Repository: yt
details:   yt/rev/53fbe4152548
changeset: 1714:53fbe4152548
user:      mturk
date:
Wed May 26 15:47:54 2010 -0700
description:
[svn r1733] Re-cythonizing to get the volume renderer fix.

hg Repository: yt
details:   yt/rev/91e7b088a7d0
changeset: 1715:91e7b088a7d0
user:      mturk
date:
Wed May 26 22:49:18 2010 -0700
description:
[svn r1734] As per discussion on yt-dev, interpolation for ghost zones, smoothed covering
grids, and vertex-centered data is changed from being in either log space or
linear space to being exclusively in linear space.

hg Repository: yt
details:   yt/rev/6385e5f4cc3f
changeset: 1716:6385e5f4cc3f
user:      Matthew Turk <matthewturk at gmail.com>
date:
Thu May 27 09:27:10 2010 -0700
description:
Merging from trunk

hg Repository: yt
details:   yt/rev/08dcf6a00649
changeset: 1717:08dcf6a00649
user:      Matthew Turk <matthewturk at gmail.com>
date:
Thu May 27 15:38:38 2010 -0700
description:
Adding a new attempt at speeding up interpolation.  10% improvement, but for my
particular runs the interpolation is not the slowest part.

hg Repository: yt
details:   yt/rev/3007999e2518
changeset: 1718:3007999e2518
user:      Matthew Turk <matthewturk at gmail.com>
date:
Sun May 30 12:31:40 2010 -0700
description:
Adding iv_dir for minor speedup, removing useless loop

hg Repository: yt
details:   yt/rev/8eb6996dd5f1
changeset: 1719:8eb6996dd5f1
user:      Matthew Turk <matthewturk at gmail.com>
date:
Tue Jun 01 09:51:42 2010 -0700
description:
Adding some initial docstring guidelines as well as the coding standards

diffstat:

 .hgignore                                        |     3 +
 doc/coding_styleguide.txt                        |    37 +
 doc/docstring_example.txt                        |    86 +
 doc/docstring_idioms.txt                         |    54 +
 scripts/fbranch                                  |     5 +-
 scripts/fbury                                    |     5 +-
 scripts/fdigup                                   |     5 +-
 scripts/fido                                     |     5 +-
 scripts/fimport                                  |     5 +-
 yt/_amr_utils/FixedInterpolator.c                |    26 +-
 yt/_amr_utils/FixedInterpolator.h                |     2 +
 yt/_amr_utils/Octree.pyx                         |   280 +
 yt/_amr_utils/QuadTree.pyx                       |   257 +
 yt/_amr_utils/VolumeIntegrator.pyx               |    53 +-
 yt/amr_utils.c                                   |  5483 ++++++++++++++++++++-------
 yt/amr_utils.pyx                                 |     1 +
 yt/arraytypes.py                                 |    11 +
 yt/extensions/DualEPS.py                         |   699 +++
 yt/extensions/image_writer.py                    |    26 +
 yt/extensions/opengl_image_viewer.py             |   256 +-
 yt/extensions/volume_rendering/image_handling.py |    87 +-
 yt/extensions/volume_rendering/multi_texture.py  |   302 +
 yt/fido/share_data.py                            |    83 +
 yt/lagos/BaseDataTypes.py                        |    29 +-
 yt/lagos/BaseGridType.py                         |    22 +-
 yt/lagos/HaloFinding.py                          |   129 +-
 yt/reason/plot_editors.py                        |    10 +-
 yt/reason/reason_v2.py                           |     5 +-
 yt/reason/tvtk_interface.py                      |     5 +-
 29 files changed, 6303 insertions(+), 1668 deletions(-)

diffs (truncated from 16394 to 300 lines):

diff -r 8488818c915f -r 8eb6996dd5f1 .hgignore
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgignore	Tue Jun 01 09:51:42 2010 -0700
@@ -0,0 +1,3 @@
+syntax: glob
+*.pyc
+.*.swp
diff -r 8488818c915f -r 8eb6996dd5f1 doc/coding_styleguide.txt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/coding_styleguide.txt	Tue Jun 01 09:51:42 2010 -0700
@@ -0,0 +1,37 @@
+Style Guide for Coding in yt
+============================
+
+ * In general, follow PEP-8 guidelines.
+ * Classes are ConjoinedCapitals, methods and functions are
+   lowercase_with_underscores.
+ * Use 4 spaces, not tabs, to represent indentation.
+ * Avoid at all costs importing "*" from a function or a module unless that
+   module is "yt.funcs" or "yt.arraytypes".  "yt.mods" may be a special case,
+   but if at all possible avoid importing it.
+ * Numpy is to be imported as "na" not "np".  While this may change in the
+   future, for now this is the correct idiom.
+ * Do not use too many keyword arguments.  If you have a lot of keyword
+   arguments, then you are doing too much in __init__ and not enough via
+   parameter setting.
+ * Line widths should not be more than 80 characters.
+ * Do not use unecessary parenthesis in conditionals.  if((something) and
+   (something_else)) should be rewritten as if something and something_else.
+   Python is more forgiving than C.
+ * In function arguments, place spaces before commas.  def something(a,b,c)
+   should be def something(a, b, c).
+ * Do not use nested classes unless you have a very good reason to, such as
+   requiring a namespace or class-definition modification.  Classes should live
+   at the top level.  __metaclass__ is exempt from this.
+ * Don't create a new class to replicate the functionality of an old class --
+   replace the old class.  Too many options makes for a confusing user
+   experience.
+ * Parameter files are a last resort.
+ * Avoid copying memory when possible. For example, don't do 
+   "a = a.reshape(3,4)" when "a.shape = (3,4)" will do, and "a = a * 3" should
+   be "na.multiply(a, 3, a)".
+ * The usage of the **kwargs construction should be avoided.  If they cannoted
+   be avoided, they must be explained, even if they are only to be passed on to
+   a nested function.
+ * Doc strings should describe input, output, behavior, and any state changes
+   that occur on an object.  See the file `doc/docstring_example.txt` for a
+   fiducial example of a docstring.
diff -r 8488818c915f -r 8eb6996dd5f1 doc/docstring_example.txt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/docstring_example.txt	Tue Jun 01 09:51:42 2010 -0700
@@ -0,0 +1,86 @@
+    r"""A one-line summary that does not use variable names or the
+    function name.
+
+    Several sentences providing an extended description. Refer to
+    variables using back-ticks, e.g. `var`.
+
+    Parameters
+    ----------
+    var1 : array_like
+        Array_like means all those objects -- lists, nested lists, etc. --
+        that can be converted to an array.  We can also refer to
+        variables like `var1`.
+    var2 : int
+        The type above can either refer to an actual Python type
+        (e.g. ``int``), or describe the type of the variable in more
+        detail, e.g. ``(N,) ndarray`` or ``array_like``.
+    Long_variable_name : {'hi', 'ho'}, optional
+        Choices in brackets, default first when optional.
+
+    Returns
+    -------
+    describe : type
+        Explanation
+    output : type
+        Explanation
+    tuple : type
+        Explanation
+    items : type
+        even more explaining
+
+    Other Parameters
+    ----------------
+    only_seldom_used_keywords : type
+        Explanation
+    common_parameters_listed_above : type
+        Explanation
+
+    Raises
+    ------
+    BadException
+        Because you shouldn't have done that.
+
+    See Also
+    --------
+    otherfunc : relationship (optional)
+    newfunc : Relationship (optional), which could be fairly long, in which
+              case the line wraps here.
+    thirdfunc, fourthfunc, fifthfunc
+
+    Notes
+    -----
+    Notes about the implementation algorithm (if needed).
+
+    This can have multiple paragraphs.
+
+    You may include some math:
+
+    .. math:: X(e^{j\omega } ) = x(n)e^{ - j\omega n}
+
+    And even use a greek symbol like :math:`omega` inline.
+
+    References
+    ----------
+    Cite the relevant literature, e.g. [1]_.  You may also cite these
+    references in the notes section above.
+
+    .. [1] O. McNoleg, "The integration of GIS, remote sensing,
+       expert systems and adaptive co-kriging for environmental habitat
+       modelling of the Highland Haggis using object-oriented, fuzzy-logic
+       and neural-network techniques," Computers & Geosciences, vol. 22,
+       pp. 585-588, 1996.
+
+    Examples
+    --------
+    These are written in doctest format, and should illustrate how to
+    use the function.  Use the variables 'pf' for the parameter file, 'pc' for
+    a plot collection, 'c' for a center, and 'L' for a vector. 
+
+    >>> a=[1,2,3]
+    >>> print [x + 3 for x in a]
+    [4, 5, 6]
+    >>> print "a\n\nb"
+    a
+    b
+
+    """
diff -r 8488818c915f -r 8eb6996dd5f1 doc/docstring_idioms.txt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/docstring_idioms.txt	Tue Jun 01 09:51:42 2010 -0700
@@ -0,0 +1,54 @@
+Idioms for Docstrings in yt
+===========================
+
+For a full list of recognized constructs for marking up docstrings, see the
+Sphinx documentation:
+
+http://sphinx.pocoo.org/
+
+Specifically, this section:
+
+http://sphinx.pocoo.org/markup/index.html
+http://sphinx.pocoo.org/markup/inline.html#cross-referencing-python-objects
+
+Variables in Examples
+---------------------
+
+In order to construct short, useful examples, some variables must be specified.
+However, because often examples require a bit of setup, here is a list of
+useful variable names that correspond to specific instances that the user is
+presupposed to have created.
+
+   * `pf`: a parameter file, loaded successfully
+   * `sp`: a sphere
+   * `c`: a 3-component "center"
+   * `L`: a 3-component vector that corresponds to either angular momentum or a
+     normal vector
+
+Cross-Referencing
+-----------------
+
+To enable sufficient linkages between different sections of the documentation,
+good cross-referencing is key.  To reference a section of the documentation,
+you can use this construction:
+
+    For more information, see :ref:`image_writer`.
+
+This will insert a link to the section in the documentation which has been
+identified with `image_writer` as its name.
+
+Referencing Classes and Functions
+---------------------------------
+
+To indicate the return type of a given object, you can reference it using this
+construction:
+
+    This function returns a :class:`PlotCollection`.
+
+To reference a function, you can use:
+
+    To write out this array, use :func:`save_image`.
+
+To reference a method, you can use:
+
+    To add a projection, use :meth:`PlotCollection.add_projection`.
diff -r 8488818c915f -r 8eb6996dd5f1 scripts/fbranch
--- a/scripts/fbranch	Tue May 25 08:54:38 2010 -0700
+++ b/scripts/fbranch	Tue Jun 01 09:51:42 2010 -0700
@@ -1,1 +1,4 @@
-basic.py
\ No newline at end of file
+#!python2.5
+import yt.fido
+
+yt.fido.runAction()
diff -r 8488818c915f -r 8eb6996dd5f1 scripts/fbury
--- a/scripts/fbury	Tue May 25 08:54:38 2010 -0700
+++ b/scripts/fbury	Tue Jun 01 09:51:42 2010 -0700
@@ -1,1 +1,4 @@
-basic.py
\ No newline at end of file
+#!python2.5
+import yt.fido
+
+yt.fido.runAction()
diff -r 8488818c915f -r 8eb6996dd5f1 scripts/fdigup
--- a/scripts/fdigup	Tue May 25 08:54:38 2010 -0700
+++ b/scripts/fdigup	Tue Jun 01 09:51:42 2010 -0700
@@ -1,1 +1,4 @@
-basic.py
\ No newline at end of file
+#!python2.5
+import yt.fido
+
+yt.fido.runAction()
diff -r 8488818c915f -r 8eb6996dd5f1 scripts/fido
--- a/scripts/fido	Tue May 25 08:54:38 2010 -0700
+++ b/scripts/fido	Tue Jun 01 09:51:42 2010 -0700
@@ -1,1 +1,4 @@
-basic.py
\ No newline at end of file
+#!python2.5
+from yt.mods import *
+
+fido.runAction()
diff -r 8488818c915f -r 8eb6996dd5f1 scripts/fimport
--- a/scripts/fimport	Tue May 25 08:54:38 2010 -0700
+++ b/scripts/fimport	Tue Jun 01 09:51:42 2010 -0700
@@ -1,1 +1,4 @@
-basic.py
\ No newline at end of file
+#!python2.5
+from yt.mods import *
+
+fido.runAction()
diff -r 8488818c915f -r 8eb6996dd5f1 yt/_amr_utils/FixedInterpolator.c
--- a/yt/_amr_utils/FixedInterpolator.c	Tue May 25 08:54:38 2010 -0700
+++ b/yt/_amr_utils/FixedInterpolator.c	Tue Jun 01 09:51:42 2010 -0700
@@ -28,8 +28,9 @@
 
 #define VINDEX(A,B,C) data[((((A)+ci[0])*(ds[1]+1)+((B)+ci[1]))*(ds[2]+1)+ci[2]+(C))]
 //  (((C*ds[1])+B)*ds[0]+A)
+#define OINDEX(A,B,C) data[(A)*(ds[1]+1)*(ds[2]+1)+(B)*ds[2]+(B)+(C)]
 
-npy_float64 fast_interpolate(int *ds, int *ci, npy_float64 *dp,
+npy_float64 fast_interpolate(int ds[3], int ci[3], npy_float64 dp[3],
                              npy_float64 *data)
 {
     int i;
@@ -48,7 +49,28 @@
     return dv;
 }
 
-npy_float64 trilinear_interpolate(int *ds, int *ci, npy_float64 *dp,
+npy_float64 offset_interpolate(int ds[3], npy_float64 dp[3], npy_float64 *data)
+{
+    int i;
+    npy_float64 dv, vz[4];
+
+    dv = 1.0 - dp[2];
+    vz[0] = dv*OINDEX(0,0,0) + dp[2]*OINDEX(0,0,1);
+    vz[1] = dv*OINDEX(0,1,0) + dp[2]*OINDEX(0,1,1);
+    vz[2] = dv*OINDEX(1,0,0) + dp[2]*OINDEX(1,0,1);
+    vz[3] = dv*OINDEX(1,1,0) + dp[2]*OINDEX(1,1,1);
+
+    dv = 1.0 - dp[1];
+    vz[0] = dv*vz[0] + dp[1]*vz[1];
+    vz[1] = dv*vz[2] + dp[1]*vz[3];
+
+    dv = 1.0 - dp[0];
+    vz[0] = dv*vz[0] + dp[0]*vz[1];
+
+    return vz[0];
+}
+
+npy_float64 trilinear_interpolate(int ds[3], int ci[3], npy_float64 dp[3],
 				  npy_float64 *data)
 {
     /* dims is one less than the dimensions of the array */
diff -r 8488818c915f -r 8eb6996dd5f1 yt/_amr_utils/FixedInterpolator.h
--- a/yt/_amr_utils/FixedInterpolator.h	Tue May 25 08:54:38 2010 -0700
+++ b/yt/_amr_utils/FixedInterpolator.h	Tue Jun 01 09:51:42 2010 -0700
@@ -36,6 +36,8 @@
 npy_float64 fast_interpolate(int ds[3], int ci[3], npy_float64 dp[3],
                              npy_float64 *data);
 
+npy_float64 offset_interpolate(int ds[3], npy_float64 dp[3], npy_float64 *data);
+
 npy_float64 trilinear_interpolate(int ds[3], int ci[3], npy_float64 dp[3],



More information about the yt-svn mailing list