[Yt-svn] yt: 7 new changesets

hg at spacepope.org hg at spacepope.org
Thu Jun 3 15:23:15 PDT 2010


hg Repository: yt
details:   yt/rev/8782a1de41fe
changeset: 1721:8782a1de41fe
user:      mturk
date:
Thu May 27 09:28:30 2010 -0700
description:
[svn r1735] Updating docstrings for image_handling module, adding write_bitmap function to
image_writer module

hg Repository: yt
details:   yt/rev/aa91298b2866
changeset: 1722:aa91298b2866
user:      Matthew Turk <matthewturk at gmail.com>
date:
Tue Jun 01 09:52:48 2010 -0700
description:
Merging from trunk

hg Repository: yt
details:   yt/rev/f83f3dcf4436
changeset: 1723:f83f3dcf4436
user:      Matthew Turk <matthewturk at gmail.com>
date:
Wed Jun 02 08:16:07 2010 -0700
description:
Initial import of some OpenGL stuff, including some GLSL code from VisVis.  The
MIP viewer does not currently work, but it gives semi-working images.

hg Repository: yt
details:   yt/rev/049be9756f11
changeset: 1724:049be9756f11
user:      Matthew Turk <matthewturk at gmail.com>
date:
Wed Jun 02 09:29:03 2010 -0700
description:
Minor changes (reverting to old shaders) and it now "works" -- it just doesn't
give the right values.

hg Repository: yt
details:   yt/rev/b7daa01da758
changeset: 1725:b7daa01da758
user:      Matthew Turk <matthewturk at gmail.com>
date:
Wed Jun 02 09:50:45 2010 -0700
description:
Adding some shaders I forgot, trying some new (not working ...) things with the
fragment shader to get the ray direction, updated some syntaxt in the python
code

hg Repository: yt
details:   yt/rev/2f4eb23acb4f
changeset: 1726:2f4eb23acb4f
user:      Matthew Turk <matthewturk at gmail.com>
date:
Wed Jun 02 22:34:56 2010 -0700
description:
The MIP projects are almost working.  I believe that I have corrected it to
largely work with the original visvis shaders, but it seems there is some
confusion as to which faces are front-facing and back facing.

hg Repository: yt
details:   yt/rev/d74f191d9663
changeset: 1727:d74f191d9663
user:      Matthew Turk <matthewturk at gmail.com>
date:
Thu Jun 03 15:23:06 2010 -0700
description:
Merging to tip

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                    |    43 +-
 yt/amr_utils.c                                        |  4762 +++++++++++++++++-----
 yt/amr_utils.pyx                                      |     1 +
 yt/arraytypes.py                                      |    11 +
 yt/extensions/DualEPS.py                              |   699 +++
 yt/extensions/image_writer.py                         |    26 +
 yt/extensions/opengl_widgets/calculateRay.vertex.glsl |    63 +
 yt/extensions/opengl_widgets/colormap.fragment.glsl   |    12 +
 yt/extensions/opengl_widgets/framebuffer.vertex.glsl  |    12 +
 yt/extensions/opengl_widgets/mip.fragment.glsl        |   135 +
 yt/extensions/opengl_widgets/mip_viewer.py            |   450 ++
 yt/extensions/opengl_widgets/rendering_contexts.py    |    88 +
 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                             |     1 -
 yt/lagos/HaloFinding.py                               |   137 +-
 yt/reason/plot_editors.py                             |    10 +-
 yt/reason/reason_v2.py                                |     5 +-
 yt/reason/tvtk_interface.py                           |     5 +-
 33 files changed, 6446 insertions(+), 1256 deletions(-)

diffs (truncated from 15671 to 300 lines):

diff -r 91e7b088a7d0 -r d74f191d9663 .hgignore
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgignore	Thu Jun 03 15:23:06 2010 -0700
@@ -0,0 +1,3 @@
+syntax: glob
+*.pyc
+.*.swp
diff -r 91e7b088a7d0 -r d74f191d9663 doc/coding_styleguide.txt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/coding_styleguide.txt	Thu Jun 03 15:23:06 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 91e7b088a7d0 -r d74f191d9663 doc/docstring_example.txt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/docstring_example.txt	Thu Jun 03 15:23:06 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 91e7b088a7d0 -r d74f191d9663 doc/docstring_idioms.txt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/docstring_idioms.txt	Thu Jun 03 15:23:06 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 91e7b088a7d0 -r d74f191d9663 scripts/fbranch
--- a/scripts/fbranch	Wed May 26 22:49:18 2010 -0700
+++ b/scripts/fbranch	Thu Jun 03 15:23:06 2010 -0700
@@ -1,1 +1,4 @@
-basic.py
\ No newline at end of file
+#!python2.5
+import yt.fido
+
+yt.fido.runAction()
diff -r 91e7b088a7d0 -r d74f191d9663 scripts/fbury
--- a/scripts/fbury	Wed May 26 22:49:18 2010 -0700
+++ b/scripts/fbury	Thu Jun 03 15:23:06 2010 -0700
@@ -1,1 +1,4 @@
-basic.py
\ No newline at end of file
+#!python2.5
+import yt.fido
+
+yt.fido.runAction()
diff -r 91e7b088a7d0 -r d74f191d9663 scripts/fdigup
--- a/scripts/fdigup	Wed May 26 22:49:18 2010 -0700
+++ b/scripts/fdigup	Thu Jun 03 15:23:06 2010 -0700
@@ -1,1 +1,4 @@
-basic.py
\ No newline at end of file
+#!python2.5
+import yt.fido
+
+yt.fido.runAction()
diff -r 91e7b088a7d0 -r d74f191d9663 scripts/fido
--- a/scripts/fido	Wed May 26 22:49:18 2010 -0700
+++ b/scripts/fido	Thu Jun 03 15:23:06 2010 -0700
@@ -1,1 +1,4 @@
-basic.py
\ No newline at end of file
+#!python2.5
+from yt.mods import *
+
+fido.runAction()
diff -r 91e7b088a7d0 -r d74f191d9663 scripts/fimport
--- a/scripts/fimport	Wed May 26 22:49:18 2010 -0700
+++ b/scripts/fimport	Thu Jun 03 15:23:06 2010 -0700
@@ -1,1 +1,4 @@
-basic.py
\ No newline at end of file
+#!python2.5
+from yt.mods import *
+
+fido.runAction()
diff -r 91e7b088a7d0 -r d74f191d9663 yt/_amr_utils/FixedInterpolator.c
--- a/yt/_amr_utils/FixedInterpolator.c	Wed May 26 22:49:18 2010 -0700
+++ b/yt/_amr_utils/FixedInterpolator.c	Thu Jun 03 15:23:06 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 91e7b088a7d0 -r d74f191d9663 yt/_amr_utils/FixedInterpolator.h
--- a/yt/_amr_utils/FixedInterpolator.h	Wed May 26 22:49:18 2010 -0700
+++ b/yt/_amr_utils/FixedInterpolator.h	Thu Jun 03 15:23:06 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