CN: per-probe LRR noise from the batch reference (CYTO-042), --probe-lrr-sd/--no-probe-lrr-sd
This commit is contained in:
1 parent
a04091a701
commit
c9aacf7d51
6 files changed
+67
-7
No files matched your search
@@ -249,3 +249,18 @@ def test_mf_refinements() -> None: # CYTO-018 / CYTO-041
|
||||
mixed = hom.copy()
|
||||
mixed[:8] = 2
|
||||
assert not complete_loss(mixed, np.full(30, 0.3))
|
||||
|
||||
|
||||
def test_probe_lrr_noise() -> None: # CYTO-042
|
||||
from simurg.cn.model import reference_lrr_spread
|
||||
from simurg.pipeline.cn import _lrr_noise
|
||||
|
||||
rng = np.random.default_rng(5)
|
||||
sd = np.array([0.1] * 50 + [0.3] * 50)
|
||||
lrr = (rng.normal(0, 1, (40, 100)) * sd + rng.normal(0, 0.2, (40, 1))).astype(np.float32) # + sample offsets
|
||||
spread = reference_lrr_spread(lrr, np.zeros(100, dtype=np.float32))
|
||||
assert abs(float(np.median(spread[:50])) - 0.1) < 0.02 and abs(float(np.median(spread[50:])) - 0.3) < 0.05
|
||||
auto = np.ones(100, dtype=np.bool_)
|
||||
s = _lrr_noise(0.2, auto, spread)
|
||||
assert np.median(s[50:]) / np.median(s[:50]) > 2
|
||||
assert np.all(_lrr_noise(0.2, auto, None) == 0.2)
|
||||
Reference in new issue
Block a user