radiasoft/rsbeams

Handle empty distributions consistently in Switchyard

Opened this issue · 0 comments

Reading an empty distribution file from elegant results in an error right now:

File "/home/vagrant/.pyenv/versions/3.7.2/envs/py3/lib/python3.7/site-packages/rsbeams/rsdata/switchyard.py", line 39, in read_elegant
    particle_data[:, i] = sdds_data[col][:]
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices

This can be sidestepped and we can read and write empty distribution files. This appears to already be the case for the OPAL read/write. It might be better to just make this an error though.