Removing a source from a scene and keyname references
Hello all, What I'm trying to figure out is the best way to remove a source from a scene, if possible doing it by keyname (or is there some other unique identifier?). I know that the scene add_source method has a keyword argument for add_source, but there isn't a remove_source function yet. I can directly access 'sources' in the scene object, but I haven't yet figured out a good way to manipulate that. I have a few volume, line, and point sources, but I would like to remove some of them and add them back in as I rotate my camera. Take care, Andrew -- Andrew W. Steiner Joint Faculty Asst. Prof. at UTK/ORNL https://neutronstars.utk.edu/
Hi Andrew, Something like this should work: In [4]: sc.sources.keys() Out[4]: odict_keys(['source_00', 'source_01']) In [5]: del sc.sources['source_01'] In [6]: sc.sources.keys() Out[6]: odict_keys(['source_00']) Adding a remove_source method to the scene object that's just syntax sugar around calling del on the sources dict would be a nice improvement over the current API. If you'd be interested in working on that it would be a nice pull request. -Nathan On Mon, Mar 18, 2019 at 2:12 PM Steiner, Andrew (Andrew W. Steiner) < awsteiner@utk.edu> wrote:
Hello all,
What I'm trying to figure out is the best way to remove a source from a scene, if possible doing it by keyname (or is there some other unique identifier?). I know that the scene add_source method has a keyword argument for add_source, but there isn't a remove_source function yet. I can directly access 'sources' in the scene object, but I haven't yet figured out a good way to manipulate that. I have a few volume, line, and point sources, but I would like to remove some of them and add them back in as I rotate my camera.
Take care, Andrew -- Andrew W. Steiner Joint Faculty Asst. Prof. at UTK/ORNL https://neutronstars.utk.edu/ _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
participants (2)
-
Nathan Goldbaum
-
Steiner, Andrew (Andrew W. Steiner)