editeodoro / Bbarolo

Bbarolo is a 3D fitting tool to derive the kinematics of galaxies from emission-line observations.
http://editeodoro.github.io/Bbarolo/
GNU General Public License v2.0
30 stars 8 forks source link

strange allocation of memory #1

Closed Punzo closed 9 years ago

Punzo commented 9 years ago

Dear Enrico,

I have noticed a strange behavior of the code (the GUI version) in the case no file par is furnished and the WCSlib return an error. My installation is running on ubuntu 14.04 64bit and I compiled the source using the following version of the prerequisites: -cfitsio3370 -wcslib5.5 -fftw3.3.4 -Qt4.8.5 -gnuplot 4.6 patchlevel 5 -python2.7.8 with astropy

Here is an output of the log file using this datacube: https://www.dropbox.com/s/1qf2xkf78lji86c/N2403.fits?dl=0 (wcsgrid5.5 doesn't complain using this datacube)

BaroloGUI log:

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -------------------------- Parameters -------------------------

Image to be analysed..............................[FitsFile] = /media/Storage/PhD_Groningen/Slicer_data/prova12/N2403.fits

Checking for bad channels in the cube........[checkChannels] = false Using Robust statistics?...................[flagRobustStats] = true Searching for sources in cube?..................[flagSearch] = false Fitting velocity field with a ring model?.........[flagRing] = false Saving the global profile?...................[globalProfile] = false Saving 0th moment map to FITS file?...............[totalMap] = false Saving 1th moment map to FITS file?............[velocityMap] = false Saving 2th moment map to FITS file?..........[dispersionMap] = false Smoothing the datacube?.............................[SMOOTH] = false Fitting a 3D model to the datacube?.................[GALFIT] = true Sub-region to be used?..............................[BOX] = NONE Number of radii..................................[NRADII] = 0 Separation between radii (arcsec)................[RADSEP] = 29.66 X center of the galaxy (pixel).....................[XPOS] = 150.00 Y center of the galaxy (pixel).....................[YPOS] = 150.00 Systemic velocity of the galaxy (km/s).............[VSYS] = 0 Initial global rotation velocity (km/s)............[VROT] = 0 Initial global velocity dispersion (km/s).........[VDISP] = 0 Initial global inclination (degrees)................[INC] = 0 Initial global position angle (degrees)..............[PA] = 0 Scale height of the disk (arcsec)....................[Z0] = 0 Global column density of gas (atoms/cm2)...........[DENS] = 1 Parameters to be minimized.........................[FREE] = VROT VDISP INC PA Type of mask?......................................[MASK] = SMOOTH What side of the galaxy to be used.................[SIDE] = B Layer type along z direction......................[LTYPE] = gaussian Function to be minimized..........................[FTYPE] = |m-o| Weighting function................................[WFUNC] = cos(θ)^2 Minimization tolerance..............................[TOL] = 0.001 Two stages minimization?.......................[TWOSTAGE] = true Degree of polynomial fitting angles?............[POLYN] = bezier Estimating errors?...........................[flagErrors] = false


Opening file /media/Storage/PhD_Groningen/Slicer_data/prova12/N2403.fits Reading 300 x 300 x 62 pixels FITS file... Done.

Cannot convert to wcs. WCS error code = 9: stat=3 : One or more of the world coordinates were invalid Creating mask for the fit (SMOOTH) ... Done.

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

at this point seems to be stacked, no step further is done, but a huge amount of ram start to be used (16 GB in few seconds).

Inserting a par file (even a "wrong" one) seems that fix the memory allocation problem.

I experienced the issue with also others datacube (like with NAXIS=4) for which WCSlib complain (I think WCS error code =4).

Of course, I think is not your job fixing the datacubes automatically (it is apt to the user to give the proper header following the WCS "rules"), however you can fix the strange memory allocation behavior if it is something not related only to my installation.

Thanks,

Cheers,

Davide.

editeodoro commented 9 years ago

Hi Davide, thank you for reporting this issue. The problem was related to a bad memory allocation when the number of rings was set to zero (in this case, the code tried to allocate a chunk of memory sized as INT_MAX!!). Now the bug is fixed in the source code, I will recompile the binaries asap.

Cheers,

Enrico

Punzo commented 9 years ago

Very good!

Cheers,

Davide.