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

Taal: Prettify simulation summary #302

Closed
sloede opened this issue Nov 6, 2020 · 4 comments
Closed

Taal: Prettify simulation summary #302

sloede opened this issue Nov 6, 2020 · 4 comments
Assignees
Labels

Comments

@sloede
Copy link
Member

sloede commented Nov 6, 2020

At the moment, running a simulation shows most relevant information in a summary to the user. However, personally, I think the presentation is still somewhat lacking in that there are no fixed widths use, which makes it harder to scan for relevant information.

I am open for suggestions, but lacking other ideas, I'd like to reinstate a summary similar to what we had in Taam.

@ranocha
Copy link
Member

ranocha commented Nov 6, 2020

Feel free to do that. I just implemented something that was convenient to write using show. Maybe you can use display and get more info about the terminal in use or just write your own stuff to mimic what we have in Taam. I would still prefer to structure the summary by component in Taal.

@ranocha ranocha mentioned this issue Nov 11, 2020
50 tasks
@ranocha
Copy link
Member

ranocha commented Nov 13, 2020

I think this would be helpful for us:

help?> show
[...]
  show(io::IO, mime, x)
[...]
  Container types generally implement 3-argument show by calling show(io, MIME"text/plain"(), x) for elements
  x, with :compact => true set in an IOContext passed as the first argument.

help?> IOContext
[...]
  IOContext(io::IO, KV::Pair...)

  Create an IOContext that wraps a given stream, adding the specified key=>value pairs to the properties of
  that stream (note that io can itself be an IOContext).

    •    use (key => value) in io to see if this particular combination is in the properties set

    •    use get(io, key, default) to retrieve the most recent value for a particular key

  The following properties are in common use::compact: Boolean specifying that values should be printed more compactly, e.g. that numbers should
        be printed with fewer digits. This is set when printing array elements. :compact output should not
        contain line breaks.

    •    :limit: Boolean specifying that containers should be truncated, e.g. showing  in place of most
        elements.

    •    :displaysize: A Tuple{Int,Int} giving the size in rows and columns to use for text output. This can
        be used to override the display size for called functions, but to get the size of the screen use
        the displaysize function.

    •    :typeinfo: a Type characterizing the information already printed concerning the type of the object
        about to be displayed. This is mainly useful when displaying a collection of objects of the same
        type, so that redundant type information can be avoided (e.g. [Float16(0)] can be shown as
        "Float16[0.0]" instead of "Float16[Float16(0.0)]" : while displaying the elements of the array, the
        :typeinfo property will be set to Float16).
[...]

Given this information, I think we should write appropriate 3-arg show methods making use of customization using IOContext. For example, we could provide additional keyword arguments specifying an indentation level to get a structured output more similar to the previous Taam version.

@sloede
Copy link
Member Author

sloede commented Nov 13, 2020

Thanks for the information! I used exactly this approach (show with IOContext) in #333.

@ranocha ranocha closed this as completed Nov 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants