XYZ parsing error
Opened this issue · 3 comments
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
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?
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.
Thanks for the input! I will definitely consider implementing it the next time when I get back to the project.