import ytfrom moltres_functions import actual_center_and_widths
home_root = '/home/peppe/'
field_label = { 'group1': r'$\phi_1\cdot$10$^{13}$ cm$^{-2}$ s$^{-1}$', 'group2': r'$\phi_2\cdot$10$^{13}$ cm$^{-2}$ s$^{-1}$', 'temp': 'T (K)', 'pre1': r'C$_1$ cm$^{-3}$', 'pre2': r'C$_2$ cm$^{-3}$', 'pre3': r'C$_3$ cm$^{-3}$', 'pre4': r'C$_4$ cm$^{-3}$', 'pre5': r'C$_5$ cm$^{-3}$', 'pre6': r'C$_6$ cm$^{-3}$'}names = [name for name in field_label.keys() if 'pre' in name]for name in names: field_label[name + '_scaled'] = field_label[name]
def _scale(field, data): new_field = field.name ftype, fname = new_field original_fname = fname.split('_')[0] return 1e13 * data[('all', original_fname)]
ds = yt.load( home_root + 'projects/2group_out.e', step=-1)for i in range(1, 7): fname = 'pre%d_scaled' % i ds.add_field(('all', fname), function=_scale, take_log=False)actual_domain_widths, actual_center = actual_center_and_widths(ds)
for field in ds.field_info.keys(): field_type, field_name = field if field_type != 'all': continue if 'scaled' not in field_name and 'temp' not in field_name and 'group' not in field_name: continue slc = yt.SlicePlot(ds, 'z', field, origin='native', center=actual_center) slc.set_log(field, False) slc.set_width((actual_domain_widths[0], actual_domain_widths[1])) slc.set_xlabel("r (cm)") slc.set_ylabel("z (cm)") if field_name == 'temp': slc.set_zlim(field, 922, ds.all_data()[('all', 'temp')].max()) slc.set_colorbar_label(field, field_label[field_name]) slc.set_figure_size(3) slc.save(home_root + 'projects/' + field_name)
Traceback (most recent call last): File "slice.py", line 43, in <module> slc = yt.SlicePlot(ds, 'z', field, center=actual_center) File "/home/peppe/yt/yt-conda/lib/python2.7/site-packages/yt/visualization/plot_window.py", line 1977, in SlicePlot return AxisAlignedSlicePlot(ds, normal, fields, *args, **kwargs) File "/home/peppe/yt/yt-conda/lib/python2.7/site-packages/yt/visualization/plot_window.py", line 1289, in __init__ slc.get_data(fields) File "/home/peppe/yt/yt-conda/lib/python2.7/site-packages/yt/data_objects/data_containers.py", line 1370, in get_data fluids, self, self._current_chunk) File "/home/peppe/yt/yt-conda/lib/python2.7/site-packages/yt/geometry/geometry_handler.py", line 245, in _read_fluid_fields chunk_size) File "/home/peppe/yt/yt-conda/lib/python2.7/site-packages/yt/frontends/exodus_ii/io.py", line 86, in _read_fluid_selection (field_ind + 1, mesh_id)][:]KeyError: 'vals_elem_var4eb2'--
You received this message because you are subscribed to the Google Groups "moltres-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to moltres-user...@googlegroups.com.
To post to this group, send email to moltre...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/moltres-users/73ff56cf-da8a-4504-b7f1-52c5a079b5a0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.