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

XYZ parsing error #212

Open
mushroomfire opened this issue Apr 8, 2024 · 3 comments
Open

XYZ parsing error #212

mushroomfire opened this issue Apr 8, 2024 · 3 comments

Comments

@mushroomfire
Copy link

Hi,
I try to load a point set in XYZ format, while the splashsurf shows wrong particle number, is there anything wrong?

The commond I run:

splashsurf reconstruct test.xyz --particle-radius 1.2 --smoothing-length 1.2 --cube-size 0.5

Here is the test.xyz, just including the coordinates. I am not sure if it is the right format.

0.0000 0.0000 0.0000
2.0250 2.0250 0.0000
2.0250 0.0000 2.0250
0.0000 2.0250 2.0250
0.0000 0.0000 4.0500
2.0250 2.0250 4.0500
2.0250 0.0000 6.0750
0.0000 2.0250 6.0750
0.0000 4.0500 0.0000
2.0250 6.0750 0.0000
2.0250 4.0500 2.0250
0.0000 6.0750 2.0250
0.0000 4.0500 4.0500
2.0250 6.0750 4.0500
2.0250 4.0500 6.0750
0.0000 6.0750 6.0750
4.0500 0.0000 0.0000
6.0750 2.0250 0.0000
6.0750 0.0000 2.0250
4.0500 2.0250 2.0250
4.0500 0.0000 4.0500
6.0750 2.0250 4.0500
6.0750 0.0000 6.0750
4.0500 2.0250 6.0750
4.0500 4.0500 0.0000
6.0750 6.0750 0.0000
6.0750 4.0500 2.0250
4.0500 6.0750 2.0250
4.0500 4.0500 4.0500
6.0750 6.0750 4.0500
6.0750 4.0500 6.0750
4.0500 6.0750 6.0750

The output shows there are 58 particles, while it is 32.

[18:31:50.778][INFO] Using single precision (f32) for surface reconstruction.
[18:31:50.778][INFO] Reading particle dataset from "test.xyz"...
[18:31:50.778][INFO] Successfully read dataset with 58 particle positions.
[18:31:50.779][INFO] Minimal enclosing bounding box of particles was computed as: AxisAlignedBoundingBox { min: [-1.2000000, -1.2000000, -1.2000000], max: [1.2000105, 1.2000105, 1.2000105] }
[18:31:50.779][INFO] Splitting 58 particles into 4 chunks (with 16 particles each) for octree generation
@w1th0utnam3
Copy link
Member

Hi! For the XYZ format option splashsurf expects a binary dump of an array of f32 values, i.e. the raw memory representation of the f32 values, not any ASCII representation (See https://github.com/InteractiveComputerGraphics/splashsurf?tab=readme-ov-file#xyz).
As there are many ways to write particle coordinates as a text file, there is no option for this yet. Maybe it would make sense to add an option for importing CSV files, where values could be separated by comma, semicolon or whitespace.
In the meantime, maybe you can try to format your particle positions as a JSON file instead, like shown here: https://github.com/InteractiveComputerGraphics/splashsurf?tab=readme-ov-file#json?

@mushroomfire
Copy link
Author

Thanks for your help. I can obtain the right result using json format. Adding an option for importing CSV file will be very useful, as the speed of saving CSV is much higher than saving json from a numpy array.

@w1th0utnam3
Copy link
Member

Thanks for the input! I will definitely consider implementing it the next time when I get back to the project.

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

No branches or pull requests

2 participants