コード例 #1
0
ファイル: widget_store.py プロジェクト: Xarthisius/yt-drone
 def create_slice(self, ds, center, axis, field, onmax):
     if onmax:
         center = ds.h.find_max('Density')[1]
     else:
         center = np.array(center)
     axis = ds.coordinates.axis_id[axis.lower()]
     coord = center[axis]
     sl = ds.slice(axis, coord, center=center)
     xax = ds.coordinates.x_axis[axis]
     yax = ds.coordinates.y_axis[axis]
     DLE, DRE = ds.domain_left_edge, ds.domain_right_edge
     pw = PWViewerExtJS(sl, (DLE[xax], DRE[xax], DLE[yax], DRE[yax]),
                        setup=False,
                        plot_type='SlicePlot')
     pw.set_current_field(field)
     field_list = list(set(ds.field_list + ds.derived_field_list))
     field_list = [dict(text=f) for f in sorted(field_list)]
     cb = pw._get_cbar_image()
     trans = pw._field_transform[pw._current_field].name
     widget_data = {
         'fields': field_list,
         'initial_field': field,
         'title': "%s Slice" % (ds),
         'colorbar': cb,
         'initial_transform': trans
     }
     self._add_widget(pw, widget_data)
コード例 #2
0
 def create_proj(self, ds, axis, field, weight):
     if weight == "None": weight = None
     axis = ds.coordinates.axis_id[axis.lower()]
     proj = ds.proj(field, axis, weight_field=weight)
     xax = ds.coordinates.x_axis[axis]
     yax = ds.coordinates.y_axis[axis]
     DLE, DRE = ds.domain_left_edge, ds.domain_right_edge
     pw = PWViewerExtJS(proj, (DLE[xax], DRE[xax], DLE[yax], DRE[yax]),
                        setup = False, plot_type='ProjectionPlot')
     pw.set_current_field(field)
     field_list = list(set(ds.field_list + ds.derived_field_list))
     field_list = [dict(text = f) for f in sorted(field_list)]
     cb = pw._get_cbar_image()
     widget_data = {'fields': field_list,
                    'initial_field': field,
                    'title': "%s Projection" % (ds),
                    'colorbar': cb}
     self._add_widget(pw, widget_data)
コード例 #3
0
ファイル: widget_store.py プロジェクト: Xarthisius/yt-drone
 def create_proj(self, ds, axis, field, weight):
     if weight == "None": weight = None
     axis = ds.coordinates.axis_id[axis.lower()]
     proj = ds.proj(field, axis, weight_field=weight)
     xax = ds.coordinates.x_axis[axis]
     yax = ds.coordinates.y_axis[axis]
     DLE, DRE = ds.domain_left_edge, ds.domain_right_edge
     pw = PWViewerExtJS(proj, (DLE[xax], DRE[xax], DLE[yax], DRE[yax]),
                        setup=False,
                        plot_type='ProjectionPlot')
     pw.set_current_field(field)
     field_list = list(set(ds.field_list + ds.derived_field_list))
     field_list = [dict(text=f) for f in sorted(field_list)]
     cb = pw._get_cbar_image()
     widget_data = {
         'fields': field_list,
         'initial_field': field,
         'title': "%s Projection" % (ds),
         'colorbar': cb
     }
     self._add_widget(pw, widget_data)
コード例 #4
0
 def create_slice(self, ds, center, axis, field, onmax):
     if onmax: 
         center = ds.h.find_max('Density')[1]
     else:
         center = np.array(center)
     axis = ds.coordinates.axis_id[axis.lower()]
     coord = center[axis]
     sl = ds.slice(axis, coord, center = center)
     xax = ds.coordinates.x_axis[axis]
     yax = ds.coordinates.y_axis[axis]
     DLE, DRE = ds.domain_left_edge, ds.domain_right_edge
     pw = PWViewerExtJS(sl, (DLE[xax], DRE[xax], DLE[yax], DRE[yax]), 
                        setup = False, plot_type='SlicePlot')
     pw.set_current_field(field)
     field_list = list(set(ds.field_list + ds.derived_field_list))
     field_list = [dict(text = f) for f in sorted(field_list)]
     cb = pw._get_cbar_image()
     trans = pw._field_transform[pw._current_field].name
     widget_data = {'fields': field_list,
                      'initial_field': field,
                      'title': "%s Slice" % (ds),
                      'colorbar': cb,
                      'initial_transform' : trans}
     self._add_widget(pw, widget_data)