Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Commit a8b395e prevents dark matter-only Enzo simulations from being analyzed #3809

Closed
anchwr opened this issue Feb 14, 2022 · 6 comments · Fixed by #3810
Closed

Commit a8b395e prevents dark matter-only Enzo simulations from being analyzed #3809

anchwr opened this issue Feb 14, 2022 · 6 comments · Fixed by #3810
Labels
bug code frontends Things related to specific frontends
Milestone

Comments

@anchwr
Copy link

anchwr commented Feb 14, 2022

Bug report

Bug summary

As of commit a8b395e, yt appears to fail with dark matter-only Enzo simulations as soon as frontends.enzo.fields.setup_energy_field() is called (e.g., via ds.all_data() or ds.add_particle_filter()). These simulations do not have an explicit energy field, so an error is triggered at line 278 of frontends/enzo/fields.py, since ('enzo', None) is not a valid field name.

Code for reproduction

import yt
ds = yt.load('DD0064/DD0064')
ads = ds.all_data()

Sample dataset that generates error at: http://use.yt/upload/35be3369

Actual outcome

Traceback (most recent call last):
  File "Research/Outputs/TestSphere.py", line 15, in <module>
    ads = ds.all_data()
  File "/Users/anna/yt/yt/data_objects/static_output.py", line 1052, in all_data
    self.index
  File "/Users/anna/yt/yt/data_objects/static_output.py", line 546, in index
    self.create_field_info()
  File "/Users/anna/yt/yt/data_objects/static_output.py", line 592, in create_field_info
    self.field_info.setup_fluid_fields()
  File "/Users/anna/yt/yt/frontends/enzo/fields.py", line 189, in setup_fluid_fields
    self.setup_energy_field()
  File "/Users/anna/yt/yt/frontends/enzo/fields.py", line 280, in setup_energy_field
    ("enzo", te_name), sampling_type="cell", units="code_velocity**2"
  File "/Users/anna/yt/yt/fields/field_info_container.py", line 425, in add_output_field
    self[name] = DerivedField(name, sampling_type, NullFunc, **kwargs)
  File "/Users/anna/yt/yt/fields/derived_field.py", line 134, in __init__
    validate_field_key(name)
  File "/Users/anna/yt/yt/funcs.py", line 1206, in validate_field_key
    "Expected a 2-tuple of strings formatted as\n"
TypeError: Expected a 2-tuple of strings formatted as
(field or particle type, field name)
Received invalid field key: ('enzo', None), with type <class 'tuple'>

Expected outcome

This shouldn't usually produce any output. As far as I can tell, it works on commits prior to a8b395e

Version Information

  • Operating System: macOS 10.15.7
  • Python Version: 3.7.7
  • yt version: 4.1.dev0
  • Other Libraries (if applicable): N/A

yt installed from source

@welcome
Copy link

welcome bot commented Feb 14, 2022

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.

@anchwr anchwr changed the title Commit a8b395e1833381d1647d1b91c7ecda99a09ec75b prevents dark matter-only Enzo simulations from being analyzed Commit a8b395e prevents dark matter-only Enzo simulations from being analyzed Feb 14, 2022
@neutrinoceros
Copy link
Member

Thank you for reporting this regression with such care, pinning the exact commit the problem bisects to and providing a usable dataset for reproduction. I assume for now that this reveals a bug in the Enzo frontend, so I'm going to triage it as such. I'll take a deeper look soon.

@neutrinoceros neutrinoceros added this to the 4.1.0 milestone Feb 14, 2022
@neutrinoceros neutrinoceros added the code frontends Things related to specific frontends label Feb 14, 2022
@anchwr
Copy link
Author

anchwr commented Feb 14, 2022

Awesome! Thanks!

@matthewturk
Copy link
Member

@anchwr thank you so much for reporting!

I think a fix for this should go into 4.0.3. @brittonsmith I wanted to CC you on this just to make sure you saw it.

@neutrinoceros
Copy link
Member

neutrinoceros commented Feb 14, 2022

@matthewturk Unless I'm mistaken this bug only appeared on the main branch so far (#3433) so there's no need to backport a fix to 4.0.x

@matthewturk
Copy link
Member

@neutrinoceros good catch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug code frontends Things related to specific frontends
Projects
None yet
3 participants