get_turnaround_flags(method="scanspeed") can fail with:
ValueError: cannot convert float NaN to integer
packages/sotodlib/tod_ops/flags.py", in
get_turnaround_flags
approx_samps_onescan = int(np.ptp(az) / approx_daz)
ValueError: cannot convert float NaN to integer
Cause: in line 220: approx_daz = np.median(daz[daz>np.percentile(daz, 95)])
|
approx_daz = np.median(daz[daz>np.percentile(daz, 95)]) |
In simulations with constant scan speed, daz is discrete and often: p95 == max(daz)
So:
- daz > p95 --> empty array
- median --> NaN
daz > p95 is too strict for regular simulations with stable scan speed where p95 == max(daz), leading to an empty selection and NaN; using >= avoids this.
I noted in simulations:
count(daz > p95) = 0
count(daz >= p95) > 0
Fix:
Use: approx_daz = np.median(daz[daz >= np.percentile(daz, 95)])
I checked that this solves the ValueError that often fails for my simulations. If this solution is accepted, I can open a PR.
get_turnaround_flags(method="scanspeed")can fail with:ValueError: cannot convert float NaN to integer
Cause: in line 220:
approx_daz = np.median(daz[daz>np.percentile(daz, 95)])sotodlib/sotodlib/tod_ops/flags.py
Line 220 in f915bfa
In simulations with constant scan speed,
dazis discrete and often:p95 == max(daz)So:
daz > p95is too strict for regular simulations with stable scan speed wherep95 == max(daz), leading to an empty selection and NaN; using>=avoids this.I noted in simulations:
count(daz > p95) = 0
count(daz >= p95) > 0
Fix:
Use:
approx_daz = np.median(daz[daz >= np.percentile(daz, 95)])I checked that this solves the ValueError that often fails for my simulations. If this solution is accepted, I can open a PR.