webbjj / clustertools

A Python package with tools for analysing star clusters.
https://clustertools.readthedocs.io
MIT License
14 stars 6 forks source link

Importing AMUSE datasets #3

Closed jeremykaram closed 4 years ago

jeremykaram commented 4 years ago

Hello, I am trying to load a star cluster using hdf5 dump files from a simulation I ran using AMUSE. However, when I try and use clustertools.load_cluster(ctype="amuse", fname="file_name")I am met with an error in the load.py file of the analysis directory. The error claims that a function called get_amuse_particles is not defined. Is there a specific argument I am missing in the load_cluster function perhaps? Thank you for the help. Jeremy

webbjj commented 4 years ago

Hello, and thanks for catching this typo. I just pushed the fix. However I wanted to clarify that clustertools.load_cluster(ctype="amuse", fname="file_name") does not accept "fname" or "filename" as one of the arguments. It actually gets an AMUSE particle dataset. If you want to read from an AMUSE snapshot, I think you would have to use read_set_from_file from AMUSE:

from amuse.io import read_set_from_file stars=read_set_from_file(filename, "hdf5") cluster=clustertools.load_cluster(ctype="amuse", particles=stars)

That being said, I have also just pushed an untested option that does exactly this. So if you pull the latest release then your original command clustertools.load_cluster(ctype="amuse", filename="file_name") should work, albeit with fname changed to filename. I'll try to test it soon, but if you want to give it a try please feel free.

Thanks again

Jeremy

jeremykaram commented 4 years ago

Great. Thanks for pointing out working with AMUSE particles. That makes sense. Also the new untested option seems to work well for me so all is good. Thanks again!