ccpem/mrcfile

Complex valued data in mrcfile gives warnings.

jmp1985 opened this issue · 1 comments

Hi Colin

I thought I would add a github ticket to cover what we discussed earlier.

When I save a complex valued mrc file I get the following warnings.

/home/upc86896/Software/env/dev/lib/python3.9/site-packages/numpy/core/records.py:516: ComplexWarning: Casting complex values to real discards the imaginary part
  return self.setfield(val, *res)
/home/upc86896/Software/env/dev/lib/python3.9/site-packages/numpy/core/_methods.py:178: ComplexWarning: Casting complex values to real discards the imaginary part
  ret = umr_sum(arr, axis, dtype, out, keepdims, where=where)
/home/upc86896/Software/env/dev/lib/python3.9/site-packages/numpy/core/_methods.py:211: ComplexWarning: Casting complex values to real discards the imaginary part
  arrmean = umr_sum(arr, axis, dtype, keepdims=True, where=where)

What metadata to store is obviously poorly defined but perhaps we can set these values to NaN in the header.

I've fixed this as discussed in the pull request, by taking your code and adjusting it to leave the min, max and mean fields at their default un-set values rather than using NaN. Thanks for the contribution!