def _parallel_bls_worker(task):
try:<EOL><INDENT>times, mags, errs = task[:<NUM_LIT:3>]<EOL>magsarefluxes = task[<NUM_LIT:3>]<EOL>minfreq, nfreq, stepsize = task[<NUM_LIT:4>:<NUM_LIT:7>]<EOL>ndurations, mintransitduration, maxtransitduration = task[<NUM_LIT:7>:<NUM_LIT:10>]<EOL>blsobjective, blsmethod, blsoversample = task[<NUM_LIT:10>:]<EOL>frequencies = minfreq + nparange(nfreq)*stepsize<EOL>periods = <NUM_LIT:1.0>/frequencies<EOL>durations = nplinspace(mintransitduration*periods.min(),<EOL>maxtransitduration*periods.min(),<EOL>ndurations)<EOL>if magsarefluxes:<EOL><INDENT>blsmodel = BoxLeastSquares(<EOL>times*u.day,<EOL>mags*u.dimensionless_unscaled,<EOL>dy=errs*u.dimensionless_unscaled<EOL>)<EOL><DEDENT>else:<EOL><INDENT>blsmodel = BoxLeastSquares(<EOL>times*u.day,<EOL>mags*u.mag,<EOL>dy=errs*u.mag<EOL>)<EOL><DEDENT>blsresult = blsmodel.power(<EOL>periods*u.day,<EOL>durations*u.day,<EOL>objective=blsobjective,<EOL>method=blsmethod,<EOL>oversample=blsoversample<EOL>)<EOL>return {<EOL>'<STR_LIT>': blsresult,<EOL>'<STR_LIT>': blsmodel,<EOL>'<STR_LIT>': durations,<EOL>'<STR_LIT>': nparray(blsresult.power)<EOL>}<EOL><DEDENT>except Exception as e:<EOL><INDENT>LOGEXCEPTION('<STR_LIT>' %<EOL>(frequencies[<NUM_LIT:0>], frequencies[-<NUM_LIT:1>]))<EOL>return {<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': durations,<EOL>'<STR_LIT>': nparray([npnan for x in range(nfreq)]),<EOL>}<EOL><DEDENT>
This wraps Astropy's BoxLeastSquares for use with bls_parallel_pfind below.

`task` is a tuple::

    task[0] = times
    task[1] = mags
    task[2] = errs
    task[3] = magsarefluxes

    task[4] = minfreq
    task[5] = nfreq
    task[6] = stepsize

    task[7] = ndurations
    task[8] = mintransitduration
    task[9] = maxtransitduration

    task[10] = blsobjective
    task[11] = blsmethod
    task[12] = blsoversample