1 from analysisSharedFunctions
import loadYaml, loadFile, \
2 loadPhaseFile, fourierSpectrum
3 from plotSetUp
import setSvgLatexMatplotlibSettings, \
4 colors_qualitative_short
as colors_short, \
5 colors_qualitative_long
as colors_long, \
7 checkIfMultipleBlocks, \
10 from matplotlib
import pyplot
as plt
21 legend_loc="lower right",
26 print(multiple_blocks)
27 print(block_data.shape)
29 for i, block
in enumerate(block_data):
30 plt.plot(time_steps, block,
31 color=colors_short[i % len(colors_short)],
32 linestyle=linestyles[i % len(linestyles)],
33 label=
"Block: " + str(i)
36 plt.plot(time_steps, block_data,
37 color=colors_short[0 % len(colors_short)],
38 linestyle=linestyles[0 % len(linestyles)],
39 label=
"Block: " + str(0)
41 plt.legend(title=legend_title, loc=legend_loc)
50 x_label="\$\\dot{x}\$",
56 plt.plot(phase_data[1], phase_data[0],
57 color=colors_long[color_index],
58 linestyle=linestyles[line_style_index],
77 plt.plot(fourier_dictionary[
"x_values"][1:],
78 fourier_dictionary[
"y_values"][1:],
79 color=colors_long[color_index],
80 linestyle=linestyles[line_style_index],
91 block_positions =
loadFile(run_name, yaml_file,
92 file_name=
"block_position")
93 block_velocities =
loadFile(run_name, yaml_file,
94 file_name=
"block_velocity")
100 y_label=
"\$\dot{u_j}\$")
108 increment = yaml_file[
"Parameters"][
"increment"]
109 blocks = yaml_file[
"Parameters"][
"blocks"]
111 slider_velocities = [8, 11, 67, 72, 111, 130]
112 phase_labels = [str(round(abs(increment*velocity),2))
for velocity
in slider_velocities]
114 slider_velocities = [int(149 - slider_velocity)
for slider_velocity
in slider_velocities]
116 for i, velocity
in enumerate(slider_velocities):
117 phase_data =
loadPhaseFile(run_name,
"block_phase_" + str(velocity))
119 for j
in range(0,len(phase_data)//2):
125 line_style_index=(j%4),
133 line_style_index=(j%4),
149 plt.legend(title=
"Block:")
150 plt.suptitle(
"\$\\nu=\$" + phase_labels[i])
156 if(len(sys.argv) > 1):
161 if __name__ ==
"__main__":
def prettyPlotFourier(fourier_dictionary, y_label="\\, x_label="\f\", alpha=1.0, color_index=0, line_style_index=0, label="")
def checkIfMultipleBlocks(block_data)
def plot_blocks(run_name)
def prettyPlotPhase(phase_data, y_label="\\, x_label="\\dot{x}\", alpha=1.0, color_index=0, line_style_index=0, label="")
def loadPhaseFile(run_name, file_name, friction_folder="/friction_phase/", use_shared_names=False)
def createTimeStepValues(block_data, yaml_file)
def loadFile(run_name, shared_names, selected='pad_position.csv')
def fourierSpectrum(run_name, data_vector)
def prettyPlotBlocks(time_steps, block_data, yaml_file, legend_title="", legend_loc="lower right", y_label="", x_label="\\)
def setSvgLatexMatplotlibSettings(pyplot)