ytree-project / ytree

A yt-based merger-tree code.
Other
15 stars 10 forks source link

Could not determine arbor type #159

Open PauCaBu opened 1 year ago

PauCaBu commented 1 year ago

Hello, I have a merger tree in a .dat file with 5 columns:

redshift, halo_mass, ID, ID progenitor (=-1 if it's a starting point), num (1=leaf, 0=not a leaf) 4.5 100000 1 -1 0 (example)

all values are separated by an empty space.

trying to load it using ytree

merger_tree = './tree.dat' a = ytree.load(merger_tree)

I get:

raise IOError(f"Could not determine arbor type for {filename}.")

I see that this format doesn't follow the available formats, could there be a workaround for this?

Thanks

brittonsmith commented 1 year ago

Thanks for raising this issue! We are probably not that far off from being able to support this type of input as it's fairly similar to the ConsistentTrees format. Alternatively, we could think about supporting generic input from a dictionary of fields, like:

fields = {"uid": ..., "desc_id": ..., "mass": ..., }
a = ytree.load_from_dict(fields)

I'm on holiday this week, but I will give it some thought and report back here. If you're interested in working with this, I'm happy to work with you.

PauCaBu commented 1 year ago

I think that is a great idea :). I'm interested in working on this, although this is my first time working on this, and I'm trying to familiarize myself with these types of formats. Maybe there is a way to adapt a generic tree input onto the consistentTrees format?

brittonsmith commented 1 year ago

Yes, I think there might be. I would be happy to put something together to get you started and we can iterate on it. I've got a very busy next 1.5 weeks, so I don't think I can do much until after that, but I am very excited to work on this. Sorry for the wait!

brittonsmith commented 1 year ago

Hi again, I have something working now to get you going. I will issue a pull request in the next day or two that you can start working from and we can go from there.

brittonsmith commented 1 year ago

@PauCaBu, I have issued PR #160 that should get you going. I chose to create a new frontend as a means to test out some ideas I had for refactoring other parts of the code. Please feel free to either make changes or get back to me with feedback about what could be improved. You can also access the branch with these changes here.