ProfilePlot error: weakly-referenced object no longer exists
Hi, I am trying to plot two profiles on one plot and adjust xlim. I am getting the following error message: Traceback (most recent call last): File "test.py", line 17, in <module> plot.set_xlim([0.1, 1.0]) File "/home/mateuszr/my_yt/yt-x86_64/src/yt-hg/yt/visualization/plot_container.py", line 62, in newfunc rv = f(*args, **kwargs) File "/home/mateuszr/my_yt/yt-x86_64/src/yt-hg/yt/visualization/profile_plotter.py", line 547, in set_xlim extrema=extrema, units=units) File "/home/mateuszr/my_yt/yt-x86_64/src/yt-hg/yt/data_objects/profiles.py", line 1436, in create_profile bin_fields = data_source._determine_fields(bin_fields) File "/home/mateuszr/my_yt/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 552, in _determine_fields finfo = self.ds._get_field_info(ftype, fname) ReferenceError: weakly-referenced object no longer exists --------------------------------------------------- I am using the following script: import yt profiles = [] labels = [] for i in range(0,2,1): print i ds=yt.load("./sedov_hdf5_chk_%04i"%i) my_data = ds.sphere(ds.domain_center, 1.0) sim_time = ds.current_time profiles.append(yt.create_profile(my_data, "radius", fields=["density"], weight_field="cell_volume", n_bins=32)) labels.append("t= %.0f" % sim_time) plot = yt.ProfilePlot.from_profiles(profiles, labels=labels) plot.set_xlim([0.1, 1.0]) plot.save() ------------------------------------------------------ I am using the following yt version: Version = 3.3-dev Changeset = 603eab147248 (yt) tip ------------------------------------------------------- Data = standard Flash Sedov test. Any idea what I may be doing wrong? Thanks, Mateusz
I can reproduce this and have opened an issue to track it: https://bitbucket.org/yt_analysis/yt/issues/1069/data-objects-used-to-create... On Thu, Aug 20, 2015 at 6:33 PM, Mateusz Ruszkowski <mateuszr@umich.edu> wrote:
Hi,
I am trying to plot two profiles on one plot and adjust xlim. I am getting the following error message:
Traceback (most recent call last): File "test.py", line 17, in <module> plot.set_xlim([0.1, 1.0]) File "/home/mateuszr/my_yt/yt-x86_64/src/yt-hg/yt/visualization/plot_container.py", line 62, in newfunc rv = f(*args, **kwargs) File "/home/mateuszr/my_yt/yt-x86_64/src/yt-hg/yt/visualization/profile_plotter.py", line 547, in set_xlim extrema=extrema, units=units) File "/home/mateuszr/my_yt/yt-x86_64/src/yt-hg/yt/data_objects/profiles.py", line 1436, in create_profile bin_fields = data_source._determine_fields(bin_fields) File "/home/mateuszr/my_yt/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 552, in _determine_fields finfo = self.ds._get_field_info(ftype, fname) ReferenceError: weakly-referenced object no longer exists
--------------------------------------------------- I am using the following script:
import yt
profiles = [] labels = []
for i in range(0,2,1):
print i ds=yt.load("./sedov_hdf5_chk_%04i"%i) my_data = ds.sphere(ds.domain_center, 1.0) sim_time = ds.current_time profiles.append(yt.create_profile(my_data, "radius", fields=["density"], weight_field="cell_volume", n_bins=32)) labels.append("t= %.0f" % sim_time)
plot = yt.ProfilePlot.from_profiles(profiles, labels=labels) plot.set_xlim([0.1, 1.0]) plot.save()
------------------------------------------------------ I am using the following yt version:
Version = 3.3-dev Changeset = 603eab147248 (yt) tip
-------------------------------------------------------
Data = standard Flash Sedov test.
Any idea what I may be doing wrong?
Thanks, Mateusz
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
A workaround would be to retain the ds's loaded in memory, for instance by appending them to a list or something. Not a solution, but a workaround. On Thu, Aug 20, 2015 at 6:55 PM, Nathan Goldbaum <nathan12343@gmail.com> wrote:
I can reproduce this and have opened an issue to track it: https://bitbucket.org/yt_analysis/yt/issues/1069/data-objects-used-to-create...
On Thu, Aug 20, 2015 at 6:33 PM, Mateusz Ruszkowski <mateuszr@umich.edu> wrote:
Hi,
I am trying to plot two profiles on one plot and adjust xlim. I am getting the following error message:
Traceback (most recent call last): File "test.py", line 17, in <module> plot.set_xlim([0.1, 1.0]) File "/home/mateuszr/my_yt/yt-x86_64/src/yt-hg/yt/visualization/plot_container.py", line 62, in newfunc rv = f(*args, **kwargs) File "/home/mateuszr/my_yt/yt-x86_64/src/yt-hg/yt/visualization/profile_plotter.py", line 547, in set_xlim extrema=extrema, units=units) File "/home/mateuszr/my_yt/yt-x86_64/src/yt-hg/yt/data_objects/profiles.py", line 1436, in create_profile bin_fields = data_source._determine_fields(bin_fields) File "/home/mateuszr/my_yt/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 552, in _determine_fields finfo = self.ds._get_field_info(ftype, fname) ReferenceError: weakly-referenced object no longer exists
--------------------------------------------------- I am using the following script:
import yt
profiles = [] labels = []
for i in range(0,2,1):
print i ds=yt.load("./sedov_hdf5_chk_%04i"%i) my_data = ds.sphere(ds.domain_center, 1.0) sim_time = ds.current_time profiles.append(yt.create_profile(my_data, "radius", fields=["density"], weight_field="cell_volume", n_bins=32)) labels.append("t= %.0f" % sim_time)
plot = yt.ProfilePlot.from_profiles(profiles, labels=labels) plot.set_xlim([0.1, 1.0]) plot.save()
------------------------------------------------------ I am using the following yt version:
Version = 3.3-dev Changeset = 603eab147248 (yt) tip
-------------------------------------------------------
Data = standard Flash Sedov test.
Any idea what I may be doing wrong?
Thanks, Mateusz
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Just to follow up, Matt's suggestion to store a list of dataset objects somewhere will definitely "fix" the issue in that you'll avoid the traceback. I'm going to try to make it so the sphere object never actually needs to access the dataset object, since data containers only retain a weak reference to Dataset instances to avoid memory leaks. -Nathan On Thu, Aug 20, 2015 at 7:05 PM, Matthew Turk <matthewturk@gmail.com> wrote:
A workaround would be to retain the ds's loaded in memory, for instance by appending them to a list or something. Not a solution, but a workaround.
On Thu, Aug 20, 2015 at 6:55 PM, Nathan Goldbaum <nathan12343@gmail.com> wrote:
I can reproduce this and have opened an issue to track it:
https://bitbucket.org/yt_analysis/yt/issues/1069/data-objects-used-to-create...
On Thu, Aug 20, 2015 at 6:33 PM, Mateusz Ruszkowski <mateuszr@umich.edu> wrote:
Hi,
I am trying to plot two profiles on one plot and adjust xlim. I am
the following error message:
Traceback (most recent call last): File "test.py", line 17, in <module> plot.set_xlim([0.1, 1.0]) File
"/home/mateuszr/my_yt/yt-x86_64/src/yt-hg/yt/visualization/plot_container.py",
line 62, in newfunc rv = f(*args, **kwargs) File
"/home/mateuszr/my_yt/yt-x86_64/src/yt-hg/yt/visualization/profile_plotter.py",
line 547, in set_xlim extrema=extrema, units=units) File "/home/mateuszr/my_yt/yt-x86_64/src/yt-hg/yt/data_objects/profiles.py",
getting line
1436, in create_profile bin_fields = data_source._determine_fields(bin_fields) File
"/home/mateuszr/my_yt/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py",
line 552, in _determine_fields finfo = self.ds._get_field_info(ftype, fname) ReferenceError: weakly-referenced object no longer exists
--------------------------------------------------- I am using the following script:
import yt
profiles = [] labels = []
for i in range(0,2,1):
print i ds=yt.load("./sedov_hdf5_chk_%04i"%i) my_data = ds.sphere(ds.domain_center, 1.0) sim_time = ds.current_time profiles.append(yt.create_profile(my_data, "radius", fields=["density"], weight_field="cell_volume", n_bins=32)) labels.append("t= %.0f" % sim_time)
plot = yt.ProfilePlot.from_profiles(profiles, labels=labels) plot.set_xlim([0.1, 1.0]) plot.save()
------------------------------------------------------ I am using the following yt version:
Version = 3.3-dev Changeset = 603eab147248 (yt) tip
-------------------------------------------------------
Data = standard Flash Sedov test.
Any idea what I may be doing wrong?
Thanks, Mateusz
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
participants (3)
-
Mateusz Ruszkowski
-
Matthew Turk
-
Nathan Goldbaum