thomasorb / orcs

ORCS is an analysis engine for SITELLE spectral cubes.
GNU General Public License v3.0
9 stars 6 forks source link

Seg fault on attempting to print ifit *_gvar results in _fit_integrated_spectra #32

Open Lyalpha opened 6 years ago

Lyalpha commented 6 years ago

When running

from orcs.process import SpectralCube
cube = SpectralCube('data/SN3/NGC6946_SN3.merged.cm1.1.0.hdf5', debug=True)
cube.map_sky_velocity(80., div_nb=4)

I get a Segmentation fault (core dumped), output is below. I'm running the latest master versions of orb/orcs. From stepping through the code with python debugger - I get to this point in the code:

...
...
 [==========] [100%] [completed in 13.9 s]                                    
180130-13:46:50|parallel:87:close_pp_server|DEBUG> ncpus: 8,  njobs: 4, rworker: None, time: 32.7136440277
> /home/jdl/research/work/NGC6946_SITELLE/build/bdist.linux-x86_64/egg/orcs/core.py(733)_fit_integrated_spectra()
-> lines = gvar.mean(self.inputparams.allparams.pos_guess)
(Pdb) n
> /home/jdl/research/work/NGC6946_SITELLE/build/bdist.linux-x86_64/egg/orcs/core.py(736)_fit_integrated_spectra()
-> for iregion in range(len(regions)):
(Pdb) s
> /home/jdl/research/work/NGC6946_SITELLE/build/bdist.linux-x86_64/egg/orcs/core.py(737)_fit_integrated_spectra()
-> ifit, ispectrum = all_fit[iregion]
(Pdb) s
> /home/jdl/research/work/NGC6946_SITELLE/build/bdist.linux-x86_64/egg/orcs/core.py(739)_fit_integrated_spectra()
-> if ifit != []:
(Pdb) s
> /home/jdl/research/work/NGC6946_SITELLE/build/bdist.linux-x86_64/egg/orcs/core.py(741)_fit_integrated_spectra()
-> all_fit_results = list()
(Pdb) s
> /home/jdl/research/work/NGC6946_SITELLE/build/bdist.linux-x86_64/egg/orcs/core.py(742)_fit_integrated_spectra()
-> logging.info('Velocity of the first line (km/s): {}'.format(ifit['velocity_gvar'][0]))
(Pdb) s
Segmentation fault (core dumped)

In the debugger, if I try to even print ifit['velocity_gvar'] I get a seg fault. I can print ifit['velocity'] and ifit['velocity_err'], however, and the numbers seem sensible. If I try to print other *_gvar entries I also get a seg fault.

Simply commenting out the line that is attempting to print velocity_gvar acts as a workaround for me to get the results from map_sky_velocity.

simon-prunet commented 6 years ago

Hello @Lyalpha @thomasorb, I had the same problem, and just submitted two pull requests (on orcs and orb) with a fix. See https://github.com/simon-prunet/orcs/commits/next and https://github.com/simon-prunet/orb/commits/next (sorry I don't know how to create a link to a specific commit :)

simon-prunet commented 6 years ago

Hello @Lyalpha I think @thomasorb is away for a few weeks, so you might want to try the fix from my github account directly (see links above). Let me know if it solves things for you.

Lyalpha commented 6 years ago

Yep, since your commit removes that print line (and seems to do some more stuff) it fixes it also.

simon-prunet commented 6 years ago

Good ! Thanks for the feedback. The solution was similar to what @thomasorb did in fixing issue #4, i.e. split the gvar variables into mean and stdev arrays when pickling the parameter dictionaries for parallel processing. I'll let @thomasorb review this, and eventually close the issue if he's happy with the solution.