[yt-svn] commit/yt: 9 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Sat Jan 3 20:26:53 PST 2015


9 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/f0f920b4e50a/
Changeset:   f0f920b4e50a
Branch:      yt
User:        jzuhone
Date:        2014-12-16 03:03:40+00:00
Summary:     Adding north_vector to PPVCube. Enforcing square domains.
Affected #:  2 files

diff -r 75ac9c5f003c6949fe46bab2a2227e4507b5d93c -r f0f920b4e50abc3318db2c7b1eff75f3cf36813a yt/analysis_modules/ppv_cube/ppv_cube.py
--- a/yt/analysis_modules/ppv_cube/ppv_cube.py
+++ b/yt/analysis_modules/ppv_cube/ppv_cube.py
@@ -51,8 +51,9 @@
 
 class PPVCube(object):
     def __init__(self, ds, normal, field, center="c", width=(1.0,"unitary"),
-                 dims=(100,100,100), velocity_bounds=None, thermal_broad=False,
-                 atomic_weight=56., method="integrate", no_shifting=False):
+                 dims=(100,100), velocity_bounds=None, thermal_broad=False,
+                 atomic_weight=56., method="integrate", no_shifting=False,
+                 north_vector=None):
         r""" Initialize a PPVCube object.
 
         Parameters
@@ -62,7 +63,7 @@
         normal : array_like or string
             The normal vector along with to make the projections. If an array, it
             will be normalized. If a string, it will be assumed to be along one of the
-            principal axes of the domain ("x","y", or "z").
+            principal axes of the domain ("x", "y", or "z").
         field : string
             The field to project.
         center : A sequence of floats, a string, or a tuple.
@@ -79,8 +80,8 @@
             The width of the projection. A float will assume the width is in code units.
             A (value, unit) tuple or YTQuantity allows for the units of the width to be
             specified.
-        dims : tuple, optional
-            A 3-tuple of dimensions (nx,ny,nv) for the cube.
+        resolution : tuple, optional
+            A 2-tuple of dimensions (nx,nv) for the cube. Implies nx = ny. 
         velocity_bounds : tuple, optional
             A 3-tuple of (vmin, vmax, units) for the velocity bounds to
             integrate over. If None, the largest velocity of the
@@ -95,6 +96,10 @@
         no_shifting : boolean, optional
             If set, no shifting due to velocity will occur but only thermal broadening.
             Should not be set when *thermal_broad* is False, otherwise nothing happens!
+        north_vector : a sequence of floats
+            A vector defining the 'up' direction. This option sets the orientation of 
+            the plane of projection. If not set, an arbitrary grid-aligned north_vector 
+            is chosen. Ignored in the case of on-axis plots.
 
         Examples
         --------
@@ -117,8 +122,8 @@
         self.center = ds.coordinates.sanitize_center(center, normal)[0]
 
         self.nx = dims[0]
-        self.ny = dims[1]
-        self.nv = dims[2]
+        self.ny = dims[0]
+        self.nv = dims[1]
 
         if method not in ["integrate","sum"]:
             raise RuntimeError("Only the 'integrate' and 'sum' projection +"
@@ -167,6 +172,7 @@
             else:
                 buf = off_axis_projection(ds, self.center, normal, width,
                                           (self.nx, self.ny), "intensity",
+                                          north_vector=north_vector,
                                           no_ghost=True, method=method)[::-1]
             sto.result_id = i
             sto.result = buf
@@ -176,7 +182,7 @@
         self.data = ds.arr(np.zeros((self.nx,self.ny,self.nv)), self.proj_units)
         if is_root():
             for i, buf in sorted(storage.items()):
-                self.data[:,:,i] = buf[:,:]
+                self.data[:,:,i] = buf.transpose()
 
         self.axis_type = "velocity"
 
@@ -197,8 +203,8 @@
             T = data["temperature"].v
             w = ppv_utils.compute_weight(self.thermal_broad, self.dv_cgs,
                                          self.particle_mass, v.flatten(), T.flatten())
-            w[np.isnan(w)] = 0.0                                                                                                                        
-            return data[self.field]*w.reshape(v.shape)                                                                                                  
+            w[np.isnan(w)] = 0.0
+            return data[self.field]*w.reshape(v.shape)
         return _intensity
 
     def transform_spectral_axis(self, rest_value, units):
@@ -283,7 +289,7 @@
         if sky_scale is not None and sky_center is not None:
             w = create_sky_wcs(w, sky_center, sky_scale)
 
-        fib = FITSImageBuffer(self.data.transpose(2,0,1), fields=self.field, wcs=w)
+        fib = FITSImageBuffer(self.data.transpose(), fields=self.field, wcs=w)
         fib[0].header["bunit"] = re.sub('()', '', str(self.proj_units))
         fib[0].header["btype"] = self.field
 

diff -r 75ac9c5f003c6949fe46bab2a2227e4507b5d93c -r f0f920b4e50abc3318db2c7b1eff75f3cf36813a yt/analysis_modules/ppv_cube/tests/test_ppv.py
--- a/yt/analysis_modules/ppv_cube/tests/test_ppv.py
+++ b/yt/analysis_modules/ppv_cube/tests/test_ppv.py
@@ -38,7 +38,7 @@
 
     ds = load_uniform_grid(data, dims)
 
-    cube = PPVCube(ds, "z", "density", dims=dims,
+    cube = PPVCube(ds, "z", "density", dims=(8,1024),
                    velocity_bounds=(-300., 300., "km/s"),
                    thermal_broad=True)
 


https://bitbucket.org/yt_analysis/yt/commits/46945782a52e/
Changeset:   46945782a52e
Branch:      yt
User:        jzuhone
Date:        2014-12-16 03:11:20+00:00
Summary:     Updating PPVCube docs.
Affected #:  1 file

diff -r f0f920b4e50abc3318db2c7b1eff75f3cf36813a -r 46945782a52e785c33e54af194c20120d6108972 doc/source/analyzing/analysis_modules/PPVCube.ipynb
--- a/doc/source/analyzing/analysis_modules/PPVCube.ipynb
+++ b/doc/source/analyzing/analysis_modules/PPVCube.ipynb
@@ -1,7 +1,7 @@
 {
  "metadata": {
   "name": "",
-  "signature": "sha256:7ba601e381023e5b7c00a585ccaa55996316d2dfe7f8c96284b4539e1ee5b846"
+  "signature": "sha256:de78b6ea344df8f42bb2fb0309d3a81e1b4283ebdfb4eb2df9146994b31ec4ec"
  },
  "nbformat": 3,
  "nbformat_minor": 0,
@@ -19,10 +19,13 @@
      "cell_type": "code",
      "collapsed": false,
      "input": [
+      "from yt.config import ytcfg\n",
+      "ytcfg[\"yt\",\"loglevel\"] = 30\n",
+      "\n",
       "import yt\n",
       "import numpy as np\n",
-      "\n",
-      "from yt.analysis_modules.ppv_cube.api import PPVCube"
+      "from yt.analysis_modules.ppv_cube.api import PPVCube\n",
+      "import yt.units as u"
      ],
      "language": "python",
      "metadata": {},
@@ -168,7 +171,7 @@
      "cell_type": "markdown",
      "metadata": {},
      "source": [
-      "Which shows a rotating disk with a specific density and velocity profile. Now, suppose we wanted to look at this disk galaxy from a certain orientation angle, and simulate a 3D FITS data cube where we can see the gas that is emitting at different velocities along the line of sight. We can do this using the `PPVCube` class. First, let's assume we rotate our viewing angle 60 degrees from face-on, from along the z-axis into the y-axis. We'll create a normal vector:"
+      "Which shows a rotating disk with a specific density and velocity profile. Now, suppose we wanted to look at this disk galaxy from a certain orientation angle, and simulate a 3D FITS data cube where we can see the gas that is emitting at different velocities along the line of sight. We can do this using the `PPVCube` class. First, let's assume we rotate our viewing angle 60 degrees from face-on, from along the z-axis into the x-axis. We'll create a normal vector:"
      ]
     },
     {
@@ -176,7 +179,7 @@
      "collapsed": false,
      "input": [
       "i = 60.*np.pi/180.\n",
-      "L = [0.0,np.sin(i),np.sin(i)]"
+      "L = [np.sin(i),0.0,np.cos(i)]"
      ],
      "language": "python",
      "metadata": {},
@@ -193,7 +196,7 @@
      "cell_type": "code",
      "collapsed": false,
      "input": [
-      "cube = PPVCube(ds, L, \"density\", dims=(200,100,50), velocity_bounds=(-150.,150.,\"km/s\"), method=\"sum\")"
+      "cube = PPVCube(ds, L, \"density\", dims=(200,50), velocity_bounds=(-150.,150.,\"km/s\"), method=\"sum\", north_vector=[0,1,0])"
      ],
      "language": "python",
      "metadata": {},
@@ -268,7 +271,6 @@
      "cell_type": "code",
      "collapsed": false,
      "input": [
-      "import yt.units as u\n",
       "# Picking different velocities for the slices\n",
       "new_center = ds_cube.domain_center\n",
       "new_center[2] = ds_cube.spec2pixel(-100.*u.km/u.s)\n",
@@ -334,8 +336,8 @@
      "cell_type": "code",
      "collapsed": false,
      "input": [
-      "cube2 = PPVCube(ds, L, \"density\", dims=(200,100,50), velocity_bounds=(-150,150,\"km/s\"), thermal_broad=True, \n",
-      "                atomic_weight=12.0, method=\"sum\")\n",
+      "cube2 = PPVCube(ds, L, \"density\", dims=(200,50), velocity_bounds=(-150,150,\"km/s\"), thermal_broad=True, \n",
+      "                atomic_weight=12.0, method=\"sum\", north_vector=[0,1,0])\n",
       "cube2.write_fits(\"cube2.fits\", clobber=True, length_unit=\"kpc\")"
      ],
      "language": "python",


https://bitbucket.org/yt_analysis/yt/commits/c7e78a952111/
Changeset:   c7e78a952111
Branch:      yt
User:        jzuhone
Date:        2014-12-16 15:33:53+00:00
Summary:     Photon simulator bug fix in the case that no photons are generated for a processor
Affected #:  1 file

diff -r 46945782a52e785c33e54af194c20120d6108972 -r c7e78a952111821b718f35f009ce0a99d2ce2124 yt/analysis_modules/photon_simulator/photon_models.py
--- a/yt/analysis_modules/photon_simulator/photon_models.py
+++ b/yt/analysis_modules/photon_simulator/photon_models.py
@@ -217,7 +217,8 @@
             photons["dx"].append(chunk["dx"][idxs].in_units("kpc"))
 
         for key in photons:
-            photons[key] = uconcatenate(photons[key])
+            if len(photons[key]) > 0:   
+                photons[key] = uconcatenate(photons[key])
 
         return photons
 


https://bitbucket.org/yt_analysis/yt/commits/e36c63e424ed/
Changeset:   e36c63e424ed
Branch:      yt
User:        jzuhone
Date:        2014-12-16 15:41:44+00:00
Summary:     Made more explicit that the aspect ratio = 1 in the docstrings.
Affected #:  1 file

diff -r c7e78a952111821b718f35f009ce0a99d2ce2124 -r e36c63e424ed99a2db8ecde8846acfaa21417189 yt/analysis_modules/ppv_cube/ppv_cube.py
--- a/yt/analysis_modules/ppv_cube/ppv_cube.py
+++ b/yt/analysis_modules/ppv_cube/ppv_cube.py
@@ -79,9 +79,11 @@
         width : float, tuple, or YTQuantity.
             The width of the projection. A float will assume the width is in code units.
             A (value, unit) tuple or YTQuantity allows for the units of the width to be
-            specified.
+            specified. Implies width = height, e.g. the aspect ratio of the PPVCube's 
+            spatial dimensions is 1. 
         resolution : tuple, optional
-            A 2-tuple of dimensions (nx,nv) for the cube. Implies nx = ny. 
+            A 2-tuple of dimensions (nx,nv) for the cube. Implies nx = ny, e.g. the aspect
+            ratio of the PPVCube's spatial dimensions is 1. 
         velocity_bounds : tuple, optional
             A 3-tuple of (vmin, vmax, units) for the velocity bounds to
             integrate over. If None, the largest velocity of the


https://bitbucket.org/yt_analysis/yt/commits/54db1784082a/
Changeset:   54db1784082a
Branch:      yt
User:        jzuhone
Date:        2014-12-16 15:42:06+00:00
Summary:     Bug fix for the case that a processor has no photons
Affected #:  1 file

diff -r e36c63e424ed99a2db8ecde8846acfaa21417189 -r 54db1784082a7467dd7c3b0ed355ede8678c79c0 yt/analysis_modules/photon_simulator/photon_models.py
--- a/yt/analysis_modules/photon_simulator/photon_models.py
+++ b/yt/analysis_modules/photon_simulator/photon_models.py
@@ -217,7 +217,7 @@
             photons["dx"].append(chunk["dx"][idxs].in_units("kpc"))
 
         for key in photons:
-            if len(photons[key]) > 0:   
+            if len(photons[key]) > 0:
                 photons[key] = uconcatenate(photons[key])
 
         return photons


https://bitbucket.org/yt_analysis/yt/commits/0cbcca8de3b0/
Changeset:   0cbcca8de3b0
Branch:      yt
User:        jzuhone
Date:        2014-12-16 15:57:27+00:00
Summary:     Naming consistency
Affected #:  1 file

diff -r 54db1784082a7467dd7c3b0ed355ede8678c79c0 -r 0cbcca8de3b0434563d13bbd0113003d1ac0a7e9 yt/analysis_modules/ppv_cube/ppv_cube.py
--- a/yt/analysis_modules/ppv_cube/ppv_cube.py
+++ b/yt/analysis_modules/ppv_cube/ppv_cube.py
@@ -81,7 +81,7 @@
             A (value, unit) tuple or YTQuantity allows for the units of the width to be
             specified. Implies width = height, e.g. the aspect ratio of the PPVCube's 
             spatial dimensions is 1. 
-        resolution : tuple, optional
+        dims : tuple, optional
             A 2-tuple of dimensions (nx,nv) for the cube. Implies nx = ny, e.g. the aspect
             ratio of the PPVCube's spatial dimensions is 1. 
         velocity_bounds : tuple, optional


https://bitbucket.org/yt_analysis/yt/commits/943a16188b82/
Changeset:   943a16188b82
Branch:      yt
User:        jzuhone
Date:        2014-12-18 07:05:22+00:00
Summary:     Finally got the behavior with north_vector to be the same as with off-axis projection plots
Affected #:  2 files

diff -r 0cbcca8de3b0434563d13bbd0113003d1ac0a7e9 -r 943a16188b82bb8a88c588b77e41a294ac000eab doc/source/analyzing/analysis_modules/PPVCube.ipynb
--- a/doc/source/analyzing/analysis_modules/PPVCube.ipynb
+++ b/doc/source/analyzing/analysis_modules/PPVCube.ipynb
@@ -1,7 +1,7 @@
 {
  "metadata": {
   "name": "",
-  "signature": "sha256:de78b6ea344df8f42bb2fb0309d3a81e1b4283ebdfb4eb2df9146994b31ec4ec"
+  "signature": "sha256:794e861818b8a105bc91b537e8359801c8d28d5a13a32787fb386b0578109a66"
  },
  "nbformat": 3,
  "nbformat_minor": 0,
@@ -196,7 +196,7 @@
      "cell_type": "code",
      "collapsed": false,
      "input": [
-      "cube = PPVCube(ds, L, \"density\", dims=(200,50), velocity_bounds=(-150.,150.,\"km/s\"), method=\"sum\", north_vector=[0,1,0])"
+      "cube = PPVCube(ds, L, \"density\", dims=(200,50), velocity_bounds=(-150.,150.,\"km/s\"), method=\"sum\")"
      ],
      "language": "python",
      "metadata": {},
@@ -337,7 +337,7 @@
      "collapsed": false,
      "input": [
       "cube2 = PPVCube(ds, L, \"density\", dims=(200,50), velocity_bounds=(-150,150,\"km/s\"), thermal_broad=True, \n",
-      "                atomic_weight=12.0, method=\"sum\", north_vector=[0,1,0])\n",
+      "                atomic_weight=12.0, method=\"sum\")\n",
       "cube2.write_fits(\"cube2.fits\", clobber=True, length_unit=\"kpc\")"
      ],
      "language": "python",

diff -r 0cbcca8de3b0434563d13bbd0113003d1ac0a7e9 -r 943a16188b82bb8a88c588b77e41a294ac000eab yt/analysis_modules/ppv_cube/ppv_cube.py
--- a/yt/analysis_modules/ppv_cube/ppv_cube.py
+++ b/yt/analysis_modules/ppv_cube/ppv_cube.py
@@ -175,7 +175,7 @@
                 buf = off_axis_projection(ds, self.center, normal, width,
                                           (self.nx, self.ny), "intensity",
                                           north_vector=north_vector,
-                                          no_ghost=True, method=method)[::-1]
+                                          no_ghost=True, method=method).swapaxes(0,1)
             sto.result_id = i
             sto.result = buf
             pbar.update(i)


https://bitbucket.org/yt_analysis/yt/commits/714ee06c641e/
Changeset:   714ee06c641e
Branch:      yt
User:        jzuhone
Date:        2014-12-18 07:56:30+00:00
Summary:     Bugfix
Affected #:  1 file

diff -r 943a16188b82bb8a88c588b77e41a294ac000eab -r 714ee06c641e182cd87b7d9118c634fc25577a8c yt/utilities/fits_image.py
--- a/yt/utilities/fits_image.py
+++ b/yt/utilities/fits_image.py
@@ -337,8 +337,8 @@
         cunit = [str(ds.wcs.wcs.cunit[idx]) for idx in axis_wcs[axis]]
         ctype = [ds.wcs.wcs.ctype[idx] for idx in axis_wcs[axis]]
         cdelt = [ds.wcs.wcs.cdelt[idx] for idx in axis_wcs[axis]]
-        ctr_pix = center.in_units("code_length")[:self.dimensionality].v
-        crval = ds.wcs.wcs_pix2world(ctr_pix.reshape(1,self.dimensionality))[0]
+        ctr_pix = center.in_units("code_length")[:ds.dimensionality].v
+        crval = ds.wcs.wcs_pix2world(ctr_pix.reshape(1,ds.dimensionality))[0]
         crval = [crval[idx] for idx in axis_wcs[axis]]
     else:
         # This is some other kind of dataset                                                                      


https://bitbucket.org/yt_analysis/yt/commits/f904451a2faa/
Changeset:   f904451a2faa
Branch:      yt
User:        MatthewTurk
Date:        2015-01-04 04:26:46+00:00
Summary:     Merged in jzuhone/yt-3.x (pull request #1367)

[bugfixish] PPVCube fixes
Affected #:  5 files

diff -r 6f2e8040d395c53810a66157cf804dc7dc9c1431 -r f904451a2faa7a2461dc85d651dc8ff32e30e2d6 doc/source/analyzing/analysis_modules/PPVCube.ipynb
--- a/doc/source/analyzing/analysis_modules/PPVCube.ipynb
+++ b/doc/source/analyzing/analysis_modules/PPVCube.ipynb
@@ -1,7 +1,7 @@
 {
  "metadata": {
   "name": "",
-  "signature": "sha256:7ba601e381023e5b7c00a585ccaa55996316d2dfe7f8c96284b4539e1ee5b846"
+  "signature": "sha256:794e861818b8a105bc91b537e8359801c8d28d5a13a32787fb386b0578109a66"
  },
  "nbformat": 3,
  "nbformat_minor": 0,
@@ -19,10 +19,13 @@
      "cell_type": "code",
      "collapsed": false,
      "input": [
+      "from yt.config import ytcfg\n",
+      "ytcfg[\"yt\",\"loglevel\"] = 30\n",
+      "\n",
       "import yt\n",
       "import numpy as np\n",
-      "\n",
-      "from yt.analysis_modules.ppv_cube.api import PPVCube"
+      "from yt.analysis_modules.ppv_cube.api import PPVCube\n",
+      "import yt.units as u"
      ],
      "language": "python",
      "metadata": {},
@@ -168,7 +171,7 @@
      "cell_type": "markdown",
      "metadata": {},
      "source": [
-      "Which shows a rotating disk with a specific density and velocity profile. Now, suppose we wanted to look at this disk galaxy from a certain orientation angle, and simulate a 3D FITS data cube where we can see the gas that is emitting at different velocities along the line of sight. We can do this using the `PPVCube` class. First, let's assume we rotate our viewing angle 60 degrees from face-on, from along the z-axis into the y-axis. We'll create a normal vector:"
+      "Which shows a rotating disk with a specific density and velocity profile. Now, suppose we wanted to look at this disk galaxy from a certain orientation angle, and simulate a 3D FITS data cube where we can see the gas that is emitting at different velocities along the line of sight. We can do this using the `PPVCube` class. First, let's assume we rotate our viewing angle 60 degrees from face-on, from along the z-axis into the x-axis. We'll create a normal vector:"
      ]
     },
     {
@@ -176,7 +179,7 @@
      "collapsed": false,
      "input": [
       "i = 60.*np.pi/180.\n",
-      "L = [0.0,np.sin(i),np.sin(i)]"
+      "L = [np.sin(i),0.0,np.cos(i)]"
      ],
      "language": "python",
      "metadata": {},
@@ -193,7 +196,7 @@
      "cell_type": "code",
      "collapsed": false,
      "input": [
-      "cube = PPVCube(ds, L, \"density\", dims=(200,100,50), velocity_bounds=(-150.,150.,\"km/s\"), method=\"sum\")"
+      "cube = PPVCube(ds, L, \"density\", dims=(200,50), velocity_bounds=(-150.,150.,\"km/s\"), method=\"sum\")"
      ],
      "language": "python",
      "metadata": {},
@@ -268,7 +271,6 @@
      "cell_type": "code",
      "collapsed": false,
      "input": [
-      "import yt.units as u\n",
       "# Picking different velocities for the slices\n",
       "new_center = ds_cube.domain_center\n",
       "new_center[2] = ds_cube.spec2pixel(-100.*u.km/u.s)\n",
@@ -334,7 +336,7 @@
      "cell_type": "code",
      "collapsed": false,
      "input": [
-      "cube2 = PPVCube(ds, L, \"density\", dims=(200,100,50), velocity_bounds=(-150,150,\"km/s\"), thermal_broad=True, \n",
+      "cube2 = PPVCube(ds, L, \"density\", dims=(200,50), velocity_bounds=(-150,150,\"km/s\"), thermal_broad=True, \n",
       "                atomic_weight=12.0, method=\"sum\")\n",
       "cube2.write_fits(\"cube2.fits\", clobber=True, length_unit=\"kpc\")"
      ],

diff -r 6f2e8040d395c53810a66157cf804dc7dc9c1431 -r f904451a2faa7a2461dc85d651dc8ff32e30e2d6 yt/analysis_modules/photon_simulator/photon_models.py
--- a/yt/analysis_modules/photon_simulator/photon_models.py
+++ b/yt/analysis_modules/photon_simulator/photon_models.py
@@ -217,7 +217,8 @@
             photons["dx"].append(chunk["dx"][idxs].in_units("kpc"))
 
         for key in photons:
-            photons[key] = uconcatenate(photons[key])
+            if len(photons[key]) > 0:
+                photons[key] = uconcatenate(photons[key])
 
         return photons
 

diff -r 6f2e8040d395c53810a66157cf804dc7dc9c1431 -r f904451a2faa7a2461dc85d651dc8ff32e30e2d6 yt/analysis_modules/ppv_cube/ppv_cube.py
--- a/yt/analysis_modules/ppv_cube/ppv_cube.py
+++ b/yt/analysis_modules/ppv_cube/ppv_cube.py
@@ -51,8 +51,9 @@
 
 class PPVCube(object):
     def __init__(self, ds, normal, field, center="c", width=(1.0,"unitary"),
-                 dims=(100,100,100), velocity_bounds=None, thermal_broad=False,
-                 atomic_weight=56., method="integrate", no_shifting=False):
+                 dims=(100,100), velocity_bounds=None, thermal_broad=False,
+                 atomic_weight=56., method="integrate", no_shifting=False,
+                 north_vector=None):
         r""" Initialize a PPVCube object.
 
         Parameters
@@ -62,7 +63,7 @@
         normal : array_like or string
             The normal vector along with to make the projections. If an array, it
             will be normalized. If a string, it will be assumed to be along one of the
-            principal axes of the domain ("x","y", or "z").
+            principal axes of the domain ("x", "y", or "z").
         field : string
             The field to project.
         center : A sequence of floats, a string, or a tuple.
@@ -78,9 +79,11 @@
         width : float, tuple, or YTQuantity.
             The width of the projection. A float will assume the width is in code units.
             A (value, unit) tuple or YTQuantity allows for the units of the width to be
-            specified.
+            specified. Implies width = height, e.g. the aspect ratio of the PPVCube's 
+            spatial dimensions is 1. 
         dims : tuple, optional
-            A 3-tuple of dimensions (nx,ny,nv) for the cube.
+            A 2-tuple of dimensions (nx,nv) for the cube. Implies nx = ny, e.g. the aspect
+            ratio of the PPVCube's spatial dimensions is 1. 
         velocity_bounds : tuple, optional
             A 3-tuple of (vmin, vmax, units) for the velocity bounds to
             integrate over. If None, the largest velocity of the
@@ -95,6 +98,10 @@
         no_shifting : boolean, optional
             If set, no shifting due to velocity will occur but only thermal broadening.
             Should not be set when *thermal_broad* is False, otherwise nothing happens!
+        north_vector : a sequence of floats
+            A vector defining the 'up' direction. This option sets the orientation of 
+            the plane of projection. If not set, an arbitrary grid-aligned north_vector 
+            is chosen. Ignored in the case of on-axis plots.
 
         Examples
         --------
@@ -117,8 +124,8 @@
         self.center = ds.coordinates.sanitize_center(center, normal)[0]
 
         self.nx = dims[0]
-        self.ny = dims[1]
-        self.nv = dims[2]
+        self.ny = dims[0]
+        self.nv = dims[1]
 
         if method not in ["integrate","sum"]:
             raise RuntimeError("Only the 'integrate' and 'sum' projection +"
@@ -167,7 +174,8 @@
             else:
                 buf = off_axis_projection(ds, self.center, normal, width,
                                           (self.nx, self.ny), "intensity",
-                                          no_ghost=True, method=method)[::-1]
+                                          north_vector=north_vector,
+                                          no_ghost=True, method=method).swapaxes(0,1)
             sto.result_id = i
             sto.result = buf
             pbar.update(i)
@@ -176,7 +184,7 @@
         self.data = ds.arr(np.zeros((self.nx,self.ny,self.nv)), self.proj_units)
         if is_root():
             for i, buf in sorted(storage.items()):
-                self.data[:,:,i] = buf[:,:]
+                self.data[:,:,i] = buf.transpose()
 
         self.axis_type = "velocity"
 
@@ -197,8 +205,8 @@
             T = data["temperature"].v
             w = ppv_utils.compute_weight(self.thermal_broad, self.dv_cgs,
                                          self.particle_mass, v.flatten(), T.flatten())
-            w[np.isnan(w)] = 0.0                                                                                                                        
-            return data[self.field]*w.reshape(v.shape)                                                                                                  
+            w[np.isnan(w)] = 0.0
+            return data[self.field]*w.reshape(v.shape)
         return _intensity
 
     def transform_spectral_axis(self, rest_value, units):
@@ -283,7 +291,7 @@
         if sky_scale is not None and sky_center is not None:
             w = create_sky_wcs(w, sky_center, sky_scale)
 
-        fib = FITSImageBuffer(self.data.transpose(2,0,1), fields=self.field, wcs=w)
+        fib = FITSImageBuffer(self.data.transpose(), fields=self.field, wcs=w)
         fib[0].header["bunit"] = re.sub('()', '', str(self.proj_units))
         fib[0].header["btype"] = self.field
 

diff -r 6f2e8040d395c53810a66157cf804dc7dc9c1431 -r f904451a2faa7a2461dc85d651dc8ff32e30e2d6 yt/analysis_modules/ppv_cube/tests/test_ppv.py
--- a/yt/analysis_modules/ppv_cube/tests/test_ppv.py
+++ b/yt/analysis_modules/ppv_cube/tests/test_ppv.py
@@ -38,7 +38,7 @@
 
     ds = load_uniform_grid(data, dims)
 
-    cube = PPVCube(ds, "z", "density", dims=dims,
+    cube = PPVCube(ds, "z", "density", dims=(8,1024),
                    velocity_bounds=(-300., 300., "km/s"),
                    thermal_broad=True)
 

diff -r 6f2e8040d395c53810a66157cf804dc7dc9c1431 -r f904451a2faa7a2461dc85d651dc8ff32e30e2d6 yt/utilities/fits_image.py
--- a/yt/utilities/fits_image.py
+++ b/yt/utilities/fits_image.py
@@ -337,8 +337,8 @@
         cunit = [str(ds.wcs.wcs.cunit[idx]) for idx in axis_wcs[axis]]
         ctype = [ds.wcs.wcs.ctype[idx] for idx in axis_wcs[axis]]
         cdelt = [ds.wcs.wcs.cdelt[idx] for idx in axis_wcs[axis]]
-        ctr_pix = center.in_units("code_length")[:self.dimensionality].v
-        crval = ds.wcs.wcs_pix2world(ctr_pix.reshape(1,self.dimensionality))[0]
+        ctr_pix = center.in_units("code_length")[:ds.dimensionality].v
+        crval = ds.wcs.wcs_pix2world(ctr_pix.reshape(1,ds.dimensionality))[0]
         crval = [crval[idx] for idx in axis_wcs[axis]]
     else:
         # This is some other kind of dataset

Repository URL: https://bitbucket.org/yt_analysis/yt/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the yt-svn mailing list