def test_multiple_rakes(self):
        strike, dip, rake = np.array(self.data).T

        lon, lat = smath.rake(strike, dip, rake)
        plunge, bearing = smath.geographic2plunge_bearing(lon, lat)
        newrake = smath.project_onto_plane(strike, dip, plunge, bearing)
        assert np.allclose(rake, newrake)
示例#2
0
    def test_multiple_rakes(self):
        strike, dip, rake = np.array(self.data).T

        lon, lat = smath.rake(strike, dip, rake)
        plunge, bearing = smath.geographic2plunge_bearing(lon, lat)
        newrake = smath.project_onto_plane(strike, dip, plunge, bearing)
        assert np.allclose(rake, newrake)
示例#3
0
    def test_offset_back_to_rake(self):
        for strike, dip, rake in self.data:
            # Displace the line perpendicular to the plane...
            line = smath.sph2cart(*smath.rake(strike, dip, rake))
            norm = smath.sph2cart(*smath.pole(strike, dip))
            line = np.array(line) + 0.5 * np.array(norm)

            # Project the "displaced" line back onto the plane...
            lon, lat = smath.cart2sph(*line)
            plunge, bearing = smath.geographic2plunge_bearing(lon, lat)
            newrake = smath.project_onto_plane(strike, dip, plunge, bearing)
            assert np.allclose(rake, newrake)
    def test_offset_back_to_rake(self):
        for strike, dip, rake in self.data:
            # Displace the line perpendicular to the plane...
            line = smath.sph2cart(*smath.rake(strike, dip, rake))
            norm = smath.sph2cart(*smath.pole(strike, dip))
            line = np.array(line) + 0.5 * np.array(norm)

            # Project the "displaced" line back onto the plane...
            lon, lat = smath.cart2sph(*line)
            plunge, bearing = smath.geographic2plunge_bearing(lon, lat)
            newrake = smath.project_onto_plane(strike, dip, plunge, bearing)
            assert np.allclose(rake, newrake)
示例#5
0
    def __init__(self, strike, dip, rake, *angular_errors, **kwargs):
        _trans_arr = N.array([-1, -1, 1])
        def vec(latlon):
            lat, lon = latlon
            _ = M.sph2cart(lat, lon)
            val = N.array(_).flatten()
            val = N.roll(val,-1)
            return val * _trans_arr

        normal_error = kwargs.pop('normal_error',1)

        self.__strike = strike
        self.__dip = dip
        self.__angular_errors = angular_errors
        self.__rake = rake

        errors = N.radians(angular_errors)/2
        pole = M.pole(strike, dip)

        # Uncertain why we have to do this to get a normal vector
        # but it has something to do with the stereonet coordinate
        # system relative to the normal
        self.normal = vec(pole)
        ll = M.rake(strike, dip, rake)
        max_angle = vec(ll)
        min_angle = N.cross(self.normal, max_angle)

        # These axes have the correct length but need to be
        # rotated into the correct reference frame.
        ax = N.vstack((min_angle, max_angle, self.normal))

        # Apply right-hand rule
        #ax[0:],ax[1:]

        #T = N.eye(3)
        #T[:-1,:-1] = rotate_2D(N.radians(rake))

        T = transform(ax[0],max_angle)
        self.axes = ax
        if self.axes[-1,-1] < 0:
            self.axes *= -1

        lengths = normal_error/N.tan(errors[::-1])
        self.hyperbolic_axes = N.array(list(lengths)+[normal_error])
        self.covariance_matrix = N.diag(self.hyperbolic_axes)
示例#6
0
 def test_rake_back_to_rakes(self):
     for strike, dip, rake in self.data:
         lon, lat = smath.rake(strike, dip, rake)
         plunge, bearing = smath.geographic2plunge_bearing(lon, lat)
         newrake = smath.project_onto_plane(strike, dip, plunge, bearing)
         assert np.allclose(rake, newrake)
 def test_rake_back_to_rakes(self):
     for strike, dip, rake in self.data:
         lon, lat = smath.rake(strike, dip, rake)
         plunge, bearing = smath.geographic2plunge_bearing(lon, lat)
         newrake = smath.project_onto_plane(strike, dip, plunge, bearing)
         assert np.allclose(rake, newrake)