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

Further improve pretty printing of DimensionalArray #53

Closed
Datseris opened this issue Feb 3, 2020 · 4 comments · Fixed by #55
Closed

Further improve pretty printing of DimensionalArray #53

Datseris opened this issue Feb 3, 2020 · 4 comments · Fixed by #55

Comments

@Datseris
Copy link
Contributor

Datseris commented Feb 3, 2020

Although the PR #33 improved the situation, much is left to be desired:

image

The printing of the dimensions is not optimal, too many elements are shown and they are taking multiple lines, which messes the alignment. The array data take up several pages when printed, which is also not so helpful.

No matter how much I hacked at it I couldn't make it work cleanly. I don't know why it worked cleanly for DynamicalSystems.jl.

Anyway, here is what I propose to make the situation better, which I can easily put in a PR:

  1. For any dimension by default show at most 4 elements: first, second, end-1 and end, and put ... in between.
  2. For array data with dimension 3 or larger, only show the first 2D frame, i.e. A[:, :, 1, 1, 1, 1,...].

This will make the printing both useful as well as readable.

@rafaqz
Copy link
Owner

rafaqz commented Feb 3, 2020

Sounds good to me.

I think they should also be Lat (Lattitude): Float32[0.5: so the type name is shown first, as you pointed out somewhere else it's a little confusing as is.

@Datseris
Copy link
Contributor Author

Datseris commented Feb 3, 2020

Yes good point. I was thinking about that and I thought another way to do this is to start with the normal name and then mention the type explicitly, as in

Lattitude (type Lat): ...

@rafaqz
Copy link
Owner

rafaqz commented Feb 3, 2020

I'm ok with either, whichever you think looks best and is clearest.

@rafaqz
Copy link
Owner

rafaqz commented Feb 3, 2020

Shortening the index display to 4 elements would be great. It was annoying me today scrolling across in the Atom/Juno popup to check the end/end-1 values of the dim.

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

Successfully merging a pull request may close this issue.

2 participants