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
We can patch the error raising statement to get a better idea what's going on
--- a/yt_astro_analysis/halo_analysis/halo_catalog/plot_modifications.py+++ b/yt_astro_analysis/halo_analysis/halo_catalog/plot_modifications.py@@ -137,9 +137,10 @@ class HaloCatalogCallback(PlotCallback):
else:
self.halo_data = halo_catalog.halos_ds.all_data()
else:
- raise RuntimeError(+ raise TypeError(
"halo_catalog argument must be a HaloCatalog object, "
- + "a dataset, or a data container."+ f"a dataset, or a data container. Received {halo_catalog} "+ f"with type {type(halo_catalog)}"
)
self.width = width
and we get
TypeError: halo_catalog argument must be a HaloCatalog object, a dataset, or a data container. Received
<yt.extensions.astro_analysis.halo_analysis.halo_catalog.halo_catalog.HaloCatalog object at 0x12059faf0> with type <class
'yt.extensions.astro_analysis.halo_analysis.halo_catalog.halo_catalog.HaloCatalog'>
So what seems to be happening is that by using the extension-style import for yt_astro_analysis classes, we're de facto creating a different namespace than the one used internally, which breaks runtime validation.
The example script works as intended if we use the direct import style instead
Running the example here
https://yt-astro-analysis.readthedocs.io/en/yt_astro_analysis-1.1.0/cookbook/cosmological_analysis.html#plotting-halos
I get
This is easily solved with the following patch
bug then, the example script still fails with a more exotic error
We can patch the error raising statement to get a better idea what's going on
and we get
So what seems to be happening is that by using the extension-style import for yt_astro_analysis classes, we're de facto creating a different namespace than the one used internally, which breaks runtime validation.
The example script works as intended if we use the direct import style instead
A possible solution on the extension side would be to replace if/else validation with try/except.
The text was updated successfully, but these errors were encountered: