PYME.localization.FitFactories.fitCommon module¶
Created on Sat Apr 12 17:58:51 2014
@author: david
- PYME.localization.FitFactories.fitCommon.fmtSlicesUsed(slicesUsed)¶
- PYME.localization.FitFactories.fitCommon.pack_results(dtype, tIndex, fitResults, fitError=None, startParams=None, slicesUsed=None, resultCode=-1, **kwargs)¶
Pack fit results into a structured array of the given dtype
Collects logic from fit factories to a central place which hopefully makes it easier to maintain.
- Parameters
- dtypenp.dtype
the numpy dtype of the structured array we want to pack into
- tIndexint
the current frame number
- fitResultsnp.ndarray
the fit parameters in the order they are defined in the dtype
- fitErrornp.ndarray
the fit errors in the order they are defined in the dtype
- startParamsnp.ndarray, optional
the start parameters in the order they are defined in the dtype
- slicesUsedtuple, optional
a 3-tuple of slice objects (xslice, yslice, zslice) that define the ROI used for this molecule
- resultCodeint, optional
the result code as returned by the fitting routine
- **kwargsdict, optional
any additional information which gets stored in the structured array, either a scalar or a numpy array
- Returns
- np.recarray
The packed results array
- TODOS:
- Support length mismatch on data
- FIXME: This currently uses tuples which is really gross for a number of reasons (e.g. moves what should be a numpy
- low level c loop into python, relies on implicitly coercing types rather than doing it explicitly). For some
- reason it is currently faster than assigning to views into an array even though it really should be quite a
- lot slower. If numpy history is anything to go by, it’s also quite likely to break at some point in the future.
- PYME.localization.FitFactories.fitCommon.pickleSlice(slice)¶
- PYME.localization.FitFactories.fitCommon.replNoneWith1(n)¶
- PYME.localization.FitFactories.fitCommon.unpickleSlice(start, stop, step)¶