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 · May be fixed by #211
Open

More useful __repr__ for interactive use #202

kyleaoman opened this issue Sep 20, 2024 · 0 comments · May be fixed by #211
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.

@MatthieuSchaller MatthieuSchaller added the enhancement New feature or request label Nov 15, 2024
@robjmcgibbon robjmcgibbon linked a pull request Nov 18, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

3 participants