From ac548c90c3e0da2a1e91674b6d68534ea5234fbb Mon Sep 17 00:00:00 2001 From: Eric Charles Date: Mon, 17 Feb 2025 00:18:03 -0800 Subject: [PATCH 1/2] protect plot_output with if __name__ == '__main__' to avoid issues with importing it, e.g., by sphinx autodoc --- src/rail/pipelines/estimation/plot_output.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/rail/pipelines/estimation/plot_output.py b/src/rail/pipelines/estimation/plot_output.py index 413a9aa..6ee916d 100644 --- a/src/rail/pipelines/estimation/plot_output.py +++ b/src/rail/pipelines/estimation/plot_output.py @@ -8,9 +8,12 @@ import pickle import os -with open(os.path.join("data", "output_summarize.pkl"), "rb") as f: - ncc = pickle.load(f) - ncc.to_files(os.path.join("data", "output")) -ax = ncc.plot(indicate_zero=True) -ax.set_xlabel("Redshift") -ax.figure.savefig(os.path.join("data", "checkplot.png")) + +if __name__ == '__main__': + + with open(os.path.join("data", "output_summarize.pkl"), "rb") as f: + ncc = pickle.load(f) + ncc.to_files(os.path.join("data", "output")) + ax = ncc.plot(indicate_zero=True) + ax.set_xlabel("Redshift") + ax.figure.savefig(os.path.join("data", "checkplot.png")) From 1ad8f779d6f277317d9d85d7e97c9f641d235f1a Mon Sep 17 00:00:00 2001 From: Eric Charles Date: Mon, 17 Feb 2025 00:18:30 -0800 Subject: [PATCH 2/2] fix up docstring for sphinx --- src/rail/estimation/algos/cc_yaw.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/rail/estimation/algos/cc_yaw.py b/src/rail/estimation/algos/cc_yaw.py index 03b66ac..a1b4be4 100644 --- a/src/rail/estimation/algos/cc_yaw.py +++ b/src/rail/estimation/algos/cc_yaw.py @@ -111,11 +111,12 @@ class YawCacheCreate( The cache can be constructed from input files or tabular data in memory. Column names for sky coordinates are required, redshifts and per-object weights are optional. One out of three patch create methods must be - specified: - 1. Splitting the data into predefined patches (from ASCII file or an + specified: + + #. Splitting the data into predefined patches (from ASCII file or an existing cache instance, linked as optional stage input). - 2. Splitting the data based on a column with patch indices. - 3. Generating approximately equal size patches using k-means clustering of + #. Splitting the data based on a column with patch indices. + #. Generating approximately equal size patches using k-means clustering of objects positions (preferably randoms if provided). **Note:** The cache directory must be deleted manually when it is no longer