Skip to content

Commit

Permalink
Add option to error if there are really bad z^2
Browse files Browse the repository at this point in the history
  • Loading branch information
steven-murray committed Jan 20, 2025
1 parent 0fc326b commit 979b41e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions hera_notebook_templates/notebooks/lststack.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@
"freq_max: float = 0.0\n",
"history: str = \"\"\n",
"plot_every: int = 1\n",
"exception_for_zsq_above: float = np.inf # Raise an exception if any baseline has a zsq greater than this. Useful for flagging weird behaviour for validation.\n",
"\n",
"# In-painting config\n",
"inpaint_horizon: float = 1.0\n",
Expand Down Expand Up @@ -1301,6 +1302,17 @@
" zsquare = do_flagging([direct_zscore_pruning, watershed], cross_stacks, auto_stats, max_iter=max_flagging_iterations)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2c58d0b1-6900-4e65-981d-68fb0ec8d30c",
"metadata": {},
"outputs": [],
"source": [
"if any(np.any(zsq.metrics > exception_for_zsq_above) for zsq in zsquare):\n",
" raise RuntimeError(f\"The maximum zsquares before inpainting are {[np.nanmax(zsq.metrics) for zsq in zsquares]}, which is over the threshold for raising an error\")"
]
},
{
"cell_type": "markdown",
"id": "ca98fc9f-a22e-4a2d-8ff1-8bccfdb453f5",
Expand Down

0 comments on commit 979b41e

Please sign in to comment.