metafold 0.12.dev9__tar.gz → 0.12.dev10__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. {metafold-0.12.dev9 → metafold-0.12.dev10}/PKG-INFO +1 -1
  2. {metafold-0.12.dev9 → metafold-0.12.dev10}/metafold/simulation/compression_simulation.py +29 -36
  3. {metafold-0.12.dev9 → metafold-0.12.dev10}/metafold.egg-info/PKG-INFO +1 -1
  4. {metafold-0.12.dev9 → metafold-0.12.dev10}/pyproject.toml +1 -1
  5. {metafold-0.12.dev9 → metafold-0.12.dev10}/tests/test_compression_simulation.py +38 -8
  6. {metafold-0.12.dev9 → metafold-0.12.dev10}/LICENSE +0 -0
  7. {metafold-0.12.dev9 → metafold-0.12.dev10}/README.md +0 -0
  8. {metafold-0.12.dev9 → metafold-0.12.dev10}/metafold/__init__.py +0 -0
  9. {metafold-0.12.dev9 → metafold-0.12.dev10}/metafold/api.py +0 -0
  10. {metafold-0.12.dev9 → metafold-0.12.dev10}/metafold/assets.py +0 -0
  11. {metafold-0.12.dev9 → metafold-0.12.dev10}/metafold/auth.py +0 -0
  12. {metafold-0.12.dev9 → metafold-0.12.dev10}/metafold/client.py +0 -0
  13. {metafold-0.12.dev9 → metafold-0.12.dev10}/metafold/exceptions.py +0 -0
  14. {metafold-0.12.dev9 → metafold-0.12.dev10}/metafold/jobs.py +0 -0
  15. {metafold-0.12.dev9 → metafold-0.12.dev10}/metafold/materials.py +0 -0
  16. {metafold-0.12.dev9 → metafold-0.12.dev10}/metafold/projects.py +0 -0
  17. {metafold-0.12.dev9 → metafold-0.12.dev10}/metafold/simulation/__init__.py +0 -0
  18. {metafold-0.12.dev9 → metafold-0.12.dev10}/metafold/simulation/compression_experiment.py +0 -0
  19. {metafold-0.12.dev9 → metafold-0.12.dev10}/metafold/simulation/run_experiment.py +0 -0
  20. {metafold-0.12.dev9 → metafold-0.12.dev10}/metafold/utils.py +0 -0
  21. {metafold-0.12.dev9 → metafold-0.12.dev10}/metafold/workflows.py +0 -0
  22. {metafold-0.12.dev9 → metafold-0.12.dev10}/metafold.egg-info/SOURCES.txt +0 -0
  23. {metafold-0.12.dev9 → metafold-0.12.dev10}/metafold.egg-info/dependency_links.txt +0 -0
  24. {metafold-0.12.dev9 → metafold-0.12.dev10}/metafold.egg-info/requires.txt +0 -0
  25. {metafold-0.12.dev9 → metafold-0.12.dev10}/metafold.egg-info/top_level.txt +0 -0
  26. {metafold-0.12.dev9 → metafold-0.12.dev10}/setup.cfg +0 -0
  27. {metafold-0.12.dev9 → metafold-0.12.dev10}/tests/test_assets.py +0 -0
  28. {metafold-0.12.dev9 → metafold-0.12.dev10}/tests/test_compession_experiment.py +0 -0
  29. {metafold-0.12.dev9 → metafold-0.12.dev10}/tests/test_jobs.py +0 -0
  30. {metafold-0.12.dev9 → metafold-0.12.dev10}/tests/test_materials.py +0 -0
  31. {metafold-0.12.dev9 → metafold-0.12.dev10}/tests/test_projects.py +0 -0
  32. {metafold-0.12.dev9 → metafold-0.12.dev10}/tests/test_run_experiment.py +0 -0
  33. {metafold-0.12.dev9 → metafold-0.12.dev10}/tests/test_shear_simulation.py +0 -0
  34. {metafold-0.12.dev9 → metafold-0.12.dev10}/tests/test_utils.py +0 -0
  35. {metafold-0.12.dev9 → metafold-0.12.dev10}/tests/test_workflows.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: metafold
3
- Version: 0.12.dev9
3
+ Version: 0.12.dev10
4
4
  Summary: Metafold SDK for Python
5
5
  Author-email: Metafold 3D <info@metafold3d.com>
6
6
  License: Copyright 2024 Metafold 3D
@@ -535,20 +535,6 @@ class CompressionSimulation:
535
535
  def download_results(self):
536
536
  self.write_results()
537
537
 
538
- def _get_primary_deformable_info(self):
539
- """The specimen part for stress/strain and the featured histogram: the
540
- first part that isn't a rigid piston/support (pistons are inserted at
541
- index 0, so this is the first deformable body in the stack)."""
542
- return next(
543
- (
544
- p for p in self.part_infos
545
- if not isinstance(
546
- p.part, (ExperimentPistonBase, ExperimentSupportBase)
547
- )
548
- ),
549
- None,
550
- )
551
-
552
538
  def setup_results(self, output_path):
553
539
  self.out_dir = Path(output_path)
554
540
  self.out_dir.mkdir(parents=True, exist_ok=True)
@@ -2673,24 +2659,8 @@ class CompressionSimulation:
2673
2659
  },
2674
2660
  ]
2675
2661
 
2676
- self.manifest["cardsConfig"]["B"] = []
2677
- specimen = self._get_primary_deformable_info()
2678
- if self._contains_step(WorkflowStepType.VON_MISES_STRESS) and specimen is not None:
2679
- rep_idx = specimen.material_index
2680
- self.manifest["cardsConfig"]["B"].append(
2681
- {
2682
- "id": "vonMisesStress",
2683
- "title": "von Mises Stress",
2684
- "component": "SingleExperimentHistogram",
2685
- "props": {
2686
- "dataSource": f"vonMisesStressHistogram{rep_idx}",
2687
- "xAxisLabel": "von Mises Stress",
2688
- "yAxisLabel": "Frequency",
2689
- },
2690
- }
2691
- )
2692
-
2693
- # One stress-strain card per deformable part (keyed stressStrain{i}).
2662
+ # One stress-strain card per deformable part (keyed stressStrain{i}),
2663
+ # under force-displacement: same data, per-part normalizations.
2694
2664
  if self._contains_step(WorkflowStepType.STRESS_STRAIN):
2695
2665
  for part_info in self.part_infos:
2696
2666
  if not self._is_analysis_target(part_info.part):
@@ -2698,7 +2668,7 @@ class CompressionSimulation:
2698
2668
  if part_info.disabled:
2699
2669
  continue
2700
2670
  i = part_info.material_index
2701
- self.manifest["cardsConfig"]["B"].append(
2671
+ self.manifest["cardsConfig"]["A"].append(
2702
2672
  {
2703
2673
  "id": f"stressStrain{i}",
2704
2674
  "title": f"{part_info.part_unique_name} Stress-Strain",
@@ -2714,6 +2684,29 @@ class CompressionSimulation:
2714
2684
  }
2715
2685
  )
2716
2686
 
2687
+ # One von Mises histogram card per deformable part (keyed
2688
+ # vonMisesStressHistogram{i}).
2689
+ self.manifest["cardsConfig"]["B"] = []
2690
+ if self._contains_step(WorkflowStepType.VON_MISES_STRESS):
2691
+ for part_info in self.part_infos:
2692
+ if not self._is_analysis_target(part_info.part):
2693
+ continue
2694
+ if part_info.disabled:
2695
+ continue
2696
+ i = part_info.material_index
2697
+ self.manifest["cardsConfig"]["B"].append(
2698
+ {
2699
+ "id": f"vonMisesStress{i}",
2700
+ "title": f"{part_info.part_unique_name} von Mises Stress",
2701
+ "component": "SingleExperimentHistogram",
2702
+ "props": {
2703
+ "dataSource": f"vonMisesStressHistogram{i}",
2704
+ "xAxisLabel": "von Mises Stress",
2705
+ "yAxisLabel": "Frequency",
2706
+ },
2707
+ }
2708
+ )
2709
+
2717
2710
  if self._results_have_energy_metrics(results):
2718
2711
  self.manifest["resultsListConfig"].append(
2719
2712
  {"key": "volume", "heading": "Volume (mm³)", "filtering": False},
@@ -2739,7 +2732,7 @@ class CompressionSimulation:
2739
2732
  "filtering": False,
2740
2733
  }
2741
2734
  )
2742
- self.manifest["cardsConfig"]["C"] = [
2735
+ self.manifest["cardsConfig"]["C"].append(
2743
2736
  {
2744
2737
  "id": "energyVolume",
2745
2738
  "title": "Energy Absorbed-Interior Volume",
@@ -2751,7 +2744,7 @@ class CompressionSimulation:
2751
2744
  "yAxisLabel": "Energy Absorbed (J)",
2752
2745
  "colorScaleMeasurement": "energyAbsorbed",
2753
2746
  },
2754
- },
2755
- ]
2747
+ }
2748
+ )
2756
2749
 
2757
2750
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: metafold
3
- Version: 0.12.dev9
3
+ Version: 0.12.dev10
4
4
  Summary: Metafold SDK for Python
5
5
  Author-email: Metafold 3D <info@metafold3d.com>
6
6
  License: Copyright 2024 Metafold 3D
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "metafold"
7
- version = "0.12.dev9"
7
+ version = "0.12.dev10"
8
8
  authors = [
9
9
  {name = "Metafold 3D", email = "info@metafold3d.com"},
10
10
  ]
@@ -754,7 +754,6 @@ class TestMakeManifestV2:
754
754
  def test_card_c_present_when_energy_metrics_step_present(self, sim_with_full_steps):
755
755
  sim_with_full_steps.make_manifest_v2(results=[])
756
756
  card_c = sim_with_full_steps.manifest["cardsConfig"]["C"]
757
- assert len(card_c) == 1
758
757
  assert card_c[0]["id"] == "energyVolume"
759
758
 
760
759
  def test_card_c_absent_when_no_energy_metrics(self, ply_folder, basic_parts, tmp_path):
@@ -847,12 +846,38 @@ class TestMakeManifestV2:
847
846
  sim.make_manifest_v2()
848
847
  assert sim.manifest["cardsConfig"]["A"] == []
849
848
 
850
- def test_stress_strain_cards_one_per_deformable_part(self, sim_with_full_steps):
849
+ def test_von_mises_cards_one_per_deformable_part(self, sim_with_full_steps):
851
850
  sim_with_full_steps.make_manifest_v2()
852
- ids = [c["id"] for c in sim_with_full_steps.manifest["cardsConfig"]["B"]]
853
- assert "stressStrain1" in ids
854
- assert "stressStrain2" in ids
855
- assert "stressStrain3" in ids
851
+ cards = sim_with_full_steps.manifest["cardsConfig"]["B"]
852
+ ids = [c["id"] for c in cards]
853
+ assert ids == ["vonMisesStress1", "vonMisesStress2", "vonMisesStress3"]
854
+ for card in cards:
855
+ assert card["component"] == "SingleExperimentHistogram"
856
+ assert card["props"]["dataSource"] == card["id"].replace(
857
+ "vonMisesStress", "vonMisesStressHistogram"
858
+ )
859
+
860
+ def test_von_mises_cards_absent_when_step_missing(self, ply_folder, basic_parts, tmp_path):
861
+ sim = CompressionSimulation(
862
+ parts=basic_parts,
863
+ simulation_name="t",
864
+ stl_folder_path=str(ply_folder),
865
+ output_path=str(tmp_path / "out"),
866
+ client=MagicMock(),
867
+ workflow_steps=[WorkflowStep(WorkflowStepType.COMPRESS)],
868
+ )
869
+ sim.make_manifest_v2()
870
+ assert sim.manifest["cardsConfig"]["B"] == []
871
+
872
+ def test_stress_strain_cards_in_pane_a_after_force_displacement(self, sim_with_full_steps):
873
+ sim_with_full_steps.make_manifest_v2()
874
+ ids = [c["id"] for c in sim_with_full_steps.manifest["cardsConfig"]["A"]]
875
+ assert ids == [
876
+ "forceDisplacement",
877
+ "stressStrain1",
878
+ "stressStrain2",
879
+ "stressStrain3",
880
+ ]
856
881
  # Piston (material_index 0) gets no stress-strain card.
857
882
  assert "stressStrain0" not in ids
858
883
 
@@ -860,7 +885,7 @@ class TestMakeManifestV2:
860
885
  sim_with_full_steps.make_manifest_v2()
861
886
  cards = [
862
887
  c
863
- for c in sim_with_full_steps.manifest["cardsConfig"]["B"]
888
+ for c in sim_with_full_steps.manifest["cardsConfig"]["A"]
864
889
  if c["id"].startswith("stressStrain")
865
890
  ]
866
891
  assert cards
@@ -880,9 +905,14 @@ class TestMakeManifestV2:
880
905
  workflow_steps=[WorkflowStep(WorkflowStepType.COMPRESS)],
881
906
  )
882
907
  sim.make_manifest_v2()
883
- ids = [c["id"] for c in sim.manifest["cardsConfig"]["B"]]
908
+ ids = [c["id"] for c in sim.manifest["cardsConfig"]["A"]]
884
909
  assert not any(i.startswith("stressStrain") for i in ids)
885
910
 
911
+ def test_pane_c_is_energy_volume_only(self, sim_with_full_steps):
912
+ sim_with_full_steps.make_manifest_v2(results=[])
913
+ ids = [c["id"] for c in sim_with_full_steps.manifest["cardsConfig"]["C"]]
914
+ assert ids == ["energyVolume"]
915
+
886
916
 
887
917
  class TestResultsHaveEnergyMetrics:
888
918
  def test_returns_true_when_energy_metrics_step_present(self, ply_folder, basic_parts, tmp_path):
File without changes
File without changes
File without changes