<jupyter_start><jupyter_text>Accelerometer Horizontal OrientationLIS3MDL (Mag) and LSM6DS33 (Acc+Gyro) with XY-Axis horizontal in a building.<jupyter_code>data1 = np.genfromtxt(fname='longterm4.csv', usecols=range(1, 18), delimiter=",", names=True)
data1 = data1[200:]
data1_x = np.linspace(0, np.shape(data1)[0], np.shape(data1)[0])
print("longterm Samples: {}".format(np.shape(data1)[0]))
mean_1 = np.array([np.mean(data1["ax"]), np.mean(data1["ay"]), np.mean(data1["az"])]).round(4)
mean_or = np.array([np.mean(data1["pitch"]), np.mean(data1["roll"]), np.mean(data1["heading"])]).round(4)
fig, axs = plt.subplots(1, 3, figsize=(18, 6), tight_layout=False)
axs[0].set_title("X-Axis Acceleration over Time");
axs[0].grid(True);
axs[0].hist2d(data1_x, data1["ax"], bins=[30,50]);
axs[0].hlines(mean_1[0], data1_x[0], data1_x[-1], linewidth = 3, linestyle="--", color='#ff6100');
axs[0].set(ylabel='$m/s^2$', xlabel='Seconds');
axs[0].set_ylim(mean_1[0]-0.1, mean_1[0]+0.1)
axs[0].set_facecolor("#440154")

axs[1].set_title("Y-Axis Acceleration over Time");
axs[1].grid(True);
axs[1].hist2d(data1_x, data1["ay"], bins=[30,50]);
axs[1].hlines(mean_1[1], data1_x[0], data1_x[-1], linewidth = 3, linestyle="--", color='#ff6100');
axs[1].set(ylabel='$m/s^2$', xlabel='Seconds');
axs[1].set_ylim(mean_1[1]-0.1, mean_1[1]+0.1)
axs[1].set_facecolor("#440154")

axs[2].set_title("Z-Axis Acceleration over Time");
axs[2].grid(True);
axs[2].hist2d(data1_x, data1["az"], bins=[30,50]);
axs[2].hlines(mean_1[2], data1_x[0], data1_x[-1], linewidth = 3, linestyle="--", color='#ff6100');
axs[2].set(ylabel='$m/s^2$', xlabel='Seconds');
axs[2].set_ylim(mean_1[2]-0.1, mean_1[2]+0.1);
axs[2].set_facecolor("#440154");
xlim = .1

fig, axs = plt.subplots(1, 1, figsize=(8, 8), tight_layout=False)
axs.set_title("Sample Variation");
x = np.linspace(-xlim, xlim, 100)
axs.plot(x, stats.norm.pdf(x + mean_1[0], np.mean(data1["ax"]), np.std(data1["ax"])), linewidth=3, linestyle='-', label="$A_x$");
axs.plot(x, stats.norm.pdf(x + mean_1[1], np.mean(data1["ay"]), np.std(data1["ay"])), linewidth=3, linestyle='-', label="$A_y$");
axs.plot(x, stats.norm.pdf(x + mean_1[2], np.mean(data1["az"]), np.std(data1["az"])), linewidth=3, linestyle='-', label="$A_z$");
axs.grid(True);
axs.set_xlim(-xlim*0.75, xlim*0.75)
axs.legend();<jupyter_output><empty_output><jupyter_text>Accelerometer Vertical Orientation<jupyter_code>data1 = np.genfromtxt(fname='longterm5.csv', usecols=range(1, 18), delimiter=",", names=True)
data1_x = np.linspace(0, np.shape(data1)[0], np.shape(data1)[0])
print("longterm Samples: {}".format(np.shape(data1)[0]))
mean_acc = np.array([np.mean(data1["ax"]), np.mean(data1["ay"]), np.mean(data1["az"])]).round(4)
mean_or = np.array([np.mean(data1["pitch"]), np.mean(data1["roll"]), np.mean(data1["heading"])]).round(4)
fig, axs = plt.subplots(1, 3, figsize=(18, 6), tight_layout=False)
axs[0].set_title("X-Axis Acceleration over Time");
axs[0].grid(True);
axs[0].hist2d(data1_x, data1["ax"], bins=[30,50]);
axs[0].hlines(mean_acc[0], data1_x[0], data1_x[-1], linewidth = 3, linestyle="--", color='#ff6100');
axs[0].set(ylabel='$m/s^2$', xlabel='Seconds');
axs[0].set_ylim(mean_acc[0]-0.1, mean_acc[0]+0.1)
axs[0].set_facecolor("#440154")

axs[1].set_title("Y-Axis Acceleration over Time");
axs[1].grid(True);
axs[1].hist2d(data1_x, data1["ay"], bins=[30,50]);
axs[1].hlines(mean_acc[1], data1_x[0], data1_x[-1], linewidth = 3, linestyle="--", color='#ff6100');
axs[1].set(ylabel='$m/s^2$', xlabel='Seconds');
axs[1].set_ylim(mean_acc[1]-0.1, mean_acc[1]+0.1)
axs[1].set_facecolor("#440154")

axs[2].set_title("Z-Axis Acceleration over Time");
axs[2].grid(True);
axs[2].hist2d(data1_x, data1["az"], bins=[30,50]);
axs[2].hlines(mean_acc[2], data1_x[0], data1_x[-1], linewidth = 3, linestyle="--", color='#ff6100');
axs[2].set(ylabel='$m/s^2$', xlabel='Seconds');
axs[2].set_ylim(mean_acc[2]-0.1, mean_acc[2]+0.1);
axs[2].set_facecolor("#440154");
xlim = .1

fig, axs = plt.subplots(1, 1, figsize=(8, 8), tight_layout=False)
axs.set_title("Sample Variation");
x = np.linspace(-xlim, xlim, 100)
axs.plot(x, stats.norm.pdf(x + mean_acc[0], np.mean(data1["ax"]), np.std(data1["ax"])), linewidth=3, linestyle='-', label="$A_x$");
axs.plot(x, stats.norm.pdf(x + mean_acc[1], np.mean(data1["ay"]), np.std(data1["ay"])), linewidth=3, linestyle='-', label="$A_y$");
axs.plot(x, stats.norm.pdf(x + mean_acc[2], np.mean(data1["az"]), np.std(data1["az"])), linewidth=3, linestyle='-', label="$A_z$");
axs.grid(True);
axs.set_xlim(-xlim*0.75, xlim*0.75)
axs.legend();
fig, axs = plt.subplots(1, 3, figsize=(18, 6), tight_layout=False)
axs[0].set_title("Pitch over Time");
axs[0].grid(True);
axs[0].hist2d(data1_x, data1["pitch"], bins=[32,32]);
axs[0].hlines(mean_or[0], data1_x[0], data1_x[-1], linewidth = 3, linestyle="--", color='#ff6100');
axs[0].set(ylabel='$Degrees$', xlabel='Seconds');
axs[0].set_ylim(mean_or[0]-0.1, mean_or[0]+0.1)
axs[0].set_facecolor("#440154")

axs[1].set_title("Roll over Time");
axs[1].grid(True);
axs[1].hist2d(data1_x, data1["roll"], bins=[32,50]);
axs[1].hlines(mean_or[1], data1_x[0], data1_x[-1], linewidth = 3, linestyle="--", color='#ff6100');
axs[1].set(ylabel='$Degrees$', xlabel='Seconds');
axs[1].set_ylim(mean_or[1]-0.1, mean_or[1]+0.1)
axs[1].set_facecolor("#440154")

axs[2].set_title("Heading over Time");
axs[2].grid(True);
axs[2].hist2d(data1_x, data1["heading"], bins=[32,32]);
axs[2].hlines(mean_or[2], data1_x[0], data1_x[-1], linewidth = 3, linestyle="--", color='#ff6100');
axs[2].set(ylabel='$Degrees$', xlabel='Seconds');
axs[2].set_ylim(mean_or[2]-2, mean_or[2]+2)
axs[2].set_facecolor("#440154")<jupyter_output><empty_output><jupyter_text>Pitch from Accelerometer Data<jupyter_code>#pitch = np.arctan2( np.sqrt(np.square(data1["ax"]) + np.square(data1["az"])), data1["ay"]) * 180/np.pi;
pitch = np.arctan2( data1["ay"], data1["ax"]) * 180 / np.pi;
num_avg = 20

fig, axs = plt.subplots(1, 1, figsize=(18, 6), tight_layout=False)
axs.set_title("Pitch over Time");
axs.grid(True);

#axs.plot(data1_x[num_avg-1:], np.convolve(pitch, np.ones(num_avg), 'valid') / num_avg, linewidth=2, linestyle='-');
axs.plot(data1_x[num_avg-1:], np.convolve(data1["pitch"], np.ones(num_avg), 'valid') / num_avg, linewidth=2, linestyle='-');

axs.set(ylabel='$Degrees$', xlabel='Seconds');<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.2622278321236983, 'fraction_numerical': 0.07668034080151467, 'mean_word_length': 8.22707423580786, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '484600', 'license': 'MIT', 'n_tokens_mistral': 3070, 'n_tokens_neox': 2910, 'n_words': 384, 'path': 'docs/Long-Term-Behavior.ipynb', 'repo_name': 'henrythasler/telescope-sync', 'size': '6338'}