metafold 0.12.1__tar.gz → 0.13.dev0__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.1 → metafold-0.13.dev0}/PKG-INFO +1 -1
  2. {metafold-0.12.1 → metafold-0.13.dev0}/metafold/simulation/compression_simulation.py +33 -4
  3. {metafold-0.12.1 → metafold-0.13.dev0}/metafold.egg-info/PKG-INFO +1 -1
  4. {metafold-0.12.1 → metafold-0.13.dev0}/pyproject.toml +1 -1
  5. {metafold-0.12.1 → metafold-0.13.dev0}/tests/test_compression_simulation.py +17 -0
  6. {metafold-0.12.1 → metafold-0.13.dev0}/LICENSE +0 -0
  7. {metafold-0.12.1 → metafold-0.13.dev0}/README.md +0 -0
  8. {metafold-0.12.1 → metafold-0.13.dev0}/metafold/__init__.py +0 -0
  9. {metafold-0.12.1 → metafold-0.13.dev0}/metafold/api.py +0 -0
  10. {metafold-0.12.1 → metafold-0.13.dev0}/metafold/assets.py +0 -0
  11. {metafold-0.12.1 → metafold-0.13.dev0}/metafold/auth.py +0 -0
  12. {metafold-0.12.1 → metafold-0.13.dev0}/metafold/client.py +0 -0
  13. {metafold-0.12.1 → metafold-0.13.dev0}/metafold/exceptions.py +0 -0
  14. {metafold-0.12.1 → metafold-0.13.dev0}/metafold/jobs.py +0 -0
  15. {metafold-0.12.1 → metafold-0.13.dev0}/metafold/materials.py +0 -0
  16. {metafold-0.12.1 → metafold-0.13.dev0}/metafold/projects.py +0 -0
  17. {metafold-0.12.1 → metafold-0.13.dev0}/metafold/simulation/__init__.py +0 -0
  18. {metafold-0.12.1 → metafold-0.13.dev0}/metafold/simulation/compression_experiment.py +0 -0
  19. {metafold-0.12.1 → metafold-0.13.dev0}/metafold/simulation/run_experiment.py +0 -0
  20. {metafold-0.12.1 → metafold-0.13.dev0}/metafold/utils.py +0 -0
  21. {metafold-0.12.1 → metafold-0.13.dev0}/metafold/workflows.py +0 -0
  22. {metafold-0.12.1 → metafold-0.13.dev0}/metafold.egg-info/SOURCES.txt +0 -0
  23. {metafold-0.12.1 → metafold-0.13.dev0}/metafold.egg-info/dependency_links.txt +0 -0
  24. {metafold-0.12.1 → metafold-0.13.dev0}/metafold.egg-info/requires.txt +0 -0
  25. {metafold-0.12.1 → metafold-0.13.dev0}/metafold.egg-info/top_level.txt +0 -0
  26. {metafold-0.12.1 → metafold-0.13.dev0}/setup.cfg +0 -0
  27. {metafold-0.12.1 → metafold-0.13.dev0}/tests/test_assets.py +0 -0
  28. {metafold-0.12.1 → metafold-0.13.dev0}/tests/test_compession_experiment.py +0 -0
  29. {metafold-0.12.1 → metafold-0.13.dev0}/tests/test_jobs.py +0 -0
  30. {metafold-0.12.1 → metafold-0.13.dev0}/tests/test_materials.py +0 -0
  31. {metafold-0.12.1 → metafold-0.13.dev0}/tests/test_projects.py +0 -0
  32. {metafold-0.12.1 → metafold-0.13.dev0}/tests/test_run_experiment.py +0 -0
  33. {metafold-0.12.1 → metafold-0.13.dev0}/tests/test_shear_simulation.py +0 -0
  34. {metafold-0.12.1 → metafold-0.13.dev0}/tests/test_utils.py +0 -0
  35. {metafold-0.12.1 → metafold-0.13.dev0}/tests/test_workflows.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: metafold
3
- Version: 0.12.1
3
+ Version: 0.13.dev0
4
4
  Summary: Metafold SDK for Python
5
5
  Author-email: Metafold 3D <info@metafold3d.com>
6
6
  License: Copyright 2024 Metafold 3D
@@ -311,6 +311,7 @@ class WorkflowStepType(Enum):
311
311
  STRESS_STRAIN = "stress_strain"
312
312
  PARTICLE_DISPLACEMENT = "particle_displacement"
313
313
  ENERGY_METRICS = "energy_metrics"
314
+ REDUCE_RESULTS = "reduce_results"
314
315
 
315
316
 
316
317
  class WorkflowStep:
@@ -444,6 +445,7 @@ class CompressionSimulation:
444
445
  # stress_strain is opt-in (not default): callers add it via workflow_steps.
445
446
  WorkflowStep(WorkflowStepType.PARTICLE_DISPLACEMENT),
446
447
  WorkflowStep(WorkflowStepType.ENERGY_METRICS),
448
+ # reduce-results is auto-added in build_workflow (not a step).
447
449
  ],
448
450
  force_reupload_files=False,
449
451
  prep_workflow_batch_size: int = 10,
@@ -1475,6 +1477,25 @@ class CompressionSimulation:
1475
1477
  part_infos, "force-displacement", "energy-metrics"
1476
1478
  )
1477
1479
 
1480
+ # One merged reduce-results job consumes the particle-data outputs the
1481
+ # browser renders and produces a compact (trimmed + int16 + decimated) HDF5.
1482
+ # Auto-added whenever compress ran; the manifest points DTB at its output.
1483
+ _REDUCE_SOURCE_JOBS = [
1484
+ "compress", "von-mises-stress", "effective-strain",
1485
+ "particle-displacement",
1486
+ ]
1487
+ _REDUCE_JOB_NAME = "reduce-results"
1488
+
1489
+ def _add_to_workflow_reduce_results(self):
1490
+ sources = [j for j in self._REDUCE_SOURCE_JOBS if j in self.workflow_jobs]
1491
+ if "compress" not in sources:
1492
+ return # nothing to preview without particle positions
1493
+ self.workflow_jobs[self._REDUCE_JOB_NAME] = {
1494
+ "type": "sim/postprocess/reduce-results",
1495
+ "needs": sources,
1496
+ "assets": {"data": [{"job": s, "asset": "output"} for s in sources]},
1497
+ }
1498
+
1478
1499
  def build_workflow(self, name_suffix=""):
1479
1500
  self.workflow_yaml = ""
1480
1501
  self.workflow_params = {}
@@ -1511,6 +1532,9 @@ class CompressionSimulation:
1511
1532
  elif step.type == WorkflowStepType.COMPUTE_BVH:
1512
1533
  pass # this is done on the prep workflow, not here
1513
1534
 
1535
+ # Always emit the browser preview when there's particle data to preview.
1536
+ self._add_to_workflow_reduce_results()
1537
+
1514
1538
  self.workflow_yaml = yaml.dump(
1515
1539
  {"jobs": self.workflow_jobs}, default_flow_style=False, sort_keys=False
1516
1540
  )
@@ -2413,27 +2437,32 @@ class CompressionSimulation:
2413
2437
  "particle-displacement",
2414
2438
  ),
2415
2439
  ]
2440
+ # Point the particle datasets DTB renders at the merged reduce-results
2441
+ # job (compact int16/decimated), falling back to the raw job if preview
2442
+ # didn't run. Histograms are tiny — leave them on the raw job.
2443
+ reduce_job_id = job_id_lookup.get(self._REDUCE_JOB_NAME, "")
2416
2444
  for step, dataset_root, key_prefix, has_histogram, local_job in full_hdf_refs:
2417
2445
  if not self._contains_step(step):
2418
2446
  continue
2419
- job_id = job_id_lookup.get(local_job, "")
2447
+ raw_job_id = job_id_lookup.get(local_job, "")
2448
+ data_job_id = reduce_job_id or raw_job_id
2420
2449
  for i in range(n_materials):
2421
2450
  if self.part_infos[i].disabled:
2422
2451
  continue
2423
2452
  server_data[f"{key_prefix}{i}"] = {
2424
- "jobId": job_id,
2453
+ "jobId": data_job_id,
2425
2454
  "assetName": "output",
2426
2455
  "path": f"/material{i}/{dataset_root}",
2427
2456
  }
2428
2457
  if has_histogram:
2429
2458
  server_data[f"{key_prefix}Histogram{i}"] = {
2430
- "jobId": job_id,
2459
+ "jobId": raw_job_id,
2431
2460
  "assetName": "output",
2432
2461
  "path": f"/material{i}/{dataset_root}_histogram",
2433
2462
  }
2434
2463
 
2435
2464
  if self._contains_step(WorkflowStepType.COMPRESS):
2436
- job_id = job_id_lookup.get("compress", "")
2465
+ job_id = reduce_job_id or job_id_lookup.get("compress", "")
2437
2466
  for i in range(n_materials):
2438
2467
  if self.part_infos[i].disabled:
2439
2468
  continue
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: metafold
3
- Version: 0.12.1
3
+ Version: 0.13.dev0
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.1"
7
+ version = "0.13.dev0"
8
8
  authors = [
9
9
  {name = "Metafold 3D", email = "info@metafold3d.com"},
10
10
  ]
@@ -579,6 +579,23 @@ jobs:
579
579
  - force-displacement
580
580
  assets:
581
581
  data: force-displacement
582
+ reduce-results:
583
+ type: sim/postprocess/reduce-results
584
+ needs:
585
+ - compress
586
+ - von-mises-stress
587
+ - effective-strain
588
+ - particle-displacement
589
+ assets:
590
+ data:
591
+ - job: compress
592
+ asset: output
593
+ - job: von-mises-stress
594
+ asset: output
595
+ - job: effective-strain
596
+ asset: output
597
+ - job: particle-displacement
598
+ asset: output
582
599
  """
583
600
  assert yaml_str.strip() == expected_yaml.strip()
584
601
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes