Issue #575: Adding a field after parameter file instantiation results in bad generation (yt_analysis/yt)
New issue 575: Adding a field after parameter file instantiation results in bad generation https://bitbucket.org/yt_analysis/yt/issue/575/adding-a-field-after-paramete... Matthew Turk: If a field is added after a parameter file is loaded, we end up with a bad state in `pf.field_dependencies` which then causes `_identify_dependencies` to continue and not provide any dependencies. This then causes `_read_fluid_fields` to return not enough data, and then a `GenerationInProgress` gets thrown from inside of `_generate_fluid_fields`. This script demonstrates it: ``` #!python from yt.mods import * pf = load("output_00010/info_00010.txt", fields = ["Density", "x-velocity", "y-velocity", "z-velocity", "Pressure"]) def _Temperature(field,data): return(data["Pressure"] / data["Density"]) add_field("Temperature", function=_Temperature, units=r"\rm{K}") pc = PlotCollection(pf) pc.add_phase_sphere(8.0, "kpc", ["Density", "Temperature", "CellMassMsun"],weight=None) pc.save() ``` I believe one possible fix would be to have a hook inside `add_field` that evaluated all of extant parameter files, but I'm not sure how much I like this. I think another option would be to update the `field_dependencies` as-needed and hope this does not become burdensome. Responsible: MatthewTurk
participants (1)
-
Matthew Turk