Skip to content

Commit

Permalink
in process
Browse files Browse the repository at this point in the history
  • Loading branch information
dprada committed Oct 17, 2023
1 parent ff2dbc3 commit d41da8e
Showing 1 changed file with 31 additions and 147 deletions.
178 changes: 31 additions & 147 deletions sandbox/Test.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -12,182 +12,66 @@
},
{
"cell_type": "code",
"execution_count": 4,
"id": "bce6f84a-26f9-4043-8c61-151421815580",
"execution_count": 2,
"id": "61855fdb-f487-48dc-8113-51543b55cad9",
"metadata": {},
"outputs": [],
"source": [
"import numpy as np"
"ureg = puw.forms.api_pint.ureg"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "1906c419-f856-42bb-a68d-445691ba3d72",
"execution_count": 3,
"id": "ef3becda-1911-44ad-ab9c-42f5a4614e4d",
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/html": [
"2.5 nanometer/picosecond"
],
"text/latex": [
"$2.5\\ \\frac{\\mathrm{nanometer}}{\\mathrm{picosecond}}$"
],
"text/plain": [
"2.5 <Unit('nanometer / picosecond')>"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"aa = [puw.quantity(np.zeros([6,3]), 'mm') for ii in range(10)]"
"ureg.Quantity(2.5, 'nanometers/picoseconds')"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "04bca252-a741-429e-ba3d-1cbbef6b2919",
"execution_count": 5,
"id": "6f47c7c9-3eea-45f6-818d-d2363aa339c3",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<table><tbody><tr><th>Magnitude</th><td style='text-align:left;'><pre>[[[0.0 0.0 0.0]<br> [0.0 0.0 0.0]<br> [0.0 0.0 0.0]<br> [0.0 0.0 0.0]<br> [0.0 0.0 0.0]<br> [0.0 0.0 0.0]]<br><br> [[0.0 0.0 0.0]<br> [0.0 0.0 0.0]<br> [0.0 0.0 0.0]<br> [0.0 0.0 0.0]<br> [0.0 0.0 0.0]<br> [0.0 0.0 0.0]]<br><br> [[0.0 0.0 0.0]<br> [0.0 0.0 0.0]<br> [0.0 0.0 0.0]<br> [0.0 0.0 0.0]<br> [0.0 0.0 0.0]<br> [0.0 0.0 0.0]]<br><br> [[0.0 0.0 0.0]<br> [0.0 0.0 0.0]<br> [0.0 0.0 0.0]<br> [0.0 0.0 0.0]<br> [0.0 0.0 0.0]<br> [0.0 0.0 0.0]]<br><br> [[0.0 0.0 0.0]<br> [0.0 0.0 0.0]<br> [0.0 0.0 0.0]<br> [0.0 0.0 0.0]<br> [0.0 0.0 0.0]<br> [0.0 0.0 0.0]]<br><br> [[0.0 0.0 0.0]<br> [0.0 0.0 0.0]<br> [0.0 0.0 0.0]<br> [0.0 0.0 0.0]<br> [0.0 0.0 0.0]<br> [0.0 0.0 0.0]]<br><br> [[0.0 0.0 0.0]<br> [0.0 0.0 0.0]<br> [0.0 0.0 0.0]<br> [0.0 0.0 0.0]<br> [0.0 0.0 0.0]<br> [0.0 0.0 0.0]]<br><br> [[0.0 0.0 0.0]<br> [0.0 0.0 0.0]<br> [0.0 0.0 0.0]<br> [0.0 0.0 0.0]<br> [0.0 0.0 0.0]<br> [0.0 0.0 0.0]]<br><br> [[0.0 0.0 0.0]<br> [0.0 0.0 0.0]<br> [0.0 0.0 0.0]<br> [0.0 0.0 0.0]<br> [0.0 0.0 0.0]<br> [0.0 0.0 0.0]]<br><br> [[0.0 0.0 0.0]<br> [0.0 0.0 0.0]<br> [0.0 0.0 0.0]<br> [0.0 0.0 0.0]<br> [0.0 0.0 0.0]<br> [0.0 0.0 0.0]]]</pre></td></tr><tr><th>Units</th><td style='text-align:left;'>millimeter</td></tr></tbody></table>"
],
"text/latex": [
"$arr[,0,:,:] = \\begin{pmatrix}0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\end{pmatrix}\n",
"arr[,1,:,:] = \\begin{pmatrix}0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\end{pmatrix}\n",
"arr[,2,:,:] = \\begin{pmatrix}0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\end{pmatrix}\n",
"arr[,3,:,:] = \\begin{pmatrix}0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\end{pmatrix}\n",
"arr[,4,:,:] = \\begin{pmatrix}0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\end{pmatrix}\n",
"arr[,5,:,:] = \\begin{pmatrix}0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\end{pmatrix}\n",
"arr[,6,:,:] = \\begin{pmatrix}0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\end{pmatrix}\n",
"arr[,7,:,:] = \\begin{pmatrix}0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\end{pmatrix}\n",
"arr[,8,:,:] = \\begin{pmatrix}0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\end{pmatrix}\n",
"arr[,9,:,:] = \\begin{pmatrix}0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\\\ \n",
"0.0 & 0.0 & 0.0\\end{pmatrix}\\ \\mathrm{millimeter}$"
],
"text/plain": [
"array([[[0., 0., 0.],\n",
" [0., 0., 0.],\n",
" [0., 0., 0.],\n",
" [0., 0., 0.],\n",
" [0., 0., 0.],\n",
" [0., 0., 0.]],\n",
"\n",
" [[0., 0., 0.],\n",
" [0., 0., 0.],\n",
" [0., 0., 0.],\n",
" [0., 0., 0.],\n",
" [0., 0., 0.],\n",
" [0., 0., 0.]],\n",
"\n",
" [[0., 0., 0.],\n",
" [0., 0., 0.],\n",
" [0., 0., 0.],\n",
" [0., 0., 0.],\n",
" [0., 0., 0.],\n",
" [0., 0., 0.]],\n",
"\n",
" [[0., 0., 0.],\n",
" [0., 0., 0.],\n",
" [0., 0., 0.],\n",
" [0., 0., 0.],\n",
" [0., 0., 0.],\n",
" [0., 0., 0.]],\n",
"\n",
" [[0., 0., 0.],\n",
" [0., 0., 0.],\n",
" [0., 0., 0.],\n",
" [0., 0., 0.],\n",
" [0., 0., 0.],\n",
" [0., 0., 0.]],\n",
"\n",
" [[0., 0., 0.],\n",
" [0., 0., 0.],\n",
" [0., 0., 0.],\n",
" [0., 0., 0.],\n",
" [0., 0., 0.],\n",
" [0., 0., 0.]],\n",
"\n",
" [[0., 0., 0.],\n",
" [0., 0., 0.],\n",
" [0., 0., 0.],\n",
" [0., 0., 0.],\n",
" [0., 0., 0.],\n",
" [0., 0., 0.]],\n",
"\n",
" [[0., 0., 0.],\n",
" [0., 0., 0.],\n",
" [0., 0., 0.],\n",
" [0., 0., 0.],\n",
" [0., 0., 0.],\n",
" [0., 0., 0.]],\n",
"\n",
" [[0., 0., 0.],\n",
" [0., 0., 0.],\n",
" [0., 0., 0.],\n",
" [0., 0., 0.],\n",
" [0., 0., 0.],\n",
" [0., 0., 0.]],\n",
"\n",
" [[0., 0., 0.],\n",
" [0., 0., 0.],\n",
" [0., 0., 0.],\n",
" [0., 0., 0.],\n",
" [0., 0., 0.],\n",
" [0., 0., 0.]]]) <Unit('millimeter')>"
"True"
]
},
"execution_count": 8,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"puw.concatenate(aa, type_value='numpy.ndarray')"
"puw.quantity(2.5, 'nanometers/picoseconds') == ureg.Quantity(2.5, 'nanometers/picoseconds')"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "61855fdb-f487-48dc-8113-51543b55cad9",
"id": "585db8fb-c6dc-4c12-a276-b2a8cb9076d6",
"metadata": {},
"outputs": [],
"source": []
Expand All @@ -209,7 +93,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.15"
"version": "3.10.12"
}
},
"nbformat": 4,
Expand Down

0 comments on commit d41da8e

Please sign in to comment.