Module Expr Str ImportFrom alias Import alias identifier ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias Assign NameStore AttributeLoad NameLoad attr FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str For TupleStore NameStore NameStore Call NameLoad NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad keyword NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad body Expr Str Assign SubscriptStore NameLoad Index NameLoad NameLoad For TupleStore NameStore NameStore Call NameLoad Call NameLoad NameLoad NameLoad body For TupleStore NameStore NameStore Call NameLoad Call NameLoad NameLoad NameLoad body Assign SubscriptStore NameLoad Index NameLoad NameLoad If CompareIsNot NameLoad NameLoad body Assign SubscriptStore NameLoad Index NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad ListComp Call NameLoad ListComp SubscriptLoad NameLoad Index NameLoad comprehension NameStore NameLoad comprehension NameStore NameLoad Assign NameStore SubscriptLoad NameLoad Index NameLoad Return TupleLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults Num body Expr Str Assign NameStore AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr Str Assign NameStore ListLoad For NameStore NameLoad body Assign NameStore ListComp Call NameLoad BinOpSub NameLoad NameLoad Num comprehension TupleStore NameStore NameStore Call NameLoad NameLoad NameLoad Assign NameStore ListComp Call NameLoad BinOpAdd BinOpAdd NameLoad NameLoad Num NameLoad comprehension TupleStore NameStore NameStore NameStore Call NameLoad NameLoad NameLoad NameLoad Assign NameStore Call NameLoad ListComp Call NameLoad NameLoad NameLoad comprehension TupleStore NameStore NameStore Call NameLoad NameLoad NameLoad Assign NameStore Call NameLoad SubscriptLoad NameLoad Index NameLoad NameLoad Assign NameStore BinOpDiv NameLoad SubscriptLoad NameLoad Index Num Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Slice Num Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad kwarg body Expr Str Assign NameStore BinOpMult ListLoad ListLoad Call NameLoad NameLoad Assign NameStore BinOpMult ListLoad ListLoad Call NameLoad NameLoad Assign NameStore BinOpMult ListLoad ListLoad Call NameLoad NameLoad Assign NameStore BinOpMult ListLoad ListLoad Call NameLoad NameLoad Assign NameStore BinOpMult ListLoad ListLoad Call NameLoad NameLoad Assign NameStore AttributeLoad NameLoad attr Assign NameStore ListLoad For NameStore NameLoad body If Call NameLoad NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr Call NameLoad NameLoad orelse Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call NameLoad NameLoad For NameStore NameLoad body Assign NameStore ListComp NameLoad comprehension TupleStore NameStore NameStore Call NameLoad NameLoad CompareEq NameLoad NameLoad Assign NameStore ListComp SubscriptLoad NameLoad Index NameLoad comprehension NameStore NameLoad Assign NameStore ListComp SubscriptLoad NameLoad Index NameLoad comprehension NameStore NameLoad Assign NameStore ListComp SubscriptLoad NameLoad Index NameLoad comprehension NameStore NameLoad Assign NameStore ListComp SubscriptLoad NameLoad Index NameLoad comprehension NameStore NameLoad Assign NameStore ListComp SubscriptLoad NameLoad Index NameLoad comprehension NameStore NameLoad Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr Str Assign NameStore BinOpSub NameLoad NameLoad Assign NameStore BinOpAdd BinOpAdd NameLoad NameLoad Num For NameStore Call NameLoad Call NameLoad NameLoad body Assign SubscriptStore SubscriptLoad NameLoad ExtSlice Slice Index NameLoad Index Call AttributeLoad NameLoad attr CompareLt SubscriptLoad NameLoad ExtSlice Slice Index NameLoad Num Num For TupleStore NameStore NameStore Call NameLoad NameLoad body Assign SubscriptStore SubscriptLoad NameLoad ExtSlice Slice Index NameLoad Index Call AttributeLoad NameLoad attr CompareGt SubscriptLoad NameLoad ExtSlice Slice Index NameLoad NameLoad NameLoad Assign NameStore NameStore Call AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr Num Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr Num Assign NameStore Call NameLoad ListComp Call NameLoad NameLoad NameLoad comprehension TupleStore NameStore NameStore Call NameLoad NameLoad NameLoad Assign NameStore SubscriptLoad NameLoad Index NameLoad Assign NameStore BinOpSub NameLoad NameLoad Assign NameStore BinOpSub NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr keyword Str For TupleStore NameStore NameStore Call NameLoad NameLoad NameLoad body Assign NameStore Call NameLoad ListComp Call NameLoad NameLoad NameLoad comprehension TupleStore NameStore NameStore Call NameLoad NameLoad NameLoad Assign SubscriptStore NameLoad Index NameLoad NameLoad Assign NameStore ListComp ListComp Call AttributeLoad NameLoad attr NameLoad TupleLoad NameLoad NameLoad comprehension TupleStore NameStore NameStore NameStore NameStore Call NameLoad NameLoad NameLoad NameLoad NameLoad comprehension NameStore NameLoad Assign NameStore ListComp ListComp Call NameLoad ListComp Call AttributeLoad NameLoad attr NameLoad TupleLoad NameLoad NameLoad comprehension NameStore Call NameLoad NameLoad comprehension TupleStore NameStore NameStore NameStore NameStore Call NameLoad NameLoad NameLoad NameLoad NameLoad comprehension NameStore NameLoad Assign NameStore Call NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad If NameLoad body Assign TupleStore NameStore NameStore NameStore NameStore NameStore NameLoad Assign NameStore ListComp ListComp Call AttributeLoad NameLoad attr NameLoad TupleLoad NameLoad NameLoad comprehension TupleStore NameStore NameStore NameStore NameStore Call NameLoad NameLoad NameLoad NameLoad NameLoad comprehension NameStore NameLoad orelse Assign TupleStore NameStore NameStore NameStore NameLoad Assign NameStore ListComp ListComp Call AttributeLoad NameLoad attr NameLoad TupleLoad NameLoad NameLoad comprehension TupleStore NameStore NameStore NameStore NameStore Call NameLoad NameLoad NameLoad NameLoad NameLoad comprehension NameStore NameLoad If NameLoad body Expr Call NameLoad Str Expr Call NameLoad Str NameLoad Str NameLoad Str NameLoad Expr Call NameLoad Str NameLoad Expr Call NameLoad Str NameLoad For TupleStore NameStore NameStore NameStore Call NameLoad NameLoad NameLoad NameLoad body Assign SubscriptStore NameLoad Index NameLoad NameLoad Assign SubscriptStore NameLoad Index NameLoad NameLoad Assign SubscriptStore NameLoad Index NameLoad NameLoad If NameLoad body For TupleStore NameStore NameStore NameStore Call NameLoad NameLoad NameLoad NameLoad body Assign SubscriptStore NameLoad Index NameLoad NameLoad Assign SubscriptStore NameLoad Index NameLoad NameLoad If CompareIs NameLoad NameLoad body Return TupleLoad NameLoad NameLoad NameLoad Return TupleLoad NameLoad NameLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad NameLoad kwarg body Expr Str Assign NameStore AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr If CompareNotEq Call NameLoad NameLoad NameLoad body Raise Call NameLoad Str Assign NameStore ListLoad For NameStore NameLoad body If Call NameLoad NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr Call NameLoad NameLoad orelse Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore ListComp Call AttributeLoad NameLoad attr NameLoad comprehension TupleStore NameStore NameStore Call NameLoad NameLoad NameLoad Assign NameStore Call NameLoad NameLoad Assign NameStore ListLoad For TupleStore NameStore NameStore Call NameLoad NameLoad body If CompareNotEq Call NameLoad NameLoad NameLoad body Assign NameStore Str Raise Call NameLoad BinOpMod NameLoad NameLoad For TupleStore NameStore NameStore Call NameLoad NameLoad body If CompareNotEq Call NameLoad NameLoad SubscriptLoad NameLoad Index NameLoad body Assign NameStore Str Raise Call NameLoad BinOpMod NameLoad TupleLoad NameLoad NameLoad For NameStore NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad If CompareIs NameLoad NameLoad body Assign NameStore ListComp BinOpMult ListLoad TupleLoad NameLoad NameLoad NameLoad comprehension NameStore NameLoad Assign NameStore BinOpMult ListLoad NameLoad NameLoad If CompareNotEq Call NameLoad NameLoad NameLoad body Raise Call NameLoad Str Assign NameStore ListLoad For TupleStore NameStore NameStore Call NameLoad NameLoad body If CompareIs NameLoad NameLoad body Assign NameStore ListComp BinOpMult ListLoad TupleLoad NameLoad NameLoad NameLoad comprehension NameStore NameLoad If CompareNotEq Call NameLoad NameLoad NameLoad body Assign NameStore Str Raise Call NameLoad BinOpMod NameLoad NameLoad For TupleStore NameStore NameStore Call NameLoad NameLoad body If CompareIs NameLoad NameLoad body Assign NameStore BinOpMult ListLoad TupleLoad NameLoad NameLoad SubscriptLoad NameLoad Index NameLoad If CompareNotEq Call NameLoad NameLoad SubscriptLoad NameLoad Index NameLoad body Assign NameStore Str Raise Call NameLoad BinOpMod NameLoad TupleLoad NameLoad NameLoad For TupleStore NameStore NameStore Call NameLoad NameLoad body If CompareIs NameLoad NameLoad body Assign NameStore TupleLoad NameLoad NameLoad If CompareNotEq Call NameLoad NameLoad Num body Assign NameStore Str Raise Call NameLoad BinOpMod NameLoad TupleLoad NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad If CompareNotEq Call NameLoad NameLoad NameLoad body Raise Call NameLoad Str Assign NameStore BinOpAdd Call NameLoad NameLoad NameLoad If CompareIs NameLoad NameLoad body Assign NameStore BinOpMult ListLoad TupleLoad NameLoad NameLoad NameLoad If CompareNotEq Call NameLoad NameLoad NameLoad body Raise Call NameLoad Str Assign NameStore ListLoad For TupleStore NameStore NameStore Call NameLoad NameLoad body If CompareIs NameLoad NameLoad body Assign NameStore TupleLoad NameLoad NameLoad If CompareNotEq Call NameLoad NameLoad Num body Assign NameStore Str Raise Call NameLoad BinOpMod NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore BinOpAdd NameLoad NameLoad If CompareIs NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword Str If CompareNotEq AttributeLoad NameLoad attr NameLoad body Assign NameStore BinOpAdd BinOpAdd BinOpAdd Str Call NameLoad AttributeLoad NameLoad attr Str Call NameLoad NameLoad Raise Call NameLoad NameLoad If NameLoad body Assign SubscriptStore NameLoad Index Str NameLoad Assign NameStore Call NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad If BoolOpAnd CompareIn Str NameLoad SubscriptLoad NameLoad Index Str body Assign TupleStore NameStore NameStore NameStore NameStore NameStore NameLoad orelse Assign TupleStore NameStore NameStore NameLoad Assign NameStore SubscriptLoad NameLoad Slice NameLoad Assign NameStore Call NameLoad Call NameLoad SubscriptLoad NameLoad Slice NameLoad NameLoad Assign NameStore ListComp Call NameLoad NameLoad NameLoad comprehension NameStore NameLoad If CompareIs NameLoad NameLoad body Return TupleLoad NameLoad NameLoad NameLoad Assign NameStore Call NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad Assign NameStore SubscriptLoad NameLoad Slice NameLoad Assign NameStore Call NameLoad Call NameLoad SubscriptLoad NameLoad Slice NameLoad NameLoad Assign NameStore ListComp Call NameLoad NameLoad NameLoad comprehension NameStore NameLoad Return TupleLoad NameLoad NameLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad If CompareNotEq Call NameLoad NameLoad NameLoad body Raise Call NameLoad Str Assign NameStore ListLoad For NameStore NameLoad body If Call NameLoad NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr Call NameLoad NameLoad orelse Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore ListComp Call AttributeLoad NameLoad attr NameLoad comprehension TupleStore NameStore NameStore Call NameLoad NameLoad NameLoad Assign NameStore Call NameLoad NameLoad Assign NameStore ListLoad For TupleStore NameStore NameStore Call NameLoad NameLoad body If CompareNotEq Call NameLoad NameLoad NameLoad body Assign NameStore Str Raise Call NameLoad BinOpMod NameLoad NameLoad For TupleStore NameStore NameStore Call NameLoad NameLoad body If CompareNotEq Call NameLoad NameLoad SubscriptLoad NameLoad Index NameLoad body Assign NameStore Str Raise Call NameLoad BinOpMod NameLoad TupleLoad NameLoad NameLoad For NameStore NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad If CompareNotEq Call NameLoad NameLoad NameLoad body Raise Call NameLoad Str Assign NameStore BinOpAdd Call NameLoad NameLoad NameLoad Return Call NameLoad NameLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore ListLoad Assign NameStore Num For NameStore NameLoad body Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Slice NameLoad BinOpAdd NameLoad NameLoad Assign NameStore BinOpAdd NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad BinOpDiv Call NameLoad NameLoad NameLoad Assign NameStore Call NameLoad Num BinOpAdd Call NameLoad NameLoad Num NameLoad Return ListComp SubscriptLoad NameLoad Slice SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index BinOpAdd NameLoad Num comprehension NameStore Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad NameLoad AttributeLoad NameLoad attr NameLoad NameLoad NameLoad Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr NameLoad Num attr Assign NameStore AttributeLoad NameLoad attr Assign NameStore BinOpSub AttributeLoad NameLoad attr Num Assign NameStore Call AttributeLoad NameLoad attr BinOpDiv NameLoad BinOpSub BinOpSub NameLoad NameLoad Num If CompareIs NameLoad NameLoad body Return BinOpMult ListLoad NameLoad Call NameLoad NameLoad Return BinOpMult NameLoad Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Expr Str Assign NameStore ListComp Call AttributeLoad NameLoad attr Num comprehension NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad NameLoad NameLoad Assign TupleStore NameStore NameStore TupleLoad Call AttributeLoad NameLoad attr Num Call AttributeLoad NameLoad attr Num Assign NameStore Call NameLoad BinOpAdd ListLoad NameLoad NameLoad NameLoad NameLoad For TupleStore NameStore NameStore Call NameLoad NameLoad NameLoad body Assign NameStore BinOpAdd NameLoad Call NameLoad BinOpAdd ListLoad NameLoad NameLoad NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword Str For TupleStore NameStore NameStore Call NameLoad NameLoad NameLoad body Assign NameStore ListComp Call AttributeLoad NameLoad attr Num comprehension NameStore Call NameLoad Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Return Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad Call NameLoad NameLoad NameLoad NameLoad NameLoad Return Call AttributeLoad BinOpMult BinOpSub NameLoad NameLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam defaults kwarg body Expr Str Assign NameStore TupleLoad NameLoad AttributeLoad NameLoad attr NameLoad NameLoad NameLoad Assign NameStore Call NameLoad NameLoad NameLoad keyword NameLoad keyword NameLoad NameLoad Return NameLoad decorator_list
N/A N/A 
Functions for fitting and simulating arbitrary dimensional lineshapes commonly
found in NMR experiments
 __future__ print_function N/A numpy np leastsqbound leastsqbound analysisbase squish lineshapes1d ls_str2class fileio table N/A pi N/A np pi add_to_table N/A N/A rec columns column_names N/A N/A N/A 
    Add (append) multiple columns to a records array.

    Parameters
    ----------
    rec : recarray
        Records array (table).
    columns : list of ndarrays
        List of columns data to append to table.
    column_names : list of str
        List of names of columns.

    Returns
    -------
    nrec : recarray
        Records array with columns added

     N/A N/A col col_name N/A zip columns column_names N/A N/A rec N/A N/A table append_column rec col name col_name N/A rec N/A pack_table N/A N/A pbest abest iers rec param_columns amp_column ier_column N/A None N/A N/A 
    Pack fitting parameters into table

    Parameters
    ----------
    pbest : list
        List of best-fit parameters.  See :py:func:`fit_NDregion` for format.
    abest : list
        List of best-fit amplitudes.
    iers : list
        List of fitting error return values.
    rec : recarray
        Records array (table) to save fitting parameters into. Updated with
        fitting parameter in place.
    param_columns : list
        List of parameter columns in rec. Format is the same as pbest.
    amp_columns : str
        Name of amplitude column in rec.
    ier_column : str or None, optional
        Name of column in rec to save iers to. None will not record this in the
        table.

     N/A N/A rec N/A amp_column abest N/A N/A dbest dcolumns N/A zip N/A zip pbest param_columns N/A N/A N/A p c N/A zip N/A zip dbest dcolumns N/A N/A N/A rec N/A c p N/A N/A ier_column None N/A N/A N/A rec N/A ier_column iers N/A unpack_table N/A N/A rec param_columns amp_column N/A N/A N/A 
    Unpack initial fitting parameters from a table.

    Parameters
    ----------
    rec : recarray
        Records array (table) holding parameters.
    param_columns : list
        List of column names which hold lineshape parameters.  See
        :py:func:`fit_NDregion` for format.
    amp_column : str
        Name of columns in rec holding initial amplitudes.

    Returns
    -------
    params : list
        List of initial parameter in the format required for
        :py:func:`fit_NDregion`.
    amps : list
        List of initial peak amplitudes.

     N/A params N/A zip N/A N/A zip N/A N/A rec N/A c N/A c dc N/A dc param_columns N/A amps N/A rec N/A amp_column N/A N/A params amps N/A estimate_scales N/A N/A spectrum centers box_width scale_axis N/A 0 N/A N/A 
    Estimate scale parameter for peaks in a spectrum.

    Parameters
    ----------
    spectrum : array_like
        NMR spectral data. ndarray or emulated type which can be sliced.
    centers : list
        List of N-tuples indicating peak centers.
    box_width : tuple
        N-tuple indicating box width to add and subtract from peak centers to
        form region around peak to fit.
    scale_axis : int
        Axis number to estimate scale parameters for.

    Returns
    -------
    scales : list
        List of estimated scale parameters.

     N/A shape N/A spectrum shape N/A bcenters N/A N/A np round N/A N/A N/A N/A np array centers astype int N/A scales N/A N/A bc bcenters N/A N/A bmin N/A N/A max N/A c w 0 N/A N/A c w N/A zip bc box_width N/A bmax N/A N/A min N/A N/A c w 1 s N/A N/A c w s N/A zip bc box_width shape N/A s N/A tuple N/A N/A slice mn mx N/A N/A mn mx N/A zip bmin bmax N/A scale N/A squish N/A spectrum N/A s scale_axis N/A scale N/A scale N/A scale N/A 0 N/A N/A N/A scales append N/A scale N/A 1 N/A scales N/A fit_spectrum N/A N/A spectrum lineshapes params amps bounds ampbounds centers rIDs box_width error_flag verb N/A True kw N/A N/A 
    Fit a NMR spectrum by regions which contain one or more peaks.

    Parameters
    ----------

    spectrum : array_like
        NMR data. ndarray or emulated type, must be slicable.
    lineshape :list
        List of lineshapes by label (str) or a lineshape class. See
        :py:func:`fit_NDregion` for details.
    params : list
        P-length list (P is the number of peaks in region) of N-length lists
        of tuples where each each tuple is the optimiztion starting parameters
        for a given peak and dimension lineshape.
    amps : list
        P-length list of amplitudes.
    bounds : list
        List of bounds for parameter of same shape as params.  If none of the
        parameters in a given dimension have limits None can be used,
        otherwise each dimension should have a list or tuple of (min,max) or
        None for each parameter. min or max may be None when there is no
        bounds in a given direction.
    ampbounds : list
        P-length list of bounds for the amplitude with format similar to
        bounds.
    centers : list
        List of N-tuples indicating peak centers.
    rIDs : list
        P-length list of region numbers.  Peak with the same region number
        are fit together.
    box_width : tuple
        Tuple of length N indicating box width to add and subtract from peak
        centers to form regions around peak to fit.
    error_flag : bool
        True to estimate errors for each lineshape parameter and amplitude.
    verb : bool, optional
        True to print a summary of each region fit, False (the default)
        supresses all printing.
    **kw : optional
        Additional keywords passed to the scipy.optimize.leastsq function.

    Returns
    -------
    params_best : list
        Optimal values for lineshape parameters with same format as params
        input parameter.
    amp_best : list
        List of optimal peak amplitudes.
    param_err : list, only returned when error_flag is True
        Estimated lineshape parameter errors with same format as params.
    amp_err : list, only returned when error_flag is True
        Estimated peak amplitude errors.
    iers : list
        List of interger flag from scipy.optimize.leastsq indicating if the
        solution was found for a given peak.  1,2,3,4 indicates that a
        solution was found. Other indicate an error.

     N/A pbest N/A N/A N/A N/A len params N/A pbest_err N/A N/A N/A N/A len params N/A abest N/A N/A N/A N/A len params N/A abest_err N/A N/A N/A N/A len params N/A iers N/A N/A N/A N/A len params N/A shape N/A spectrum shape N/A ls_classes N/A N/A l lineshapes N/A N/A N/A isinstance l str N/A N/A N/A N/A ls_classes append N/A ls_str2class l N/A N/A N/A N/A ls_classes append l N/A cIDs N/A set rIDs N/A cID cIDs N/A N/A cpeaks N/A i N/A N/A i v N/A enumerate rIDs N/A v cID N/A cparams N/A N/A params N/A i N/A i cpeaks N/A camps N/A N/A amps N/A i N/A i cpeaks N/A cbounds N/A N/A bounds N/A i N/A i cpeaks N/A campbounds N/A N/A ampbounds N/A i N/A i cpeaks N/A ccenters N/A N/A centers N/A i N/A i cpeaks N/A bcenters N/A N/A np round N/A N/A N/A N/A np array ccenters astype int N/A bmin N/A bcenters box_width N/A bmax N/A N/A bcenters box_width 1 N/A i N/A range N/A len shape N/A N/A N/A N/A bmin N/A N/A N/A i N/A N/A N/A np where N/A N/A bmin N/A N/A N/A i 0 0 N/A N/A i v N/A enumerate shape N/A N/A N/A N/A bmax N/A N/A N/A i N/A N/A N/A np where N/A N/A bmax N/A N/A N/A i v v N/A rmin edge N/A N/A N/A N/A np array bmin min 0 N/A rmax N/A N/A N/A N/A np array bmax max 0 N/A s N/A tuple N/A N/A slice mn mx N/A N/A mn mx N/A zip rmin rmax N/A region N/A spectrum N/A s N/A ebmin N/A bmin edge N/A ebmax N/A bmax edge N/A wmask N/A N/A np zeros N/A region shape dtype bool N/A N/A bmn bmx N/A zip ebmin ebmax N/A N/A s N/A tuple N/A N/A slice mn mx N/A N/A mn mx N/A zip bmn bmx N/A N/A wmask N/A s True N/A ecparams N/A N/A N/A N/A ls add_edge p N/A mn mx N/A N/A ls mn mx p N/A zip ls_classes rmin rmax g N/A g cparams N/A ecbounds N/A N/A N/A zip N/A N/A N/A ls add_edge b N/A mn mx N/A b N/A zip db N/A N/A ls mn mx db N/A zip ls_classes rmin rmax pb N/A pb cbounds N/A t N/A fit_NDregion region ls_classes ecparams camps ecbounds campbounds wmask error_flag kw N/A error_flag N/A N/A N/A ecpbest acbest ecpbest_err acbest_err ier t N/A cpbest_err N/A N/A N/A N/A ls remove_edge p N/A mn mx N/A N/A ls mn mx p N/A zip ls_classes rmin rmax g N/A g ecpbest_err N/A N/A N/A ecpbest acbest ier t N/A cpbest N/A N/A N/A N/A ls remove_edge p N/A mn mx N/A N/A ls mn mx p N/A zip ls_classes rmin rmax g N/A g ecpbest N/A verb N/A N/A N/A print ----------------------- N/A N/A print cID: cID ier: ier Peaks fit cpeaks N/A N/A print fit parameters: cpbest N/A N/A print fit amplitudes acbest N/A N/A i pb ab N/A zip cpeaks cpbest acbest N/A N/A N/A pbest N/A i pb N/A N/A abest N/A i ab N/A N/A iers N/A i ier N/A error_flag N/A N/A N/A i pb ab N/A zip cpeaks cpbest_err acbest_err N/A N/A N/A pbest_err N/A i pb N/A N/A abest_err N/A i ab N/A N/A error_flag False N/A N/A N/A pbest abest iers N/A N/A pbest abest pbest_err abest_err iers N/A fit_NDregion N/A N/A region lineshapes params amps bounds ampbounds wmask error_flag N/A None None None False kw N/A N/A 
    Fit a N-dimensional region.

    Parameters
    ----------

    region : ndarray
        Region of a NMR data to fit.
    lineshape :list
        List of lineshapes by label (str) or a lineshape class. See
        Notes for details.
    params : list
        P-length list (P is the number of peaks in region) of N-length lists
        of tuples where each each tuple is the optimiztion starting parameters
        for a given peak and dimension lineshape.
    amps : list
        P-length list of amplitudes.
    bounds : list
        List of bounds for parameter of same shape as params.  If none of the
        parameters in a given dimension have limits None can be used,
        otherwise each dimension should have a list or tuple of (min,max) or
        None for each parameter. min or max may be None when there is no
        bounds in a given direction.
    ampbounds : list
        P-length list of bounds for the amplitude with format similar to
        bounds.
    wmask : ndarray, optional
        Array with same shape as region which is used to weight points in the
        error calculation, typically a boolean array is used to exclude
        certain points in the region.  Default of None will include all
        points in the region equally in the error calculation.
    centers : list
        List of N-tuples indicating peak centers.
    error_flag : bool
        True to estimate errors for each lineshape parameter and amplitude.
    **kw : optional
        Additional keywords passed to the scipy.optimize.leastsq function.

    Returns
    -------
    params_best : list
        Optimal values for lineshape parameters with same format as params
        input parameter.
    amp_best : list
        List of optimal peak amplitudes.
    param_err : list, only returned when error_flag is True
        Estimated lineshape parameter errors with same format as params.
    amp_err : list, only returned when error_flag is True
        Estimated peak amplitude errors.
    iers : list
        List of interger flag from scipy.optimize.leastsq indicating if the
        solution was found for a given peak.  1,2,3,4 indicates that a
        solution was found. Other indicate an error.


    Notes
    -----

    The lineshape parameter:

    Elements of the lineshape parameter list can be string indicating the
    lineshape of given dimension or an instance of a lineshape class
    which provide a sim method which takes two arguments, the first being the
    length of the lineshape the second being a list of lineshape parameters,
    and returns a simulated lineshape as well as a nparam method which when
    given the length of lineshape returns the number of parameters needed to
    describe the lineshape. Currently the following strings are allowed:

    * 'g' or 'gauss'    Gaussian (normal) lineshape.
    * 'l' or 'lorentz'  Lorentzian lineshape.
    * 'v' or 'voigt'    Voigt lineshape.
    * 'pv' or 'pvoight' Pseudo Voigt lineshape
    * 's' or 'scale'    Scaled lineshape.

    The first four lineshapes (Gaussian, Lorentzian, Voigt and Pseudo Voigt)
    all take a FWHM scale parameter.

    The following are all valid lineshapes parameters for a 2D Gaussian peak:

    * ['g','g']
    * ['gauss','gauss']
    * [ng.lineshapes1d.gauss(),ng.lineshapes1d.gauss()]

     N/A ndim N/A region ndim N/A shape N/A region shape N/A N/A N/A len lineshapes ndim N/A N/A N/A ValueError Incorrect number of lineshapes provided N/A ls_classes N/A N/A l lineshapes N/A N/A N/A isinstance l str N/A N/A N/A N/A ls_classes append N/A ls_str2class l N/A N/A N/A N/A ls_classes append l N/A dim_nparam N/A N/A N/A c nparam l N/A N/A l c N/A zip shape ls_classes N/A n_peaks N/A len params N/A p0 N/A N/A N/A i guess N/A enumerate params N/A N/A N/A N/A len guess ndim N/A N/A err Incorrect number of params for peak %i N/A N/A ValueError N/A err i N/A N/A j dim_guess N/A enumerate guess N/A N/A N/A N/A len dim_guess N/A dim_nparam N/A j N/A N/A err Incorrect number of parameters in peak %i dimension %i N/A N/A ValueError N/A err N/A i j N/A g dim_guess N/A N/A N/A N/A p0 append g N/A N/A bounds None N/A N/A peak_bounds N/A N/A N/A N/A None None i N/A i dim_nparam N/A bounds N/A N/A peak_bounds n_peaks N/A N/A N/A len bounds n_peaks N/A N/A N/A ValueError Incorrect number of parameter bounds provided N/A p_bounds N/A N/A N/A i peak_bounds N/A enumerate bounds N/A N/A N/A peak_bounds None N/A N/A peak_bounds N/A N/A N/A N/A None None i N/A i dim_nparam N/A N/A N/A len peak_bounds ndim N/A N/A err Incorrect number of bounds for peak %i N/A N/A ValueError N/A err i N/A N/A j dim_bounds N/A enumerate peak_bounds N/A N/A N/A dim_bounds None N/A N/A dim_bounds N/A N/A N/A None None N/A dim_nparam N/A j N/A N/A N/A len dim_bounds N/A dim_nparam N/A j N/A N/A err Incorrect number of bounds for peak %i dimension %i N/A N/A ValueError N/A err N/A i j N/A N/A k b N/A enumerate dim_bounds N/A N/A N/A b None N/A N/A b N/A None None N/A N/A N/A len b 2 N/A N/A err No min/max for peak %i dim %i parameter %i N/A N/A ValueError N/A err N/A i j k N/A N/A N/A p_bounds append b N/A N/A N/A len amps n_peaks N/A N/A N/A ValueError Incorrect number of amplitude guesses provided N/A p0 N/A N/A list amps p0 N/A N/A ampbounds None N/A N/A ampbounds N/A N/A N/A None None n_peaks N/A N/A N/A len ampbounds n_peaks N/A N/A N/A ValueError Incorrect number of amplitude bounds N/A to_add N/A N/A N/A k b N/A enumerate ampbounds N/A N/A N/A b None N/A N/A b N/A None None N/A N/A N/A len b 2 N/A N/A err No min/max for amplitude bound %i N/A N/A ValueError N/A err k N/A N/A N/A to_add append b N/A p_bounds N/A to_add p_bounds N/A N/A wmask None N/A N/A wmask N/A N/A np ones shape dtype bool N/A N/A N/A wmask shape shape N/A N/A err N/A N/A N/A wmask has incorrect shape: N/A str N/A wmask shape  should be  N/A str shape N/A N/A ValueError err N/A error_flag N/A N/A N/A kw N/A full_output True N/A r N/A f_NDregion region ls_classes p0 p_bounds n_peaks wmask kw N/A N/A N/A full_output kw N/A kw N/A full_output N/A N/A N/A p_best cov_xi infodic mesg ier r N/A N/A N/A p_best ier r N/A amp_best N/A p_best N/A n_peaks N/A p_list N/A split_list N/A list N/A p_best N/A n_peaks n_peaks N/A param_best N/A N/A make_slist l dim_nparam N/A l p_list N/A N/A error_flag False N/A N/A N/A param_best amp_best ier N/A p_err N/A calc_errors region ls_classes p_best cov_xi n_peaks wmask N/A amp_err N/A p_err N/A n_peaks N/A pe_list N/A split_list N/A list N/A p_err N/A n_peaks n_peaks N/A param_err N/A N/A make_slist l dim_nparam N/A l pe_list N/A N/A param_best amp_best param_err amp_err ier N/A sim_NDregion N/A N/A shape lineshapes params amps N/A N/A N/A 
    Simulate an N-dimensional region with one or more peaks.

    Parameters
    ----------
    shape : tuple of ints
        Shape of region.
    lineshapes : list
        List of lineshapes by label (str) or a lineshape class. See
        :py:func:`fit_NDregion` for additional documentation.
    params : list
        P-length list (P is the number of peaks in region) of N-length lists
        of tuples where each each tuple is lineshape parameters for a given
        peak and dimension.
    amps : list
        P-length of peak amplitudes.

    Returns
    -------
    sim : ndarray with shape, shape.
        Simulated region.

     N/A ndim N/A len shape N/A N/A N/A len lineshapes ndim N/A N/A N/A ValueError Incorrect number of lineshapes provided N/A ls_classes N/A N/A l lineshapes N/A N/A N/A isinstance l str N/A N/A N/A N/A ls_classes append N/A ls_str2class l N/A N/A N/A N/A ls_classes append l N/A dim_nparam N/A N/A N/A c nparam l N/A N/A l c N/A zip shape ls_classes N/A n_peaks N/A len params N/A p N/A N/A N/A i param N/A enumerate params N/A N/A N/A N/A len param ndim N/A N/A err Incorrect number of parameters for peak %i N/A N/A ValueError N/A err i N/A N/A j dim_param N/A enumerate param N/A N/A N/A N/A len dim_param N/A dim_nparam N/A j N/A N/A err Incorrect number of parameters in peak %i dimension %i N/A N/A ValueError N/A err N/A i j N/A g dim_param N/A N/A N/A N/A p append g N/A N/A N/A len amps n_peaks N/A N/A N/A ValueError Incorrect number of amplitudes provided N/A p N/A N/A list amps p N/A N/A s_NDregion p shape ls_classes n_peaks N/A make_slist N/A N/A l t_sizes N/A N/A N/A 
    Create a list of tuples of given sizes from a list

    Parameters
    ----------
    l : list or ndarray
        List or array to pack into shaped list.
    t_sizes : list of ints
        List of tuple sizes.

    Returns
    -------
    slist : list of tuples
        List of tuples of lengths given by t_sizes.

     N/A out N/A N/A start 0 N/A s t_sizes N/A N/A N/A N/A out append N/A l N/A start N/A start s N/A start N/A start s N/A out N/A split_list N/A N/A l N N/A N/A N/A  Split list l into N sublists of equal size  N/A step N/A int N/A N/A len l N N/A div_points N/A range 0 N/A N/A len l 1 step N/A N/A N/A l N/A N/A div_points N/A i N/A div_points N/A N/A i 1 N/A i N/A range N N/A calc_errors N/A N/A region ls_classes p cov n_peaks wmask N/A N/A N/A 
    Calcuate the parameter errors from the standard errors of the estimate.

    Parameters
    ----------
    region : ndarray
        Region which was fit.
    ls_classes : list
        List of lineshape classes.
    p : ndarray
        Fit parameters.
    cov : ndarray
        Covariance matrix from least squares fitting.
    n_peaks : int
        Number of peaks in the region.

    Returns
    -------
    errors : ndarray
        Array of standard errors of parameters in p.

     N/A resid N/A err_NDregion p region N/A region shape ls_classes n_peaks wmask N/A SS_err N/A N/A N/A N/A np power resid 2 sum N/A n N/A region size N/A k N/A N/A p size 1 N/A st_err N/A N/A np sqrt N/A SS_err N/A N/A n k 1 N/A N/A cov None N/A N/A N/A N/A None N/A len p N/A N/A st_err N/A N/A np sqrt N/A N/A np diag cov N/A s_NDregion N/A N/A p shape ls_classes n_peaks N/A N/A N/A 
    Simulate an N-dimensional region with one or more peaks.

    Parameters
    ----------
    p : list
        List of parameters, must be a list, modified by function.
    shape : tuple of ints
        Shape of region.
    ls_classes : list
        List of lineshape classes.
    n_peaks : int
        Number of peaks in region.

    Returns
    -------
    r : ndarray
        Simulated region.

     N/A As N/A N/A N/A p pop 0 N/A i N/A range n_peaks N/A ps N/A split_list p n_peaks N/A N/A A curr_p N/A N/A N/A As pop 0 N/A N/A ps pop 0 N/A r N/A s_single_NDregion N/A N/A A curr_p shape ls_classes N/A N/A A curr_p N/A zip As ps N/A N/A r N/A r N/A s_single_NDregion N/A N/A A curr_p shape ls_classes N/A r N/A s_single_NDregion N/A N/A p shape ls_classes N/A N/A N/A 
    Simulate an N-dimensional region with a single peak.

    This function is called repeatly by s_NDregion to build up a full
    simulated region.

    Parameters
    ----------
    p : list
        List of parameters, must be a list.
    shape : tuple
        Shape of region.
    ls_classes : list
        List of lineshape classes.

    Returns
    -------
    r : ndarray
        Simulated region.

     N/A A N/A N/A p pop 0 N/A r N/A N/A np array A dtype float N/A N/A length ls_class N/A zip shape ls_classes N/A N/A s_p N/A N/A N/A p pop 0 N/A i N/A range N/A N/A ls_class nparam length N/A ls N/A N/A ls_class sim length s_p N/A r N/A N/A np kron r ls N/A N/A N/A r reshape shape N/A err_NDregion N/A N/A p region shape ls_classes n_peaks wmask N/A N/A N/A 
    Error function for an N-dimensional region, called by :py:func:`f_NDregion`
     N/A sim_region N/A s_NDregion N/A list p shape ls_classes n_peaks N/A N/A N/A N/A N/A region sim_region wmask flatten N/A f_NDregion N/A N/A region ls_classes p0 p_bounds n_peaks wmask N/A kw N/A N/A 
    Fit an N-dimensional regions containing one or more peaks.

    Region is fit using a contrained Levenberg-Marquard optmization algorithm.
    See :py:func:`fit_NDregion` for additional documentation.

    Parameters
    ----------
    region : ndarray
        Region to fit.
    ls_classes : list
        List of lineshape classes.
    p0 : ndarray
        Initial parameters.
    p_bounds : list of tuples
        List of (min, max) bounds for each element of p0.
    n_peaks : int
        Number of peaks in the simulated region.
    wmask : ndarray
        Array with same shape as region which is used to weight points in the
        error calculation, typically a boolean array is used to exclude
        certain points in the region.
    **kw : optional
        Additional keywords passed to the scipy.optimize.leastsq function.

    See Also
    --------
    fit_NDregion : Fit N-dimensional region with user friendly parameter.

     N/A args N/A region N/A region shape ls_classes n_peaks wmask N/A p_best N/A leastsqbound err_NDregion p0 bounds p_bounds args args kw N/A p_best N/A