// Drop any segments where the C value is None
new_segs = []
for seg, ncop in zip(segarr.copy(), copies):
if ncop is None:
continue
new_segs.append(seg._replace(
log2=math.log((ncop or 0.5) / ploidy, 2)))
yield segarr.as_rows(new_segs)
After Change
for copies in theta["C"]:
// Drop any segments where the C value is None
mask_drop = np.array([c is None for c in copies], dtype="bool")
segarr = segarr[~mask_drop].copy()
ok_copies = np.array([c for c in copies if c is not None], dtype="int")
// Replace remaining segment values with these integers
segarr["cn"] = ok_copies.copy()
ok_copies[ok_copies == 0] = 0.5