Closed Ecskrabacz10 closed 1 year ago
Hum, it's not immediately clear to me where the problem is. This could be a bug in yt_astro_analysis, rockstar, yt, or unyt 😵💫
It'd be helpful to strip out the parts of the script that aren't necessary to reproduce the error (if any), so it's easier to find the source of error.
Can you try with a different finder_method
and without MPI ?
The issue is that the comoving unit system needs to be added to the unit system associated with ds
. If you have a look in yt/yt/data_objects/static_output.py
, you can see how this is setup for other cosmological datasets inset_units
:
if getattr(self, "cosmological_simulation", False):
# this dataset is cosmological, so add cosmological units.
self.unit_registry.modify("h", self.hubble_constant)
if getattr(self, "current_redshift", None) is not None:
# Comoving lengths
for my_unit in ["m", "pc", "AU", "au"]:
new_unit = f"{my_unit}cm"
my_u = Unit(my_unit, registry=self.unit_registry)
self.unit_registry.add(
new_unit,
my_u.base_value / (1 + self.current_redshift),
dimensions.length,
"\\rm{%s}/(1+z)" % my_unit,
prefixable=True,
)
self.unit_registry.modify("a", 1 / (1 + self.current_redshift))
In this context, self
would be your ds
. If you can add something similar to your loaded dataset, that should do it.
As well, I would not use use the unit_registry associated with the Cosmology object. In there, the comoving and proper frames are incorrectly set equal to each other, which is an unfortunate limitation of the unit system.
Thank you so much! I fixed up a little bit of the code and took your suggestion and I was able to run the code. I also added some other things to my dataset (current redshift, omega matter, etc.) so that Rockstar would run with the correct parameters.
However, I do have one more question. I tried loading the rockstar file "halos_0.0.bin", through ds = yt.load("rockstar_halos/halos_0.0.bin"),
and running the command ad = ds.all_data()
, but I receive the following error:
edit: deleted the image of the error
At the top, it states "Allocating for 0 particles", but the simulation and dataset have 240^3 particles. Here is the code I ran with all of the fixes:
edit: deleted the code from comment
Is there anything in my code/that I am missing that would cause this error? The scale factor that I am testing is at a=0.10, is this possibly too early for Rockstar to recognize halos?
It seems like a=0.10 was too early, I just tested the code on a = 0.30 and it is loading perfectly! Thank you so much for the help!
@Ecskrabacz10, that's great to hear. Very glad we could help!
I am currently trying to figure out how to get a new simulation file type to work with Rockstar and am having a bit of trouble. I've started to try and use a generic particle data set, which will have the particles' position, velocity, and mass. When I try to run rockstar through the astro_analysis tool, I run into a UnitParseError saying that "Mpccm" is not an available unit symbol.
To combat this, I tried creating a cosmology through yt.utilities.cosmology as I could define an Mpccm that way, but I am still running into the same issue.
This is the current code that I am trying to run.
edit: deleted the code from post
This code produces the following error. error.txt
Would anybody be able to help me out with this problem?