Exemplo n.º 1
0
    def test_get_discretized_profile(self):
        Vs30 = 256
        z1 = 100
        svm = SVM(Vs30, z1=z1, show_fig=False)

        # Test fixed_thk
        discr_profile = svm.get_discretized_profile(fixed_thk=10,
                                                    show_fig=False)
        self.assertTrue(isinstance(discr_profile, Vs_Profile))
        if svm.has_bedrock_Vs:  # bedrock Vs must match
            self.assertTrue(svm.bedrock_Vs == discr_profile.vs_profile[-1, 1])
            self.assertTrue(discr_profile.vs_profile[-1, 0] == 0)

        # Test Vs_increment
        discr_profile = svm.get_discretized_profile(Vs_increment=100,
                                                    show_fig=False)
        self.assertTrue(isinstance(discr_profile, Vs_Profile))
        if svm.has_bedrock_Vs:  # bedrock Vs must match
            self.assertTrue(svm.bedrock_Vs == discr_profile.vs_profile[-1, 1])
            self.assertTrue(discr_profile.vs_profile[-1, 0] == 0)

        # Test invalid Vs_increment
        with self.assertRaises(ValueError, msg='max Vs of the smooth profile'):
            svm.get_discretized_profile(Vs_increment=5000)

        # Test input parameter checking
        with self.assertRaises(ValueError, msg='You need to provide either'):
            svm.get_discretized_profile(Vs_increment=None, fixed_thk=None)
        with self.assertRaises(ValueError, msg='do not provide both'):
            svm.get_discretized_profile(Vs_increment=1, fixed_thk=2)
Exemplo n.º 2
0
 def test_get_discretized_profile__valid_Vs_increment(self):
     svm = SVM(target_Vs30=256, z1=100, show_fig=False)
     discr_profile = svm.get_discretized_profile(Vs_increment=100,
                                                 show_fig=False)
     self.assertTrue(isinstance(discr_profile, Vs_Profile))
     if svm.has_bedrock_Vs:  # bedrock Vs must match
         self.assertTrue(svm.bedrock_Vs == discr_profile.vs_profile[-1, 1])
         self.assertTrue(discr_profile.vs_profile[-1, 0] == 0)
Exemplo n.º 3
0
 def test_svm_profiles_plotting(self):
     vs30 = 256  # m/s
     z1 = 200  # m
     svm = SVM(vs30, z1=z1, show_fig=False)
     svm.get_discretized_profile(fixed_thk=20, show_fig=True)
     svm.get_discretized_profile(Vs_increment=1, show_fig=True)
     svm.get_discretized_profile(Vs_increment=100, show_fig=True)
     svm.get_randomized_profile(show_fig=True)
Exemplo n.º 4
0
 def test_get_discretized_profile__both_input_param_are_provided(self):
     svm = SVM(target_Vs30=256, z1=100, show_fig=False)
     with self.assertRaisesRegex(ValueError, 'do not provide both'):
         svm.get_discretized_profile(Vs_increment=1, fixed_thk=2)
Exemplo n.º 5
0
 def test_get_discretized_profile__both_input_param_are_None(self):
     svm = SVM(target_Vs30=256, z1=100, show_fig=False)
     with self.assertRaisesRegex(ValueError, 'You need to provide either'):
         svm.get_discretized_profile(Vs_increment=None, fixed_thk=None)
Exemplo n.º 6
0
 def test_get_discretized_profile__invalid_Vs_increment(self):
     svm = SVM(target_Vs30=256, z1=100, show_fig=False)
     with self.assertRaisesRegex(ValueError,
                                 'max Vs of the smooth profile'):
         svm.get_discretized_profile(Vs_increment=5000)