Pastebin

Paste #3150: MassEnclosed Error

< previous paste - next paste>

Pasted by Aaron

Download View as text

TypeError                                 Traceback (most recent call last)
<ipython-input-1-7dfbe2d65914> in <module>()
    204 
    205 plot = PhasePlot(sp,"CylinderRadiusAU","VectorKeplerianDiff",["CellVolumeRestrict","CellMassRestrict"],
--> 206                  weight_field=None,fractional=True,x_bins=r_bins,y_bins=v_bins)
    207 

/home1/02703/wienkers/lib/yt-x86_64/src/yt-hg/yt/visualization/profile_plotter.pyc in __init__(self, data_source, x_field, y_field, z_fields, weight_field, x_bins, y_bins, accumulation, fractional, profile, fontsize, font_color, figure_size)
    556                weight_field = weight_field,
    557                accumulation=accumulation,
--> 558                fractional=fractional)
    559         self.profile = profile
    560         ImagePlotContainer.__init__(self, data_source, profile.field_data.keys(),

/home1/02703/wienkers/lib/yt-x86_64/src/yt-hg/yt/data_objects/profiles.pyc in create_profile(data_source, bin_fields, n, weight_field, fields, accumulation, fractional)
   1051     logs = [data_source.pf.field_info[f].take_log for f in bin_fields]
   1052     ex = [data_source.quantities["Extrema"](f, non_zero=l)[0] \
-> 1053           for f, l in zip(bin_fields, logs)]
   1054     args = [data_source]
   1055     for f, n, (mi, ma), l in zip(bin_fields, n, ex, logs):

/home1/02703/wienkers/lib/yt-x86_64/src/yt-hg/yt/data_objects/derived_quantities.pyc in __call__(self, *args, **kwargs)
     80                           self._data_source.pf.h.io)
     81         if lazy_reader and not self.force_unlazy:
---> 82             return self._call_func_lazy(args, kwargs)
     83         else:
     84             return self._call_func_unlazy(args, kwargs)

/home1/02703/wienkers/lib/yt-x86_64/src/yt-hg/yt/data_objects/derived_quantities.pyc in _call_func_lazy(self, args, kwargs)
     87         self.retvals = [ [] for i in range(self.n_ret)]
     88         for gi,g in enumerate(self._get_grids()):
---> 89             rv = self.func(GridChildMaskWrapper(g, self._data_source), *args, **kwargs)
     90             if not iterable(rv): rv = (rv,)
     91             for i in range(self.n_ret): self.retvals[i].append(rv[i])

/home1/02703/wienkers/lib/yt-x86_64/src/yt-hg/yt/data_objects/derived_quantities.pyc in _Extrema(data, fields, non_zero, filter)
    603     mins, maxs = [], []
    604     for field in fields:
--> 605         if data[field].size < 1:
    606             mins.append(1e90)
    607             maxs.append(-1e90)

/home1/02703/wienkers/lib/yt-x86_64/src/yt-hg/yt/data_objects/derived_quantities.pyc in __getitem__(self, item)
     48     def __getitem__(self, item):
     49         if item not in self.local_cache:
---> 50             data = self.data_source._get_data_from_grid(self.grid, item)
     51             self.local_cache[item] = data
     52         return self.local_cache[item]

/home1/02703/wienkers/lib/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.pyc in save_state(self, grid, field, *args, **kwargs)
     79         old_keys = grid.field_data.keys()
     80         grid.field_parameters = self.field_parameters
---> 81         tr = func(self, grid, field, *args, **kwargs)
     82         grid.field_parameters = old_params
     83         grid.field_data = YTFieldData( [(k, grid.field_data[k]) for k in old_keys] )

/home1/02703/wienkers/lib/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.pyc in _get_data_from_grid(self, grid, field)
   2652             return np.array([f[i,:][pointI] for i in range(3)])
   2653         else:
-> 2654             tr = grid[field]
   2655             if tr.size == 1: # dx, dy, dz, cellvolume
   2656                 tr = tr * np.ones(grid.ActiveDimensions, dtype='float64')

/home1/02703/wienkers/lib/yt-x86_64/src/yt-hg/yt/data_objects/grid_patch.pyc in __getitem__(self, key)
    145         """
    146         if key not in self.field_data:
--> 147             self.get_data(key)
    148         return self.field_data[key]
    149 

/home1/02703/wienkers/lib/yt-x86_64/src/yt-hg/yt/data_objects/grid_patch.pyc in get_data(self, field, convert)
    188                     else: raise
    189             else:
--> 190                 self._generate_field(field)
    191         return self.field_data[field]
    192 

/home1/02703/wienkers/lib/yt-x86_64/src/yt-hg/yt/data_objects/grid_patch.pyc in _generate_field(self, field)
    133                 self[field] = temp_array[sl]
    134             else:
--> 135                 self[field] = self.pf.field_info[field](self)
    136         else: # Can't find the field, try as it might
    137             raise exceptions.KeyError(field)

/home1/02703/wienkers/lib/yt-x86_64/src/yt-hg/yt/data_objects/field_info_container.pyc in __call__(self, data)
    383         ii = self.check_available(data)
    384         original_fields = data.keys() # Copy
--> 385         dd = self._function(self, data)
    386         dd *= self._convert_function(data)
    387         for field_name in data.keys():

<ipython-input-1-7dfbe2d65914> in _VectorKeplerianDiff(field, data)
    142     r_u = r_vec/na.sqrt(na.sum(na.square(r_vec),0))
    143     tan_u = na.cross(L,r_u,axis=0)
--> 144     kepvelocity = na.sqrt(G*data['MassEnclosed']/data['CylinderRadius'])*tan_u
    145 
    146     v_anomaly = v_vec-kepvelocity

/home1/02703/wienkers/lib/yt-x86_64/src/yt-hg/yt/data_objects/grid_patch.pyc in __getitem__(self, key)
    145         """
    146         if key not in self.field_data:
--> 147             self.get_data(key)
    148         return self.field_data[key]
    149 

/home1/02703/wienkers/lib/yt-x86_64/src/yt-hg/yt/data_objects/grid_patch.pyc in get_data(self, field, convert)
    188                     else: raise
    189             else:
--> 190                 self._generate_field(field)
    191         return self.field_data[field]
    192 

/home1/02703/wienkers/lib/yt-x86_64/src/yt-hg/yt/data_objects/grid_patch.pyc in _generate_field(self, field)
    133                 self[field] = temp_array[sl]
    134             else:
--> 135                 self[field] = self.pf.field_info[field](self)
    136         else: # Can't find the field, try as it might
    137             raise exceptions.KeyError(field)

/home1/02703/wienkers/lib/yt-x86_64/src/yt-hg/yt/data_objects/field_info_container.pyc in __call__(self, data)
    383         ii = self.check_available(data)
    384         original_fields = data.keys() # Copy
--> 385         dd = self._function(self, data)
    386         dd *= self._convert_function(data)
    387         for field_name in data.keys():

<ipython-input-1-7dfbe2d65914> in _MassEnclosed(field, data)
    121 
    122     for i in range(Radius.size):
--> 123         M[i] += Minterp[int(np.round(Radius[i]*pf['au']))]
    124 
    125     return M

TypeError: only length-1 arrays can be converted to Python scalars

New Paste


Do not write anything in this field if you're a human.

Go to most recent paste.