SoFiA icon indicating copy to clipboard operation
SoFiA copied to clipboard

Make cubelet generation more stable

Open gigjozsa opened this issue 4 years ago • 6 comments

It may happen that there is a nan for the centre of mass, in which case Sofia refuses to work. To address this, you may consider to replace:

https://github.com/SoFiA-Admin/SoFiA/blob/ac84cb9adfa6a0c2ade739e3db2636fbdf096629/sofia/cubelets.py#L57-L60

with

# If centre of mass estimation is wrong replace by geometric centre
		if Xc < 0 or Xc > cubeDim[2] - 1 or np.isnan(Xc): Xc = obj[cathead == "x_geo"][0]
		if Yc < 0 or Yc > cubeDim[1] - 1 or np.isnan(Yc): Yc = obj[cathead == "y_geo"][0]
		if Zc < 0 or Zc > cubeDim[0] - 1 or np.isnan(Zc): Zc = obj[cathead == "z_geo"][0]

gigjozsa avatar Nov 13 '20 16:11 gigjozsa

@gigjozsa thanks for the message. Do you understand why you got a NaN there in the first place? In principle NaN voxels should. not be included in the mask. If that is happening in your case we should fix it. It would be good to know whether the NaN got included by S+C (unlikely) or by mask dilation.

paoloserra avatar Nov 16 '20 08:11 paoloserra

I feared the question. I encountered the problem once myself and then more recently with @samueltwum1 , when we followed up on it (entering this issue). @samueltwum1 , could you perhaps post you sofia config file here?

gigjozsa avatar Nov 16 '20 08:11 gigjozsa

Not sure the config file is useful. I'd find it more useful if you could inspect the cube and mask at the position of the trouble-making object to see whether there is a NaN in the mask.

paoloserra avatar Nov 16 '20 08:11 paoloserra

OK, sure, will take a bit.

gigjozsa avatar Nov 16 '20 08:11 gigjozsa

Sorry I'm late to this thread. @paoloserra I also have the pipeline log saved if that's any useful for you

samueltwum1 avatar Nov 16 '20 20:11 samueltwum1

I also have the pipeline log saved if that's any useful for you

Sure, but see above. We need to understand whether the mask includes NaN voxels. That can only be established by inspecting the cube and the mask.

paoloserra avatar Nov 16 '20 20:11 paoloserra