if one uses no-Alex configuration, advanced sorting will fail.
Solution is to move S = trace.stoi[: trace.first_bleach] to else statement:
elif setup == "advanced":
conditions = []
E = trace.fret[: trace.first_bleach]
# TODO: write a warning that stoichiometry will be ignored?
if lib.math.contains_nan(trace.red.int):
cond1 = True
else:
S = trace.stoi[: trace.first_bleach]
cond1 = S_med_lo < np.median(S) < S_med_hi