Skip to content

Commit

Permalink
Merge pull request #16 from ProjectPythia/ian-notebooks
Browse files Browse the repository at this point in the history
Added line to create directory if it doesn't exist
  • Loading branch information
ifranda authored Jun 12, 2024
2 parents ea91930 + 5d757ee commit a4d4e51
Showing 1 changed file with 42 additions and 11 deletions.
53 changes: 42 additions & 11 deletions notebooks/keyframing_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,26 @@
},
{
"cell_type": "code",
"execution_count": 70,
"execution_count": 1,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Warning: sysroot \"/Applications/Xcode_12.4.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk\" not found (ignoring for now)."
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Vapor 3.9.2\n",
"Python 3.9.19 (/opt/anaconda3/envs/vapor-cookbook-dev)\n",
"OpenGL 4.1 Metal - 83.1\n"
]
}
],
"source": [
"from vapor import session, dataset, renderer\n",
"from vapor.animation import Animation"
Expand All @@ -40,7 +57,7 @@
},
{
"cell_type": "code",
"execution_count": 79,
"execution_count": 2,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -103,7 +120,7 @@
},
{
"cell_type": "code",
"execution_count": 74,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -132,7 +149,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -170,10 +187,11 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"os.makedirs(\"keyframes\", exist_ok=True) # Make directory for keyframes if it doesn't exist\n",
"for i, position, target, up in zip(range(1, len(positions)+1), positions, targets, ups):\n",
" ses.GetCamera().LookAt(position, target, up)\n",
" ses.Save(f\"./keyframes/keyframe{i}.vs3\")"
Expand All @@ -195,7 +213,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -271,7 +289,7 @@
" cam.SetUp( up )\n",
" anim.CaptureFrame()\n",
" \n",
" # Print statement is for each keyframe, not for whole animation\n",
" # Print status\n",
" print(f\"Rendering Animation [{'#'*round((j+n)*40/total_frames)}{' '*round(40-((j+n)*40/total_frames))}] {(j+1+n)*100/total_frames:.0f}%\", end=\"\\r\")\n",
" n += steps[i]\n",
" return anim\n",
Expand All @@ -294,7 +312,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -324,7 +342,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"metadata": {},
"outputs": [
{
Expand All @@ -335,7 +353,20 @@
"Dataset: 'wrfout_d02_2005-08-29_02.nc'\n",
"Dataset: 'wrfout_d02_2005-08-29_02.nc'\n",
"Dataset: 'wrfout_d02_2005-08-29_02.nc'\n",
"Dataset: 'wrfout_d02_2005-08-29_02.nc'\n",
"Dataset: 'wrfout_d02_2005-08-29_02.nc'\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"UNSUPPORTED (log once): POSSIBLE ISSUE: unit 5 GLD_TEXTURE_INDEX_3D is unloadable and bound to sampler type (Float) - using zero texture because texture unloadable\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Rendering Animation [########################################] 100%\r"
]
},
Expand Down

0 comments on commit a4d4e51

Please sign in to comment.