BVHTools icon indicating copy to clipboard operation
BVHTools copied to clipboard

[HELP] Convert Scientific Notation to Number

Open cl3386 opened this issue 2 years ago • 1 comments

Hi Author, First of all, great thanks for awesome project.

I am trying to import bvh file that was created in python3. Python3 automatically convert numbers that has a lot of decimal numbers to Scientific Notation such as "-1.25358e-05"

When I import my bvh file in Unity, it gives me following error: ArgumentException: Failed to parse BVH data at position 9638. Expected channel value around here: 4.8479 1.2379>>>9e-<<<06 -2.59538e-

I am trying to convert all the scientific notations(they are like thousands) to number in BVHParser.cs script myself, but I am struggling from doing it.

Can you give me any direction for achieving my goal?

Many Thanks!

cl3386 avatar Apr 14 '22 07:04 cl3386

Hi! Those are not valid BVH files, so I would recommend printing the numbers in a way that no scientific notation is produced on the Python side. The exact way to do this will depend on what kind of data you are handling (there are different print options for e.g. numpy and pytorch). If they are regular floats, you can try something like print(f"{your_number:.5f") to print it with five digits.

emilianavt avatar Apr 15 '22 17:04 emilianavt