From 457b0d6f4261e4d29637b1267a9a1426ef69cbfa Mon Sep 17 00:00:00 2001 From: drewoldag <47493171+drewoldag@users.noreply.github.com> Date: Tue, 23 Apr 2024 15:21:42 -0700 Subject: [PATCH 1/3] Changing the seed param to be a `StageParam` and setting the default to be `None`. --- src/rail/creation/noisifier.py | 4 +++- src/rail/creation/selector.py | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/rail/creation/noisifier.py b/src/rail/creation/noisifier.py index 4042cdad..bc9f5d0e 100644 --- a/src/rail/creation/noisifier.py +++ b/src/rail/creation/noisifier.py @@ -18,7 +18,9 @@ class Noisifier(RailStage): name = 'Noisifier' config_options = RailStage.config_options.copy() - config_options.update(seed=1337) + config_options.update( + seed=Param(int, None, msg="If set, creates reproducible results."), + ) inputs = [('input', PqHandle)] outputs = [('output', PqHandle)] diff --git a/src/rail/creation/selector.py b/src/rail/creation/selector.py index 1faaf929..f8a88a73 100644 --- a/src/rail/creation/selector.py +++ b/src/rail/creation/selector.py @@ -22,6 +22,7 @@ class Selector(RailStage): config_options = RailStage.config_options.copy() config_options.update( drop_rows=Param(bool, True, msg="Drop selected rows from output table"), + seed=Param(int, None, msg="If set, creates reproducible results."), ) inputs = [('input', PqHandle)] outputs = [('output', PqHandle)] From 45a9b40cbeb6f94ccaa58cd5480a9e933c9dac80 Mon Sep 17 00:00:00 2001 From: Tianqing Zhang Date: Wed, 24 Apr 2024 11:42:17 -0400 Subject: [PATCH 2/3] import Param in noisifier --- src/rail/creation/noisifier.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rail/creation/noisifier.py b/src/rail/creation/noisifier.py index bc9f5d0e..9d9b2fb3 100644 --- a/src/rail/creation/noisifier.py +++ b/src/rail/creation/noisifier.py @@ -6,7 +6,7 @@ from rail.core.stage import RailStage from rail.core.data import PqHandle - +from ceci.config import StageParameter as Param class Noisifier(RailStage): """Base class Noisifier, which adds noise to the input catalog From cc443d6d09bb9f18af6f8378faae6f666f3c966f Mon Sep 17 00:00:00 2001 From: Drew Oldag Date: Wed, 24 Apr 2024 09:44:16 -0700 Subject: [PATCH 3/3] Updating the definition of the StageParams to remove dtype and include required=False. --- src/rail/creation/noisifier.py | 2 +- src/rail/creation/selector.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rail/creation/noisifier.py b/src/rail/creation/noisifier.py index 9d9b2fb3..aa31bae8 100644 --- a/src/rail/creation/noisifier.py +++ b/src/rail/creation/noisifier.py @@ -19,7 +19,7 @@ class Noisifier(RailStage): name = 'Noisifier' config_options = RailStage.config_options.copy() config_options.update( - seed=Param(int, None, msg="If set, creates reproducible results."), + seed=Param(default=None, required=False, msg="Set to an `int` to force reproducible results."), ) inputs = [('input', PqHandle)] outputs = [('output', PqHandle)] diff --git a/src/rail/creation/selector.py b/src/rail/creation/selector.py index f8a88a73..10794cc1 100644 --- a/src/rail/creation/selector.py +++ b/src/rail/creation/selector.py @@ -22,7 +22,7 @@ class Selector(RailStage): config_options = RailStage.config_options.copy() config_options.update( drop_rows=Param(bool, True, msg="Drop selected rows from output table"), - seed=Param(int, None, msg="If set, creates reproducible results."), + seed=Param(default=None, required=False, msg="Set to an `int` to force reproducible results."), ) inputs = [('input', PqHandle)] outputs = [('output', PqHandle)]