Issue #1142: ProfilePlot.from_profiles fails when passed two profile objects (yt_analysis/yt)
New issue 1142: ProfilePlot.from_profiles fails when passed two profile objects https://bitbucket.org/yt_analysis/yt/issues/1142/profileplotfrom_profiles-fa... Nathan Goldbaum: The following test script (from mintaka on IRC): ``` #!python import yt import numpy as np from yt.units import kpc from matplotlib import pyplot as plt ds = yt.load('sizmbhloz-clref04SNth-rs9_a0.9011/sizmbhloz-clref04SNth-rs9_a0.9011.art') ad = ds.all_data() profiles = [] labels = [] profiles.append(yt.create_profile(ad, ["radius"], fields=['density'])) labels.append("density") profiles.append(yt.create_profile(ad, ["radius"], fields=[('deposit', 'N-BODY_density')])) labels.append('N-BODY') prf = yt.ProfilePlot.from_profiles(profiles, labels=labels) prf.save() ``` Raises the following error: ``` Traceback (most recent call last): File "test.py", line 15, in <module> prf = yt.ProfilePlot.from_profiles(profiles, labels=labels) File "/Users/goldbaum/Documents/yt-hg/yt/visualization/profile_plotter.py", line 416, in from_profiles return cls._initialize_instance(obj, profiles, labels, plot_specs, y_log) File "/Users/goldbaum/Documents/yt-hg/yt/visualization/profile_plotter.py", line 366, in _initialize_instance obj._setup_plots() File "/Users/goldbaum/Documents/yt-hg/yt/visualization/profile_plotter.py", line 340, in _setup_plots xtitle, ytitle = self._get_field_title(fname, profile) File "/Users/goldbaum/Documents/yt-hg/yt/visualization/profile_plotter.py", line 634, in _get_field_title y_unit = profile.field_units[field_y] KeyError: ('gas', 'density') ``` Probably we need to make sure that field name tuples are normalized somewhere. Responsible: ngoldbaum
participants (1)
-
Nathan Goldbaum