Determine the vertical effective stress at a single depth z_c.

        :param y_c: float, depth from surface
541919
def get_v_eff_stress_at_depth(self, y_c):
        
        sigma_v_c = self.get_v_total_stress_at_depth(y_c)
        pp = self.get_hydrostatic_pressure_at_depth(y_c)
        sigma_veff_c = sigma_v_c - pp
        return sigma_veff_c
669982
def simplified_rayliegh_vel(self):
        
        # FIXME: What if last layer has no thickness?
        thicks = np.array([l.thickness for l in self])
        depths_mid = np.array([l.depth_mid for l in self])
        shear_vels = np.array([l.shear_vel for l in self])

        mode_incr = depths_mid * thicks / shear_vels ** 2
        # Mode shape is computed as the sumation from the base of
        # the profile. Need to append a 0 for the roll performed in the next
        # step
        shape = np.r_[np.cumsum(mode_incr[::-1])[::-1], 0]

        freq_fund = np.sqrt(4 * np.sum(
            thicks * depths_mid ** 2 / shear_vels ** 2
        ) / np.sum(
            thicks *
            # Roll is used to offset the mode_shape so that the sum
            # can be calculated for two adjacent layers
            np.sum(np.c_[shape, np.roll(shape, -1)], axis=1)[:-1] ** 2))
        period_fun = 2 * np.pi / freq_fund
        rayleigh_vel = 4 * thicks.sum() / period_fun
        return rayleigh_vel
871249
def get_v_total_stress_at_depth(self, z):
        

        if not hasattr(z, "__len__"):
            return self.one_vertical_total_stress(z)
        else:
            sigma_v_effs = []
            for value in z:
                sigma_v_effs.append(self.one_vertical_total_stress(value))
            return np.array(sigma_v_effs)
12518
def vertical_gradient(self, x0, y0, x1, y1, start, end):
        """"""
        x0, y0, x1, y1 = self.rect_helper(x0, y0, x1, y1)
        grad = gradient_list(start, end, y1 - y0)
        for x in range(x0, x1 + 1):
            for y in range(y0, y1 + 1):
                self.point(x, y, grad[y - y0])
1000132
def ycoord(self):
        """"""
        v = next(self.raw_data.psy.iter_base_variables)
        return self.decoder.get_y(v, coords=self.data.coords)
507587
def one_vertical_total_stress(self, z_c):
        
        total_stress = 0.0
        depths = self.depths
        end = 0
        for layer_int in range(1, len(depths) + 1):
            l_index = layer_int - 1
            if z_c > depths[layer_int - 1]:
                if l_index < len(depths) - 1 and z_c > depths[l_index + 1]:
                    height = depths[l_index + 1] - depths[l_index]
                    bottom_depth = depths[l_index + 1]
                else:
                    end = 1
                    height = z_c - depths[l_index]
                    bottom_depth = z_c

                if bottom_depth <= self.gwl:
                    total_stress += height * self.layer(layer_int).unit_dry_weight
                else:
                    if self.layer(layer_int).unit_sat_weight is None:
                        raise AnalysisError("Saturated unit weight not defined for layer %i." % layer_int)
                    sat_height = bottom_depth - max(self.gwl, depths[l_index])
                    dry_height = height - sat_height
                    total_stress += dry_height * self.layer(layer_int).unit_dry_weight + \
                                    sat_height * self.layer(layer_int).unit_sat_weight
            else:
                end = 1
            if end:
                break
        return total_stress
369270
def _get_basic_term(self, C, rup, dists):
        
        # Fictitious depth calculation
        if rup.mag > 5.:
            c4m = C['c4']
        elif rup.mag > 4.:
            c4m = C['c4'] - (C['c4']-1.) * (5. - rup.mag)
        else:
            c4m = 1.
        R = np.sqrt(dists.rrup**2. + c4m**2.)
        # basic form
        base_term = C['a1'] * np.ones_like(dists.rrup) + C['a17'] * dists.rrup
        # equation 2 at page 1030
        if rup.mag >= C['m1']:
            base_term += (C['a5'] * (rup.mag - C['m1']) +
                          C['a8'] * (8.5 - rup.mag)**2. +
                          (C['a2'] + C['a3'] * (rup.mag - C['m1'])) *
                          np.log(R))
        elif rup.mag >= self.CONSTS['m2']:
            base_term += (C['a4'] * (rup.mag - C['m1']) +
                          C['a8'] * (8.5 - rup.mag)**2. +
                          (C['a2'] + C['a3'] * (rup.mag - C['m1'])) *
                          np.log(R))
        else:
            base_term += (C['a4'] * (self.CONSTS['m2'] - C['m1']) +
                          C['a8'] * (8.5 - self.CONSTS['m2'])**2. +
                          C['a6'] * (rup.mag - self.CONSTS['m2']) +
                          C['a7'] * (rup.mag - self.CONSTS['m2'])**2. +
                          (C['a2'] + C['a3'] * (self.CONSTS['m2'] - C['m1'])) *
                          np.log(R))
        return base_term
657239
def xstep(self):
        
        """

        self.YU[:] = self.Y - self.U
        self.block_sep0(self.YU)[:] += self.S
        Zf = sl.rfftn(self.YU, None, self.cri.axisN)
        Z0f = self.block_sep0(Zf)
        Z1f = self.block_sep1(Zf)

        DZ0f = np.conj(self.Df) * Z0f
        DZ0fBQ = sl.dot(self.B.dot(self.Q).T, DZ0f, axis=self.cri.axisC)
        Z1fQ = sl.dot(self.Q.T, Z1f, axis=self.cri.axisC)
        b = DZ0fBQ + Z1fQ

        Xh = sl.solvedbd_sm(self.gDf, (self.mu / self.rho) * self.GHGf + 1.0,
                            b, self.c, axis=self.cri.axisM)
        self.Xf[:] = sl.dot(self.Q, Xh, axis=self.cri.axisC)
        self.X = sl.irfftn(self.Xf, self.cri.Nv, self.cri.axisN)

        if self.opt['LinSolveCheck']:
            DDXf = np.conj(self.Df) *  sl.inner(self.Df, self.Xf,
                                                axis=self.cri.axisM)
            DDXfBB = sl.dot(self.B.T.dot(self.B), DDXf, axis=self.cri.axisC)
            ax = self.rho * (DDXfBB + self.Xf) + \
                 self.mu * self.GHGf * self.Xf
            b = self.rho * (sl.dot(self.B.T, DZ0f, axis=self.cri.axisC)
                            + Z1f)
            self.xrrs = sl.rrs(ax, b)
        else:
            self.xrrs = None
572186
private float getQuaternionW(float x, float y, float z) {
        return (float) Math.cos(Math.asin(Math.sqrt(x * x + y * y + z * z)));
    }
863615
def get_z_variables(nc):
    '''
    
    '''
    z_variables = []
    # Vertical coordinates will be identifiable by units of pressure or the
    # presence of the positive attribute with a value of up/down

    # optionally, the vertical type may be indicated by providing the
    # standard_name attribute or axis='Z'

    total_coords = get_coordinate_variables(nc) + get_auxiliary_coordinate_variables(nc)
    for coord_name in total_coords:
        if coord_name in z_variables:
            continue
        coord_var = nc.variables[coord_name]
        units = getattr(coord_var, 'units', None)
        positive = getattr(coord_var, 'positive', None)
        standard_name = getattr(coord_var, 'standard_name', None)
        axis = getattr(coord_var, 'axis', None)
        # If there are no units, we can't identify it as a vertical coordinate
        # by checking pressure or positive
        if units is not None:
            if units_convertible(units, 'bar'):
                z_variables.append(coord_name)
            elif isinstance(positive, basestring):
                if positive.lower() in ['up', 'down']:
                    z_variables.append(coord_name)
        # if axis='Z' we're good
        if coord_name not in z_variables and axis == 'Z':
            z_variables.append(coord_name)
        if coord_name not in z_variables and standard_name in ('depth', 'height', 'altitude'):
            z_variables.append(coord_name)
        if coord_name not in z_variables and standard_name in DIMENSIONLESS_VERTICAL_COORDINATES:
            z_variables.append(coord_name)

    return z_variables
312335
def stress_vert(self, depth_within=0, effective=False):
        """"""
        assert depth_within <= self.thickness
        stress_vert = self._stress_vert + depth_within * self.unit_wt
        if effective:
            pore_pressure = self._profile.pore_pressure(self.depth +
                                                        depth_within)
            stress_vert -= pore_pressure
        return stress_vert
215252
def _get_basin_depth_term(self, C, sites, period):
        
        if period < 0.65:
            f_dz1 = np.zeros(len(sites.vs30), dtype=float)
        else:
            f_dz1 = C["f7"] + np.zeros(len(sites.vs30), dtype=float)
            f_ratio = C["f7"] / C["f6"]
            dz1 = (sites.z1pt0 / 1000.0) - california_basin_model(sites.vs30)
            idx = dz1 <= f_ratio
            f_dz1[idx] = C["f6"] * dz1[idx]
        return f_dz1
553534
def floor_point(self):
        '''
        

        '''
        floor_point = self.centroid
        # y to floor
        floor_point[1] = self.v[:, 1].min()
        return floor_point
535421
def _get_YYTfactor(self, Y):
        
        N, D = Y.shape
        if (N>=D):
            return Y.view(np.ndarray)
        else:
            return jitchol(tdot(Y))
983403
def ystep(self):
        
        """

        self.Y = sp.prox_l1(self.AX - self.S + self.U, self.Wdf / self.rho)
480297
def main(self, c):
        
        conj = self.conjugate.main(c)
        mult = self.complex_mult.main(c, conj)
        angle = self.angle.main(mult)

        self.y = self.GAIN_SFIX * angle
        return self.y
1146634
def _get_distance_term(self, C, rrup, backarc):
        
        # Geometric attenuation function
        distance_scale = -np.log10(np.sqrt(rrup ** 2 + 3600.0))
        # Anelastic attenuation in the backarc
        distance_scale[backarc] += (C["c2"] * rrup[backarc])
        # Anelastic Attenuation in the forearc
        idx = np.logical_not(backarc)
        distance_scale[idx] += (C["c1"] * rrup[idx])
        return distance_scale