From 14bb2c54fb8a009efffe4166c3517164d689256d Mon Sep 17 00:00:00 2001 From: Seth R Johnson Date: Tue, 2 Jun 2026 14:21:03 -0400 Subject: [PATCH 1/2] Make csg levels optional and delete unused struct --- celerpy/model/output.py | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/celerpy/model/output.py b/celerpy/model/output.py index 1ec781f..6255e50 100644 --- a/celerpy/model/output.py +++ b/celerpy/model/output.py @@ -55,23 +55,13 @@ class OrangeScalars(_Model): max_intersections: NonNegativeInt "Maximum number of surface intersections along a ray" - max_csg_levels: NonNegativeInt - "Maximum CSG logic tree depth" + max_csg_levels: Optional[NonNegativeInt] = None + "Maximum CSG logic tree depth unless using infix" tol: Tolerance "Construction and tracking tolerance" -# orange/OrangeParamsOutput.hh -class BihSizes(_Model): - """Bounding Interval Hierarchy tree sizes.""" - - bboxes: NonNegativeInt - internal_nodes: NonNegativeInt - leaf_nodes: NonNegativeInt - local_volume_ids: NonNegativeInt - - # orange/OrangeParamsOutput.hh class BihMetadata(_Model): """Bounding Interval Hierarchy characteristics.""" From 9e3a5fe934819e29ab4b881aa011973a60ab308e Mon Sep 17 00:00:00 2001 From: Seth R Johnson Date: Wed, 3 Jun 2026 07:01:52 -0400 Subject: [PATCH 2/2] Remove old test and add params output test --- test/test_model.py | 50 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 45 insertions(+), 5 deletions(-) diff --git a/test/test_model.py b/test/test_model.py index 22d819e..f5e8c3c 100644 --- a/test/test_model.py +++ b/test/test_model.py @@ -49,10 +49,50 @@ def test_orange_stats_serialization(): assert result == {"_cmd": "orange_stats"} -def test_bih_load(): - result = moutput.BihSizes.model_validate_json( - '{"bboxes":8,"internal_nodes":0,"leaf_nodes":1,"local_volume_ids":7}' +def test_orange_output(): + # See UniversesTest + result = moutput.OrangeParamsOutput.model_validate_json( + '{"_category":"internal","_label":"orange","bih_metadata":{"depth":[4,3,1],"num_finite_bboxes":[4,4,1],"num_infinite_bboxes":[1,0,0]},"scalars":{"num_univ_levels":3,"max_faces":14,"max_intersections":14,"tol":{"abs":1.5e-08,"rel":1.5e-08}},"sizes":{"bih":{"bboxes":12,"internal_nodes":6,"leaf_nodes":9,"local_volume_ids":10},"connectivity_records":25,"daughters":3,"local_surface_ids":55,"local_volume_ids":21,"logic_ints":164,"obz_records":0,"real_ids":25,"reals":24,"rect_arrays":0,"simple_units":3,"surface_types":25,"transforms":3,"universe_indexer":{"surfaces":4,"volumes":4},"univ_indices":3,"univ_types":3,"volume_ids":12,"volume_instance_ids":12,"volume_records":12},"tracking_logic":"infix"}' ) - assert result == moutput.BihSizes( - bboxes=8, internal_nodes=0, leaf_nodes=1, local_volume_ids=7 + assert result == moutput.OrangeParamsOutput( + scalars=moutput.OrangeScalars( + num_univ_levels=3, + max_faces=14, + max_intersections=14, + max_csg_levels=None, + tol=moutput.Tolerance(rel=1.5e-08, abs=1.5e-08), + ), + sizes={ + "bih": { + "bboxes": 12, + "internal_nodes": 6, + "leaf_nodes": 9, + "local_volume_ids": 10, + }, + "connectivity_records": 25, + "daughters": 3, + "local_surface_ids": 55, + "local_volume_ids": 21, + "logic_ints": 164, + "obz_records": 0, + "real_ids": 25, + "reals": 24, + "rect_arrays": 0, + "simple_units": 3, + "surface_types": 25, + "transforms": 3, + "universe_indexer": {"surfaces": 4, "volumes": 4}, + "univ_indices": 3, + "univ_types": 3, + "volume_ids": 12, + "volume_instance_ids": 12, + "volume_records": 12, + }, + bih_metadata=moutput.BihMetadata( + num_finite_bboxes=[4, 4, 1], + num_infinite_bboxes=[1, 0, 0], + depth=[4, 3, 1], + structure=None, + ), + tracking_logic=moutput.LogicNotation.INFIX, )