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, data = handle.get_measurements(handle.sensors[0].channel)
27x_axis = data[
'All'].get(
'x_axis', [])
28strain = data[
'All'].get(
'strain', [])
32maskingobject = fa.preprocessing.masking.GTM(delta_max=400,
33 forward_comparison_range=1,
34 activate_reverse_sweep=
False,
38aggregateobject = fa.preprocessing.resizing.Aggregate(method=
"nanmedian")
42repairobject = fa.preprocessing.repair.ScipyInterpolation1D()
45filterobject = fa.preprocessing.filtering.SlidingFilter(radius=5, method=
"nanmedian")
48cropobject = fa.preprocessing.resizing.Crop(start_pos=3, end_pos=5)
60preprocessingobject = fa.preprocessing.Preprocessing(tasklist=tasklist)
63x_processed, times, strain_processed = preprocessingobject.run(x=x_axis, y=times, z=strain)
66plt.plot(x_axis, strain[0], label=
"raw")
67plt.plot(x_processed, strain_processed, label=
"processed")
72sp = fa.crackmonitoring.strainprofile.Concrete(x=x_processed, strain=strain_processed)
75sp.calculate_crack_widths()
86c_w = sp.crack_list.widths
87c_s = sp.crack_list.max_strains
88c_l = sp.crack_list.x_l
89c_loc = sp.crack_list.locations
90c_r = sp.crack_list.x_r
93fig, ax1 = plt.subplots()
94ax1.set_xlabel(
"Position x [m]")
95ax1.set_ylabel(
"Strain [µm/m]")
97ax2.set_ylabel(
"Crack width [µm]", c=
"red")
98ax2.tick_params(axis=
"y", labelcolor=
"red")
99ax1.plot(sp.x, sp.strain, c=
"k", label=
"strain")
100ax1.plot(sp.x, sp.tension_stiffening_values, c=
"k", ls=
"--", label=
"ts")
101ax1.plot(c_loc, c_s, c=
"k", ls=
"", marker=
"v", label=
"peak")
102ax1.plot(c_l, c_s, c=
"k", ls=
"", marker=
">", label=
"left")
103ax1.plot(c_r, c_s, c=
"k", ls=
"", marker=
"<", label=
"right")
104ax2.plot(c_loc, c_w, c=
"red", ls=
"", marker=
"o", label=
"crack width")
105h1, l1 = ax1.get_legend_handles_labels()
106h2, l2 = ax2.get_legend_handles_labels()
107ax2.legend(loc=
"best", handles=h1 + h2, labels=l1 + l2)