simonsobs / sotodlib

Simons Observatory: Time-Ordered Data processing library.
MIT License
16 stars 19 forks source link

plot_flag_stats error with jumps #974

Closed davidvng closed 1 month ago

davidvng commented 2 months ago

Found an error within plot_flag_stats after jumps during some preprocess runs . It seemed to happen specifically for mv18 in this case, but not fully convinced that's completely correlated. Will need to add handling for this.

394.749: ERROR: obs_1710033028_satp1_1111111 ['ufm_mv18_1709863558_tune']
<class 'ValueError'>: zero-size array to reduction operation minimum which has no identity
  File "/global/u1/d/davidvng/sotodlib/sotodlib/site_pipeline/update_preprocess_plots.py", line 113, in plot_preprocess_tod
    pipe.run(aman, aman.preprocess, update_plot=True)
  File "/global/homes/d/davidvng/.local/soconda/20240903_0.1.4/lib/python3.11/site-packages/sotodlib/preprocess/pcore.py", line 462, in run
    process.plot(aman, proc_aman, filename=os.path.join(self.plot_dir, '{ctime}/{obsid}', f'{step+1}_{{name}}.png'))
  File "/global/homes/d/davidvng/.local/soconda/20240903_0.1.4/lib/python3.11/site-packages/sotodlib/preprocess/processes.py", line 341, in plot
    plot_flag_stats(aman, proc_aman[name], flag_type='jumps', filename=filename.replace('{name}', f'{ufm}_jumps_stats'))
  File "/global/homes/d/davidvng/.local/soconda/20240903_0.1.4/lib/python3.11/site-packages/sotodlib/preprocess/preprocess_plot.py", line 479, in plot_flag_stats
    binmin = int(np.floor(np.min(glitchlog)))
                          ^^^^^^^^^^^^^^^^^
  File "/global/common/software/sobs/perlmutter/conda_envs/soconda_20240903_0.1.4/lib/python3.11/site-packages/numpy/core/fromnumeric.py", line 2953, in min
    return _wrapreduction(a, np.minimum, 'min', axis, None, out,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/global/common/software/sobs/perlmutter/conda_envs/soconda_20240903_0.1.4/lib/python3.11/site-packages/numpy/core/fromnumeric.py", line 88, in _wrapreduction
    return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^