loop_spe_multiprocessing not parallel any more
Since we updated to MPDAF v1.2 on some machines here, I find that a piece of code that I used to compute the S/N for Voronoi binning is not using more than 100% CPU any more, i.e. does not run in parallel.
Was something done to loop_spe_multiprocessing()
to break it between 1.1.16 and 1.2 or do I have to use it differently?
def f_SN(spec, lmin, lmax):
scut = spec.get_lambda(lmin, lmax = lmax)
sn = scut.data / np.sqrt(scut.var)
if scut.data.count() > 0 and sn.count() > 0:
return sn.mean()
return 0.
def SN_par(filename, outfilename):
print 'Opening %s.' % filename
cube = mpdaf.obj.Cube(filename)
print 'Opened %s.' % filename
# create image of mean S/N of the continuum
sn = cube.loop_spe_multiprocessing(f = f_SN, lmin = 5600., lmax = 6500.)
print 'Will write to %s.' % outfilename
sn.write(outfilename)