1 from analysisSharedFunctions
import loadYaml, loadFile, \
2 loadPhaseFile, fourierSpectrum
3 from plotSetUp
import setSvgLatexMatplotlibSettings, \
4 colors_qualitative_short
as colors_short, \
5 colors_diverging_long
as colors_long, \
7 createTimeStepValues, \
8 createSliderVelocityStepValues
10 from matplotlib
import pyplot
as plt
11 from mpl_toolkits.mplot3d
import Axes3D
12 from matplotlib.collections
import PolyCollection
13 from matplotlib
import colors
23 start_speed_continuous = yaml_file[
"Parameters"][
"start_speed_continuous"]
24 end_speed_continuous = yaml_file[
"Parameters"][
"end_speed_continuous"]
26 direction = end_speed_continuous - start_speed_continuous
43 plt.plot(time_steps, pad_data,
44 color=colors_short[color_index],
45 linestyle=linestyles[0],
60 from matplotlib
import cm
62 pad_position =
loadFile(run_name, yaml_file, file_name=
"pad_position")
63 start_velocity = yaml_file[
"Parameters"][
"slider_speed"]
64 increment = yaml_file[
"Parameters"][
"increment"]
72 ax = fig.add_subplot(111)
73 for i
in range(0, 150):
78 amount_data_half = len(phase_data[0])//5
79 verts.append(list(zip(fourier_dictionary[
'x_values'], fourier_dictionary[
'y_values'])))
80 amplitudes.append(fourier_dictionary[
'y_values'][1:])
81 frequencies.append(fourier_dictionary[
'x_values'][1:])
87 cax = ax.matshow(amplitudes, cmap=
"ocean_r",
88 extent=[frequencies[0][0], frequencies[0][-1], 1.49, 0.0])
89 ax.set_xlabel(
"\$f\$")
90 ax.set_ylabel(
"\$\\nu\$")
91 cbar = fig.colorbar(cax)
92 cbar.set_label(
"\$A\$", rotation=270)
100 from matplotlib
import cm
102 pad_position =
loadFile(run_name, yaml_file, file_name=
"pad_position")
103 start_velocity = yaml_file[
"Parameters"][
"slider_speed"]
104 increment = yaml_file[
"Parameters"][
"increment"]
112 jet = plt.get_cmap(
'viridis')
113 cNorm = colors.Normalize(vmin=0, vmax=1.49)
114 scalarMap = cm.ScalarMappable(norm=cNorm, cmap=jet)
116 ax = fig.gca(projection=
'3d')
117 for i
in range(0, 150):
118 velocity = start_velocity+increment*i
121 ax.plot(phase_data[0], phase_data[1], alpha=alpha,
122 zs=(velocity), color=scalarMap.to_rgba(velocity))
124 ax.view_init(elev=2.5, azim=-45)
125 plt.rcParams[
"savefig.bbox"] =
"tight" 126 ax.set_ylabel(
"\$x\$")
127 ax.set_xlabel(
"\$\dot{x}\$")
128 ax.set_zlabel(
"\$\\nu\$")
129 ax.set_yticks(np.arange(-0.6,0.6,0.3))
131 plt.rcParams[
"savefig.bbox"] =
"standard" 137 x_label="\$\\dot{x}\$",
143 plt.plot(phase_data[1], phase_data[0],
144 color=colors_short[color_index],
145 linestyle=linestyles[line_style_index],
164 plt.plot(fourier_dictionary[
"x_values"][1:],
165 fourier_dictionary[
"y_values"][1:],
166 color=colors_short[color_index],
167 linestyle=linestyles[line_style_index],
179 pad_position =
loadFile(run_name, yaml_file, file_name=
"pad_position")
184 x_label=
"\$\\nu\$", alpha=alpha)
192 start_velocity = yaml_file[
"Parameters"][
"slider_speed"]
193 increment = yaml_file[
"Parameters"][
"increment"]
195 slider_velocities = [8, 11, 67, 72, 111, 130]
196 phase_labels = [str(round(abs(increment*velocity),2))
for velocity
in slider_velocities]
198 slider_velocities = [int(149 - slider_velocity)
for slider_velocity
in slider_velocities]
201 for i, velocity
in enumerate(slider_velocities):
202 phase_data =
loadPhaseFile(run_name,
"pad_phase_" + str(velocity))
205 line_style_index=(i%4),
206 label=phase_labels[i])
211 line_style_index=(i%4),
227 plt.suptitle(
"\$\\nu=\$" + phase_labels[i])
236 start_velocity = yaml_file[
"Parameters"][
"slider_speed"]
237 increment = yaml_file[
"Parameters"][
"increment"]
240 for i
in range(0, 150):
245 line_style_index=(i%4))
246 plt.suptitle(
"\$\\nu=\$" + str(start_velocity + i*increment))
256 for run_name
in run_names:
263 if(len(sys.argv) == 2):
268 elif(len(sys.argv) > 2):
272 if __name__ ==
"__main__":
def plotComparePads(run_names)
def createSliderVelocityStepValues(block_data, yaml_file, step_as_continous=False)
def plotPad(run_name, alpha=1.0)
def plotPhase3D(run_name)
def prettyPlotPad(time_steps, pad_data, yaml_file, y_label="\\, x_label="\t\", alpha=1.0)
def prettyPlotFourier(fourier_dictionary, y_label="\\, x_label="\f\", 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 plotFourier(run_name)
def loadFile(run_name, shared_names, selected='pad_position.csv')
def fourierSpectrum(run_name, data_vector)
def choseColourFromDirection(yaml_file)
def prettyPlotPhase(phase_data, y_label="\\, x_label="\\dot{x}\", alpha=1.0, color_index=0, line_style_index=0, label="")
def setSvgLatexMatplotlibSettings(pyplot)