<html><body>
<p>4 new commits in yt:</p>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/5595d7cdcb46/">https://bitbucket.org/yt_analysis/yt/commits/5595d7cdcb46/</a> Changeset:   5595d7cdcb46 Branch:      yt User:        migueldvb Date:        2016-03-14 20:21:10+00:00 Summary:     remove trailing space</p>
<p>Affected #:  1 file</p>
<p>diff -r e1b2e0a5997f0cce7ff52547347e9e5214ad0d5c -r 5595d7cdcb461ff2f15a4b931c7065e6d11d9fbd yt/analysis_modules/absorption_spectrum/absorption_spectrum_fit.py --- a/yt/analysis_modules/absorption_spectrum/absorption_spectrum_fit.py +++ b/yt/analysis_modules/absorption_spectrum/absorption_spectrum_fit.py @@ -12,14 +12,14 @@</p>
<pre>optimize = _scipy.optimize
</pre>
<p>-def generate_total_fit(x, fluxData, orderFits, speciesDicts, +def generate_total_fit(x, fluxData, orderFits, speciesDicts,</p>
<pre>minError=1E-4, complexLim=.995,</pre>
<ul><li><p>fitLim=.97, minLength=3,</p></li></ul>
<p>+        fitLim=.97, minLength=3,</p>
<pre>        maxLength=1000, splitLim=.99,
        output_file=None):

    """</pre>
<ul><li><p>This function is designed to fit an absorption spectrum by breaking</p></li></ul>
<p>+    This function is designed to fit an absorption spectrum by breaking</p>
<pre>    the spectrum up into absorption complexes, and iteratively adding
    and optimizing voigt profiles to each complex.
</pre>
<p>@@ -31,46 +31,46 @@</p>
<pre>    array of flux corresponding to the wavelengths given
    in x. (needs to be the same size as x)
orderFits : list</pre>
<ul><li><p>list of the names of the species in the order that they</p></li></ul>
<p>+        list of the names of the species in the order that they</p>
<pre>    should be fit. Names should correspond to the names of the species
    given in speciesDicts. (ex: ['lya','OVI'])
speciesDicts : dictionary
    Dictionary of dictionaries (I'm addicted to dictionaries, I
    confess). Top level keys should be the names of all the species given</pre>
<ul><li><p>in orderFits. The entries should be dictionaries containing all</p></li>
<li><p>relevant parameters needed to create an absorption line of a given</p></li></ul>
<p>+        in orderFits. The entries should be dictionaries containing all +        relevant parameters needed to create an absorption line of a given</p>
<pre>    species (f,Gamma,lambda0) as well as max and min values for parameters
    to be fit
complexLim : float, optional</pre>
<ul><li><p>Maximum flux to start the edge of an absorption complex. Different</p></li>
<li><p>from fitLim because it decides extent of a complex rather than</p></li>
<li><p>whether or not a complex is accepted.</p></li></ul>
<p>+        Maximum flux to start the edge of an absorption complex. Different +        from fitLim because it decides extent of a complex rather than +        whether or not a complex is accepted.</p>
<pre>fitLim : float,optional</pre>
<ul><li><p>Maximum flux where the level of absorption will trigger</p></li></ul>
<p>+        Maximum flux where the level of absorption will trigger</p>
<pre>    identification of the region as an absorption complex. Default = .98.
    (ex: for a minSize=.98, a region where all the flux is between 1.0 and
    .99 will not be separated out to be fit as an absorbing complex, but
    a region that contains a point where the flux is .97 will be fit
    as an absorbing complex.)
minLength : int, optional</pre>
<ul><li><p>number of cells required for a complex to be included.</p></li></ul>
<p>+        number of cells required for a complex to be included.</p>
<pre>    default is 3 cells.
maxLength : int, optional
    number of cells required for a complex to be split up. Default
    is 1000 cells.
splitLim : float, optional
    if attempting to split a region for being larger than maxlength</pre>
<ul><li><p>the point of the split must have a flux greater than splitLim</p></li></ul>
<p>+        the point of the split must have a flux greater than splitLim</p>
<pre>    (ie: absorption greater than splitLim). Default= .99.
output_file : string, optional</pre>
<ul><li><p>location to save the results of the fit.</p></li></ul>
<p>+        location to save the results of the fit.</p>
<pre>Returns
-------
allSpeciesLines : dictionary</pre>
<ul><li><p>Dictionary of dictionaries representing the fit lines.</p></li></ul>
<p>+        Dictionary of dictionaries representing the fit lines.</p>
<pre>Top level keys are the species given in orderFits and the corresponding</pre>
<ul><li><p>entries are dictionaries with the keys ‘N','b','z’, and ‘group#’.</p></li></ul>
<p>+        entries are dictionaries with the keys ‘N','b','z’, and ‘group#’.</p>
<pre>Each of these corresponds to a list of the parameters for every
accepted fitted line. (ie: N[0],b[0],z[0] will create a line that
fits some part of the absorption spectrum). 'group#' is a similar list</pre>
<p>@@ -87,7 +87,7 @@</p>
<pre># convert to NumPy array if we have a YTArray
if isinstance(x, YTArray):
    x = x.d</pre>
<p>– +</p>
<pre>    #Empty dictionary for fitted lines
    allSpeciesLines = {}
</pre>
<p>@@ -129,8 +129,8 @@</p>
<pre>#Check if any flux at partner sites
if not _line_exists(speciesDict['wavelength'],</pre>
<ul><li><p>fluxData,z,x0,xRes,fitLim):</p></li>
<li><p>continue</p></li></ul>
<p>+                    fluxData,z,x0,xRes,fitLim): +                continue</p>
<pre>#Fit Using complex tools
newLinesP,flag=_complex_fit(xBounded,yDatBounded,yFitBounded,</pre>
<p>@@ -139,7 +139,7 @@</p>
<pre>#If flagged as a bad fit, species is lyman alpha,
#   and it may be a saturated line, use special tools
if flag and species=='lya' and min(yDatBounded)<.1:</pre>
<ul><li><p>newLinesP=_large_flag_fit(xBounded,yDatBounded,</p></li></ul>
<p>+                newLinesP=_large_flag_fit(xBounded,yDatBounded,</p>
<pre>                        yFitBounded,z,speciesDict,
                        fitLim,minError)
</pre>
<p>@@ -151,7 +151,7 @@</p>
<pre>#Check existence of partner lines if applicable
if len(speciesDict['wavelength']) != 1:</pre>
<ul><li><p>newLinesP = _remove_unaccepted_partners(newLinesP, x, fluxData,</p></li></ul>
<p>+                newLinesP = _remove_unaccepted_partners(newLinesP, x, fluxData,</p>
<pre>                        b, minError, x0, xRes, speciesDict)

</pre>
<p>@@ -177,15 +177,15 @@</p>
<pre>    return (allSpeciesLines,yFit)
</pre>
<p>-def _complex_fit(x, yDat, yFit, initz, minSize, errBound, speciesDict, +def _complex_fit(x, yDat, yFit, initz, minSize, errBound, speciesDict,</p>
<pre>    initP=None):
""" Fit an absorption complex by iteratively adding and optimizing
voigt profiles.</pre>
<p>– +</p>
<pre>A complex is defined as a region where some number of lines may be present,
or a region of non zero of absorption. Lines are iteratively added
and optimized until the difference between the flux generated using</pre>
<ul><li><p>the optimized parameters has a least squares difference between the</p></li></ul>
<p>+    the optimized parameters has a least squares difference between the</p>
<pre>    desired flux profile less than the error bound.

    Parameters</pre>
<p>@@ -199,7 +199,7 @@</p>
<pre>    array of flux profile fitted for the wavelength
    space given by x already. Same size as x.
initz : float</pre>
<ul><li><p>redshift to try putting first line at</p></li></ul>
<p>+        redshift to try putting first line at</p>
<pre>    (maximum absorption for region)
minsize : float
    minimum absorption allowed for a line to still count as a line</pre>
<p>@@ -219,7 +219,7 @@</p>
<pre>Returns
-------
linesP : (3,) ndarray</pre>
<ul><li><p>Array of best parameters if a good enough fit is found in</p></li></ul>
<p>+        Array of best parameters if a good enough fit is found in</p>
<pre>    the form [[N1,b1,z1], [N2,b2,z2],...]
flag : bool
    boolean value indicating the success of the fit (True if unsuccessful)</pre>
<p>@@ -227,8 +227,8 @@</p>
<pre>#Setup initial line guesses
if initP is None: #Regular fit</pre>
<ul><li><p>initP = [0,0,0]</p></li>
<li><p>if min(yDat)<.01: #Large lines get larger initial guess</p></li></ul>
<p>+        initP = [0,0,0] +        if min(yDat)<.01: #Large lines get larger initial guess</p>
<pre>initP[0] = speciesDict['init_N']*10**2
         elif min(yDat)<.5:
initP[0] = speciesDict['init_N']*10**1</pre>
<p>@@ -246,9 +246,9 @@</p>
<pre>    wl0 = speciesDict['wavelength'][0]

    #Check if first line exists still</pre>
<ul><li><p>if min(yDat-yFit+1)>minSize:</p></li></ul>
<p>+    if min(yDat-yFit+1)>minSize:</p>
<pre>return [],False</pre>
<p>– +</p>
<pre>    #Values to proceed through first run
    errSq,prevErrSq,prevLinesP=1,10*len(x),[]
</pre>
<p>@@ -283,9 +283,9 @@</p>
<pre>         if any(linesP[:,1]==speciesDict['init_b']):
flag = True
break</pre>
<p>– +</p>
<pre>#If good enough, break</pre>
<ul><li><p>if errSq < errBound:</p></li></ul>
<p>+        if errSq < errBound:</p>
<pre>            break

        #If last fit was worse, reject the last line and revert to last fit</pre>
<p>@@ -297,7 +297,7 @@</p>
<pre>                linesP = prevLinesP
                break
</pre>
<ul><li><p>#If too many lines</p></li></ul>
<p>+        #If too many lines</p>
<pre>         if np.shape(linesP)[0]>8 or np.size(linesP)+3>=len(x):
#If its fitable by flag tools and still bad, use flag tools
if errSq >1E2*errBound and speciesDict['name']=='HI lya':</pre>
<p>@@ -311,11 +311,11 @@</p>
<pre>        prevLinesP = linesP

        #Set up initial condition for new line</pre>
<ul><li><p>newP = [0,0,0]</p></li></ul>
<p>+        newP = [0,0,0]</p>
<pre>yAdjusted = 1+yFit*yNewFit-yDat</pre>
<p>–</p>
<ul><li><p>if min(yAdjusted)<.01: #Large lines get larger initial guess</p></li></ul>
<p>+ +        if min(yAdjusted)<.01: #Large lines get larger initial guess</p>
<pre>newP[0] = speciesDict['init_N']*10**2
         elif min(yAdjusted)<.5:
newP[0] = speciesDict['init_N']*10**1</pre>
<p>@@ -333,7 +333,7 @@</p>
<pre>remove=[]
for i,p in enumerate(linesP):
    check=_check_params(np.array([p]),speciesDict,x)</pre>
<ul><li><p>if check:</p></li></ul>
<p>+        if check:</p>
<pre>            remove.append(i)
    linesP = np.delete(linesP,remove,axis=0)
</pre>
<p>@@ -358,7 +358,7 @@</p>
<pre>    array of flux profile fitted for the wavelength
    space given by x already. Same size as x.
initz : float</pre>
<ul><li><p>redshift to try putting first line at</p></li></ul>
<p>+        redshift to try putting first line at</p>
<pre>    (maximum absorption for region)
speciesDict : dictionary
    dictionary containing all relevant parameters needed</pre>
<p>@@ -374,15 +374,15 @@</p>
<pre>Returns
-------
bestP : (3,) ndarray</pre>
<ul><li><p>array of best parameters if a good enough fit is found in</p></li>
<li><p>the form [[N1,b1,z1], [N2,b2,z2],…]</p></li></ul>
<p>+        array of best parameters if a good enough fit is found in +        the form [[N1,b1,z1], [N2,b2,z2],…]</p>
<pre>    """

    #Set up some initial line guesses
    lineTests = _get_test_lines(initz)

    #Keep track of the lowest achieved error</pre>
<ul><li><p>bestError = 1000</p></li></ul>
<p>+    bestError = 1000</p>
<pre>#Iterate through test line guesses
for initLines in lineTests:</pre>
<p>@@ -403,7 +403,7 @@</p>
<pre>            bestError = errSq
            bestP = linesP
</pre>
<ul><li><p>if bestError>10*errBound*len(x):</p></li></ul>
<p>+    if bestError>10*errBound*len(x):</p>
<pre>    return []
else:
    return bestP</pre>
<p>@@ -411,11 +411,11 @@</p>
<pre>def _get_test_lines(initz):
    """
    Returns a 3d numpy array of lines to test as initial guesses for difficult</pre>
<ul><li><p>to fit lyman alpha absorbers that are saturated.</p></li></ul>
<p>– +    to fit lyman alpha absorbers that are saturated. +</p>
<pre>The array is 3d because
the first dimension gives separate initial guesses, the second dimension</pre>
<ul><li><p>has multiple lines for the same guess (trying a broad line plus a</p></li></ul>
<p>+    has multiple lines for the same guess (trying a broad line plus a</p>
<pre>    saturated line) and the 3d dimension contains the 3 fit parameters (N,b,z)

    Parameters</pre>
<p>@@ -426,7 +426,7 @@</p>
<pre>Returns
-------
testP : (,3,) ndarray</pre>
<ul><li><p>numpy array of the form</p></li></ul>
<p>+        numpy array of the form</p>
<pre>        [[[N1a,b1a,z1a], [N1b,b1b,z1b]], [[N2a,b2,z2a],...] ...]
    """
</pre>
<p>@@ -454,8 +454,8 @@</p>
<pre>    return testP

def _get_bounds(z, b, wl, x0, xRes):</pre>
<ul><li><p>"""</p></li>
<li><p>Gets the indices of range of wavelength that the wavelength wl is in</p></li></ul>
<p>+    """ +    Gets the indices of range of wavelength that the wavelength wl is in</p>
<pre>    with the size of some initial wavelength range.

    Used for checking if species with multiple lines (as in the OVI doublet)</pre>
<p>@@ -466,21 +466,21 @@</p>
<pre>z : float
    redshift
b : (3) ndarray/list</pre>
<ul><li><p>initial bounds in form [i0,i1,i2] where i0 is the index of the</p></li>
<li><p>minimum flux for the complex, i1 is index of the lower wavelength</p></li></ul>
<p>+        initial bounds in form [i0,i1,i2] where i0 is the index of the +        minimum flux for the complex, i1 is index of the lower wavelength</p>
<pre>    edge of the complex, and i2 is the index of the higher wavelength
    edge of the complex.
wl : float</pre>
<ul><li><p>unredshifted wavelength of the peak of the new region</p></li></ul>
<p>+        unredshifted wavelength of the peak of the new region</p>
<pre>x0 : float
    wavelength of the index 0
xRes : float
    difference in wavelength for two consecutive indices</pre>
<p>– +</p>
<pre>Returns
-------
indices : (2) tuple</pre>
<ul><li><p>Tuple (i1,i2) where i1 is the index of the lower wavelength bound of</p></li></ul>
<p>+        Tuple (i1,i2) where i1 is the index of the lower wavelength bound of</p>
<pre>    the new region and i2 is the index of the higher wavelength bound of
    the new region
"""</pre>
<p>@@ -492,7 +492,7 @@</p>
<pre>    return indices
</pre>
<p>-def _remove_unaccepted_partners(linesP, x, y, b, errBound, +def _remove_unaccepted_partners(linesP, x, y, b, errBound,</p>
<pre>    x0, xRes, speciesDict):
"""
Given a set of parameters [N,b,z] that form multiple lines for a given</pre>
<p>@@ -507,18 +507,18 @@</p>
<pre>Parameters
----------
linesP : (3,) ndarray</pre>
<ul><li><p>array giving sets of line parameters in</p></li></ul>
<p>+        array giving sets of line parameters in</p>
<pre>    form [[N1, b1, z1], ...]
x : (N) ndarray
    wavelength array [nm]
y : (N) ndarray
    normalized flux array of original data
b : (3) tuple/list/ndarray</pre>
<ul><li><p>indices that give the bounds of the original region so that another</p></li></ul>
<p>+        indices that give the bounds of the original region so that another</p>
<pre>    region of similar size can be used to determine the goodness
    of fit of the other wavelengths
errBound : float</pre>
<ul><li><p>size of the error that is appropriate for a given region,</p></li></ul>
<p>+        size of the error that is appropriate for a given region,</p>
<pre>        adjusted to account for the size of the region.

    Returns</pre>
<p>@@ -569,7 +569,7 @@</p>
<pre>    #Remove all bad line fits
    linesP = np.delete(linesP,removeLines,axis=0)
</pre>
<ul><li><p>return linesP</p></li></ul>
<p>+    return linesP</p>
<p>@@ -588,12 +588,12 @@</p>
<pre>xRes : float
    difference in wavelength between consecutive cells in flux array
fluxMin : float</pre>
<ul><li><p>maximum flux to count as a line existing.</p></li></ul>
<p>+        maximum flux to count as a line existing.</p>
<pre>    Returns
    -------
</pre>
<ul><li><p>flag : boolean</p></li></ul>
<p>+    flag : boolean</p>
<pre>        value indicating whether all lines exist. True if all lines exist
    """
</pre>
<p>@@ -618,7 +618,7 @@</p>
<pre>def _find_complexes(x, yDat, complexLim=.999, fitLim=.99,
        minLength =3, maxLength=1000, splitLim=.99):
    """Breaks up the wavelength space into groups</pre>
<ul><li><p>where there is some absorption.</p></li></ul>
<p>+    where there is some absorption.</p>
<pre>Parameters
----------</pre>
<p>@@ -628,33 +628,33 @@</p>
<pre>    array of flux corresponding to the wavelengths given
    in x. (needs to be the same size as x)
complexLim : float, optional</pre>
<ul><li><p>Maximum flux to start the edge of an absorption complex. Different</p></li>
<li><p>from fitLim because it decides extent of a complex rather than</p></li>
<li><p>whether or not a complex is accepted.</p></li></ul>
<p>+        Maximum flux to start the edge of an absorption complex. Different +        from fitLim because it decides extent of a complex rather than +        whether or not a complex is accepted.</p>
<pre>fitLim : float,optional</pre>
<ul><li><p>Maximum flux where the level of absorption will trigger</p></li></ul>
<p>+        Maximum flux where the level of absorption will trigger</p>
<pre>    identification of the region as an absorption complex. Default = .98.
    (ex: for a minSize=.98, a region where all the flux is between 1.0 and
    .99 will not be separated out to be fit as an absorbing complex, but
    a region that contains a point where the flux is .97 will be fit
    as an absorbing complex.)
minLength : int, optional</pre>
<ul><li><p>number of cells required for a complex to be included.</p></li></ul>
<p>+        number of cells required for a complex to be included.</p>
<pre>    default is 3 cells.
maxLength : int, optional
    number of cells required for a complex to be split up. Default
    is 1000 cells.
splitLim : float, optional
    if attempting to split a region for being larger than maxlength</pre>
<ul><li><p>the point of the split must have a flux greater than splitLim</p></li></ul>
<p>+        the point of the split must have a flux greater than splitLim</p>
<pre>        (ie: absorption greater than splitLim). Default= .99.

    Returns
    -------</pre>
<ul><li><p>cBounds : (3,)</p></li>
<li><p>list of bounds in the form [[i0,i1,i2],…] where i0 is the</p></li></ul>
<p>+    cBounds : (3,) +        list of bounds in the form [[i0,i1,i2],…] where i0 is the</p>
<pre>index of the maximum flux for a complex, i1 is the index of the</pre>
<ul><li><p>beginning of the complex, and i2 is the index of the end of the</p></li></ul>
<p>+        beginning of the complex, and i2 is the index of the end of the</p>
<pre>        complex. Indexes refer to the indices of x and yDat.
    """
</pre>
<p>@@ -743,7 +743,7 @@</p>
<pre>x : (N) ndarray
    Array of wavelength
linesP: (3,) ndarray</pre>
<ul><li><p>Array giving sets of line parameters in</p></li></ul>
<p>+        Array giving sets of line parameters in</p>
<pre>    form [[N1, b1, z1], ...]
speciesDict : dictionary
    Dictionary containing all relevant parameters needed</pre>
<p>@@ -762,7 +762,7 @@</p>
<pre>g=speciesDict['Gamma'][i]
wl=speciesDict['wavelength'][i]
y = y+ _gen_tau(x,p,f,g,wl)</pre>
<ul><li><p>if firstLine:</p></li></ul>
<p>+            if firstLine:</p>
<pre>                break

    flux = np.exp(-y)</pre>
<p>@@ -772,15 +772,15 @@</p>
<pre>"""This calculates a flux distribution for given parameters using the yt
voigt profile generator"""
N,b,z= p</pre>
<p>– +</p>
<pre>#Calculating quantities
tau_o = 1.4973614E-15*N*f*lambda_unshifted/b
a=7.95774715459E-15*Gamma*lambda_unshifted/b
x=299792.458/b*(lambda_unshifted*(1+z)/t-1)</pre>
<p>– +</p>
<pre>H = np.zeros(len(x))
H = voigt(a,x)</pre>
<p>– +</p>
<pre>    tau = tau_o*H

    return tau</pre>
<p>@@ -797,8 +797,8 @@</p>
<pre>Parameters
----------</pre>
<ul><li><p>pTotal : (3,) ndarray</p></li>
<li><p>Array with form [[N1, b1, z1], …]</p></li></ul>
<p>+    pTotal : (3,) ndarray +        Array with form [[N1, b1, z1], …]</p>
<pre>x : (N) ndarray
    array of wavelengths [nm]
yDat : (N) ndarray</pre>
<p>@@ -816,7 +816,7 @@</p>
<pre>error : (N) ndarray
    the difference between the fit generated by the parameters
    given in pTotal multiplied by the previous fit and the desired</pre>
<ul><li><p>flux profile, w/ first index modified appropriately for bad</p></li></ul>
<p>+        flux profile, w/ first index modified appropriately for bad</p>
<pre>    parameter choices and additional penalty for fitting with a lower
    flux than observed.
"""</pre>
<p>@@ -834,13 +834,13 @@</p>
<pre>def _check_params(p, speciesDict,xb):
    """</pre>
<ul><li><p>Check to see if any of the parameters in p fall outside the range</p></li></ul>
<p>+    Check to see if any of the parameters in p fall outside the range</p>
<pre>        given in speciesDict or on the boundaries

    Parameters
    ----------
    p : (3,) ndarray</pre>
<ul><li><p>array with form [[N1, b1, z1], …]</p></li></ul>
<p>+        array with form [[N1, b1, z1], …]</p>
<pre>speciesDict : dictionary
    dictionary with properties giving the max and min
    values appropriate for each parameter N,b, and z.</pre>
<p>@@ -865,20 +865,20 @@</p>
<pre>any(p[:,2] >= maxz) or\
any(p[:,2] <= minz):
    check = 999</pre>
<p>– +</p>
<pre>    return check

def _check_optimization_init(p,speciesDict,initz,xb,yDat,yFit,minSize,errorBound):

    """
    Check to see if any of the parameters in p are the</pre>
<ul><li><p>same as initial paramters and if so, attempt to</p></li></ul>
<p>+    same as initial paramters and if so, attempt to</p>
<pre>    split the region and refit it.

    Parameters
    ----------
    p : (3,) ndarray</pre>
<ul><li><p>array with form [[N1, b1, z1], …]</p></li></ul>
<p>+        array with form [[N1, b1, z1], …]</p>
<pre>speciesDict : dictionary
    dictionary with properties giving the max and min
    values appropriate for each parameter N,b, and z.</pre>
<p>@@ -902,7 +902,7 @@</p>
<pre># Attempt to split region
split = _split_region(yDat,init_bounds,newSplitLim)</pre>
<p>– +</p>
<pre># If we can't split it, just reject it. Its unphysical
# to just keep the default parameters and we're out of
# options at this point</pre>
<p>@@ -939,7 +939,7 @@</p>
<pre>Parameters
----------
p : (3,) ndarray</pre>
<ul><li><p>array with form [[N1, b1, z1], …]</p></li></ul>
<p>+        array with form [[N1, b1, z1], …]</p>
<pre>speciesDict : dictionary
    dictionary with properties giving the max and min
    values appropriate for each parameter N,b, and z.</pre>
<p>@@ -979,7 +979,7 @@</p>
<pre># we just set it to no fit because we've tried
# everything else at this point. this region just sucks :(
remove_lines.append(i)</pre>
<p>– +</p>
<pre>    if remove_lines:
        p = np.delete(p, remove_lines, axis=0)
</pre>
<p>@@ -988,7 +988,7 @@</p>
<pre>def _output_fit(lineDic, file_name = 'spectrum_fit.h5'):
    """
    This function is designed to output the parameters of the series</pre>
<ul><li><p>of lines used to fit an absorption spectrum.</p></li></ul>
<p>+    of lines used to fit an absorption spectrum.</p>
<pre>The dataset contains entries in the form species/N, species/b
species/z, and species/complex. The ith entry in each of the datasets</pre>
<p>@@ -999,11 +999,11 @@</p>
<pre>Parameters
----------
lineDic : dictionary</pre>
<ul><li><p>Dictionary of dictionaries representing the fit lines.</p></li></ul>
<p>+        Dictionary of dictionaries representing the fit lines.</p>
<pre>Top level keys are the species given in orderFits and the corresponding</pre>
<ul><li><p>entries are dictionaries with the keys ‘N','b','z’, and ‘group#’.</p></li></ul>
<p>+        entries are dictionaries with the keys ‘N','b','z’, and ‘group#’.</p>
<pre>Each of these corresponds to a list of the parameters for every</pre>
<ul><li><p>accepted fitted line.</p></li></ul>
<p>+        accepted fitted line.</p>
<pre>    fileName : string, optional
        Name of the file to output fit to. Default = 'spectrum_fit.h5'
</pre>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/0e09458b79c9/">https://bitbucket.org/yt_analysis/yt/commits/0e09458b79c9/</a> Changeset:   0e09458b79c9 Branch:      yt User:        migueldvb Date:        2016-03-14 20:25:11+00:00 Summary:     Fix indentation</p>
<p>Affected #:  1 file</p>
<p>diff -r 5595d7cdcb461ff2f15a4b931c7065e6d11d9fbd -r 0e09458b79c963950d3c2ff5e68dfd9d32035382 yt/analysis_modules/absorption_spectrum/absorption_spectrum_fit.py --- a/yt/analysis_modules/absorption_spectrum/absorption_spectrum_fit.py +++ b/yt/analysis_modules/absorption_spectrum/absorption_spectrum_fit.py @@ -864,7 +864,7 @@</p>
<pre>any(p[:,1] <= speciesDict['minb']) or\
any(p[:,2] >= maxz) or\
any(p[:,2] <= minz):</pre>
<ul><li><p>check = 999</p></li></ul>
<p>+        check = 999</p>
<pre>    return check
</pre>
<p>@@ -894,38 +894,38 @@</p>
<pre>          any(p[:,1] == speciesDict['init_b']) or\
          any(p[:,1] == speciesDict['maxb']):
</pre>
<ul><li><p># These are the initial bounds</p></li>
<li><p>init_bounds = [yDat.argmin(),0,len(xb)-1]</p></li></ul>
<p>+        # These are the initial bounds +        init_bounds = [yDat.argmin(),0,len(xb)-1]</p>
<ul><li><p># Gratitutous limit for splitting region</p></li>
<li><p>newSplitLim = 1 – (1-min(yDat))*.5</p></li></ul>
<p>+        # Gratitutous limit for splitting region +        newSplitLim = 1 – (1-min(yDat))*.5</p>
<ul><li><p># Attempt to split region</p></li>
<li><p>split = _split_region(yDat,init_bounds,newSplitLim)</p></li></ul>
<p>+        # Attempt to split region +        split = _split_region(yDat,init_bounds,newSplitLim)</p>
<ul><li><p># If we can't split it, just reject it. Its unphysical</p></li>
<li><p># to just keep the default parameters and we're out of</p></li>
<li><p># options at this point</p></li>
<li><p>if not split:</p></li>
<li><p>return []</p></li></ul>
<p>+        # If we can't split it, just reject it. Its unphysical +        # to just keep the default parameters and we're out of +        # options at this point +        if not split: +            return []</p>
<ul><li><p># Else set up the bounds for each region and fit separately</p></li>
<li><p>b1,b2 = split[0][2], split[1][1]</p></li></ul>
<p>+        # Else set up the bounds for each region and fit separately +        b1,b2 = split[0][2], split[1][1]</p>
<ul><li><p>p1,flag = _complex_fit(xb[:b1], yDat[:b1], yFit[:b1],</p></li>
<li><p>initz, minSize, errorBound, speciesDict)</p></li></ul>
<p>+        p1,flag = _complex_fit(xb[:b1], yDat[:b1], yFit[:b1], +                        initz, minSize, errorBound, speciesDict)</p>
<ul><li><p>p2,flag = _complex_fit(xb[b2:], yDat[b2:], yFit[b2:],</p></li>
<li><p>initz, minSize, errorBound, speciesDict)</p></li></ul>
<p>+        p2,flag = _complex_fit(xb[b2:], yDat[b2:], yFit[b2:], +                        initz, minSize, errorBound, speciesDict)</p>
<ul><li><p># Make the final line parameters. Its annoying because</p></li>
<li><p># one or both regions may have fit to nothing</p></li>
<li><p>if np.size(p1)> 0 and np.size(p2)>0:</p></li>
<li><p>p = np.r_[p1,p2]</p></li>
<li><p>elif np.size(p1) > 0:</p></li>
<li><p>p = p1</p></li>
<li><p>else:</p></li>
<li><p>p = p2</p></li></ul>
<p>+        # Make the final line parameters. Its annoying because +        # one or both regions may have fit to nothing +        if np.size(p1)> 0 and np.size(p2)>0: +            p = np.r_[p1,p2] +        elif np.size(p1) > 0: +            p = p1 +        else: +            p = p2</p>
<pre>    return p
</pre>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/e14f3ad3b7f2/">https://bitbucket.org/yt_analysis/yt/commits/e14f3ad3b7f2/</a> Changeset:   e14f3ad3b7f2 Branch:      yt User:        migueldvb Date:        2016-04-07 02:00:08+00:00 Summary:     Write logging functions as format string + args</p>
<p>This should have a little better performance than string formatting</p>
<p>Affected #:  1 file</p>
<p>diff -r 0e09458b79c963950d3c2ff5e68dfd9d32035382 -r e14f3ad3b7f2e27dac2c2141f7e76b0922fd8a5f yt/analysis_modules/absorption_spectrum/absorption_spectrum.py --- a/yt/analysis_modules/absorption_spectrum/absorption_spectrum.py +++ b/yt/analysis_modules/absorption_spectrum/absorption_spectrum.py @@ -54,7 +54,7 @@</p>
<pre># lambda, flux, and tau are wavelength, flux, and optical depth
self.lambda_min = lambda_min
self.lambda_max = lambda_max</pre>
<ul><li><p>self.lambda_field = YTArray(np.linspace(lambda_min, lambda_max,</p></li></ul>
<p>+        self.lambda_field = YTArray(np.linspace(lambda_min, lambda_max,</p>
<pre>n_lambda), "angstrom")
         self.tau_field = None
         self.flux_field = None</pre>
<p>@@ -237,7 +237,7 @@</p>
<pre>     def _apply_observing_redshift(self, field_data, use_peculiar_velocity,
observing_redshift):
         """</pre>
<ul><li><p>Change the redshifts of individual absorbers to account for the</p></li></ul>
<p>+        Change the redshifts of individual absorbers to account for the</p>
<pre>        redshift at which the observer sits.

        The intermediate redshift that is seen by an observer</pre>
<p>@@ -275,9 +275,9 @@</p>
<pre>"""
Add continuum features to the spectrum.
"""</pre>
<ul><li><p># Change the redshifts of continuum sources to account for the</p></li></ul>
<p>+        # Change the redshifts of continuum sources to account for the</p>
<pre># redshift at which the observer sits</pre>
<ul><li><p>redshift, redshift_eff = self._apply_observing_redshift(field_data,</p></li></ul>
<p>+        redshift, redshift_eff = self._apply_observing_redshift(field_data,</p>
<pre>                                 use_peculiar_velocity, observing_redshift)

        # Only add continuum features down to tau of 1.e-4.</pre>
<p>@@ -319,9 +319,9 @@</p>
<pre>        Add the absorption lines to the spectrum.
        """
</pre>
<ul><li><p># Change the redshifts of individual absorbers to account for the</p></li></ul>
<p>+        # Change the redshifts of individual absorbers to account for the</p>
<pre># redshift at which the observer sits</pre>
<ul><li><p>redshift, redshift_eff = self._apply_observing_redshift(field_data,</p></li></ul>
<p>+        redshift, redshift_eff = self._apply_observing_redshift(field_data,</p>
<pre>                                 use_peculiar_velocity, observing_redshift)

        # Widen wavelength window until optical depth falls below this tau</pre>
<p>@@ -349,13 +349,13 @@</p>
<pre># we want to know the bin index in the lambda_field array
# where each line has its central wavelength after being
# redshifted.  however, because we don't know a priori how wide</pre>
<ul><li><p># a line will be (ie DLAs), we have to include bin indices</p></li>
<li><p># <strong>outside</strong> the spectral range of the AbsorptionSpectrum</p></li></ul>
<p>+            # a line will be (ie DLAs), we have to include bin indices +            # <strong>outside</strong> the spectral range of the AbsorptionSpectrum</p>
<pre># object.  Thus, we find the "equivalent" bin index, which
# may be <0 or >the size of the array.  In the end, we deposit
# the bins that actually overlap with the AbsorptionSpectrum's
# range in lambda.</pre>
<p>– +</p>
<pre># this equation gives us the "equivalent" bin index for each line
# if it were placed into the self.lambda_field array
center_index = (lambda_obs.in_units('Angstrom').d - self.lambda_min) \</pre>
<p>@@ -399,10 +399,10 @@</p>
<pre># a note to the user about which lines components are unresolved
if (thermal_width < self.bin_width).any():</pre>
<ul><li><p>mylog.info(("%d out of %d line components will be " + \</p></li>
<li><p>“deposited as unresolved lines.”) %</p></li>
<li><p>((thermal_width < self.bin_width).sum(),</p></li>
<li><p>n_absorbers))</p></li></ul>
<p>+                mylog.info("%d out of %d line components will be " + +                            “deposited as unresolved lines.”, +                            (thermal_width < self.bin_width).sum(), +                            n_absorbers)</p>
<pre># provide a progress bar with information about lines processsed
pbar = get_pbar("Adding line - %s [%f A]: " % \</pre>
<p>@@ -411,13 +411,13 @@</p>
<pre># for a given transition, step through each location in the
# observed spectrum where it occurs and deposit a voigt profile
for i in parallel_objects(np.arange(n_absorbers), njobs=-1):</pre>
<p>–</p>
<ul><li><p># the virtual window into which the line is deposited initially</p></li>
<li><p># spans a region of 2 coarse spectral bins</p></li></ul>
<p>+ +                # the virtual window into which the line is deposited initially +                # spans a region of 2 coarse spectral bins</p>
<pre># (one on each side of the center_index) but the window
# can expand as necessary.
# it will continue to expand until the tau value in the far</pre>
<ul><li><p># edge of the wings is less than the min_tau value or it</p></li></ul>
<p>+                # edge of the wings is less than the min_tau value or it</p>
<pre>                # reaches the edge of the spectrum
                window_width_in_bins = 2
</pre>
<p>@@ -425,18 +425,18 @@</p>
<pre>left_index = (center_index[i] - window_width_in_bins/2)
right_index = (center_index[i] + window_width_in_bins/2)
n_vbins = (right_index - left_index) * n_vbins_per_bin[i]</pre>
<p>– +</p>
<pre># the array of virtual bins in lambda space
vbins = \</pre>
<ul><li><p>np.linspace(self.lambda_min + self.bin_width.d * left_index,</p></li>
<li><p>self.lambda_min + self.bin_width.d * right_index,</p></li></ul>
<p>+                        np.linspace(self.lambda_min + self.bin_width.d * left_index, +                                    self.lambda_min + self.bin_width.d * right_index,</p>
<pre>                                    n_vbins, endpoint=False)

                    # the virtual bins and their corresponding opacities
                    vbins, vtau = \
                        tau_profile(</pre>
<ul><li><p>lambda_0, line['f_value'], line['gamma'],</p></li>
<li><p>thermb[i], cdens[i],</p></li></ul>
<p>+                            lambda_0, line['f_value'], line['gamma'], +                            thermb[i], cdens[i],</p>
<pre>                            delta_lambda=dlambda[i], lambda_bins=vbins)

                    # If tau has not dropped below min tau threshold by the</pre>
<p>@@ -468,7 +468,7 @@</p>
<pre>                    continue

                # otherwise, determine how much of the original spectrum</pre>
<ul><li><p># is intersected by the expanded line window to be deposited,</p></li></ul>
<p>+                # is intersected by the expanded line window to be deposited,</p>
<pre># and deposit the Equivalent Width data into that intersecting
# window in the original spectrum's tau
else:</pre>
<p>@@ -517,7 +517,7 @@</p>
<pre>         """
         if filename is None:
return</pre>
<ul><li><p>mylog.info("Writing absorber list: %s." % filename)</p></li></ul>
<p>+        mylog.info("Writing absorber list: %s.", filename)</p>
<pre>self.absorbers_list.sort(key=lambda obj: obj['wavelength'])
f = open(filename, 'w')
f.write('#%-14s %-14s %-12s %-14s %-15s %-9s %-10s\n' %</pre>
<p>@@ -534,7 +534,7 @@</p>
<pre>"""
Write spectrum to an ascii file.
"""</pre>
<ul><li><p>mylog.info("Writing spectrum to ascii file: %s." % filename)</p></li></ul>
<p>+        mylog.info("Writing spectrum to ascii file: %s.", filename)</p>
<pre>f = open(filename, 'w')
f.write("# wavelength[A] tau flux\n")
for i in range(self.lambda_field.size):</pre>
<p>@@ -547,7 +547,7 @@</p>
<pre>"""
Write spectrum to a fits file.
"""</pre>
<ul><li><p>mylog.info("Writing spectrum to fits file: %s." % filename)</p></li></ul>
<p>+        mylog.info("Writing spectrum to fits file: %s.", filename)</p>
<pre>col1 = pyfits.Column(name='wavelength', format='E', array=self.lambda_field)
col2 = pyfits.Column(name='flux', format='E', array=self.flux_field)
cols = pyfits.ColDefs([col1, col2])</pre>
<p>@@ -560,7 +560,7 @@</p>
<pre>        Write spectrum to an hdf5 file.

        """</pre>
<ul><li><p>mylog.info("Writing spectrum to hdf5 file: %s." % filename)</p></li></ul>
<p>+        mylog.info("Writing spectrum to hdf5 file: %s.", filename)</p>
<pre>output = h5py.File(filename, 'w')
output.create_dataset('wavelength', data=self.lambda_field)
output.create_dataset('tau', data=self.tau_field)</pre>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/5d118c06fa7e/">https://bitbucket.org/yt_analysis/yt/commits/5d118c06fa7e/</a> Changeset:   5d118c06fa7e Branch:      yt User:        ngoldbaum Date:        2016-04-20 18:20:28+00:00 Summary:     Merged in migueldvb/yt (pull request #2114)</p>
<p>absorption spectrum module minor changes Affected #:  2 files</p>
<p>diff -r 8f91fd7329595d87b927cec203b1246b1de963f9 -r 5d118c06fa7eecc494eff5d231ebf3c47d9d4ab9 yt/analysis_modules/absorption_spectrum/absorption_spectrum.py --- a/yt/analysis_modules/absorption_spectrum/absorption_spectrum.py +++ b/yt/analysis_modules/absorption_spectrum/absorption_spectrum.py @@ -54,7 +54,7 @@</p>
<pre># lambda, flux, and tau are wavelength, flux, and optical depth
self.lambda_min = lambda_min
self.lambda_max = lambda_max</pre>
<ul><li><p>self.lambda_field = YTArray(np.linspace(lambda_min, lambda_max,</p></li></ul>
<p>+        self.lambda_field = YTArray(np.linspace(lambda_min, lambda_max,</p>
<pre>n_lambda), "angstrom")
         self.tau_field = None
         self.flux_field = None</pre>
<p>@@ -237,7 +237,7 @@</p>
<pre>     def _apply_observing_redshift(self, field_data, use_peculiar_velocity,
observing_redshift):
         """</pre>
<ul><li><p>Change the redshifts of individual absorbers to account for the</p></li></ul>
<p>+        Change the redshifts of individual absorbers to account for the</p>
<pre>        redshift at which the observer sits.

        The intermediate redshift that is seen by an observer</pre>
<p>@@ -275,9 +275,9 @@</p>
<pre>"""
Add continuum features to the spectrum.
"""</pre>
<ul><li><p># Change the redshifts of continuum sources to account for the</p></li></ul>
<p>+        # Change the redshifts of continuum sources to account for the</p>
<pre># redshift at which the observer sits</pre>
<ul><li><p>redshift, redshift_eff = self._apply_observing_redshift(field_data,</p></li></ul>
<p>+        redshift, redshift_eff = self._apply_observing_redshift(field_data,</p>
<pre>                                 use_peculiar_velocity, observing_redshift)

        # Only add continuum features down to tau of 1.e-4.</pre>
<p>@@ -319,9 +319,9 @@</p>
<pre>        Add the absorption lines to the spectrum.
        """
</pre>
<ul><li><p># Change the redshifts of individual absorbers to account for the</p></li></ul>
<p>+        # Change the redshifts of individual absorbers to account for the</p>
<pre># redshift at which the observer sits</pre>
<ul><li><p>redshift, redshift_eff = self._apply_observing_redshift(field_data,</p></li></ul>
<p>+        redshift, redshift_eff = self._apply_observing_redshift(field_data,</p>
<pre>                                 use_peculiar_velocity, observing_redshift)

        # Widen wavelength window until optical depth falls below this tau</pre>
<p>@@ -349,13 +349,13 @@</p>
<pre># we want to know the bin index in the lambda_field array
# where each line has its central wavelength after being
# redshifted.  however, because we don't know a priori how wide</pre>
<ul><li><p># a line will be (ie DLAs), we have to include bin indices</p></li>
<li><p># <strong>outside</strong> the spectral range of the AbsorptionSpectrum</p></li></ul>
<p>+            # a line will be (ie DLAs), we have to include bin indices +            # <strong>outside</strong> the spectral range of the AbsorptionSpectrum</p>
<pre># object.  Thus, we find the "equivalent" bin index, which
# may be <0 or >the size of the array.  In the end, we deposit
# the bins that actually overlap with the AbsorptionSpectrum's
# range in lambda.</pre>
<p>– +</p>
<pre># this equation gives us the "equivalent" bin index for each line
# if it were placed into the self.lambda_field array
center_index = (lambda_obs.in_units('Angstrom').d - self.lambda_min) \</pre>
<p>@@ -399,10 +399,10 @@</p>
<pre># a note to the user about which lines components are unresolved
if (thermal_width < self.bin_width).any():</pre>
<ul><li><p>mylog.info(("%d out of %d line components will be " + \</p></li>
<li><p>“deposited as unresolved lines.”) %</p></li>
<li><p>((thermal_width < self.bin_width).sum(),</p></li>
<li><p>n_absorbers))</p></li></ul>
<p>+                mylog.info("%d out of %d line components will be " + +                            “deposited as unresolved lines.”, +                            (thermal_width < self.bin_width).sum(), +                            n_absorbers)</p>
<pre># provide a progress bar with information about lines processsed
pbar = get_pbar("Adding line - %s [%f A]: " % \</pre>
<p>@@ -411,13 +411,13 @@</p>
<pre># for a given transition, step through each location in the
# observed spectrum where it occurs and deposit a voigt profile
for i in parallel_objects(np.arange(n_absorbers), njobs=-1):</pre>
<p>–</p>
<ul><li><p># the virtual window into which the line is deposited initially</p></li>
<li><p># spans a region of 2 coarse spectral bins</p></li></ul>
<p>+ +                # the virtual window into which the line is deposited initially +                # spans a region of 2 coarse spectral bins</p>
<pre># (one on each side of the center_index) but the window
# can expand as necessary.
# it will continue to expand until the tau value in the far</pre>
<ul><li><p># edge of the wings is less than the min_tau value or it</p></li></ul>
<p>+                # edge of the wings is less than the min_tau value or it</p>
<pre>                # reaches the edge of the spectrum
                window_width_in_bins = 2
</pre>
<p>@@ -425,18 +425,18 @@</p>
<pre>left_index = (center_index[i] - window_width_in_bins/2)
right_index = (center_index[i] + window_width_in_bins/2)
n_vbins = (right_index - left_index) * n_vbins_per_bin[i]</pre>
<p>– +</p>
<pre># the array of virtual bins in lambda space
vbins = \</pre>
<ul><li><p>np.linspace(self.lambda_min + self.bin_width.d * left_index,</p></li>
<li><p>self.lambda_min + self.bin_width.d * right_index,</p></li></ul>
<p>+                        np.linspace(self.lambda_min + self.bin_width.d * left_index, +                                    self.lambda_min + self.bin_width.d * right_index,</p>
<pre>                                    n_vbins, endpoint=False)

                    # the virtual bins and their corresponding opacities
                    vbins, vtau = \
                        tau_profile(</pre>
<ul><li><p>lambda_0, line['f_value'], line['gamma'],</p></li>
<li><p>thermb[i], cdens[i],</p></li></ul>
<p>+                            lambda_0, line['f_value'], line['gamma'], +                            thermb[i], cdens[i],</p>
<pre>                            delta_lambda=dlambda[i], lambda_bins=vbins)

                    # If tau has not dropped below min tau threshold by the</pre>
<p>@@ -468,7 +468,7 @@</p>
<pre>                    continue

                # otherwise, determine how much of the original spectrum</pre>
<ul><li><p># is intersected by the expanded line window to be deposited,</p></li></ul>
<p>+                # is intersected by the expanded line window to be deposited,</p>
<pre># and deposit the Equivalent Width data into that intersecting
# window in the original spectrum's tau
else:</pre>
<p>@@ -517,7 +517,7 @@</p>
<pre>         """
         if filename is None:
return</pre>
<ul><li><p>mylog.info("Writing absorber list: %s." % filename)</p></li></ul>
<p>+        mylog.info("Writing absorber list: %s.", filename)</p>
<pre>self.absorbers_list.sort(key=lambda obj: obj['wavelength'])
f = open(filename, 'w')
f.write('#%-14s %-14s %-12s %-14s %-15s %-9s %-10s\n' %</pre>
<p>@@ -534,7 +534,7 @@</p>
<pre>"""
Write spectrum to an ascii file.
"""</pre>
<ul><li><p>mylog.info("Writing spectrum to ascii file: %s." % filename)</p></li></ul>
<p>+        mylog.info("Writing spectrum to ascii file: %s.", filename)</p>
<pre>f = open(filename, 'w')
f.write("# wavelength[A] tau flux\n")
for i in range(self.lambda_field.size):</pre>
<p>@@ -547,7 +547,7 @@</p>
<pre>"""
Write spectrum to a fits file.
"""</pre>
<ul><li><p>mylog.info("Writing spectrum to fits file: %s." % filename)</p></li></ul>
<p>+        mylog.info("Writing spectrum to fits file: %s.", filename)</p>
<pre>col1 = pyfits.Column(name='wavelength', format='E', array=self.lambda_field)
col2 = pyfits.Column(name='flux', format='E', array=self.flux_field)
cols = pyfits.ColDefs([col1, col2])</pre>
<p>@@ -560,7 +560,7 @@</p>
<pre>        Write spectrum to an hdf5 file.

        """</pre>
<ul><li><p>mylog.info("Writing spectrum to hdf5 file: %s." % filename)</p></li></ul>
<p>+        mylog.info("Writing spectrum to hdf5 file: %s.", filename)</p>
<pre>output = h5py.File(filename, 'w')
output.create_dataset('wavelength', data=self.lambda_field)
output.create_dataset('tau', data=self.tau_field)</pre>
<p>diff -r 8f91fd7329595d87b927cec203b1246b1de963f9 -r 5d118c06fa7eecc494eff5d231ebf3c47d9d4ab9 yt/analysis_modules/absorption_spectrum/absorption_spectrum_fit.py --- a/yt/analysis_modules/absorption_spectrum/absorption_spectrum_fit.py +++ b/yt/analysis_modules/absorption_spectrum/absorption_spectrum_fit.py @@ -12,14 +12,14 @@</p>
<pre>optimize = _scipy.optimize
</pre>
<p>-def generate_total_fit(x, fluxData, orderFits, speciesDicts, +def generate_total_fit(x, fluxData, orderFits, speciesDicts,</p>
<pre>minError=1E-4, complexLim=.995,</pre>
<ul><li><p>fitLim=.97, minLength=3,</p></li></ul>
<p>+        fitLim=.97, minLength=3,</p>
<pre>        maxLength=1000, splitLim=.99,
        output_file=None):

    """</pre>
<ul><li><p>This function is designed to fit an absorption spectrum by breaking</p></li></ul>
<p>+    This function is designed to fit an absorption spectrum by breaking</p>
<pre>    the spectrum up into absorption complexes, and iteratively adding
    and optimizing voigt profiles to each complex.
</pre>
<p>@@ -31,46 +31,46 @@</p>
<pre>    array of flux corresponding to the wavelengths given
    in x. (needs to be the same size as x)
orderFits : list</pre>
<ul><li><p>list of the names of the species in the order that they</p></li></ul>
<p>+        list of the names of the species in the order that they</p>
<pre>    should be fit. Names should correspond to the names of the species
    given in speciesDicts. (ex: ['lya','OVI'])
speciesDicts : dictionary
    Dictionary of dictionaries (I'm addicted to dictionaries, I
    confess). Top level keys should be the names of all the species given</pre>
<ul><li><p>in orderFits. The entries should be dictionaries containing all</p></li>
<li><p>relevant parameters needed to create an absorption line of a given</p></li></ul>
<p>+        in orderFits. The entries should be dictionaries containing all +        relevant parameters needed to create an absorption line of a given</p>
<pre>    species (f,Gamma,lambda0) as well as max and min values for parameters
    to be fit
complexLim : float, optional</pre>
<ul><li><p>Maximum flux to start the edge of an absorption complex. Different</p></li>
<li><p>from fitLim because it decides extent of a complex rather than</p></li>
<li><p>whether or not a complex is accepted.</p></li></ul>
<p>+        Maximum flux to start the edge of an absorption complex. Different +        from fitLim because it decides extent of a complex rather than +        whether or not a complex is accepted.</p>
<pre>fitLim : float,optional</pre>
<ul><li><p>Maximum flux where the level of absorption will trigger</p></li></ul>
<p>+        Maximum flux where the level of absorption will trigger</p>
<pre>    identification of the region as an absorption complex. Default = .98.
    (ex: for a minSize=.98, a region where all the flux is between 1.0 and
    .99 will not be separated out to be fit as an absorbing complex, but
    a region that contains a point where the flux is .97 will be fit
    as an absorbing complex.)
minLength : int, optional</pre>
<ul><li><p>number of cells required for a complex to be included.</p></li></ul>
<p>+        number of cells required for a complex to be included.</p>
<pre>    default is 3 cells.
maxLength : int, optional
    number of cells required for a complex to be split up. Default
    is 1000 cells.
splitLim : float, optional
    if attempting to split a region for being larger than maxlength</pre>
<ul><li><p>the point of the split must have a flux greater than splitLim</p></li></ul>
<p>+        the point of the split must have a flux greater than splitLim</p>
<pre>    (ie: absorption greater than splitLim). Default= .99.
output_file : string, optional</pre>
<ul><li><p>location to save the results of the fit.</p></li></ul>
<p>+        location to save the results of the fit.</p>
<pre>Returns
-------
allSpeciesLines : dictionary</pre>
<ul><li><p>Dictionary of dictionaries representing the fit lines.</p></li></ul>
<p>+        Dictionary of dictionaries representing the fit lines.</p>
<pre>Top level keys are the species given in orderFits and the corresponding</pre>
<ul><li><p>entries are dictionaries with the keys ‘N','b','z’, and ‘group#’.</p></li></ul>
<p>+        entries are dictionaries with the keys ‘N','b','z’, and ‘group#’.</p>
<pre>Each of these corresponds to a list of the parameters for every
accepted fitted line. (ie: N[0],b[0],z[0] will create a line that
fits some part of the absorption spectrum). 'group#' is a similar list</pre>
<p>@@ -87,7 +87,7 @@</p>
<pre># convert to NumPy array if we have a YTArray
if isinstance(x, YTArray):
    x = x.d</pre>
<p>– +</p>
<pre>    #Empty dictionary for fitted lines
    allSpeciesLines = {}
</pre>
<p>@@ -129,8 +129,8 @@</p>
<pre>#Check if any flux at partner sites
if not _line_exists(speciesDict['wavelength'],</pre>
<ul><li><p>fluxData,z,x0,xRes,fitLim):</p></li>
<li><p>continue</p></li></ul>
<p>+                    fluxData,z,x0,xRes,fitLim): +                continue</p>
<pre>#Fit Using complex tools
newLinesP,flag=_complex_fit(xBounded,yDatBounded,yFitBounded,</pre>
<p>@@ -139,7 +139,7 @@</p>
<pre>#If flagged as a bad fit, species is lyman alpha,
#   and it may be a saturated line, use special tools
if flag and species=='lya' and min(yDatBounded)<.1:</pre>
<ul><li><p>newLinesP=_large_flag_fit(xBounded,yDatBounded,</p></li></ul>
<p>+                newLinesP=_large_flag_fit(xBounded,yDatBounded,</p>
<pre>                        yFitBounded,z,speciesDict,
                        fitLim,minError)
</pre>
<p>@@ -151,7 +151,7 @@</p>
<pre>#Check existence of partner lines if applicable
if len(speciesDict['wavelength']) != 1:</pre>
<ul><li><p>newLinesP = _remove_unaccepted_partners(newLinesP, x, fluxData,</p></li></ul>
<p>+                newLinesP = _remove_unaccepted_partners(newLinesP, x, fluxData,</p>
<pre>                        b, minError, x0, xRes, speciesDict)

</pre>
<p>@@ -177,15 +177,15 @@</p>
<pre>    return (allSpeciesLines,yFit)
</pre>
<p>-def _complex_fit(x, yDat, yFit, initz, minSize, errBound, speciesDict, +def _complex_fit(x, yDat, yFit, initz, minSize, errBound, speciesDict,</p>
<pre>    initP=None):
""" Fit an absorption complex by iteratively adding and optimizing
voigt profiles.</pre>
<p>– +</p>
<pre>A complex is defined as a region where some number of lines may be present,
or a region of non zero of absorption. Lines are iteratively added
and optimized until the difference between the flux generated using</pre>
<ul><li><p>the optimized parameters has a least squares difference between the</p></li></ul>
<p>+    the optimized parameters has a least squares difference between the</p>
<pre>    desired flux profile less than the error bound.

    Parameters</pre>
<p>@@ -199,7 +199,7 @@</p>
<pre>    array of flux profile fitted for the wavelength
    space given by x already. Same size as x.
initz : float</pre>
<ul><li><p>redshift to try putting first line at</p></li></ul>
<p>+        redshift to try putting first line at</p>
<pre>    (maximum absorption for region)
minsize : float
    minimum absorption allowed for a line to still count as a line</pre>
<p>@@ -219,7 +219,7 @@</p>
<pre>Returns
-------
linesP : (3,) ndarray</pre>
<ul><li><p>Array of best parameters if a good enough fit is found in</p></li></ul>
<p>+        Array of best parameters if a good enough fit is found in</p>
<pre>    the form [[N1,b1,z1], [N2,b2,z2],...]
flag : bool
    boolean value indicating the success of the fit (True if unsuccessful)</pre>
<p>@@ -227,8 +227,8 @@</p>
<pre>#Setup initial line guesses
if initP is None: #Regular fit</pre>
<ul><li><p>initP = [0,0,0]</p></li>
<li><p>if min(yDat)<.01: #Large lines get larger initial guess</p></li></ul>
<p>+        initP = [0,0,0] +        if min(yDat)<.01: #Large lines get larger initial guess</p>
<pre>initP[0] = speciesDict['init_N']*10**2
         elif min(yDat)<.5:
initP[0] = speciesDict['init_N']*10**1</pre>
<p>@@ -246,9 +246,9 @@</p>
<pre>    wl0 = speciesDict['wavelength'][0]

    #Check if first line exists still</pre>
<ul><li><p>if min(yDat-yFit+1)>minSize:</p></li></ul>
<p>+    if min(yDat-yFit+1)>minSize:</p>
<pre>return [],False</pre>
<p>– +</p>
<pre>    #Values to proceed through first run
    errSq,prevErrSq,prevLinesP=1,10*len(x),[]
</pre>
<p>@@ -283,9 +283,9 @@</p>
<pre>         if any(linesP[:,1]==speciesDict['init_b']):
flag = True
break</pre>
<p>– +</p>
<pre>#If good enough, break</pre>
<ul><li><p>if errSq < errBound:</p></li></ul>
<p>+        if errSq < errBound:</p>
<pre>            break

        #If last fit was worse, reject the last line and revert to last fit</pre>
<p>@@ -297,7 +297,7 @@</p>
<pre>                linesP = prevLinesP
                break
</pre>
<ul><li><p>#If too many lines</p></li></ul>
<p>+        #If too many lines</p>
<pre>         if np.shape(linesP)[0]>8 or np.size(linesP)+3>=len(x):
#If its fitable by flag tools and still bad, use flag tools
if errSq >1E2*errBound and speciesDict['name']=='HI lya':</pre>
<p>@@ -311,11 +311,11 @@</p>
<pre>        prevLinesP = linesP

        #Set up initial condition for new line</pre>
<ul><li><p>newP = [0,0,0]</p></li></ul>
<p>+        newP = [0,0,0]</p>
<pre>yAdjusted = 1+yFit*yNewFit-yDat</pre>
<p>–</p>
<ul><li><p>if min(yAdjusted)<.01: #Large lines get larger initial guess</p></li></ul>
<p>+ +        if min(yAdjusted)<.01: #Large lines get larger initial guess</p>
<pre>newP[0] = speciesDict['init_N']*10**2
         elif min(yAdjusted)<.5:
newP[0] = speciesDict['init_N']*10**1</pre>
<p>@@ -333,7 +333,7 @@</p>
<pre>remove=[]
for i,p in enumerate(linesP):
    check=_check_params(np.array([p]),speciesDict,x)</pre>
<ul><li><p>if check:</p></li></ul>
<p>+        if check:</p>
<pre>            remove.append(i)
    linesP = np.delete(linesP,remove,axis=0)
</pre>
<p>@@ -358,7 +358,7 @@</p>
<pre>    array of flux profile fitted for the wavelength
    space given by x already. Same size as x.
initz : float</pre>
<ul><li><p>redshift to try putting first line at</p></li></ul>
<p>+        redshift to try putting first line at</p>
<pre>    (maximum absorption for region)
speciesDict : dictionary
    dictionary containing all relevant parameters needed</pre>
<p>@@ -374,15 +374,15 @@</p>
<pre>Returns
-------
bestP : (3,) ndarray</pre>
<ul><li><p>array of best parameters if a good enough fit is found in</p></li>
<li><p>the form [[N1,b1,z1], [N2,b2,z2],…]</p></li></ul>
<p>+        array of best parameters if a good enough fit is found in +        the form [[N1,b1,z1], [N2,b2,z2],…]</p>
<pre>    """

    #Set up some initial line guesses
    lineTests = _get_test_lines(initz)

    #Keep track of the lowest achieved error</pre>
<ul><li><p>bestError = 1000</p></li></ul>
<p>+    bestError = 1000</p>
<pre>#Iterate through test line guesses
for initLines in lineTests:</pre>
<p>@@ -403,7 +403,7 @@</p>
<pre>            bestError = errSq
            bestP = linesP
</pre>
<ul><li><p>if bestError>10*errBound*len(x):</p></li></ul>
<p>+    if bestError>10*errBound*len(x):</p>
<pre>    return []
else:
    return bestP</pre>
<p>@@ -411,11 +411,11 @@</p>
<pre>def _get_test_lines(initz):
    """
    Returns a 3d numpy array of lines to test as initial guesses for difficult</pre>
<ul><li><p>to fit lyman alpha absorbers that are saturated.</p></li></ul>
<p>– +    to fit lyman alpha absorbers that are saturated. +</p>
<pre>The array is 3d because
the first dimension gives separate initial guesses, the second dimension</pre>
<ul><li><p>has multiple lines for the same guess (trying a broad line plus a</p></li></ul>
<p>+    has multiple lines for the same guess (trying a broad line plus a</p>
<pre>    saturated line) and the 3d dimension contains the 3 fit parameters (N,b,z)

    Parameters</pre>
<p>@@ -426,7 +426,7 @@</p>
<pre>Returns
-------
testP : (,3,) ndarray</pre>
<ul><li><p>numpy array of the form</p></li></ul>
<p>+        numpy array of the form</p>
<pre>        [[[N1a,b1a,z1a], [N1b,b1b,z1b]], [[N2a,b2,z2a],...] ...]
    """
</pre>
<p>@@ -454,8 +454,8 @@</p>
<pre>    return testP

def _get_bounds(z, b, wl, x0, xRes):</pre>
<ul><li><p>"""</p></li>
<li><p>Gets the indices of range of wavelength that the wavelength wl is in</p></li></ul>
<p>+    """ +    Gets the indices of range of wavelength that the wavelength wl is in</p>
<pre>    with the size of some initial wavelength range.

    Used for checking if species with multiple lines (as in the OVI doublet)</pre>
<p>@@ -466,21 +466,21 @@</p>
<pre>z : float
    redshift
b : (3) ndarray/list</pre>
<ul><li><p>initial bounds in form [i0,i1,i2] where i0 is the index of the</p></li>
<li><p>minimum flux for the complex, i1 is index of the lower wavelength</p></li></ul>
<p>+        initial bounds in form [i0,i1,i2] where i0 is the index of the +        minimum flux for the complex, i1 is index of the lower wavelength</p>
<pre>    edge of the complex, and i2 is the index of the higher wavelength
    edge of the complex.
wl : float</pre>
<ul><li><p>unredshifted wavelength of the peak of the new region</p></li></ul>
<p>+        unredshifted wavelength of the peak of the new region</p>
<pre>x0 : float
    wavelength of the index 0
xRes : float
    difference in wavelength for two consecutive indices</pre>
<p>– +</p>
<pre>Returns
-------
indices : (2) tuple</pre>
<ul><li><p>Tuple (i1,i2) where i1 is the index of the lower wavelength bound of</p></li></ul>
<p>+        Tuple (i1,i2) where i1 is the index of the lower wavelength bound of</p>
<pre>    the new region and i2 is the index of the higher wavelength bound of
    the new region
"""</pre>
<p>@@ -492,7 +492,7 @@</p>
<pre>    return indices
</pre>
<p>-def _remove_unaccepted_partners(linesP, x, y, b, errBound, +def _remove_unaccepted_partners(linesP, x, y, b, errBound,</p>
<pre>    x0, xRes, speciesDict):
"""
Given a set of parameters [N,b,z] that form multiple lines for a given</pre>
<p>@@ -507,18 +507,18 @@</p>
<pre>Parameters
----------
linesP : (3,) ndarray</pre>
<ul><li><p>array giving sets of line parameters in</p></li></ul>
<p>+        array giving sets of line parameters in</p>
<pre>    form [[N1, b1, z1], ...]
x : (N) ndarray
    wavelength array [nm]
y : (N) ndarray
    normalized flux array of original data
b : (3) tuple/list/ndarray</pre>
<ul><li><p>indices that give the bounds of the original region so that another</p></li></ul>
<p>+        indices that give the bounds of the original region so that another</p>
<pre>    region of similar size can be used to determine the goodness
    of fit of the other wavelengths
errBound : float</pre>
<ul><li><p>size of the error that is appropriate for a given region,</p></li></ul>
<p>+        size of the error that is appropriate for a given region,</p>
<pre>        adjusted to account for the size of the region.

    Returns</pre>
<p>@@ -569,7 +569,7 @@</p>
<pre>    #Remove all bad line fits
    linesP = np.delete(linesP,removeLines,axis=0)
</pre>
<ul><li><p>return linesP</p></li></ul>
<p>+    return linesP</p>
<p>@@ -588,12 +588,12 @@</p>
<pre>xRes : float
    difference in wavelength between consecutive cells in flux array
fluxMin : float</pre>
<ul><li><p>maximum flux to count as a line existing.</p></li></ul>
<p>+        maximum flux to count as a line existing.</p>
<pre>    Returns
    -------
</pre>
<ul><li><p>flag : boolean</p></li></ul>
<p>+    flag : boolean</p>
<pre>        value indicating whether all lines exist. True if all lines exist
    """
</pre>
<p>@@ -618,7 +618,7 @@</p>
<pre>def _find_complexes(x, yDat, complexLim=.999, fitLim=.99,
        minLength =3, maxLength=1000, splitLim=.99):
    """Breaks up the wavelength space into groups</pre>
<ul><li><p>where there is some absorption.</p></li></ul>
<p>+    where there is some absorption.</p>
<pre>Parameters
----------</pre>
<p>@@ -628,33 +628,33 @@</p>
<pre>    array of flux corresponding to the wavelengths given
    in x. (needs to be the same size as x)
complexLim : float, optional</pre>
<ul><li><p>Maximum flux to start the edge of an absorption complex. Different</p></li>
<li><p>from fitLim because it decides extent of a complex rather than</p></li>
<li><p>whether or not a complex is accepted.</p></li></ul>
<p>+        Maximum flux to start the edge of an absorption complex. Different +        from fitLim because it decides extent of a complex rather than +        whether or not a complex is accepted.</p>
<pre>fitLim : float,optional</pre>
<ul><li><p>Maximum flux where the level of absorption will trigger</p></li></ul>
<p>+        Maximum flux where the level of absorption will trigger</p>
<pre>    identification of the region as an absorption complex. Default = .98.
    (ex: for a minSize=.98, a region where all the flux is between 1.0 and
    .99 will not be separated out to be fit as an absorbing complex, but
    a region that contains a point where the flux is .97 will be fit
    as an absorbing complex.)
minLength : int, optional</pre>
<ul><li><p>number of cells required for a complex to be included.</p></li></ul>
<p>+        number of cells required for a complex to be included.</p>
<pre>    default is 3 cells.
maxLength : int, optional
    number of cells required for a complex to be split up. Default
    is 1000 cells.
splitLim : float, optional
    if attempting to split a region for being larger than maxlength</pre>
<ul><li><p>the point of the split must have a flux greater than splitLim</p></li></ul>
<p>+        the point of the split must have a flux greater than splitLim</p>
<pre>        (ie: absorption greater than splitLim). Default= .99.

    Returns
    -------</pre>
<ul><li><p>cBounds : (3,)</p></li>
<li><p>list of bounds in the form [[i0,i1,i2],…] where i0 is the</p></li></ul>
<p>+    cBounds : (3,) +        list of bounds in the form [[i0,i1,i2],…] where i0 is the</p>
<pre>index of the maximum flux for a complex, i1 is the index of the</pre>
<ul><li><p>beginning of the complex, and i2 is the index of the end of the</p></li></ul>
<p>+        beginning of the complex, and i2 is the index of the end of the</p>
<pre>        complex. Indexes refer to the indices of x and yDat.
    """
</pre>
<p>@@ -743,7 +743,7 @@</p>
<pre>x : (N) ndarray
    Array of wavelength
linesP: (3,) ndarray</pre>
<ul><li><p>Array giving sets of line parameters in</p></li></ul>
<p>+        Array giving sets of line parameters in</p>
<pre>    form [[N1, b1, z1], ...]
speciesDict : dictionary
    Dictionary containing all relevant parameters needed</pre>
<p>@@ -762,7 +762,7 @@</p>
<pre>g=speciesDict['Gamma'][i]
wl=speciesDict['wavelength'][i]
y = y+ _gen_tau(x,p,f,g,wl)</pre>
<ul><li><p>if firstLine:</p></li></ul>
<p>+            if firstLine:</p>
<pre>                break

    flux = np.exp(-y)</pre>
<p>@@ -772,15 +772,15 @@</p>
<pre>"""This calculates a flux distribution for given parameters using the yt
voigt profile generator"""
N,b,z= p</pre>
<p>– +</p>
<pre>#Calculating quantities
tau_o = 1.4973614E-15*N*f*lambda_unshifted/b
a=7.95774715459E-15*Gamma*lambda_unshifted/b
x=299792.458/b*(lambda_unshifted*(1+z)/t-1)</pre>
<p>– +</p>
<pre>H = np.zeros(len(x))
H = voigt(a,x)</pre>
<p>– +</p>
<pre>    tau = tau_o*H

    return tau</pre>
<p>@@ -797,8 +797,8 @@</p>
<pre>Parameters
----------</pre>
<ul><li><p>pTotal : (3,) ndarray</p></li>
<li><p>Array with form [[N1, b1, z1], …]</p></li></ul>
<p>+    pTotal : (3,) ndarray +        Array with form [[N1, b1, z1], …]</p>
<pre>x : (N) ndarray
    array of wavelengths [nm]
yDat : (N) ndarray</pre>
<p>@@ -816,7 +816,7 @@</p>
<pre>error : (N) ndarray
    the difference between the fit generated by the parameters
    given in pTotal multiplied by the previous fit and the desired</pre>
<ul><li><p>flux profile, w/ first index modified appropriately for bad</p></li></ul>
<p>+        flux profile, w/ first index modified appropriately for bad</p>
<pre>    parameter choices and additional penalty for fitting with a lower
    flux than observed.
"""</pre>
<p>@@ -834,13 +834,13 @@</p>
<pre>def _check_params(p, speciesDict,xb):
    """</pre>
<ul><li><p>Check to see if any of the parameters in p fall outside the range</p></li></ul>
<p>+    Check to see if any of the parameters in p fall outside the range</p>
<pre>        given in speciesDict or on the boundaries

    Parameters
    ----------
    p : (3,) ndarray</pre>
<ul><li><p>array with form [[N1, b1, z1], …]</p></li></ul>
<p>+        array with form [[N1, b1, z1], …]</p>
<pre>speciesDict : dictionary
    dictionary with properties giving the max and min
    values appropriate for each parameter N,b, and z.</pre>
<p>@@ -864,21 +864,21 @@</p>
<pre>any(p[:,1] <= speciesDict['minb']) or\
any(p[:,2] >= maxz) or\
any(p[:,2] <= minz):</pre>
<ul><li><p>check = 999</p></li></ul>
<p>– +        check = 999 +</p>
<pre>    return check

def _check_optimization_init(p,speciesDict,initz,xb,yDat,yFit,minSize,errorBound):

    """
    Check to see if any of the parameters in p are the</pre>
<ul><li><p>same as initial paramters and if so, attempt to</p></li></ul>
<p>+    same as initial paramters and if so, attempt to</p>
<pre>    split the region and refit it.

    Parameters
    ----------
    p : (3,) ndarray</pre>
<ul><li><p>array with form [[N1, b1, z1], …]</p></li></ul>
<p>+        array with form [[N1, b1, z1], …]</p>
<pre>speciesDict : dictionary
    dictionary with properties giving the max and min
    values appropriate for each parameter N,b, and z.</pre>
<p>@@ -894,38 +894,38 @@</p>
<pre>          any(p[:,1] == speciesDict['init_b']) or\
          any(p[:,1] == speciesDict['maxb']):
</pre>
<ul><li><p># These are the initial bounds</p></li>
<li><p>init_bounds = [yDat.argmin(),0,len(xb)-1]</p></li></ul>
<p>+        # These are the initial bounds +        init_bounds = [yDat.argmin(),0,len(xb)-1]</p>
<ul><li><p># Gratitutous limit for splitting region</p></li>
<li><p>newSplitLim = 1 – (1-min(yDat))*.5</p></li></ul>
<p>+        # Gratitutous limit for splitting region +        newSplitLim = 1 – (1-min(yDat))*.5</p>
<ul><li><p># Attempt to split region</p></li>
<li><p>split = _split_region(yDat,init_bounds,newSplitLim)</p></li></ul>
<p>–</p>
<ul><li><p># If we can't split it, just reject it. Its unphysical</p></li>
<li><p># to just keep the default parameters and we're out of</p></li>
<li><p># options at this point</p></li>
<li><p>if not split:</p></li>
<li><p>return []</p></li></ul>
<p>+        # Attempt to split region +        split = _split_region(yDat,init_bounds,newSplitLim)</p>
<ul><li><p># Else set up the bounds for each region and fit separately</p></li>
<li><p>b1,b2 = split[0][2], split[1][1]</p></li></ul>
<p>+        # If we can't split it, just reject it. Its unphysical +        # to just keep the default parameters and we're out of +        # options at this point +        if not split: +            return []</p>
<ul><li><p>p1,flag = _complex_fit(xb[:b1], yDat[:b1], yFit[:b1],</p></li>
<li><p>initz, minSize, errorBound, speciesDict)</p></li></ul>
<p>+        # Else set up the bounds for each region and fit separately +        b1,b2 = split[0][2], split[1][1]</p>
<ul><li><p>p2,flag = _complex_fit(xb[b2:], yDat[b2:], yFit[b2:],</p></li>
<li><p>initz, minSize, errorBound, speciesDict)</p></li></ul>
<p>+        p1,flag = _complex_fit(xb[:b1], yDat[:b1], yFit[:b1], +                        initz, minSize, errorBound, speciesDict)</p>
<ul><li><p># Make the final line parameters. Its annoying because</p></li>
<li><p># one or both regions may have fit to nothing</p></li>
<li><p>if np.size(p1)> 0 and np.size(p2)>0:</p></li>
<li><p>p = np.r_[p1,p2]</p></li>
<li><p>elif np.size(p1) > 0:</p></li>
<li><p>p = p1</p></li>
<li><p>else:</p></li>
<li><p>p = p2</p></li></ul>
<p>+        p2,flag = _complex_fit(xb[b2:], yDat[b2:], yFit[b2:], +                        initz, minSize, errorBound, speciesDict) + +        # Make the final line parameters. Its annoying because +        # one or both regions may have fit to nothing +        if np.size(p1)> 0 and np.size(p2)>0: +            p = np.r_[p1,p2] +        elif np.size(p1) > 0: +            p = p1 +        else: +            p = p2</p>
<pre>    return p
</pre>
<p>@@ -939,7 +939,7 @@</p>
<pre>Parameters
----------
p : (3,) ndarray</pre>
<ul><li><p>array with form [[N1, b1, z1], …]</p></li></ul>
<p>+        array with form [[N1, b1, z1], …]</p>
<pre>speciesDict : dictionary
    dictionary with properties giving the max and min
    values appropriate for each parameter N,b, and z.</pre>
<p>@@ -979,7 +979,7 @@</p>
<pre># we just set it to no fit because we've tried
# everything else at this point. this region just sucks :(
remove_lines.append(i)</pre>
<p>– +</p>
<pre>    if remove_lines:
        p = np.delete(p, remove_lines, axis=0)
</pre>
<p>@@ -988,7 +988,7 @@</p>
<pre>def _output_fit(lineDic, file_name = 'spectrum_fit.h5'):
    """
    This function is designed to output the parameters of the series</pre>
<ul><li><p>of lines used to fit an absorption spectrum.</p></li></ul>
<p>+    of lines used to fit an absorption spectrum.</p>
<pre>The dataset contains entries in the form species/N, species/b
species/z, and species/complex. The ith entry in each of the datasets</pre>
<p>@@ -999,11 +999,11 @@</p>
<pre>Parameters
----------
lineDic : dictionary</pre>
<ul><li><p>Dictionary of dictionaries representing the fit lines.</p></li></ul>
<p>+        Dictionary of dictionaries representing the fit lines.</p>
<pre>Top level keys are the species given in orderFits and the corresponding</pre>
<ul><li><p>entries are dictionaries with the keys ‘N','b','z’, and ‘group#’.</p></li></ul>
<p>+        entries are dictionaries with the keys ‘N','b','z’, and ‘group#’.</p>
<pre>Each of these corresponds to a list of the parameters for every</pre>
<ul><li><p>accepted fitted line.</p></li></ul>
<p>+        accepted fitted line.</p>
<pre>fileName : string, optional
    Name of the file to output fit to. Default = 'spectrum_fit.h5'</pre>
<p>Repository URL: <a href="https://bitbucket.org/yt_analysis/yt/">https://bitbucket.org/yt_analysis/yt/</a></p>
<p>—</p>
<p>This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.</p>

<img src="http://link.bitbucket.org/wf/open?upn=ll4ctv0L-2ByeRZFC1LslHcg6aJmnQ70VruLbmeLQr27CzavGpNpjhDNaIP1zx7IoeEsgVvQA7AHFE1BToIWY-2Bcid8i9bnRn9DrKN7B2bn7UEv-2BeEWbu8HlHwxRlUyMp6g8J2vPQwqkZyLoyK5Y7GCExZJ0RXPtF7iu5ehxRjzuh2b9RBHIOu5W96ZpsfFo4s58woyOv5sVTKwraEzPvaH5maYmyEl2f9iMIaQpjuoP5g-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;"/>
</body></html>