Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

num_regression outputs garbage to its file if arrays are of different size

See original GitHub issue

If you write arrays of different sizes on the data dict, num_regression fills the missing positions with garbage (or at least it seems garbage):

def testNumRegression(num_regression):
    data = {}
    for index in range(4):
        data[f'data_{index}'] = np.array([index])

    data['other'] = np.array([10, 20, 30, 40, 50, 60])




Output converted to a markdown table so it’s easier to visualize:

data_0 data_1 data_2 data_3 other
0 0 1 2 3 10
1 -2147483648 -2147483648 -2147483648 -2147483648 20
2 -2147483648 -2147483648 -2147483648 -2147483648 30
3 -2147483648 -2147483648 -2147483648 -2147483648 40
4 -2147483648 -2147483648 -2147483648 -2147483648 50
5 -2147483648 -2147483648 -2147483648 -2147483648 60

I can think of some ways of solving this:

  1. Raise an error suggesting that the user write the output on different files because the arrays have different sizes.
  2. Separate it in two tables, but I don’t know how difficult would be for num_regression to process multiple tables on the same file.
  3. Fill the missing items with the space character.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

tadeucommented, Jun 18, 2019

With respect to the flag fill_different_shape_with_nan=True, should we raise an error when the array type is not float, and fill it with nan when the array type is float?

tarcisiofischercommented, Jun 18, 2019

Sounds good to me 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

C++ array of fixed size getting garbage values - Stack Overflow
Another approach would be to only assign the NULL terminator to the last cell of your string, like a[s.length()] = '\0'; .
Read more >
Change Your Container Size - Utilities -
As a current Seattle Public Utilities customer, you can change the container sizes for your garbage, recycling, and food and yard (compost) collection....
Read more >
Garbage / Recycling | Bakersfield, CA - Official Website
Quick links. City of Bakersfield garbage and recycling services for residents and businesses are operated by the Public Works Department Solid Waste Division....
Read more >
Great Pacific Garbage Patch | National Geographic Society
The Great Pacific Garbage Patch is a collection of marine debris in the North Pacific Ocean. Also known as the Pacific trash vortex,...
Read more >
Request Trash, Recycling, or Yard Waste Services
We offer three different cart sizes (option below). You only pay when you use the cart. Keep in mind a smaller cart will...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found