Skip to content

Correcting the implementation of the ascii() method.#23

Merged
jpivarski merged 2 commits into
masterfrom
1.0.x
Mar 30, 2017
Merged

Correcting the implementation of the ascii() method.#23
jpivarski merged 2 commits into
masterfrom
1.0.x

Conversation

@jpivarski
Copy link
Copy Markdown
Member

I was too hasty in accepting the Bin.ascii pull request. The old implementation

  • strongly assumed that all Bin contents are Count, would throw missing method exceptions on other cases
  • extracted entries by string manipulation on the repr
  • assumed that histogram entries are all integers

This new version fixes those and improves formatting for floating point. Example with floating point entries:

                   0.0                                                    91.8002740623
                      +--------------------------------------------------------------+
underflow      0      |                                                              |
[-90.0, -80.0) 0      |                                                              |
[-80.0, -70.0) 0      |                                                              |
[-70.0, -60.0) 0      |                                                              |
[-60.0, -50.0) 0.7124 |                                                              |
[-50.0, -40.0) 2.596  |**                                                            |
[-40.0, -30.0) 5.61   |****                                                          |
[-30.0, -20.0) 24.18  |****************                                              |
[-20.0, -10.0) 38.64  |**************************                                    |
[-10.0, 0.0)   79.63  |******************************************************        |
[0.0, 10.0)    91.8   |**************************************************************|
[10.0, 20.0)   89.96  |************************************************************* |
[20.0, 30.0)   78.63  |*****************************************************         |
[30.0, 40.0)   53.53  |************************************                          |
[40.0, 50.0)   20.47  |**************                                                |
[50.0, 60.0)   8.473  |******                                                        |
[60.0, 70.0)   3.773  |***                                                           |
[70.0, 80.0)   0.7507 |*                                                             |
overflow       0.8724 |*                                                             |
nanflow        0      |                                                              |
                      +--------------------------------------------------------------+

Example with integer entries:

                 0.0                                                           2194.0
                    +--------------------------------------------------------------+
underflow      0    |                                                              |
[-90.0, -80.0) 0    |                                                              |
[-80.0, -70.0) 0    |                                                              |
[-70.0, -60.0) 2    |                                                              |
[-60.0, -50.0) 12   |                                                              |
[-50.0, -40.0) 41   |*                                                             |
[-40.0, -30.0) 186  |*****                                                         |
[-30.0, -20.0) 476  |*************                                                 |
[-20.0, -10.0) 969  |***************************                                   |
[-10.0, 0.0)   1610 |*********************************************                 |
[0.0, 10.0)    2194 |**************************************************************|
[10.0, 20.0)   2070 |**********************************************************    |
[20.0, 30.0)   1670 |***********************************************               |
[30.0, 40.0)   1029 |*****************************                                 |
[40.0, 50.0)   486  |**************                                                |
[50.0, 60.0)   176  |*****                                                         |
[60.0, 70.0)   67   |**                                                            |
[70.0, 80.0)   10   |                                                              |
overflow       1    |                                                              |
nanflow        0    |                                                              |
                    +--------------------------------------------------------------+

@jpivarski jpivarski merged commit 3e897f2 into master Mar 30, 2017
@jpivarski jpivarski mentioned this pull request Mar 30, 2017
@ab-10
Copy link
Copy Markdown

ab-10 commented Mar 30, 2017

Oh, I see. Thank you for fixing it.

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 this pull request may close these issues.

2 participants