Returns the hanging wall r-x caling term defined in equation 7 to 12
327396
def _get_hanging_wall_coeffs_rx(self, C, rup, r_x):
        
        # Define coefficients R1 and R2
        r_1 = rup.width * cos(radians(rup.dip))
        r_2 = 62.0 * rup.mag - 350.0
        fhngrx = np.zeros(len(r_x))
        # Case when 0 <= Rx <= R1
        idx = np.logical_and(r_x >= 0., r_x < r_1)
        fhngrx[idx] = self._get_f1rx(C, r_x[idx], r_1)
        # Case when Rx > R1
        idx = r_x >= r_1
        f2rx = self._get_f2rx(C, r_x[idx], r_1, r_2)
        f2rx[f2rx < 0.0] = 0.0
        fhngrx[idx] = f2rx
        return fhngrx
684037
def _get_distance_term(self, C, rhypo, mag):
        
        h_eff = self._get_effective_distance(mag)
        r_val = np.sqrt(rhypo ** 2.0 + h_eff ** 2.0)
        return C["c3"] * np.log10(r_val)
589519
def calc_basics(width=-1, length=-1, height=2.4, prevailing_wind=2.8):   
    
    if width == -1:
        width = int(input('enter building width : '))
    if length == -1:
        length = int(input('enter building length : '))
    res = {}
    
    res['area'] = width * length
    res['perim'] =  2 * width + 2 * length
    res['roof_cladding'] = res['area']
    res['wall_cladding'] = res['perim'] * height
    pprint(res)
    return res
1199953
def _get_magnitude_term(self, C, mag):
        
        dmag = mag - 8.0
        return C["c0"] + C["c3"] * dmag + C["c4"] * (dmag ** 2.)
650242
def get_magnitude_scaling_term(self, C, mag):
        
        mval = mag - 3.0
        return C['b1'] + C['b2'] * mval + C['b3'] * (mval ** 2.0) +\
            C['b4'] * (mval ** 3.0)
1308020
def get_distance_term(self, C, rrup):
        
        f_p = C["c1"] * rrup
        idx = np.logical_and(rrup > self.CONSTANTS["r1"],
                             rrup <= self.CONSTANTS["r2"])
        f_p[idx] = (C["c1"] * self.CONSTANTS["r1"]) +\
            C["c2"] * (rrup[idx] - self.CONSTANTS["r1"])
        idx = rrup > self.CONSTANTS["r2"]
        f_p[idx] = C["c1"] * self.CONSTANTS["r1"] +\
            C["c2"] * (self.CONSTANTS["r2"] - self.CONSTANTS["r1"]) +\
            C["c3"] * (rrup[idx] - self.CONSTANTS["r2"])
        return f_p
33543
def get_depth_term(self, C, rup):
        
        if rup.ztor > 100.0:
            return C["bSLH"] * 100.0
        else:
            return C["bSLH"] * rup.ztor
1130634
def wall_time_str(self, wall_time):
        
        days = int(wall_time // 1440)
        hours = int((wall_time - days * 1440) // 60)
        minutes = int(math.floor(wall_time - days * 1440 - hours * 60))
        seconds = int((wall_time - math.floor(wall_time)) * 60)
        return "{}-{:0>2}:{:0>2}:{:0>2}".format(days, hours, minutes, seconds)
104617
def _compute_term_3(self, C, rhypo):
        
        d = rhypo
        d[d <= 15.0] = 15.0

        return C['a3'] * np.log10(d)
1199821
function(rhs, lhs) { 
            lhs = lhs || new Symbol(0);
            rhs = Symbol.unwrapSQRT(_.expand(rhs)); //expand the term expression go get rid of quotients when possible
            var c = 0, //a counter to see if we have all terms with the variable
                l = rhs.length;
            //try to rewrite the whole thing
            if(rhs.group === CP && rhs.contains(solve_for) && rhs.isLinear()) {
                rhs.distributeMultiplier();
                var t = new Symbol(0);
                //first bring all the terms containing the variable to the lhs
                rhs.each(function(x) {
                    if(x.contains(solve_for)) {
                        c++;
                        t = _.add(t, x.clone());
                    }
                    else
                        lhs = _.subtract(lhs, x.clone());
                });
                rhs = t;
                
                //if not all the terms contain the variable so it's in the form
                //a*x^2+x
                if(c !== l)
                    return rewrite(rhs, lhs);
                else { 
                    return [rhs, lhs];
                }
            }
            else if(rhs.group === CB && rhs.contains(solve_for) && rhs.isLinear()) {
                if(rhs.multiplier.lessThan(0)) {
                    rhs.multiplier = rhs.multiplier.multiply(new core.Frac(-1));
                    lhs.multiplier = lhs.multiplier.multiply(new core.Frac(-1));
                }
                if(lhs.equals(0))
                    return new Symbol(0);
                else {
                    var t = new Symbol(1);
                    rhs.each(function(x) { 
                        if(x.contains(solve_for)) 
                            t = _.multiply(t, x.clone());
                        else 
                            lhs = _.divide(lhs, x.clone());
                    });
                    rhs = t;
                    return rewrite(rhs, lhs);
                    
                }
            }   
            else if(!rhs.isLinear() && rhs.contains(solve_for)) { 
                var p = _.parse(rhs.power.clone().invert());
                rhs = _.pow(rhs, p.clone());
                lhs = _.pow(_.expand(lhs), p.clone());
                return rewrite(rhs, lhs);
            }
            else if(rhs.group === FN || rhs.group === S || rhs.group === PL) {
                return [rhs, lhs];
            }
        }
859592
def dot(self, rhs):
    

    return self.x * rhs.x + self.y * rhs.y + self.z * rhs.z
244516
def _compute_term2(self, C, mag, r):
        
        return (C['c4'] + C['c5'] * mag) * \
            np.log(np.sqrt(r**2 + C['c6']**2)) + C['c7'] * r
634529
def _get_distance_term(self, C, rrup, mag):
        
        r_adj = np.sqrt(rrup ** 2.0 + (mag ** 2.0 - 3.1 * mag - 14.55) ** 2.)
        return C["c1"] * np.log10(r_adj) + C["c2"] * r_adj
576122
def _get_magnitude_term(self, C, mag):
        
        f_mag = C["c0"] + C["c1"] * mag
        if (mag > 4.5) and (mag <= 5.5):
            return f_mag + (C["c2"] * (mag - 4.5))
        elif (mag > 5.5) and (mag <= 6.5):
            return f_mag + (C["c2"] * (mag - 4.5)) + (C["c3"] * (mag - 5.5))
        elif mag > 6.5:
            return f_mag + (C["c2"] * (mag - 4.5)) + (C["c3"] * (mag - 5.5)) +\
                (C["c4"] * (mag - 6.5))
        else:
            return f_mag
537441
def _get_linear_site_term(self, C, vs30):
        
        flin = vs30 / self.CONSTS["Vref"]
        flin[vs30 > C["Vc"]] = C["Vc"] / self.CONSTS["Vref"]
        return C["c"] * np.log(flin)
354935
def _get_magnitude_term(self, C, mag):
        
        lny = C['C1'] + (C['C3'] * ((8.5 - mag) ** 2.))
        if mag > 6.3:
            return lny + (-C['H'] * C['C5']) * (mag - 6.3)
        else:
            return lny + C['C2'] * (mag - 6.3)
1307829
def get_label(self, x, w):
        
        scores = np.dot(x,w)
        return np.argmax(scores,axis=1).transpose()