You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The documentation of fields_to_include in the data_containers.create_firefly_object() method does not specify that only fields that are common to all particle types are allowed. This should either be mentioned in the documentation (Option 1) or the behavior changed to allow fields that are not common to all particle types (Option 2, preferred). (Open to other possibilities though)
Code for reproduction
# This uses the Gizmo gizmo_mhd_mwdisk sample dataset instead of the Ramses one in the# "Exporting an Example Dataset to Firefly", but is otherwise mostly equivalent to that example.# I've changed the names (ramses -> gizmo) and included the bounding box/unit base to # ensure the data is loaded correctly. This dataset includes six particle types: PartType0, which# has the field "Temperature" and PartType1-5, which do not.bbox= [[-600.0, 600.0], [-600.0, 600.0], [-600.0, 600.0]]
unit_base= {
"length": (1.0, "kpc"),
"velocity": (1.0, "km/s"),
"mass": (1.0, "Msun"),
}
ge=yt.load("sample_data/gizmo_mhd_mwdisk/gizmo_mhd_mwdisk.hdf5",bounding_box=bbox,unit_base=unit_base)
region=ge.sphere(ge.domain_center, (1000, "kpc"))
reader=region.create_firefly_object(
"GizmoExample",
fields_to_include=["Temperature"], # Temperature is only defined for PartType0fields_units=["code_temperature"],
)
## adjust some of the optionsreader.settings["color"]["io"] = [1, 1, 0, 1] ## set default colorreader.particleGroups[0].decimation_factor=100## increase the decimation factorreader.writeToDisk()
Actual outcome
This produces the error:
YTFieldNotFound: Could not find field ('PartType1', 'Temperature') in gizmo_mhd_mwdisk.
Did you mean:
('PartType0', 'Temperature')
('PartType0', 'temperature')
('gas', 'temperature')
And nothing is written to the disk.
Expected outcome
The expected behavior depends a bit on what option is chosen.
For the documentation change (Option 1), I guess I would expect a more useful error, perhaps:
YTFieldNotFound: Could not find field ('PartType1', 'Temperature') in gizmo_mhd_mwdisk.
Please include only fields that are common to all particle types.
Did you mean:
('PartType0', 'Temperature')
('PartType0', 'temperature')
('gas', 'temperature')
with nothing written to the disk.
For Option 2, skipping the field if not present for that particle type, I would expect something like:
datadir: /XXXX/GizmoExample -- is not a sub-directory of firefly/static/data.
This may produce confusing or inoperable results. As such, we will create a symlink for you when you writeToDisk.
Make sure each field_array (1) has a field_radius_flag (0), assuming False.
Make sure each field_array (1) has a field_radius_flag (0), assuming False.
Make sure each field_array (1) has a field_radius_flag (0), assuming False.
Make sure each field_array (1) has a field_radius_flag (0), assuming False.
Make sure each field_array (1) has a field_radius_flag (0), assuming False.
Make sure each field_array (1) has a field_radius_flag (0), assuming False.
Warning: Not all particle types contained field(s): Temperature <--- New
PartType0 - 4091/409013 particles - 3 tracked fields
PartType1 - 4375/437500 particles - 2 tracked fields
PartType2 - 2500/250000 particles - 2 tracked fields
PartType3 - 1250/125000 particles - 2 tracked fields
PartType4 - 766/76546 particles - 2 tracked fields
PartType5 - 1/1 particles - 2 tracked fields
And in Firefly, the ability to set Temperature as a selectable field.
Version Information
yt version: 4.1.1
Other Libraries (if applicable): firefly v 3.2.0
yt installed from source
python from anaconda
firefly from PyPI
The text was updated successfully, but these errors were encountered:
Hi, and welcome to yt! Thanks for opening your first issue. We have an issue template that helps us to gather relevant information to help diagnosing and fixing the issue.
Thinking about it, it also made sense to allow field tuples like ("PartType1","Masses") to specify e.g. that masses should only be included for PartType, so I included that in #4175 too.
Bug report
Bug summary
The documentation of
fields_to_include
in thedata_containers.create_firefly_object()
method does not specify that only fields that are common to all particle types are allowed. This should either be mentioned in the documentation (Option 1) or the behavior changed to allow fields that are not common to all particle types (Option 2, preferred). (Open to other possibilities though)Code for reproduction
Actual outcome
This produces the error:
And nothing is written to the disk.
Expected outcome
The expected behavior depends a bit on what option is chosen.
with nothing written to the disk.
And in Firefly, the ability to set Temperature as a selectable field.
Version Information
yt installed from source
python from anaconda
firefly from PyPI
The text was updated successfully, but these errors were encountered: