Unsupported operand types(s) for *: 'NoneType' and 'float'

Hello,

I am just getting started with CPA. I could play around with the example file and I am now trying to use the tool for my own project…

After exporting the database I can explore the images from CPA and the labels appear in the right place (nuclei centroids) when calling “Show cell numbers” but I keep getting this error message after displaying the labels:

An error occurred in the program:
TypeError: unsupported operand type(s) for *: ‘NoneType’ and ‘int’

Traceback (most recent call last):
File “imageviewer.pyc”, line 86, in OnPaint

Then the program eventually crashes when gathering some nuclei from the classifier module. Peeking at the properties file of CPA example data set I saw that some channels are defined which is different to my project where I load 3 images per cycle (3 channels) from single images (8-bit tif) without associating them to channels… might that be the problem? How can I fix it?

Best,
Sébastien

Hello again,

I made some progress and could identify that the cause is in fact not related to channel assignment but to having two “Identify Primary Objects” modules (nuclei and foci) that are related (in the same way as in one of the example projects). The spreadsheets are exported correctly (the foci count per nucleus is good) but this configuration seems incompatible with CPA. I cannot afford using “IdentifySecondaryObjects” for the foci detection because the options I want to use are not available for secondary objects (concretely split clumped object by intensity). By the way since detecting foci within nucleus must be one of the most typical task I do not get why the option is not available and one should use cropping + object relationship instead (as in the example)… is there something I did not get there?

Anybody could use CPA with such configuration? Any idea?
Best,
Sébastien

Now it is working: Only the “Nuclei” measurements had to be exported to the database, it does not work when all measurements are exported - I guess because then CPA cannot determine which one is the object to consider. The error message was not exactly specific… this could certainly be improved by adding a warning or somehow allowing multiple object types.

S.

Hi Sebastien,

Glad you found CPAnalyst. You seem to have answered most of your own questions which is great and thanks for posting, and also the reason I didn’t need to answer more quickly myself! I did answer a similar question here:
viewtopic.php?f=12&t=3577&p=10215&hilit=IdentifyPrimaryObjects#p10215
in which the answer was the same - you need to choose only a single object to classify in CPA, and the simplest method is to export to separate per_object tables.

The warning we give is in CellProfiler itself, in ExportToDatabase. There should be a yellow warning indicator if you are exporting objects that do not have a 1-to-1 relationship to a single per_object table. We have always thought that the most common image processing tasks would be IDPrimary -> IDSecondary, but per-nucleus foci counting obviously doesn’t fall into this category. Unfortunately, we don’t have funding to support continued development of CPA beyond bug fixes. This is not a bug, per se, but I do appreciate your concern about the lack of a clear error message – on the other hand, we do have this Forum! :smile:

Note that if you post your properties file here, we might be able to diagnose any future CPA issues more readily.

Cheers,
David