2This script shows how to interact with `fosanalysis`.
3It is the resulting script of [Getting Started](doc/GettingStarted.md).
9import matplotlib.pyplot
as plt
10import fosanalysis
as fa
14 "svg.fonttype":
"none",
17 "axes.axisbelow":
True,
21filepath =
"data/demofile.tsv"
22handle = fa.datahandling.filehandler.FileHandler(filepath)
25x_axis = handle.sensors[0].x_axis
26times, strain_data = handle.get_measurements(handle.sensors[0].channel)
28x_axis = strain_data[
"All"][
"x_axis"]
29strains = strain_data[
"All"][
"strain"]
33maskingobject = fa.preprocessing.masking.GTM(delta_max=400,
34 forward_comparison_range=1,
35 activate_reverse_sweep=
False,
39aggregateobject = fa.preprocessing.resizing.Aggregate(method=
"nanmedian")
43repairobject = fa.preprocessing.repair.ScipyInterpolation1D()
46filterobject = fa.preprocessing.filtering.SlidingFilter(radius=5, method=
"nanmedian")
49cropobject = fa.preprocessing.resizing.Crop(start_pos=3, end_pos=5)
61preprocessingobject = fa.preprocessing.Preprocessing(tasklist=tasklist)
64x_processed, times, strain_processed = preprocessingobject.run(x=x_axis, y=times, z=strains)
67plt.plot(x_axis, strains[0], label=
"raw")
68plt.plot(x_processed, strain_processed, label=
"processed")
73sp = fa.crackmonitoring.strainprofile.Concrete(x=x_processed, strain=strain_processed)
76sp.calculate_crack_widths()
87c_w = sp.crack_list.widths
88c_s = sp.crack_list.max_strains
89c_l = sp.crack_list.x_l
90c_loc = sp.crack_list.locations
91c_r = sp.crack_list.x_r
94fig, ax1 = plt.subplots()
95ax1.set_xlabel(
"Position x [m]")
96ax1.set_ylabel(
"Strain [µm/m]")
98ax2.set_ylabel(
"Crack width [µm]", c=
"red")
99ax2.tick_params(axis=
"y", labelcolor=
"red")
100ax1.plot(sp.x, sp.strain, c=
"k", label=
"strain")
101ax1.plot(sp.x, sp.tension_stiffening_values, c=
"k", ls=
"--", label=
"ts")
102ax1.plot(c_loc, c_s, c=
"k", ls=
"", marker=
"v", label=
"peak")
103ax1.plot(c_l, c_s, c=
"k", ls=
"", marker=
">", label=
"left")
104ax1.plot(c_r, c_s, c=
"k", ls=
"", marker=
"<", label=
"right")
105ax2.plot(c_loc, c_w, c=
"red", ls=
"", marker=
"o", label=
"crack width")
106h1, l1 = ax1.get_legend_handles_labels()
107h2, l2 = ax2.get_legend_handles_labels()
108ax2.legend(loc=
"best", handles=h1 + h2, labels=l1 + l2)