STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
test_layer1_tilt_preference.py
Go to the documentation of this file.
1"""The spray fan should point straight down the chamber: tilt preference around 0 deg.
2
3Positive tilt is OUTWARD (toward the liner). Inward lean is allowed at the plain quadratic cost;
4outward costs ``outward_multiplier`` times as much. The hard wall guard is separate.
5"""
6import pytest
7
9 _impinging_resultant_tilt_preference as pref,
10)
11
12
14 assert pref(0.0) == 0.0
15 assert pref(-2.0, scale_deg=2.0) == pytest.approx(1.0)
16 assert pref(-4.0, scale_deg=2.0) == pytest.approx(4.0)
17
18
20 assert pref(1.0, scale_deg=2.0, outward_multiplier=25.0) == pytest.approx(25.0 * pref(-1.0, scale_deg=2.0))
21 assert pref(0.5, outward_multiplier=25.0) > pref(-2.0, outward_multiplier=25.0)
22
23
25 assert pref(None) == 0.0
26 assert pref(float("nan")) == 0.0
27
28
30 import inspect
31 from engine.optimizer.layers import layer1_static_optimization as L
32 src = inspect.getsource(L.run_layer1_optimization)
33 assert "'layer1_W_TILT': layer1_W_TILT" in src
34 assert "resultant_tilt_penalty" in inspect.getsource(L._compute_objective_value)