From 0bd67b6493610f8c717e3f6ac74b48445ff4e12a Mon Sep 17 00:00:00 2001 From: jaseg Date: Mon, 29 Mar 2021 14:07:00 +0200 Subject: Accelerometer validation: Update graphs with new measurement --- .../Accelerometer Data Analysis.ipynb | 58 +++++++++++---------- .../sensor-analysis/fig-acc-theory-meas-run50.pdf | Bin 17415 -> 17426 bytes .../fig-acc-trace-stacked-run50.pdf | Bin 67959 -> 64277 bytes prototype/sensor-analysis/fig-acc-trace-steps.pdf | Bin 0 -> 83704 bytes 4 files changed, 31 insertions(+), 27 deletions(-) create mode 100644 prototype/sensor-analysis/fig-acc-trace-steps.pdf (limited to 'prototype') diff --git a/prototype/sensor-analysis/Accelerometer Data Analysis.ipynb b/prototype/sensor-analysis/Accelerometer Data Analysis.ipynb index bc59667..3310027 100644 --- a/prototype/sensor-analysis/Accelerometer Data Analysis.ipynb +++ b/prototype/sensor-analysis/Accelerometer Data Analysis.ipynb @@ -22,6 +22,19 @@ "%matplotlib notebook" ] }, + { + "cell_type": "code", + "execution_count": 134, + "metadata": {}, + "outputs": [], + "source": [ + "font = {'family' : 'normal',\n", + " 'weight' : 'regular',\n", + " 'size' : 8}\n", + "\n", + "matplotlib.rc('font', **font)" + ] + }, { "cell_type": "code", "execution_count": 2, @@ -1034,7 +1047,7 @@ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" @@ -2341,7 +2354,7 @@ }, { "cell_type": "code", - "execution_count": 84, + "execution_count": 146, "metadata": {}, "outputs": [ { @@ -3305,7 +3318,7 @@ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" @@ -3313,20 +3326,10 @@ }, "metadata": {}, "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "" - ] - }, - "execution_count": 84, - "metadata": {}, - "output_type": "execute_result" } ], "source": [ - "fig, ax = plt.subplots()\n", + "fig, ax = plt.subplots(figsize=(5, 3))\n", "\n", "freqs = np.array([ f_actual for (_1, _2, f_actual) in le_data ])\n", "\n", @@ -3336,8 +3339,8 @@ "\n", "acc_meas_sorted = (np.array(acc_meas_sorted) - sensor_offx) * sensor_scale\n", "\n", - "ax.plot(freqs, acc_theory_sorted, label='Theory')\n", - "ax.plot(freqs, acc_meas_sorted, '+', label='Measurements')\n", + "ax.plot(freqs, acc_theory_sorted, label='Theory', color='orange')\n", + "ax.plot(freqs, acc_meas_sorted, '+', label='Measurements', color='darkblue')\n", " \n", "ax.grid()\n", "ax.set_xlabel('$f\\;[Hz]$')\n", @@ -3352,13 +3355,14 @@ "ax3.set_ylabel('$a\\;[ms^-1]$')\n", "\n", "ax.legend()\n", + "fig.tight_layout()\n", "\n", - "ax.savefig('fig-acc-theory-meas-run50.pdf')" + "fig.savefig('fig-acc-theory-meas-run50.pdf')" ] }, { "cell_type": "code", - "execution_count": 125, + "execution_count": 145, "metadata": { "scrolled": false }, @@ -4334,7 +4338,7 @@ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" @@ -4476,7 +4480,7 @@ "source": [ "t, y, _1, _2 = load_run(50, plot=False)\n", "\n", - "fig, ax = plt.subplots(figsize=(8, 5))\n", + "fig, ax = plt.subplots(figsize=(5, 3))\n", "\n", "# Run 50\n", "le_data = [\n", @@ -4524,14 +4528,13 @@ "print(f'Found sensor scale: {sensor_scale-1.0:+.3f}')\n", "print() \n", "\n", - "ax.set_xlabel(r't [mm:ss]')\n", + "ax.set_xlabel(r't [s]')\n", "ax.set_ylabel(r'$a\\; [g]$')\n", - "secax_y = ax.secondary_yaxis(\n", - " 'right', functions=(g_to_ms, ms_to_g))\n", + "secax_y = ax.secondary_yaxis('right', functions=(g_to_ms, ms_to_g))\n", "secax_y.set_ylabel(r'$a\\; [ms^{-1}]$')\n", "\n", - "formatter = ticker.FuncFormatter(lambda tick, _pos: f'{int(tick):02d}:{tick*60%60:02.0f}')\n", - "ax.xaxis.set_major_formatter(formatter)\n", + "#formatter = ticker.FuncFormatter(lambda tick, _pos: f'{int(tick):02d}:{tick*60%60:02.0f}')\n", + "#ax.xaxis.set_major_formatter(formatter)\n", "\n", "yp = (y / mems_lsb_per_g - sensor_offx) * sensor_scale\n", "\n", @@ -4543,8 +4546,8 @@ " idx = (t_start/60 < t) & (t < t_end/60)\n", " new_t = t[idx]\n", " new_t -= min(new_t)\n", - " ax.plot(new_t, yp[idx], color='darkblue', alpha=0.2, label=label[0])\n", - " ax.plot(new_t, filtered[idx], color='darkblue', label=label[1])\n", + " ax.plot(new_t*60, yp[idx], color='darkblue', alpha=0.2, label=label[0])\n", + " ax.plot(new_t*60, filtered[idx], color='darkblue', label=label[1])\n", " label = (None, None)\n", "\n", "ax.axhline(0, linewidth=1, color='black', alpha=0.5, zorder=1)\n", @@ -4564,6 +4567,7 @@ " print()\n", "\n", "ax.legend(loc='upper left')\n", + "ax.grid(axis='x')\n", "#ax.set_yscale('log')\n", "#ax.set_ylim([0.3, 30])\n", "fig.tight_layout()\n", diff --git a/prototype/sensor-analysis/fig-acc-theory-meas-run50.pdf b/prototype/sensor-analysis/fig-acc-theory-meas-run50.pdf index 8f86fb9..51d5325 100644 Binary files a/prototype/sensor-analysis/fig-acc-theory-meas-run50.pdf and b/prototype/sensor-analysis/fig-acc-theory-meas-run50.pdf differ diff --git a/prototype/sensor-analysis/fig-acc-trace-stacked-run50.pdf b/prototype/sensor-analysis/fig-acc-trace-stacked-run50.pdf index 3c3193c..ebcd5a5 100644 Binary files a/prototype/sensor-analysis/fig-acc-trace-stacked-run50.pdf and b/prototype/sensor-analysis/fig-acc-trace-stacked-run50.pdf differ diff --git a/prototype/sensor-analysis/fig-acc-trace-steps.pdf b/prototype/sensor-analysis/fig-acc-trace-steps.pdf new file mode 100644 index 0000000..c80efd9 Binary files /dev/null and b/prototype/sensor-analysis/fig-acc-trace-steps.pdf differ -- cgit