Cellprofiler: ComplexWarning: Casting complex values to real discards the imaginary part

Created on 15 Sep 2015  路  1Comment  路  Source: CellProfiler/CellProfiler

test_05_01_power (cellprofiler.modules.tests.test_makeprojection.TestMakeProjection) ... /home/travis/build/CellProfiler/CellProfiler/cellprofiler/modules/makeprojection.py:450: ComplexWarning: Casting complex values to real discards the imaginary part

  cached_image = (cached_image * np.conj(cached_image)).astype(np.float32)

ok
Bug

Most helpful comment

https://github.com/CellProfiler/CellProfiler/blob/master/cellprofiler/modules/makeprojection.py#L450
Imaginary part should be zero, but roundoff will leave a small imaginary fraction.

cached_image = (cached_image * np.conj(cached_image)).real.astype(np.float32)

should fix this.

>All comments

https://github.com/CellProfiler/CellProfiler/blob/master/cellprofiler/modules/makeprojection.py#L450
Imaginary part should be zero, but roundoff will leave a small imaginary fraction.

cached_image = (cached_image * np.conj(cached_image)).real.astype(np.float32)

should fix this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bethac07 picture bethac07  路  7Comments

0x00b1 picture 0x00b1  路  5Comments

imagejan picture imagejan  路  8Comments

katrinleinweber picture katrinleinweber  路  3Comments

burgerga picture burgerga  路  8Comments