Calculate floc terminal velocity.
18401
def vel_term_floc(ConcAl, ConcClay, coag, material, DIM_FRACTAL,
                  DiamTarget, Temp):
    """"""
    WaterDensity = pc.density_water(Temp).magnitude
    return (((pc.gravity.magnitude * material.Diameter**2)
             / (18 * PHI_FLOC * pc.viscosity_kinematic(Temp).magnitude)
             )
            * ((dens_floc_init(ConcAl, ConcClay, coag, material).magnitude
                - WaterDensity
                )
               / WaterDensity
               )
            * (DiamTarget / material.Diameter) ** (DIM_FRACTAL - 1)
            )
1293255
def headloss_fric(FlowRate, Diam, Length, Nu, PipeRough):
    
    #Checking input validity - inputs not checked here are checked by
    #functions this function calls.
    ut.check_range([Length, ">0", "Length"])
    return (fric(FlowRate, Diam, Nu, PipeRough)
            * 8 / (gravity.magnitude * np.pi**2)
            * (Length * FlowRate**2) / Diam**5
            )
215481
def ecliptic_velocity(self):
        """"""
        vector = _ECLIPJ2000.dot(self.velocity.au_per_d)
        return Velocity(vector)
578263
public static double calcLoad(Long deltaCpuTime, long deltaUptime, long factor) {
		if (deltaCpuTime == null || deltaCpuTime <= 0 || deltaUptime == 0) {
			return 0.0;
		}
		return deltaCpuTime * 100d / factor / deltaUptime;
	}
766300
def re_pipe(FlowRate, Diam, Nu):
    """"""
    #Checking input validity
    ut.check_range([FlowRate, ">0", "Flow rate"], [Diam, ">0", "Diameter"],
                   [Nu, ">0", "Nu"])
    return (4 * FlowRate) / (np.pi * Diam * Nu)
643149
def downstream_index(dir_value, i, j, alg='taudem'):
        """"""
        assert alg.lower() in FlowModelConst.d8_deltas
        delta = FlowModelConst.d8_deltas.get(alg.lower())
        drow, dcol = delta[int(dir_value)]
        return i + drow, j + dcol
1374683
def _call(self, x):
        """"""

        sum_constr = abs(x.ufuncs.sum() / self.diameter - 1) <= self.sum_rtol

        nonneq_constr = x.ufuncs.greater_equal(0).asarray().all()

        if sum_constr and nonneq_constr:
            return 0
        else:
            return np.inf
1243325
def fric_general(Area, PerimWetted, Vel, Nu, PipeRough):
    """"""
    #Checking input validity - inputs not checked here are checked by
    #functions this function calls.
    ut.check_range([PipeRough, "0-1", "Pipe roughness"])
    if re_general(Vel, Area, PerimWetted, Nu) >= RE_TRANSITION_PIPE:
        #Swamee-Jain friction factor adapted for any cross-section.
        #Diam = 4*R*h
        f= (0.25 /
            (np.log10((PipeRough
                       / (3.7 * 4
                          * radius_hydraulic_general(Area, PerimWetted).magnitude
                          )
                       )
                      + (5.74
                         / re_general(Vel, Area, PerimWetted, Nu) ** 0.9
                         )
                      )
             ) ** 2
            )
    else:
        f = 64 / re_general(Vel, Area, PerimWetted, Nu)
    return f
5936
def results(self):
        """"""
        if self.deriv == 0:
            return self.v,
        if self.deriv == 1:
            return self.v, self.d
        if self.deriv == 2:
            return self.v, self.d, self.dd
1335445
def predmean(self, xp): 
        
        out = np.empty_like(xp)
        for i in range(3):
            out[:, i] = xp[:, i] + self.delta * xp[:, i+3]  # position
            out[:, i+3] = xp[:, i+3]                      # velocity 
        return out
666712
def prob(self, pw):
        
        return float(self._T.get(pw, 0)) / self._T[TOTALF_W]
180227
def headloss_weir(FlowRate, Width):
    """"""
    #Checking input validity
    ut.check_range([FlowRate, ">0", "Flow rate"], [Width, ">0", "Width"])
    return (((3/2) * FlowRate
             / (con.VC_ORIFICE_RATIO * np.sqrt(2 * gravity.magnitude) * Width)
             ) ** (2/3))
567031
def recipe_velocity(adata, min_counts=3, min_counts_u=3, n_top_genes=None, n_pcs=30, n_neighbors=30, log=True, copy=False):
    
    from .moments import moments
    filter_and_normalize(adata, min_counts=min_counts, min_counts_u=min_counts_u, n_top_genes=n_top_genes, log=log)
    moments(adata, n_neighbors=n_neighbors, n_pcs=n_pcs)
    return adata if copy else None
277196
def rhochange(self):
        """"""

        self.lu, self.piv = sl.lu_factor(self.Z, self.rho)
        self.lu = np.asarray(self.lu, dtype=self.dtype)
696295
def mean_velocity(self, tol=0.05, Lx=None):
        '''
        
        '''
        dx = None
        dt = None
        p = None
        ind = None
        t_end = None

        if self.area == 0:
            return dict(dx=dx, dt=dt, p=p, ind=ind, t_end=t_end)

        x = self.x_position(Lx=Lx)

        # find the first and last valid indices
        ind_start = mlab.find(x.mask==False)[0]
        ind_last = mlab.find(x.mask==False)[-1]

        # if the original x value is within tol % of the final x value, include
        # all samples
        if x[ind_start] > (1 - tol) * x[ind_last] or x[ind_last] < 0:
            ind_stop = ind_last
        else: # otherwise, stop when x reaches (1 - tol) % of it's final value
            ind_stop = mlab.find(x > (1 - tol) * x[ind_last])[0]

        ind = [ind_start, ind_stop]

        # if we have at least 2 valid samples
        if len(ind) >=2:
            dx = np.diff(x[ind])[0]
            dt = np.diff(self.time[ind])[0] # ms

            # suppress polyfit warnings
            with warnings.catch_warnings():
                warnings.simplefilter("ignore")
                # fit a line to the data
                p = np.polyfit(self.time[ind[0]:ind[1]], x[ind[0]:ind[1]], 1)

            # find time when the the line intercepts x[ind_last]
            ind_stop = mlab.find(self.time > \
                                 (x[ind_last] - p[1]) / p[0])
            if len(ind_stop):
                t_end = self.time[ind_stop[0]]
            else:
                t_end = self.time[-1]
        return dict(dx=dx, dt=dt, p=p, ind=ind, t_end=t_end)
114533
def determine_final_freq(base, direction, modifier):
    """"""
    result = 0
    if direction == "+":
        result = base + modifier
    elif direction == "-":
        result = base - modifier
    return(result)
21613
def calculate_etag(file_path):
        
        stat = file_path.stat()
        etag = "%x-%x" % (stat.st_mtime_ns, stat.st_size)
        return etag