Skip to content

Commit

Permalink
fix: gracefully exit if the file is not full
Browse files Browse the repository at this point in the history
  • Loading branch information
steven-murray committed May 16, 2024
1 parent 2443eaa commit 690a4e5
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions hera_notebook_templates/notebooks/lststack.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,19 @@
" print(f\"Peak memory in this notebook run: {resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / 1024**2:.2f} GB\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "378e26d9",
"metadata": {},
"outputs": [],
"source": [
"if len(stackconf.time_indices) != stackconf.n_lsts:\n",
" print(\"LST-Stacking for files where not all of the LST-bins have associated data is not yet supported.\")\n",
" print_metadata()\n",
" sys.exit(0)"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -1267,7 +1280,7 @@
},
"outputs": [],
"source": [
"def write_data(rdc: list[dict], stack: list[dict], nbls_so_far: int):\n",
"def write_data(rdc: dict, stack: lstbin.LSTStack, nbls_so_far: int, lstidx: int):\n",
" chunk_size = stack.Nbls\n",
"\n",
" write = partial(\n",
Expand Down Expand Up @@ -1317,8 +1330,8 @@
"source": [
"if save_lstbin_data:\n",
" for lstidx in range(stackconf.n_lsts):\n",
" write_data(autos_lstavg[lstidx], auto_stacks[lstidx], 0)\n",
" write_data(cross_lstavg[lstidx], cross_stacks[lstidx], auto_stacks[lstidx].Nbls)\n",
" write_data(autos_lstavg[lstidx], auto_stacks[lstidx], 0, lstidx)\n",
" write_data(cross_lstavg[lstidx], cross_stacks[lstidx], auto_stacks[lstidx].Nbls, lstidx)\n",
" "
]
},
Expand Down

0 comments on commit 690a4e5

Please sign in to comment.