1 from frictionImports
import *
5 from yaml
import CLoader
as Loader, CDumper
as Dumper
7 from yaml
import Loader, Dumper
13 numeric_method = "_midpoint_",
14 plot_start_interval = None,
15 plot_end_interval = None
19 self.
setUpPlot(plot_start_interval, plot_end_interval)
27 self.
results_path = os.path.dirname(os.path.realpath(__file__)) +
"/../../../results/" 28 results_folder =
"/results/" 30 stream = open(self.
results_path + run_name +
"/doc/yaml/parameters.yaml",
'r') 35 self.
block_velocity = np.loadtxt(self.
results_path + run_name + results_folder + shared_names + numeric_method +
"block_velocity.csv", delimiter=
",")
44 half_of_velocity = self.
block_velocity[0][half_point_velocity_index:]
45 half_of_velocity_average = np.average(half_of_velocity)
47 amplitude = np.sqrt(2)*np.sqrt(np.average(np.power(half_of_velocity - half_of_velocity_average,2)))
50 plt.plot(np.abs(half_of_velocity - half_of_velocity_average))
52 print(half_point_velocity_index)
53 print(half_of_velocity)
62 if((plot_start_interval
or plot_end_interval)
is None):
66 start = plot_start_interval
67 max_time = plot_end_interval
70 max_time_block_index = max_time/self.
run_parameters[
"Parameters"][
"dt"] - 1
71 amount_data_points = max_time_block_index - start_block_index
75 self.
x = np.linspace(start = start, stop = max_time, num = amount_data_points)
76 self.
block_indexes = np.linspace(start = start_block_index, stop = max_time_block_index, num = max_time_block_index - start_block_index, dtype=int)
80 self.
x = np.linspace(start = start, stop = max_time, num = amount_data_points)
81 self.
block_indexes = np.linspace(start = start_block_index, stop = max_time_block_index, num = max_time_block_index - start_block_index, dtype = int)
102 if(len(sys.argv) == 4):
103 frictionBlockSignal =
FrictionBlockSignal(sys.argv[1],
"_midpoint_", int(sys.argv[2]), int(sys.argv[3]))
104 elif(len(sys.argv) == 2):
107 raise Exception(
"Need to have either no interval values or two, start and end.")
108 frictionBlockSignal.plotVelocity()
111 if __name__ ==
"__main__":
def setUpPlot(self, plot_start_interval, plot_end_interval)
def loadFiles(self, run_name, numeric_method)
def calculateAmplitude(self)
def __init__(self, run_name="", numeric_method="_midpoint_", plot_start_interval=None, plot_end_interval=None)