-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
212 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,208 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 194, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import numpy as np\n", | ||
"import matplotlib.pyplot as plt" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 195, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"path = '../../build/tests/reflection/'" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 196, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"diffuse = np.genfromtxt(path + 'diffuse_reflection.txt')" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# arrow plot in 3D\n", | ||
"fig = plt.figure()\n", | ||
"ax = fig.add_subplot(111, projection='3d')\n", | ||
"\n", | ||
"# draw arrow\n", | ||
"for ref in diffuse[:100]:\n", | ||
" ax.quiver(0, 0, 0, ref[0], ref[1], ref[2], color='blue', alpha=0.5)\n", | ||
"\n", | ||
"ax.set_xlim([-1, 1])\n", | ||
"ax.set_ylim([-1, 1])\n", | ||
"ax.set_zlim([0, 1])\n", | ||
"\n", | ||
"plt.show()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# theta and phi\n", | ||
"theta = np.arccos(diffuse[:, 2])\n", | ||
"phi = np.arctan2(diffuse[:, 1], diffuse[:, 0])\n", | ||
"\n", | ||
"plt.hist(theta, bins=100, histtype='step', color='blue', label='theta', density=True)\n", | ||
"plt.hist(phi, bins=100, histtype='step', color='red', label='phi', density=True)\n", | ||
"\n", | ||
"# expected distribution\n", | ||
"theta = np.linspace(0, np.pi / 2, 100)\n", | ||
"plt.plot(theta, np.sin(theta * 2), '--', color='blue', label='sin(theta)')\n", | ||
"\n", | ||
"plt.show()\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 199, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"conedSpecularOld = np.genfromtxt(path + 'coned_specular_reflection_old.txt')\n", | ||
"conedSpecular = np.genfromtxt(path + 'coned_specular_reflection.txt')" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# arrow plot in 3D\n", | ||
"fig = plt.figure()\n", | ||
"ax = fig.add_subplot(111, projection='3d')\n", | ||
"\n", | ||
"# draw arrow\n", | ||
"for ref in conedSpecular[:100]:\n", | ||
" ax.quiver(0, 0, 0, ref[0], ref[1], ref[2], color='blue', alpha=0.5)\n", | ||
"\n", | ||
"ax.set_xlim([-1, 1])\n", | ||
"ax.set_ylim([-1, 1])\n", | ||
"ax.set_zlim([0, 1])\n", | ||
"plt.title(\"New\")\n", | ||
"plt.show()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(10, 4)) \n", | ||
"\n", | ||
"# theta and phi\n", | ||
"theta = np.arccos(conedSpecular[:, 2])\n", | ||
"phi = np.arctan2(conedSpecular[:, 1], conedSpecular[:, 0])\n", | ||
"\n", | ||
"ax1.hist(theta, bins=80, histtype='step', color='blue', label='theta', density=True)\n", | ||
"ax1.hist(phi, bins=80, histtype='step', color='red', label='phi', density=True)\n", | ||
"ax1.set_xlim([-np.pi, np.pi])\n", | ||
"ax1.set_title('New')\n", | ||
"\n", | ||
"theta = np.arccos(conedSpecularOld[:, 2])\n", | ||
"phi = np.arctan2(conedSpecularOld[:, 1], conedSpecularOld[:, 0])\n", | ||
"\n", | ||
"ax2.hist(theta, bins=80, histtype='step', color='blue', label='theta', density=True)\n", | ||
"ax2.hist(phi, bins=80, histtype='step', color='red', label='phi', density=True)\n", | ||
"ax2.set_xlim([-np.pi, np.pi])\n", | ||
"ax2.set_title('Old')\n", | ||
"\n", | ||
"plt.show()\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"fig, (ax1) = plt.subplots(1, 1, figsize=(6, 4)) \n", | ||
"\n", | ||
"# theta and phi\n", | ||
"theta = np.arccos(conedSpecular[:, 2])\n", | ||
"phi = np.arctan2(conedSpecular[:, 1], conedSpecular[:, 0])\n", | ||
"\n", | ||
"ax1.hist(theta, bins=80, histtype='step', color='blue', label='theta new', density=True)\n", | ||
"ax1.hist(phi, bins=80, histtype='step', color='red', label='phi new', density=True)\n", | ||
"ax1.set_xlim([-np.pi, np.pi])\n", | ||
"ax1.set_title('New')\n", | ||
"\n", | ||
"theta = np.arccos(conedSpecularOld[:, 2])\n", | ||
"phi = np.arctan2(conedSpecularOld[:, 1], conedSpecularOld[:, 0])\n", | ||
"\n", | ||
"ax1.hist(theta, bins=80, histtype='step', color='purple', label='theta old', density=True)\n", | ||
"ax1.hist(phi, bins=80, histtype='step', color='orange', label='phi old', density=True)\n", | ||
"\n", | ||
"plt.legend()\n", | ||
"plt.show()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# arrow plot in 3D\n", | ||
"fig = plt.figure()\n", | ||
"ax = fig.add_subplot(111, projection='3d')\n", | ||
"\n", | ||
"# draw arrow\n", | ||
"for ref in conedSpecularOld[:100]:\n", | ||
" ax.quiver(0, 0, 0, ref[0], ref[1], ref[2], color='blue', alpha=0.5)\n", | ||
"\n", | ||
"ax.set_xlim([-1, 1])\n", | ||
"ax.set_ylim([-1, 1])\n", | ||
"ax.set_zlim([0, 1])\n", | ||
"plt.title('Old')\n", | ||
"plt.show()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": ".venv", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.12.3" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |