prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  RecursionError while loading enzo_p dataset with cosmology
  ### Bug report
  
  **Bug summary**
  
  Loading a cosmological Enzo_p dataset raises `RecursionError`
  
  **Code for reproduction**
  
  ```python
  from yt.utilities.answer_testing.framework import  data_dir_load 
  ep_cosmo = "ENZOP_DD0140/ENZOP_DD0140.block_list"
  ds = data_dir_load(ep_cosmo)
  ```
  
  **Actual outcome**
  
  ```
  Traceback (most recent call last):
    File "ala.py", line 7, in <module>
      ds = data_dir_load(ep_cosmo)
    File "/home/xarth/codes/xarthisius/yt/yt/utilities/answer_testing/framework.py", line 314, in data_dir_load
      ds.index
    File "/home/xarth/codes/xarthisius/yt/yt/data_objects/static_output.py", line 447, in index
      self.create_field_info()
    File "/home/xarth/codes/xarthisius/yt/yt/data_objects/static_output.py", line 494, in create_field_info
      self.field_info.setup_particle_fields(ptype)
    File "/home/xarth/codes/xarthisius/yt/yt/frontends/enzo_p/fields.py", line 50, in setup_particle_fields
      self.setup_particle_mass_field(ptype)
    File "/home/xarth/codes/xarthisius/yt/yt/frontends/enzo_p/fields.py", line 72, in setup_particle_mass_field
      val /= self.ds.domain_dimensions.prod()
    File "/home/xarth/codes/yt-project/unyt/unyt/array.py", line 1811, in __array_ufunc__
      multiply(out, mul, out=out)
    File "/home/xarth/codes/yt-project/unyt/unyt/array.py", line 1811, in __array_ufunc__
      multiply(out, mul, out=out)
    File "/home/xarth/codes/yt-project/unyt/unyt/array.py", line 1811, in __array_ufunc__
      multiply(out, mul, out=out)
    [Previous line repeated 323 more times]
    File "/home/xarth/codes/yt-project/unyt/unyt/array.py", line 1800, in __array_ufunc__
      out_arr = unyt_quantity(np.asarray(out_arr), unit)
    File "/home/xarth/codes/yt-project/unyt/unyt/array.py", line 2023, in __new__
      or isinstance(input_scalar, (numeric_type, np.number, np.ndarray))
    File "/usr/lib/python3.6/abc.py", line 190, in __instancecheck__
      subclass in cls._abc_negative_cache):
    File "/usr/lib/python3.6/_weakrefset.py", line 75, in __contains__
      return wr in self.data
  RecursionError: maximum recursion depth exceeded in comparison
  ```
  
  **Expected outcome**
  
  Just happiness
  
  **Version Information**
  
    * Operating System: Ubuntu 18.04.4 LTS
    * Python Version: 3.6.9
    * yt version: b6d9463b287099685800353fd6293dffa4bace9d
    * Other Libraries (if applicable): unyt==2.7.1
  
  <!--Please tell us how you installed yt and python e.g., from source,
  pip, conda. If you installed from conda, please specify which channel you used
  if not the default-->
  
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `yt/frontends/enzo_p/fields.py`
  Content:
  ```
  1 from yt.fields.field_info_container import \
  2     FieldInfoContainer
  3 from yt.fields.particle_fields import \
  4     add_union_field
  5 from yt.frontends.enzo_p.misc import \
  6     nested_dict_get
  7 
  8 rho_units = "code_mass / code_length**3"
  9 vel_units = "code_velocity"
  10 acc_units = "code_velocity / code_time"
  11 energy_units = "code_velocity**2"
  12 
  13 known_species_names = {
  14 }
  15 
  16 class EnzoPFieldInfo(FieldInfoContainer):
  17     known_other_fields = (
  18         ("velocity_x", (vel_units, ["velocity_x"], None)),
  19         ("velocity_y", (vel_units, ["velocity_y"], None)),
  20         ("velocity_z", (vel_units, ["velocity_z"], None)),
  21         ("acceleration_x", (acc_units, ["acceleration_x"], None)),
  22         ("acceleration_y", (acc_units, ["acceleration_y"], None)),
  23         ("acceleration_z", (acc_units, ["acceleration_z"], None)),
  24         ("density", (rho_units, ["density"], None)),
  25         ("density_total", (rho_units, ["total_density"], None)),
  26         ("total_energy", (energy_units, ["total_energy"], None)),
  27         ("internal_energy", (energy_units, ["internal_energy"], None)),
  28     )
  29 
  30     known_particle_fields = (
  31         ("x", ("code_length", ["particle_position_x"], None)),
  32         ("y", ("code_length", ["particle_position_y"], None)),
  33         ("z", ("code_length", ["particle_position_z"], None)),
  34         ("vx", (vel_units, ["particle_velocity_x"], None)),
  35         ("vy", (vel_units, ["particle_velocity_y"], None)),
  36         ("vz", (vel_units, ["particle_velocity_z"], None)),
  37         ("ax", (acc_units, ["particle_acceleration_x"], None)),
  38         ("ay", (acc_units, ["particle_acceleration_y"], None)),
  39         ("az", (acc_units, ["particle_acceleration_z"], None)),
  40         ("mass", ("code_mass", ["particle_mass"], None)),
  41     )
  42 
  43     def __init__(self, ds, field_list, slice_info = None):
  44         super(EnzoPFieldInfo, self).__init__(
  45             ds, field_list, slice_info=slice_info)
  46 
  47     def setup_particle_fields(self, ptype, ftype='gas', num_neighbors=64):
  48         super(EnzoPFieldInfo, self).setup_particle_fields(
  49             ptype, ftype=ftype, num_neighbors=num_neighbors)
  50         self.setup_particle_mass_field(ptype)
  51 
  52     def setup_particle_mass_field(self, ptype):
  53         name = "particle_mass"
  54         if ptype in self.ds.particle_unions:
  55             add_union_field(self, ptype, name, "code_mass")
  56             return
  57 
  58         constants = nested_dict_get(
  59             self.ds.parameters, ("Particle", ptype, "constants"),
  60             default=[])
  61         if not constants:
  62             names = []
  63         else:
  64             if not isinstance(constants[0], tuple):
  65                 constants = (constants,)
  66             names = [c[0] for c in constants]
  67 
  68         if "mass" in names:
  69             val = constants[names.index("mass")][2]
  70             val = self.ds.quan(val, self.ds.mass_unit)
  71             if self.ds.cosmological_simulation:
  72                 val /= self.ds.domain_dimensions.prod()
  73 
  74             def _pmass(field, data):
  75                 return val * data[ptype, "particle_ones"]
  76             self.add_field((ptype, name),
  77                             function=_pmass, units="code_mass",
  78                             sampling_type="particle")
  79
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/yt/frontends/enzo_p/fields.py b/yt/frontends/enzo_p/fields.py
  --- a/yt/frontends/enzo_p/fields.py
  +++ b/yt/frontends/enzo_p/fields.py
  @@ -69,7 +69,7 @@
               val = constants[names.index("mass")][2]
               val = self.ds.quan(val, self.ds.mass_unit)
               if self.ds.cosmological_simulation:
  -                val /= self.ds.domain_dimensions.prod()
  +                val = val / self.ds.domain_dimensions.prod()
   
               def _pmass(field, data):
                   return val * data[ptype, "particle_ones"]
  
verification_info: {"golden_diff": "diff --git a/yt/frontends/enzo_p/fields.py b/yt/frontends/enzo_p/fields.py\n--- a/yt/frontends/enzo_p/fields.py\n+++ b/yt/frontends/enzo_p/fields.py\n@@ -69,7 +69,7 @@\n             val = constants[names.index(\"mass\")][2]\n             val = self.ds.quan(val, self.ds.mass_unit)\n             if self.ds.cosmological_simulation:\n-                val /= self.ds.domain_dimensions.prod()\n+                val = val / self.ds.domain_dimensions.prod()\n \n             def _pmass(field, data):\n                 return val * data[ptype, \"particle_ones\"]\n", "issue": "RecursionError while loading enzo_p dataset with cosmology\n### Bug report\r\n\r\n**Bug summary**\r\n\r\nLoading a cosmological Enzo_p dataset raises `RecursionError`\r\n\r\n**Code for reproduction**\r\n\r\n```python\r\nfrom yt.utilities.answer_testing.framework import  data_dir_load \r\nep_cosmo = \"ENZOP_DD0140/ENZOP_DD0140.block_list\"\r\nds = data_dir_load(ep_cosmo)\r\n```\r\n\r\n**Actual outcome**\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"ala.py\", line 7, in <module>\r\n    ds = data_dir_load(ep_cosmo)\r\n  File \"/home/xarth/codes/xarthisius/yt/yt/utilities/answer_testing/framework.py\", line 314, in data_dir_load\r\n    ds.index\r\n  File \"/home/xarth/codes/xarthisius/yt/yt/data_objects/static_output.py\", line 447, in index\r\n    self.create_field_info()\r\n  File \"/home/xarth/codes/xarthisius/yt/yt/data_objects/static_output.py\", line 494, in create_field_info\r\n    self.field_info.setup_particle_fields(ptype)\r\n  File \"/home/xarth/codes/xarthisius/yt/yt/frontends/enzo_p/fields.py\", line 50, in setup_particle_fields\r\n    self.setup_particle_mass_field(ptype)\r\n  File \"/home/xarth/codes/xarthisius/yt/yt/frontends/enzo_p/fields.py\", line 72, in setup_particle_mass_field\r\n    val /= self.ds.domain_dimensions.prod()\r\n  File \"/home/xarth/codes/yt-project/unyt/unyt/array.py\", line 1811, in __array_ufunc__\r\n    multiply(out, mul, out=out)\r\n  File \"/home/xarth/codes/yt-project/unyt/unyt/array.py\", line 1811, in __array_ufunc__\r\n    multiply(out, mul, out=out)\r\n  File \"/home/xarth/codes/yt-project/unyt/unyt/array.py\", line 1811, in __array_ufunc__\r\n    multiply(out, mul, out=out)\r\n  [Previous line repeated 323 more times]\r\n  File \"/home/xarth/codes/yt-project/unyt/unyt/array.py\", line 1800, in __array_ufunc__\r\n    out_arr = unyt_quantity(np.asarray(out_arr), unit)\r\n  File \"/home/xarth/codes/yt-project/unyt/unyt/array.py\", line 2023, in __new__\r\n    or isinstance(input_scalar, (numeric_type, np.number, np.ndarray))\r\n  File \"/usr/lib/python3.6/abc.py\", line 190, in __instancecheck__\r\n    subclass in cls._abc_negative_cache):\r\n  File \"/usr/lib/python3.6/_weakrefset.py\", line 75, in __contains__\r\n    return wr in self.data\r\nRecursionError: maximum recursion depth exceeded in comparison\r\n```\r\n\r\n**Expected outcome**\r\n\r\nJust happiness\r\n\r\n**Version Information**\r\n\r\n  * Operating System: Ubuntu 18.04.4 LTS\r\n  * Python Version: 3.6.9\r\n  * yt version: b6d9463b287099685800353fd6293dffa4bace9d\r\n  * Other Libraries (if applicable): unyt==2.7.1\r\n\r\n<!--Please tell us how you installed yt and python e.g., from source,\r\npip, conda. If you installed from conda, please specify which channel you used\r\nif not the default-->\r\n\r\n\n", "before_files": [{"content": "from yt.fields.field_info_container import \\\n    FieldInfoContainer\nfrom yt.fields.particle_fields import \\\n    add_union_field\nfrom yt.frontends.enzo_p.misc import \\\n    nested_dict_get\n\nrho_units = \"code_mass / code_length**3\"\nvel_units = \"code_velocity\"\nacc_units = \"code_velocity / code_time\"\nenergy_units = \"code_velocity**2\"\n\nknown_species_names = {\n}\n\nclass EnzoPFieldInfo(FieldInfoContainer):\n    known_other_fields = (\n        (\"velocity_x\", (vel_units, [\"velocity_x\"], None)),\n        (\"velocity_y\", (vel_units, [\"velocity_y\"], None)),\n        (\"velocity_z\", (vel_units, [\"velocity_z\"], None)),\n        (\"acceleration_x\", (acc_units, [\"acceleration_x\"], None)),\n        (\"acceleration_y\", (acc_units, [\"acceleration_y\"], None)),\n        (\"acceleration_z\", (acc_units, [\"acceleration_z\"], None)),\n        (\"density\", (rho_units, [\"density\"], None)),\n        (\"density_total\", (rho_units, [\"total_density\"], None)),\n        (\"total_energy\", (energy_units, [\"total_energy\"], None)),\n        (\"internal_energy\", (energy_units, [\"internal_energy\"], None)),\n    )\n\n    known_particle_fields = (\n        (\"x\", (\"code_length\", [\"particle_position_x\"], None)),\n        (\"y\", (\"code_length\", [\"particle_position_y\"], None)),\n        (\"z\", (\"code_length\", [\"particle_position_z\"], None)),\n        (\"vx\", (vel_units, [\"particle_velocity_x\"], None)),\n        (\"vy\", (vel_units, [\"particle_velocity_y\"], None)),\n        (\"vz\", (vel_units, [\"particle_velocity_z\"], None)),\n        (\"ax\", (acc_units, [\"particle_acceleration_x\"], None)),\n        (\"ay\", (acc_units, [\"particle_acceleration_y\"], None)),\n        (\"az\", (acc_units, [\"particle_acceleration_z\"], None)),\n        (\"mass\", (\"code_mass\", [\"particle_mass\"], None)),\n    )\n\n    def __init__(self, ds, field_list, slice_info = None):\n        super(EnzoPFieldInfo, self).__init__(\n            ds, field_list, slice_info=slice_info)\n\n    def setup_particle_fields(self, ptype, ftype='gas', num_neighbors=64):\n        super(EnzoPFieldInfo, self).setup_particle_fields(\n            ptype, ftype=ftype, num_neighbors=num_neighbors)\n        self.setup_particle_mass_field(ptype)\n\n    def setup_particle_mass_field(self, ptype):\n        name = \"particle_mass\"\n        if ptype in self.ds.particle_unions:\n            add_union_field(self, ptype, name, \"code_mass\")\n            return\n\n        constants = nested_dict_get(\n            self.ds.parameters, (\"Particle\", ptype, \"constants\"),\n            default=[])\n        if not constants:\n            names = []\n        else:\n            if not isinstance(constants[0], tuple):\n                constants = (constants,)\n            names = [c[0] for c in constants]\n\n        if \"mass\" in names:\n            val = constants[names.index(\"mass\")][2]\n            val = self.ds.quan(val, self.ds.mass_unit)\n            if self.ds.cosmological_simulation:\n                val /= self.ds.domain_dimensions.prod()\n\n            def _pmass(field, data):\n                return val * data[ptype, \"particle_ones\"]\n            self.add_field((ptype, name),\n                            function=_pmass, units=\"code_mass\",\n                            sampling_type=\"particle\")\n", "path": "yt/frontends/enzo_p/fields.py"}], "after_files": [{"content": "from yt.fields.field_info_container import \\\n    FieldInfoContainer\nfrom yt.fields.particle_fields import \\\n    add_union_field\nfrom yt.frontends.enzo_p.misc import \\\n    nested_dict_get\n\nrho_units = \"code_mass / code_length**3\"\nvel_units = \"code_velocity\"\nacc_units = \"code_velocity / code_time\"\nenergy_units = \"code_velocity**2\"\n\nknown_species_names = {\n}\n\nclass EnzoPFieldInfo(FieldInfoContainer):\n    known_other_fields = (\n        (\"velocity_x\", (vel_units, [\"velocity_x\"], None)),\n        (\"velocity_y\", (vel_units, [\"velocity_y\"], None)),\n        (\"velocity_z\", (vel_units, [\"velocity_z\"], None)),\n        (\"acceleration_x\", (acc_units, [\"acceleration_x\"], None)),\n        (\"acceleration_y\", (acc_units, [\"acceleration_y\"], None)),\n        (\"acceleration_z\", (acc_units, [\"acceleration_z\"], None)),\n        (\"density\", (rho_units, [\"density\"], None)),\n        (\"density_total\", (rho_units, [\"total_density\"], None)),\n        (\"total_energy\", (energy_units, [\"total_energy\"], None)),\n        (\"internal_energy\", (energy_units, [\"internal_energy\"], None)),\n    )\n\n    known_particle_fields = (\n        (\"x\", (\"code_length\", [\"particle_position_x\"], None)),\n        (\"y\", (\"code_length\", [\"particle_position_y\"], None)),\n        (\"z\", (\"code_length\", [\"particle_position_z\"], None)),\n        (\"vx\", (vel_units, [\"particle_velocity_x\"], None)),\n        (\"vy\", (vel_units, [\"particle_velocity_y\"], None)),\n        (\"vz\", (vel_units, [\"particle_velocity_z\"], None)),\n        (\"ax\", (acc_units, [\"particle_acceleration_x\"], None)),\n        (\"ay\", (acc_units, [\"particle_acceleration_y\"], None)),\n        (\"az\", (acc_units, [\"particle_acceleration_z\"], None)),\n        (\"mass\", (\"code_mass\", [\"particle_mass\"], None)),\n    )\n\n    def __init__(self, ds, field_list, slice_info = None):\n        super(EnzoPFieldInfo, self).__init__(\n            ds, field_list, slice_info=slice_info)\n\n    def setup_particle_fields(self, ptype, ftype='gas', num_neighbors=64):\n        super(EnzoPFieldInfo, self).setup_particle_fields(\n            ptype, ftype=ftype, num_neighbors=num_neighbors)\n        self.setup_particle_mass_field(ptype)\n\n    def setup_particle_mass_field(self, ptype):\n        name = \"particle_mass\"\n        if ptype in self.ds.particle_unions:\n            add_union_field(self, ptype, name, \"code_mass\")\n            return\n\n        constants = nested_dict_get(\n            self.ds.parameters, (\"Particle\", ptype, \"constants\"),\n            default=[])\n        if not constants:\n            names = []\n        else:\n            if not isinstance(constants[0], tuple):\n                constants = (constants,)\n            names = [c[0] for c in constants]\n\n        if \"mass\" in names:\n            val = constants[names.index(\"mass\")][2]\n            val = self.ds.quan(val, self.ds.mass_unit)\n            if self.ds.cosmological_simulation:\n                val = val / self.ds.domain_dimensions.prod()\n\n            def _pmass(field, data):\n                return val * data[ptype, \"particle_ones\"]\n            self.add_field((ptype, name),\n                            function=_pmass, units=\"code_mass\",\n                            sampling_type=\"particle\")\n", "path": "yt/frontends/enzo_p/fields.py"}]}