Skip to content

Conversation

@meganrm
Copy link
Member

@meganrm meganrm commented May 21, 2025

Problem

This converts a recipe ludo gave me, the format is slightly different than other v1 recipes; the sphere trees and meshes are inline

Solution

added utils to unpack the data and convert it

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Steps to Verify:

1. pack -r 'examples/recipes/v1/example-ludo-recipe.json'

@meganrm meganrm requested review from mogres and rugeli May 21, 2025 23:11
Comment on lines +28 to +37
# assert self.packing_mode in [
# "random",
# "close",
# "closePartner",
# "randomPartner",
# "gradient",
# "hexatile",
# "squaretile",
# "triangletile",
# ]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something weird is going on with packing_mode. I would love some help on this if possible. i added a migrate script to make sure it's defined, and still hit this error

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran the packing and the result looked good! What error are you seeing, or is there a way I can reproduce it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you uncomment these lines

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example packing code ran for me after uncommenting these lines. Could you let me know the error message/repro steps?

@github-actions
Copy link
Contributor

github-actions bot commented May 21, 2025

Packing analysis report

Analysis for packing results located at cellpack/tests/outputs/test_spheres/spheresSST

Ingredient name Encapsulating radius Average number packed
ext_A 25 236.0

Packing image

Packing image

Distance analysis

Expected minimum distance: 50.00
Actual minimum distance: 50.01

Ingredient key Pairwise distance distribution
ext_A Distance distribution ext_A

Copy link
Collaborator

@mogres mogres left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was able to pack and run the recipe in the original form! This format will be useful for mesh file free packing for cellpack analysis.

I would recomment applying the suggestions by Ruge before merging as they fixed the assertion bug and also allowed the grid to load from a saved file.


def handle_positions(input_positions):
positions = []
if isinstance(input_positions, list) and isinstance(input_positions[0], int):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do the input_positions have to be int? We might want to add a check for isinstance(input_positions[0], (int, float))

def handle_radii(input_radii):
radii = []
# is just a list of radii
if isinstance(input_radii, list) and isinstance(input_radii[0], int):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same check for floats here?

normals = data["normals"]

return {
"name": "direct_mesh" + datetime.datetime.now().strftime("%Y%m%d%H%M%S"),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we pass in the ingredient name as an argument to have that included in the mesh file name?

@@ -0,0 +1 @@
test file No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be removed

Co-authored-by: Ruge Li <91452427+rugeli@users.noreply.github.com>
@@ -0,0 +1,17 @@
import copy

from ..interface_objects.gradient_data import GradientData, ModeOptions
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not used, could be removed?

Suggested change
from ..interface_objects.gradient_data import GradientData, ModeOptions

Comment on lines +28 to +37
# assert self.packing_mode in [
# "random",
# "close",
# "closePartner",
# "randomPartner",
# "gradient",
# "hexatile",
# "squaretile",
# "triangletile",
# ]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example packing code ran for me after uncommenting these lines. Could you let me know the error message/repro steps?

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.

4 participants