Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More useful __repr__ for interactive use #202

Open
kyleaoman opened this issue Sep 20, 2024 · 0 comments
Open

More useful __repr__ for interactive use #202

kyleaoman opened this issue Sep 20, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@kyleaoman
Copy link
Member

Currently printing a swift dataset gives something like this:

>>> sd = SWIFTDataset(snapfile)
>>> sd
SWIFT dataset at /cosma8/data/dp004/colibre/Runs/L0012N0376/Fiducial_test/SOAP/colibre_with_SOAP_membership_0123.hdf5.

And similarly for a particle dataset:

>>> sd.gas
<swiftsimio.reader.GasDataset object at 0x7f2c0d79b980>

It would be nice if instead these printed the available fields, like:

>>> sd
SWIFT dataset at <location>
Available fields:
gas    dark_matter    stars    black_holes

and

>>> sd.gas
GasDataset, available fields:
masses                coordinates          velocities
element_abundances    smoothing_lengths    temperatures
densities             <and so on>

Should check that it works similarly for SOAP catalogues.

I noticed recently that tab completion seems to work on recent pythons (3.12 on cosma, for instance). Could also look at that at the same time to see if it's already useful as-is or could be improved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants