Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions celerpy/model/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Comment thread
sethrj marked this conversation as resolved.

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."""
Expand Down
50 changes: 45 additions & 5 deletions test/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}'
)
Comment thread
sethrj marked this conversation as resolved.
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,
)