[yt-dev] Issue #1069: Data objects used to create a profile in a for loop get garbage collected (yt_analysis/yt)

Nathan Goldbaum issues-reply at bitbucket.org
Thu Aug 20 16:54:20 PDT 2015


New issue 1069: Data objects used to create a profile in a for loop get garbage collected
https://bitbucket.org/yt_analysis/yt/issues/1069/data-objects-used-to-create-a-profile-in-a

Nathan Goldbaum:

Illustrated by a test script Mateusz Ruszkowski reported on the mailing list:


```
#!python

import yt

profiles = []
labels = []

for i in range(0,2,1):

    print i
    ds = yt.load("Sedov_3D/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()
```

This uses the Sedov3D test dataset on yt-project.org/data.






More information about the yt-dev mailing list