From e41fcb52b40551fb80e79603e27f975ffb3a47c9 Mon Sep 17 00:00:00 2001 From: jrob93 Date: Thu, 7 Nov 2024 14:54:29 +0000 Subject: [PATCH] update docs for new sigma_clip --- docs/notebooks/outlier_detection_example.ipynb | 6 +++--- src/adler/utilities/science_utilities.py | 7 +++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/docs/notebooks/outlier_detection_example.ipynb b/docs/notebooks/outlier_detection_example.ipynb index f3af189..82ef920 100644 --- a/docs/notebooks/outlier_detection_example.ipynb +++ b/docs/notebooks/outlier_detection_example.ipynb @@ -177,7 +177,7 @@ "outputs": [], "source": [ "# astropy sigma_clip normally uses the median as the central function\n", - "utils.sigma_clip(res, {\"cenfunc\": \"median\"})" + "utils.sigma_clip(res, cenfunc=\"median\", maxiters=1)" ] }, { @@ -188,7 +188,7 @@ "outputs": [], "source": [ "# assuming that the model is the ground truth, we use zero as the centroid for the residuals\n", - "utils.sigma_clip(res, {\"cenfunc\": utils.zero_func})" + "utils.sigma_clip(res, cenfunc=utils.zero_func, maxiters=1)" ] }, { @@ -296,7 +296,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.13" + "version": "3.9.19" } }, "nbformat": 4, diff --git a/src/adler/utilities/science_utilities.py b/src/adler/utilities/science_utilities.py index 146f9c0..7bcf46a 100644 --- a/src/adler/utilities/science_utilities.py +++ b/src/adler/utilities/science_utilities.py @@ -78,7 +78,6 @@ def zero_func(x, axis=None): return 0 -# def sigma_clip(data_res, kwargs={"sigma":3, "maxiters": 1, "cenfunc": zero_func}): def sigma_clip(data_res, **kwargs): """Wrapper function for astropy.stats.sigma_clip, here we define the default centre of the data (the data - model residuals) to be zero @@ -88,7 +87,11 @@ def sigma_clip(data_res, **kwargs): data_res: array The residuals of the data compared to the model. kwargs: dict - Dictionary of keyword arguments from astropy.stats.sigma_clip + Dictionary of keyword arguments from astropy.stats.sigma_clip, namely: + sigma : default 3 + maxiters: default 5 + cenfunc: default 'median' + Returns -----------