webbjj / clustertools

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

Astropy_Table loading issue #11

Open webbjj opened 1 month ago

webbjj commented 1 month ago

@nstarman could you please look at /io/astropy_table.py, specifically lines 142-149. Originally we only had line 149, but a user reported an error when there were no IDs in their table.

I can see that on lines 134 and 135 m and ID are set to None if they aren't in the table, but the error stemmed from a numpy array of [None] getting sent to cluster.add_stars, which is expecting just None if undefined.

I originally tried changing lines 127-135 so the numpy array was defined there. For example:

x = np.array(table[cm.pop("x")])

However unfortunately this triggered an astropy units error in /tests/test_loaders/test_astropy_table.

So I have lines 142-149 for now as a quick fix, but its ugly. Any chance you know how to set the arrays before calling cluster.add_stars?

Thanks

nstarman commented 1 month ago

Do you have a MWE I can play with?

webbjj commented 1 month ago

Sent via Slack

On Mon, Oct 21, 2024 at 4:27 PM Nathaniel Starkman @.***> wrote:

Do you have a MWE I can play with?

— Reply to this email directly, view it on GitHub https://github.com/webbjj/clustertools/issues/11#issuecomment-2427653436, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB7AIYBSC5GCVVKKFWB5GL3Z4VPUNAVCNFSM6AAAAABQKQXWXOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMRXGY2TGNBTGY . You are receiving this because you authored the thread.Message ID: @.***>