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

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Thu Apr 17 20:09:32 PDT 2014


13 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/47ddf508782a/
Changeset:   47ddf508782a
Branch:      yt
User:        chummels
Date:        2014-04-04 04:59:27
Summary:     Allowing the field_parameters of a data_source to override the defaults (including the center) for a ProjectionPlot.
Affected #:  2 files

diff -r 61e6b84f875cc8fcf25b5b1e67ddd501a19daf68 -r 47ddf508782a026d94d34b60cbaa1a776d2cbeb4 yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -783,7 +783,6 @@
 
     @cache_mask
     def _get_cut_mask(self, grid):
-        #pdb.set_trace()
         points_in_grid = np.all(self.positions > grid.LeftEdge, axis=1) & \
                          np.all(self.positions <= grid.RightEdge, axis=1)
         pids = np.where(points_in_grid)[0]

diff -r 61e6b84f875cc8fcf25b5b1e67ddd501a19daf68 -r 47ddf508782a026d94d34b60cbaa1a776d2cbeb4 yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -973,8 +973,15 @@
         if axes_unit is None  and units != ('1', '1'):
             axes_unit = units
         if field_parameters is None: field_parameters = {}
-        proj = pf.h.proj(axis, fields, weight_field=weight_field, max_level=max_level,
-                         center=center, source=data_source, **field_parameters)
+        # If a data_source is specified, let its field values (including center)
+        # override the projection's own defaults
+        if data_source is not None: 
+            field_parameters = data_source.field_parameters
+            proj = pf.h.proj(axis, fields, weight_field=weight_field, max_level=max_level,
+                             source=data_source, **field_parameters)
+        else:
+            proj = pf.h.proj(axis, fields, weight_field=weight_field, max_level=max_level,
+                             center=center, source=data_source, **field_parameters)
         PWViewerMPL.__init__(self, proj, bounds, origin=origin,
                              fontsize=fontsize, fields=fields)
         self.set_axes_unit(axes_unit)


https://bitbucket.org/yt_analysis/yt/commits/c46ee294eec2/
Changeset:   c46ee294eec2
Branch:      yt
User:        chummels
Date:        2014-04-04 05:00:06
Summary:     Merging.
Affected #:  7 files

diff -r 47ddf508782a026d94d34b60cbaa1a776d2cbeb4 -r c46ee294eec2ace58f536d92c6d794106128ee4f yt/analysis_modules/absorption_spectrum/absorption_spectrum_fit.py
--- a/yt/analysis_modules/absorption_spectrum/absorption_spectrum_fit.py
+++ b/yt/analysis_modules/absorption_spectrum/absorption_spectrum_fit.py
@@ -4,10 +4,9 @@
 from yt.analysis_modules.absorption_spectrum.absorption_line \
         import voigt
 
-
 def generate_total_fit(x, fluxData, orderFits, speciesDicts, 
-        minError=1E-5, complexLim=.999,
-        fitLim=.99, minLength=3, 
+        minError=1E-4, complexLim=.995,
+        fitLim=.97, minLength=3, 
         maxLength=1000, splitLim=.99,
         output_file=None):
 
@@ -90,6 +89,7 @@
     fluxData[0]=1
     fluxData[-1]=1
 
+
     #Find all regions where lines/groups of lines are present
     cBounds = _find_complexes(x, fluxData, fitLim=fitLim,
             complexLim=complexLim, minLength=minLength,
@@ -111,6 +111,7 @@
             yDatBounded=fluxData[b[1]:b[2]]
             yFitBounded=yFit[b[1]:b[2]]
 
+
             #Find init redshift
             z=(xBounded[yDatBounded.argmin()]-initWl)/initWl
 
@@ -121,24 +122,33 @@
 
             #Fit Using complex tools
             newLinesP,flag=_complex_fit(xBounded,yDatBounded,yFitBounded,
-                    z,fitLim,minError*(b[2]-b[1]),speciesDict)
+                    z,fitLim,minError,speciesDict)
+
+            #If flagged as a bad fit, species is lyman alpha,
+            #   and it may be a saturated line, use special tools
+            if flag and species=='lya' and min(yDatBounded)<.1:
+               newLinesP=_large_flag_fit(xBounded,yDatBounded,
+                        yFitBounded,z,speciesDict,
+                        minSize,minError)
+
+            if na.size(newLinesP)> 0:
+
+                #Check for EXPLOOOOSIIONNNSSS
+                newLinesP = _check_numerical_instability(x, newLinesP, speciesDict,b)
+
 
             #Check existence of partner lines if applicable
             if len(speciesDict['wavelength']) != 1:
                 newLinesP = _remove_unaccepted_partners(newLinesP, x, fluxData, 
-                        b, minError*(b[2]-b[1]),
-                        x0, xRes, speciesDict)
+                        b, minError, x0, xRes, speciesDict)
 
-            #If flagged as a bad fit, species is lyman alpha,
-            #   and it may be a saturated line, use special tools
-            if flag and species=='lya' and min(yDatBounded)<.1:
-                newLinesP=_large_flag_fit(xBounded,yDatBounded,
-                        yFitBounded,z,speciesDict,
-                        minSize,minError*(b[2]-b[1]))
+
+
 
             #Adjust total current fit
             yFit=yFit*_gen_flux_lines(x,newLinesP,speciesDict)
 
+
             #Add new group to all fitted lines
             if na.size(newLinesP)>0:
                 speciesLines['N']=na.append(speciesLines['N'],newLinesP[:,0])
@@ -149,6 +159,7 @@
 
         allSpeciesLines[species]=speciesLines
 
+
     if output_file:
         _output_fit(allSpeciesLines, output_file)
 
@@ -205,10 +216,12 @@
     #Setup initial line guesses
     if initP==None: #Regular fit
         initP = [0,0,0] 
-        if min(yDat)<.5: #Large lines get larger initial guess 
-            initP[0] = 10**16
+        if min(yDat)<.01: #Large lines get larger initial guess 
+            initP[0] = speciesDict['init_N']*10**2
+        elif min(yDat)<.5:
+            initP[0] = speciesDict['init_N']*10**1
         elif min(yDat)>.9: #Small lines get smaller initial guess
-            initP[0] = 10**12.5
+            initP[0] = speciesDict['init_N']*10**-1
         else:
             initP[0] = speciesDict['init_N']
         initP[1] = speciesDict['init_b']
@@ -225,9 +238,16 @@
         return [],False
     
     #Values to proceed through first run
-    errSq,prevErrSq=1,1000
+    errSq,prevErrSq,prevLinesP=1,10*len(x),[]
 
+    if errBound == None:
+        errBound = len(yDat)*(max(1-yDat)*1E-2)**2
+    else:
+        errBound = errBound*len(yDat)
+
+    flag = False
     while True:
+
         #Initial parameter guess from joining parameters from all lines
         #   in lines into a single array
         initP = linesP.flatten()
@@ -237,6 +257,7 @@
                 args=(x,yDat,yFit,speciesDict),
                 epsfcn=1E-10,maxfev=1000)
 
+
         #Set results of optimization
         linesP = na.reshape(fitP,(-1,3))
 
@@ -247,17 +268,23 @@
         #Sum to get idea of goodness of fit
         errSq=sum(dif**2)
 
+        if any(linesP[:,1]==speciesDict['init_b']):
+         #   linesP = prevLinesP
+
+            flag = True
+            break
+            
         #If good enough, break
-        if errSq < errBound: 
+        if errSq < errBound:        
             break
 
         #If last fit was worse, reject the last line and revert to last fit
-        if errSq > prevErrSq*10:
+        if errSq > prevErrSq*10 :
             #If its still pretty damn bad, cut losses and try flag fit tools
             if prevErrSq >1E2*errBound and speciesDict['name']=='HI lya':
                 return [],True
             else:
-                yNewFit=_gen_flux_lines(x,prevLinesP,speciesDict)
+                linesP = prevLinesP
                 break
 
         #If too many lines 
@@ -266,21 +293,26 @@
             if errSq >1E2*errBound and speciesDict['name']=='HI lya':
                 return [],True
             else:
-                break 
+                flag = True
+                break
 
         #Store previous data in case reject next fit
         prevErrSq = errSq
         prevLinesP = linesP
 
-
         #Set up initial condition for new line
         newP = [0,0,0] 
-        if min(dif)<.1:
-            newP[0]=10**12
-        elif min(dif)>.9:
-            newP[0]=10**16
+
+        yAdjusted = 1+yFit*yNewFit-yDat
+ 
+        if min(yAdjusted)<.01: #Large lines get larger initial guess 
+            newP[0] = speciesDict['init_N']*10**2
+        elif min(yAdjusted)<.5:
+            newP[0] = speciesDict['init_N']*10**1
+        elif min(yAdjusted)>.9: #Small lines get smaller initial guess
+            newP[0] = speciesDict['init_N']*10**-1
         else:
-            newP[0]=10**14
+            newP[0] = speciesDict['init_N']
         newP[1] = speciesDict['init_b']
         newP[2]=(x[dif.argmax()]-wl0)/wl0
         linesP=na.append(linesP,[newP],axis=0)
@@ -290,12 +322,12 @@
     #   acceptable range, as given in dict ref
     remove=[]
     for i,p in enumerate(linesP):
-        check=_check_params(na.array([p]),speciesDict)
+        check=_check_params(na.array([p]),speciesDict,x)
         if check: 
             remove.append(i)
     linesP = na.delete(linesP,remove,axis=0)
 
-    return linesP,False
+    return linesP,flag
 
 def _large_flag_fit(x, yDat, yFit, initz, speciesDict, minSize, errBound):
     """
@@ -489,6 +521,9 @@
     #List of lines to remove
     removeLines=[]
 
+    #Set error
+
+
     #Iterate through all sets of line parameters
     for i,p in enumerate(linesP):
 
@@ -501,16 +536,23 @@
             lb = _get_bounds(p[2],b,wl,x0,xRes)
             xb,yb=x[lb[0]:lb[1]],y[lb[0]:lb[1]]
 
+            if errBound == None:
+                errBound = 10*len(yb)*(max(1-yb)*1E-2)**2
+            else:
+                errBound = 10*errBound*len(yb)
+
             #Generate a fit and find the difference to data
             yFitb=_gen_flux_lines(xb,na.array([p]),speciesDict)
             dif =yb-yFitb
 
+
+
             #Only counts as an error if line is too big ---------------<
             dif = [k for k in dif if k>0]
             err = sum(dif)
 
             #If the fit is too bad then add the line to list of removed lines
-            if err > errBound*1E2:
+            if err > errBound:
                 removeLines.append(i)
                 break
 
@@ -640,21 +682,13 @@
         #Check if the region needs to be divided
         if b[2]-b[1]>maxLength:
 
-            #Find the minimum absorption in the middle two quartiles of
-            #   the large complex
-            q=(b[2]-b[1])/4
-            cut = yDat[b[1]+q:b[2]-q].argmax()+b[1]+q
+            split = _split_region(yDat,b,splitLim)
 
-            #Only break it up if the minimum absorption is actually low enough
-            if yDat[cut]>splitLim:
-
-                #Get the new two peaks
-                b1Peak = yDat[b[1]:cut].argmin()+b[1]
-                b2Peak = yDat[cut:b[2]].argmin()+cut
+            if split:
 
                 #add the two regions separately
-                cBounds.insert(i+1,[b1Peak,b[1],cut])
-                cBounds.insert(i+2,[b2Peak,cut,b[2]])
+                cBounds.insert(i+1,split[0])
+                cBounds.insert(i+2,split[1])
 
                 #Remove the original region
                 cBounds.pop(i)
@@ -663,7 +697,33 @@
 
     return cBounds
 
-def _gen_flux_lines(x, linesP, speciesDict):
+
+def _split_region(yDat,b,splitLim):
+        #Find the minimum absorption in the middle two quartiles of
+    #   the large complex
+
+    q=(b[2]-b[1])/4
+    cut = yDat[b[1]+q:b[2]-q].argmax()+b[1]+q
+
+    #Only break it up if the minimum absorption is actually low enough
+    if yDat[cut]>splitLim:
+
+        #Get the new two peaks
+        b1Peak = yDat[b[1]:cut].argmin()+b[1]
+        b2Peak = yDat[cut:b[2]].argmin()+cut
+
+        region_1 = [b1Peak,b[1],cut]
+        region_2 = [b2Peak,cut,b[2]]
+
+        return [region_1,region_2]
+
+    else:
+
+        return []
+
+
+
+def _gen_flux_lines(x, linesP, speciesDict,firstLine=False):
     """
     Calculates the normalized flux for a region of wavelength space
     generated by a set of absorption lines.
@@ -692,6 +752,9 @@
             g=speciesDict['Gamma'][i]
             wl=speciesDict['wavelength'][i]
             y = y+ _gen_tau(x,p,f,g,wl)
+            if firstLine: 
+                break
+
     flux = na.exp(-y)
     return flux
 
@@ -744,21 +807,25 @@
         the difference between the fit generated by the parameters
         given in pTotal multiplied by the previous fit and the desired
         flux profile, w/ first index modified appropriately for bad 
-        parameter choices
+        parameter choices and additional penalty for fitting with a lower
+        flux than observed.
     """
 
     pTotal.shape = (-1,3)
     yNewFit = _gen_flux_lines(x,pTotal,speciesDict)
 
     error = yDat-yFit*yNewFit
-    error[0] = _check_params(pTotal,speciesDict)
+    error_plus = (yDat-yFit*yNewFit).clip(min=0)
+
+    error = error+error_plus
+    error[0] = _check_params(pTotal,speciesDict,x)
 
     return error
 
-def _check_params(p, speciesDict):
+def _check_params(p, speciesDict,xb):
     """
     Check to see if any of the parameters in p fall outside the range 
-        given in speciesDict.
+        given in speciesDict or on the boundaries
 
     Parameters
     ----------
@@ -767,6 +834,8 @@
     speciesDict : dictionary
         dictionary with properties giving the max and min
         values appropriate for each parameter N,b, and z.
+    xb : (N) ndarray
+        wavelength array [nm]
 
     Returns
     -------
@@ -774,16 +843,137 @@
         0 if all values are fine
         999 if any values fall outside acceptable range
     """
+
+    minz = (xb[0])/speciesDict['wavelength'][0]-1
+    maxz = (xb[-1])/speciesDict['wavelength'][0]-1
+
     check = 0
-    if any(p[:,0] > speciesDict['maxN']) or\
-          any(p[:,0] < speciesDict['minN']) or\
-          any(p[:,1] > speciesDict['maxb']) or\
-          any(p[:,1] < speciesDict['minb']) or\
-          any(p[:,2] > speciesDict['maxz']) or\
-          any(p[:,2] < speciesDict['minz']):
+    if any(p[:,0] >= speciesDict['maxN']) or\
+          any(p[:,0] <= speciesDict['minN']) or\
+          any(p[:,1] >= speciesDict['maxb']) or\
+          any(p[:,1] <= speciesDict['minb']) or\
+          any(p[:,2] >= maxz) or\
+          any(p[:,2] <= minz):
               check = 999
+              
     return check
 
+def _check_optimization_init(p,speciesDict,initz,xb,yDat,yFit,minSize,errorBound):
+
+    """
+    Check to see if any of the parameters in p are the
+    same as initial paramters and if so, attempt to 
+    split the region and refit it.
+
+    Parameters
+    ----------
+    p : (3,) ndarray
+        array with form [[N1, b1, z1], ...] 
+    speciesDict : dictionary
+        dictionary with properties giving the max and min
+        values appropriate for each parameter N,b, and z.
+    x : (N) ndarray
+        wavelength array [nm]
+    """
+
+    # Check if anything is a default parameter
+    if any(p[:,0] == speciesDict['init_N']) or\
+          any(p[:,0] == speciesDict['init_N']*10) or\
+          any(p[:,0] == speciesDict['init_N']*100) or\
+          any(p[:,0] == speciesDict['init_N']*.1) or\
+          any(p[:,1] == speciesDict['init_b']) or\
+          any(p[:,1] == speciesDict['maxb']):
+
+            # These are the initial bounds
+            init_bounds = [yDat.argmin(),0,len(xb)-1]
+
+            # Gratitutous limit for splitting region
+            newSplitLim = 1 - (1-min(yDat))*.5
+
+            # Attempt to split region
+            split = _split_region(yDat,init_bounds,newSplitLim)
+            
+            # If we can't split it, just reject it. Its unphysical
+            # to just keep the default parameters and we're out of
+            # options at this point
+            if not split:
+                return []
+
+            # Else set up the bounds for each region and fit separately
+            b1,b2 = split[0][2], split[1][1]
+
+            p1,flag = _complex_fit(xb[:b1], yDat[:b1], yFit[:b1],
+                            initz, minSize, errorBound, speciesDict)
+
+            p2,flag = _complex_fit(xb[b2:], yDat[b2:], yFit[b2:],
+                            initz, minSize, errorBound, speciesDict)
+
+            # Make the final line parameters. Its annoying because
+            # one or both regions may have fit to nothing
+            if na.size(p1)> 0 and na.size(p2)>0:
+                p = na.r_[p1,p2]
+            elif na.size(p1) > 0:
+                p = p1
+            else:
+                p = p2
+
+    return p
+
+
+def _check_numerical_instability(x, p, speciesDict,b):
+
+    """
+    Check to see if any of the parameters in p are causing
+    unstable numerical effects outside the region of fit
+
+    Parameters
+    ----------
+    p : (3,) ndarray
+        array with form [[N1, b1, z1], ...] 
+    speciesDict : dictionary
+        dictionary with properties giving the max and min
+        values appropriate for each parameter N,b, and z.
+    x : (N) ndarray
+        wavelength array [nm]
+    b : (3) list
+        list of integers indicating bounds of region fit in x
+    """
+
+    remove_lines = []
+
+
+    for i,line in enumerate(p):
+
+        # First to check if the line is at risk for instability
+        if line[1]<5 or line[0] < 1E12:
+
+
+            # get all flux that isn't part of fit plus a little wiggle room
+            # max and min to prevent boundary errors
+
+            flux = _gen_flux_lines(x,[line],speciesDict,firstLine=True)
+            flux = na.r_[flux[:max(b[1]-10,0)], flux[min(b[2]+10,len(x)):]]
+
+            #Find regions that are absorbing outside the region we fit
+            flux_dif = 1 - flux
+            absorbing_coefficient = max(abs(flux_dif))
+
+
+            #Really there shouldn't be any absorption outside
+            #the region we fit, but we'll give some leeway.
+            #for high resolution spectra the tiny bits on the edges
+            #can give a non negligible amount of flux. Plus the errors
+            #we are looking for are HUGE.
+            if absorbing_coefficient > .1:
+
+                # we just set it to no fit because we've tried
+                # everything else at this point. this region just sucks :(
+                remove_lines.append(i)
+    
+    if remove_lines:
+        p = na.delete(p, remove_lines, axis=0)
+
+    return p
 
 def _output_fit(lineDic, file_name = 'spectrum_fit.h5'):
     """
@@ -815,4 +1005,5 @@
         f.create_dataset("{0}/z".format(ion),data=params['z'])
         f.create_dataset("{0}/complex".format(ion),data=params['group#'])
     print 'Writing spectrum fit to {0}'.format(file_name)
+    f.close()
 

diff -r 47ddf508782a026d94d34b60cbaa1a776d2cbeb4 -r c46ee294eec2ace58f536d92c6d794106128ee4f yt/data_objects/profiles.py
--- a/yt/data_objects/profiles.py
+++ b/yt/data_objects/profiles.py
@@ -811,6 +811,7 @@
         self.pf = data_source.pf
         self.field_data = YTFieldData()
         self.weight_field = weight_field
+        ParallelAnalysisInterface.__init__(self, comm=data_source.comm)
 
     def add_fields(self, fields):
         fields = ensure_list(fields)
@@ -822,7 +823,9 @@
     def _finalize_storage(self, fields, temp_storage):
         # We use our main comm here
         # This also will fill _field_data
-        # FIXME: Add parallelism and combining std stuff
+        temp_storage.values = self.comm.mpi_allreduce(temp_storage.values, op="sum", dtype="float64")
+        temp_storage.weight_values = self.comm.mpi_allreduce(temp_storage.weight_values, op="sum", dtype="float64")
+        temp_storage.used = self.comm.mpi_allreduce(temp_storage.used, op="sum", dtype="bool")
         if self.weight_field is not None:
             temp_storage.values /= temp_storage.weight_values[...,None]
         blank = ~temp_storage.used

diff -r 47ddf508782a026d94d34b60cbaa1a776d2cbeb4 -r c46ee294eec2ace58f536d92c6d794106128ee4f yt/utilities/lib/field_interpolation_tables.pxd
--- a/yt/utilities/lib/field_interpolation_tables.pxd
+++ b/yt/utilities/lib/field_interpolation_tables.pxd
@@ -33,6 +33,7 @@
 
 cdef extern from "math.h": 
     double expf(double x) nogil 
+    int isnormal(double x) nogil
 
 @cython.boundscheck(False)
 @cython.wraparound(False)
@@ -58,6 +59,7 @@
     cdef np.float64_t bv, dy, dd, tf, rv
     cdef int bin_id
     if dvs[fit.field_id] >= fit.bounds[1] or dvs[fit.field_id] <= fit.bounds[0]: return 0.0
+    if not isnormal(dvs[fit.field_id]): return 0.0
     bin_id = <int> ((dvs[fit.field_id] - fit.bounds[0]) * fit.idbin)
     bin_id = iclip(bin_id, 0, fit.nbins-2)
     dd = dvs[fit.field_id] - (fit.bounds[0] + bin_id * fit.dbin) # x - x0

diff -r 47ddf508782a026d94d34b60cbaa1a776d2cbeb4 -r c46ee294eec2ace58f536d92c6d794106128ee4f yt/visualization/image_writer.py
--- a/yt/visualization/image_writer.py
+++ b/yt/visualization/image_writer.py
@@ -17,6 +17,7 @@
 import numpy as np
 
 from yt.funcs import *
+from yt.utilities.exceptions import YTNotInsideNotebook
 import _colormap_data as cmd
 import yt.utilities.lib as au
 import __builtin__

diff -r 47ddf508782a026d94d34b60cbaa1a776d2cbeb4 -r c46ee294eec2ace58f536d92c6d794106128ee4f yt/visualization/plot_container.py
--- a/yt/visualization/plot_container.py
+++ b/yt/visualization/plot_container.py
@@ -7,6 +7,7 @@
 from functools import wraps
 from matplotlib.font_manager import FontProperties
 
+from ._mpl_imports import FigureCanvasAgg
 from .tick_locators import LogLocator, LinearLocator
 from .color_maps import yt_colormaps, is_colormap
 from .plot_modifications import \

diff -r 47ddf508782a026d94d34b60cbaa1a776d2cbeb4 -r c46ee294eec2ace58f536d92c6d794106128ee4f yt/visualization/profile_plotter.py
--- a/yt/visualization/profile_plotter.py
+++ b/yt/visualization/profile_plotter.py
@@ -14,6 +14,7 @@
 #-----------------------------------------------------------------------------
 
 
+import __builtin__
 import base64
 import types
 
@@ -26,6 +27,7 @@
 
 from matplotlib.font_manager import FontProperties
 
+from ._mpl_imports import FigureCanvasAgg
 from .plot_window import WindowPlotMPL
 from .base_plot_types import ImagePlotMPL
 from .plot_container import \
@@ -35,6 +37,8 @@
     write_image, apply_colormap
 from yt.data_objects.profiles import \
      create_profile
+from yt.utilities.exceptions import \
+     YTNotInsideNotebook
 from yt.utilities.lib import \
     write_png_to_string
 from yt.data_objects.profiles import \
@@ -44,7 +48,8 @@
 import _mpl_imports as mpl
 from yt.funcs import \
      ensure_list, \
-     get_image_suffix
+     get_image_suffix, \
+     get_ipython_api_version
 
 def get_canvas(name):
     suffix = get_image_suffix(name)

diff -r 47ddf508782a026d94d34b60cbaa1a776d2cbeb4 -r c46ee294eec2ace58f536d92c6d794106128ee4f yt/visualization/volume_rendering/camera.py
--- a/yt/visualization/volume_rendering/camera.py
+++ b/yt/visualization/volume_rendering/camera.py
@@ -18,6 +18,7 @@
 
 from yt.funcs import *
 from yt.utilities.math_utils import *
+from yt.utilities.exceptions import YTNotInsideNotebook
 from copy import deepcopy
 
 from .grid_partitioner import HomogenizedVolume


https://bitbucket.org/yt_analysis/yt/commits/e019bc89edd6/
Changeset:   e019bc89edd6
Branch:      yt
User:        chummels
Date:        2014-04-04 05:22:13
Summary:     Using update() to not clobber any existing field_parameters already set in ProjectionPlot already.
Affected #:  1 file

diff -r c46ee294eec2ace58f536d92c6d794106128ee4f -r e019bc89edd6d39ea3fe45a87ed10b3c897f92ce yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -976,7 +976,7 @@
         # If a data_source is specified, let its field values (including center)
         # override the projection's own defaults
         if data_source is not None: 
-            field_parameters = data_source.field_parameters
+            field_parameters.update(data_source.field_parameters)
             proj = pf.h.proj(axis, fields, weight_field=weight_field, max_level=max_level,
                              source=data_source, **field_parameters)
         else:


https://bitbucket.org/yt_analysis/yt/commits/1c5dc1ea429f/
Changeset:   1c5dc1ea429f
Branch:      yt
User:        chummels
Date:        2014-04-16 01:24:31
Summary:     Merged yt_analysis/yt into yt
Affected #:  2 files

diff -r e019bc89edd6d39ea3fe45a87ed10b3c897f92ce -r 1c5dc1ea429f13c0886f71f12c6444a5961dd26d yt/analysis_modules/star_analysis/sfr_spectrum.py
--- a/yt/analysis_modules/star_analysis/sfr_spectrum.py
+++ b/yt/analysis_modules/star_analysis/sfr_spectrum.py
@@ -41,7 +41,7 @@
     star_creation_time : Ordered array or list of floats
         The creation time for the stars in code units.
     volume : Float
-        The volume of the region for the specified list of stars.
+        The comoving volume of the region for the specified list of stars.
     bins : Integer
         The number of time bins used for binning the stars. Default = 300.
     
@@ -69,7 +69,7 @@
                 If data_source is not provided, all of these paramters need to be set:
                 star_mass (array, Msun),
                 star_creation_time (array, code units),
-                volume (float, Mpc**3).
+                volume (float, cMpc**3).
                 """)
                 return None
             self.mode = 'provided'
@@ -125,14 +125,14 @@
         """
         if self.mode == 'data_source':
             try:
-                vol = self._data_source.volume('mpc')
+                vol = self._data_source.volume('mpccm')
             except AttributeError:
                 # If we're here, this is probably a HOPHalo object, and we
                 # can get the volume this way.
                 ds = self._data_source.get_sphere()
-                vol = ds.volume('mpc')
+                vol = ds.volume('mpccm')
         elif self.mode == 'provided':
-            vol = self.volume
+            vol = self.volume('mpccm')
         tc = self._pf["Time"]
         self.time = []
         self.lookback_time = []
@@ -148,6 +148,7 @@
             self.redshift.append(self.cosm.ComputeRedshiftFromTime(time * tc))
             self.Msol_yr.append(self.mass_bins[i] / \
                 (self.time_bins_dt[i] * tc / YEAR))
+            # changed vol from mpc to mpccm used in literature
             self.Msol_yr_vol.append(self.mass_bins[i] / \
                 (self.time_bins_dt[i] * tc / YEAR) / vol)
             self.Msol.append(self.mass_bins[i])

diff -r e019bc89edd6d39ea3fe45a87ed10b3c897f92ce -r 1c5dc1ea429f13c0886f71f12c6444a5961dd26d yt/visualization/eps_writer.py
--- a/yt/visualization/eps_writer.py
+++ b/yt/visualization/eps_writer.py
@@ -15,6 +15,7 @@
 import pyx
 import numpy as np
 from matplotlib import cm
+import matplotlib.pyplot as plt
 from _mpl_imports import FigureCanvasAgg
 
 from yt.utilities.logger import ytLogger as mylog
@@ -288,9 +289,7 @@
         """
         if isinstance(plot, (PlotWindow, PhasePlot)):
             plot.refresh()
-        else:
-            plot._redraw_image()
-        if isinstance(plot, (VMPlot, PlotWindow)):
+        elif isinstance(plot, (VMPlot, PlotWindow)):
             if isinstance(plot, PlotWindow):
                 data = plot._frb
                 width = plot.width[0]
@@ -344,6 +343,26 @@
                     _ylabel = plot[k].axes.get_ylabel()
             if tickcolor == None:
                 _tickcolor = None
+        elif isinstance(plot, np.ndarray):
+            ax = plt.gca()
+            _xrange = ax.get_xlim()
+            _yrange = ax.get_ylim()
+            _xlog=False
+            _ylog=False
+            if bare_axes:
+                _xlabel = ""
+                _ylabel = ""
+            else:
+                if xlabel != None:
+                    _xlabel = xlabel
+                else:
+                    _xlabel = ax.get_xlabel()
+                if ylabel != None:
+                    _ylabel = ylabel
+                else:
+                    _ylabel = ax.get_ylabel()
+            if tickcolor == None:
+                _tickcolor = None
         else:
             _xrange = plot._axes.get_xlim()
             _yrange = plot._axes.get_ylim()
@@ -461,6 +480,13 @@
             # Remove colorbar
             _p1 = plot._figure
             _p1.delaxes(_p1.axes[1])
+        elif isinstance(plot, np.ndarray):
+            fig = plt.figure()
+            iplot = plt.figimage(plot)
+            _p1 =  iplot.figure
+            _p1.set_size_inches(self.figsize[0], self.figsize[1])
+            ax = plt.gca();
+            _p1.add_axes(ax)
         else:
             raise RuntimeError("Unknown plot type")
 
@@ -855,7 +881,7 @@
         
 #=============================================================================
 
-    def save_fig(self, filename="test", format="eps"):
+    def save_fig(self, filename="test", format="eps", resolution=250):
         r"""Saves current figure to a file.
 
         Parameters
@@ -875,6 +901,10 @@
             self.canvas.writeEPSfile(filename)
         elif format == "pdf":
             self.canvas.writePDFfile(filename)
+        elif format == "png":
+             self.canvas.writeGSfile(filename+".png", "png16m", resolution=resolution)
+        elif format == "jpg":
+             self.canvas.writeGSfile(filename+".jpeg", "jpeg", resolution=resolution)
         else:
             raise RuntimeError("format %s unknown." % (format))
             


https://bitbucket.org/yt_analysis/yt/commits/6ba6c4199a0a/
Changeset:   6ba6c4199a0a
Branch:      yt
User:        chummels
Date:        2014-04-17 00:45:12
Summary:     Backed out changeset e019bc89edd6
Affected #:  1 file

diff -r e019bc89edd6d39ea3fe45a87ed10b3c897f92ce -r 6ba6c4199a0a76c2370a98e13a246346563da502 yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -976,7 +976,7 @@
         # If a data_source is specified, let its field values (including center)
         # override the projection's own defaults
         if data_source is not None: 
-            field_parameters.update(data_source.field_parameters)
+            field_parameters = data_source.field_parameters
             proj = pf.h.proj(axis, fields, weight_field=weight_field, max_level=max_level,
                              source=data_source, **field_parameters)
         else:


https://bitbucket.org/yt_analysis/yt/commits/2164980dcd29/
Changeset:   2164980dcd29
Branch:      yt
User:        chummels
Date:        2014-04-17 00:46:16
Summary:     Merging.
Affected #:  2 files

diff -r 6ba6c4199a0a76c2370a98e13a246346563da502 -r 2164980dcd292fee73ebc9dd89208a1c2a919423 yt/analysis_modules/star_analysis/sfr_spectrum.py
--- a/yt/analysis_modules/star_analysis/sfr_spectrum.py
+++ b/yt/analysis_modules/star_analysis/sfr_spectrum.py
@@ -41,7 +41,7 @@
     star_creation_time : Ordered array or list of floats
         The creation time for the stars in code units.
     volume : Float
-        The volume of the region for the specified list of stars.
+        The comoving volume of the region for the specified list of stars.
     bins : Integer
         The number of time bins used for binning the stars. Default = 300.
     
@@ -69,7 +69,7 @@
                 If data_source is not provided, all of these paramters need to be set:
                 star_mass (array, Msun),
                 star_creation_time (array, code units),
-                volume (float, Mpc**3).
+                volume (float, cMpc**3).
                 """)
                 return None
             self.mode = 'provided'
@@ -125,14 +125,14 @@
         """
         if self.mode == 'data_source':
             try:
-                vol = self._data_source.volume('mpc')
+                vol = self._data_source.volume('mpccm')
             except AttributeError:
                 # If we're here, this is probably a HOPHalo object, and we
                 # can get the volume this way.
                 ds = self._data_source.get_sphere()
-                vol = ds.volume('mpc')
+                vol = ds.volume('mpccm')
         elif self.mode == 'provided':
-            vol = self.volume
+            vol = self.volume('mpccm')
         tc = self._pf["Time"]
         self.time = []
         self.lookback_time = []
@@ -148,6 +148,7 @@
             self.redshift.append(self.cosm.ComputeRedshiftFromTime(time * tc))
             self.Msol_yr.append(self.mass_bins[i] / \
                 (self.time_bins_dt[i] * tc / YEAR))
+            # changed vol from mpc to mpccm used in literature
             self.Msol_yr_vol.append(self.mass_bins[i] / \
                 (self.time_bins_dt[i] * tc / YEAR) / vol)
             self.Msol.append(self.mass_bins[i])

diff -r 6ba6c4199a0a76c2370a98e13a246346563da502 -r 2164980dcd292fee73ebc9dd89208a1c2a919423 yt/visualization/eps_writer.py
--- a/yt/visualization/eps_writer.py
+++ b/yt/visualization/eps_writer.py
@@ -15,6 +15,7 @@
 import pyx
 import numpy as np
 from matplotlib import cm
+import matplotlib.pyplot as plt
 from _mpl_imports import FigureCanvasAgg
 
 from yt.utilities.logger import ytLogger as mylog
@@ -288,9 +289,7 @@
         """
         if isinstance(plot, (PlotWindow, PhasePlot)):
             plot.refresh()
-        else:
-            plot._redraw_image()
-        if isinstance(plot, (VMPlot, PlotWindow)):
+        elif isinstance(plot, (VMPlot, PlotWindow)):
             if isinstance(plot, PlotWindow):
                 data = plot._frb
                 width = plot.width[0]
@@ -344,6 +343,26 @@
                     _ylabel = plot[k].axes.get_ylabel()
             if tickcolor == None:
                 _tickcolor = None
+        elif isinstance(plot, np.ndarray):
+            ax = plt.gca()
+            _xrange = ax.get_xlim()
+            _yrange = ax.get_ylim()
+            _xlog=False
+            _ylog=False
+            if bare_axes:
+                _xlabel = ""
+                _ylabel = ""
+            else:
+                if xlabel != None:
+                    _xlabel = xlabel
+                else:
+                    _xlabel = ax.get_xlabel()
+                if ylabel != None:
+                    _ylabel = ylabel
+                else:
+                    _ylabel = ax.get_ylabel()
+            if tickcolor == None:
+                _tickcolor = None
         else:
             _xrange = plot._axes.get_xlim()
             _yrange = plot._axes.get_ylim()
@@ -461,6 +480,13 @@
             # Remove colorbar
             _p1 = plot._figure
             _p1.delaxes(_p1.axes[1])
+        elif isinstance(plot, np.ndarray):
+            fig = plt.figure()
+            iplot = plt.figimage(plot)
+            _p1 =  iplot.figure
+            _p1.set_size_inches(self.figsize[0], self.figsize[1])
+            ax = plt.gca();
+            _p1.add_axes(ax)
         else:
             raise RuntimeError("Unknown plot type")
 
@@ -855,7 +881,7 @@
         
 #=============================================================================
 
-    def save_fig(self, filename="test", format="eps"):
+    def save_fig(self, filename="test", format="eps", resolution=250):
         r"""Saves current figure to a file.
 
         Parameters
@@ -875,6 +901,10 @@
             self.canvas.writeEPSfile(filename)
         elif format == "pdf":
             self.canvas.writePDFfile(filename)
+        elif format == "png":
+             self.canvas.writeGSfile(filename+".png", "png16m", resolution=resolution)
+        elif format == "jpg":
+             self.canvas.writeGSfile(filename+".jpeg", "jpeg", resolution=resolution)
         else:
             raise RuntimeError("format %s unknown." % (format))
             


https://bitbucket.org/yt_analysis/yt/commits/7ee2273ec58e/
Changeset:   7ee2273ec58e
Branch:      yt
User:        chummels
Date:        2014-04-17 01:44:52
Summary:     Backing out bad changes.
Affected #:  2 files

diff -r 2164980dcd292fee73ebc9dd89208a1c2a919423 -r 7ee2273ec58eb24d53611847300da17a27583f15 yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -783,6 +783,7 @@
 
     @cache_mask
     def _get_cut_mask(self, grid):
+        #pdb.set_trace()
         points_in_grid = np.all(self.positions > grid.LeftEdge, axis=1) & \
                          np.all(self.positions <= grid.RightEdge, axis=1)
         pids = np.where(points_in_grid)[0]

diff -r 2164980dcd292fee73ebc9dd89208a1c2a919423 -r 7ee2273ec58eb24d53611847300da17a27583f15 yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -973,15 +973,8 @@
         if axes_unit is None  and units != ('1', '1'):
             axes_unit = units
         if field_parameters is None: field_parameters = {}
-        # If a data_source is specified, let its field values (including center)
-        # override the projection's own defaults
-        if data_source is not None: 
-            field_parameters = data_source.field_parameters
-            proj = pf.h.proj(axis, fields, weight_field=weight_field, max_level=max_level,
-                             source=data_source, **field_parameters)
-        else:
-            proj = pf.h.proj(axis, fields, weight_field=weight_field, max_level=max_level,
-                             center=center, source=data_source, **field_parameters)
+        proj = pf.h.proj(axis, fields, weight_field=weight_field, max_level=max_level,
+                         center=center, source=data_source, **field_parameters)
         PWViewerMPL.__init__(self, proj, bounds, origin=origin,
                              fontsize=fontsize, fields=fields)
         self.set_axes_unit(axes_unit)


https://bitbucket.org/yt_analysis/yt/commits/d71cdf6f8770/
Changeset:   d71cdf6f8770
Branch:      yt
User:        chummels
Date:        2014-04-17 01:46:02
Summary:     Merging.
Affected #:  2 files



https://bitbucket.org/yt_analysis/yt/commits/f74d3cf3cd0c/
Changeset:   f74d3cf3cd0c
Branch:      yt
User:        chummels
Date:        2014-04-17 01:55:46
Summary:     Backing out bad changes.
Affected #:  2 files

diff -r d71cdf6f877058d60048118a4a568041bbe24b9c -r f74d3cf3cd0ceaad3baa04d6156478c3d36c04e4 yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -783,6 +783,7 @@
 
     @cache_mask
     def _get_cut_mask(self, grid):
+        #pdb.set_trace()
         points_in_grid = np.all(self.positions > grid.LeftEdge, axis=1) & \
                          np.all(self.positions <= grid.RightEdge, axis=1)
         pids = np.where(points_in_grid)[0]

diff -r d71cdf6f877058d60048118a4a568041bbe24b9c -r f74d3cf3cd0ceaad3baa04d6156478c3d36c04e4 yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -973,15 +973,8 @@
         if axes_unit is None  and units != ('1', '1'):
             axes_unit = units
         if field_parameters is None: field_parameters = {}
-        # If a data_source is specified, let its field values (including center)
-        # override the projection's own defaults
-        if data_source is not None: 
-            field_parameters.update(data_source.field_parameters)
-            proj = pf.h.proj(axis, fields, weight_field=weight_field, max_level=max_level,
-                             source=data_source, **field_parameters)
-        else:
-            proj = pf.h.proj(axis, fields, weight_field=weight_field, max_level=max_level,
-                             center=center, source=data_source, **field_parameters)
+        proj = pf.h.proj(axis, fields, weight_field=weight_field, max_level=max_level,
+                         center=center, source=data_source, **field_parameters)
         PWViewerMPL.__init__(self, proj, bounds, origin=origin,
                              fontsize=fontsize, fields=fields)
         self.set_axes_unit(axes_unit)


https://bitbucket.org/yt_analysis/yt/commits/84bdf29436ae/
Changeset:   84bdf29436ae
Branch:      yt
User:        chummels
Date:        2014-04-17 04:28:29
Summary:     Making it so that data_containers will inherit the field parameters from their data_sources, when those field parameters are not defined, or are defined as the defaults.
Affected #:  1 file

diff -r f74d3cf3cd0ceaad3baa04d6156478c3d36c04e4 -r 84bdf29436aeda503167ed1a894cc57c4fc14491 yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -215,6 +215,10 @@
         if fields == None: fields = []
         self.fields = ensure_list(fields)[:]
         self.field_data = YTFieldData()
+        self.defaults = {}
+        self.defaults["center"] = np.zeros(3,dtype='float64')
+        self.defaults["bulk_velocity"] = np.zeros(3,dtype='float64')
+        self.defaults["normal"] = np.array([0,0,1],dtype='float64')
         self.field_parameters = {}
         self.__set_default_field_parameters()
         self._cut_masks = {}
@@ -225,9 +229,14 @@
             self.set_field_parameter(key, val)
 
     def __set_default_field_parameters(self):
-        self.set_field_parameter("center",np.zeros(3,dtype='float64'))
-        self.set_field_parameter("bulk_velocity",np.zeros(3,dtype='float64'))
-        self.set_field_parameter("normal",np.array([0,0,1],dtype='float64'))
+        for k,v in self.defaults.items():
+            self.set_field_parameter(k,v)
+
+    def is_default_field_parameter(self, parameter, value):
+        try:
+            self.defaults[parameter] == value
+        except:
+            return False
 
     def _set_center(self, center):
         if center is None:
@@ -1772,8 +1781,10 @@
             self._distributed = False
             self._okay_to_serialize = False
             self._check_region = True
+            # Use the data_source's field parameters if they don't exist in the
+            # object or if they are the default values
             for k, v in source.field_parameters.items():
-                if k not in self.field_parameters:
+                if k not in self.field_parameters or self.is_default_field_parameter(k,v):
                     self.set_field_parameter(k,v)
         self.source = source
         if self._field_cuts is not None:


https://bitbucket.org/yt_analysis/yt/commits/abcc1d3c8d00/
Changeset:   abcc1d3c8d00
Branch:      yt
User:        chummels
Date:        2014-04-17 05:22:40
Summary:     Correcting some bugs to make data_source field parameters propagate correctly.
Affected #:  1 file

diff -r 84bdf29436aeda503167ed1a894cc57c4fc14491 -r abcc1d3c8d00263ef3d8392306c5afcb907a2d40 yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -215,10 +215,10 @@
         if fields == None: fields = []
         self.fields = ensure_list(fields)[:]
         self.field_data = YTFieldData()
-        self.defaults = {}
-        self.defaults["center"] = np.zeros(3,dtype='float64')
-        self.defaults["bulk_velocity"] = np.zeros(3,dtype='float64')
-        self.defaults["normal"] = np.array([0,0,1],dtype='float64')
+        self.default_field_parameters = {}
+        self.default_field_parameters["center"] = np.zeros(3,dtype='float64')
+        self.default_field_parameters["bulk_velocity"] = np.zeros(3,dtype='float64')
+        self.default_field_parameters["normal"] = np.array([0,0,1],dtype='float64')
         self.field_parameters = {}
         self.__set_default_field_parameters()
         self._cut_masks = {}
@@ -229,12 +229,12 @@
             self.set_field_parameter(key, val)
 
     def __set_default_field_parameters(self):
-        for k,v in self.defaults.items():
+        for k,v in self.default_field_parameters.items():
             self.set_field_parameter(k,v)
 
-    def is_default_field_parameter(self, parameter, value):
+    def is_default_field_parameter(self, parameter):
         try:
-            self.defaults[parameter] == value
+            return (self.default_field_parameters[parameter] == self.field_parameters[parameter]).all()
         except:
             return False
 
@@ -792,7 +792,6 @@
 
     @cache_mask
     def _get_cut_mask(self, grid):
-        #pdb.set_trace()
         points_in_grid = np.all(self.positions > grid.LeftEdge, axis=1) & \
                          np.all(self.positions <= grid.RightEdge, axis=1)
         pids = np.where(points_in_grid)[0]
@@ -1784,7 +1783,7 @@
             # Use the data_source's field parameters if they don't exist in the
             # object or if they are the default values
             for k, v in source.field_parameters.items():
-                if k not in self.field_parameters or self.is_default_field_parameter(k,v):
+                if k not in self.field_parameters or self.is_default_field_parameter(k):
                     self.set_field_parameter(k,v)
         self.source = source
         if self._field_cuts is not None:


https://bitbucket.org/yt_analysis/yt/commits/38b65ffa0367/
Changeset:   38b65ffa0367
Branch:      yt
User:        chummels
Date:        2014-04-17 16:07:16
Summary:     Cleaning up default parameters fix with comments from PR.
Affected #:  1 file

diff -r abcc1d3c8d00263ef3d8392306c5afcb907a2d40 -r 38b65ffa0367fcd13337cde85c6404515fa0b1da yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -215,12 +215,12 @@
         if fields == None: fields = []
         self.fields = ensure_list(fields)[:]
         self.field_data = YTFieldData()
-        self.default_field_parameters = {}
-        self.default_field_parameters["center"] = np.zeros(3,dtype='float64')
-        self.default_field_parameters["bulk_velocity"] = np.zeros(3,dtype='float64')
-        self.default_field_parameters["normal"] = np.array([0,0,1],dtype='float64')
+        self._default_field_parameters = {}
+        self._default_field_parameters["center"] = np.zeros(3, dtype='float64')
+        self._default_field_parameters["bulk_velocity"] = np.zeros(3, dtype='float64')
+        self._default_field_parameters["normal"] = np.array([0,0,1], dtype='float64')
         self.field_parameters = {}
-        self.__set_default_field_parameters()
+        self._set_default_field_parameters()
         self._cut_masks = {}
         self._point_indices = {}
         self._vc_data = {}
@@ -228,15 +228,13 @@
             mylog.debug("Setting %s to %s", key, val)
             self.set_field_parameter(key, val)
 
-    def __set_default_field_parameters(self):
-        for k,v in self.default_field_parameters.items():
+    def _set_default_field_parameters(self):
+        for k,v in self._default_field_parameters.items():
             self.set_field_parameter(k,v)
 
-    def is_default_field_parameter(self, parameter):
-        try:
-            return (self.default_field_parameters[parameter] == self.field_parameters[parameter]).all()
-        except:
-            return False
+    def _is_default_field_parameter(self, parameter):
+        if parameter not in self._default_field_parameters: return False
+        return self._default_field_parameters[parameter] is self.field_parameters[parameter]
 
     def _set_center(self, center):
         if center is None:
@@ -1783,7 +1781,7 @@
             # Use the data_source's field parameters if they don't exist in the
             # object or if they are the default values
             for k, v in source.field_parameters.items():
-                if k not in self.field_parameters or self.is_default_field_parameter(k):
+                if k not in self.field_parameters or self._is_default_field_parameter(k):
                     self.set_field_parameter(k,v)
         self.source = source
         if self._field_cuts is not None:
@@ -2125,7 +2123,7 @@
             self._okay_to_serialize = False
             self._check_region = True
             for k, v in source.field_parameters.items():
-                if k not in self.field_parameters:
+                if k not in self.field_parameters or self._is_default_field_parameter(k):
                     self.set_field_parameter(k,v)
         self.source = source
         if self._field_cuts is not None:


https://bitbucket.org/yt_analysis/yt/commits/6c43763f6c83/
Changeset:   6c43763f6c83
Branch:      yt
User:        chummels
Date:        2014-04-17 17:33:09
Summary:     Adding test to projection to check that field parameters from data source are inherited.
Affected #:  1 file

diff -r 38b65ffa0367fcd13337cde85c6404515fa0b1da -r 6c43763f6c838bdd6e5859d13c56e33963a224ba yt/data_objects/tests/test_projection.py
--- a/yt/data_objects/tests/test_projection.py
+++ b/yt/data_objects/tests/test_projection.py
@@ -70,5 +70,8 @@
             v1 = proj["Density"].sum()
             v2 = (dd["Density"] * dd["d%s" % an]).sum()
             yield assert_rel_equal, v1, v2, 10
-
-
+        # test if projections inherit the field parameters of their data sources
+        dd.set_field_parameter("bulk_velocity", np.array([0,1,2]))
+        proj = pf.h.proj(0, "Density", source=dd)
+        yield assert_equal, dd.field_parameters["bulk_velocity"], \
+                proj.field_parameters["bulk_velocity"]

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