diff --git a/src/rail/estimation/algos/naiveStack.py b/src/rail/estimation/algos/naive_stack.py similarity index 96% rename from src/rail/estimation/algos/naiveStack.py rename to src/rail/estimation/algos/naive_stack.py index be6463f5..02b2f99b 100644 --- a/src/rail/estimation/algos/naiveStack.py +++ b/src/rail/estimation/algos/naive_stack.py @@ -9,11 +9,11 @@ import qp -class NaiveStack(PZSummarizer): +class NaiveStackSummarizer(PZSummarizer): """Summarizer which simply histograms a point estimate """ - name = 'NaiveStack' + name = 'NaiveStackSummarizer' config_options = PZSummarizer.config_options.copy() config_options.update(zmin=Param(float, 0.0, msg="The minimum redshift of the z grid"), zmax=Param(float, 3.0, msg="The maximum redshift of the z grid"), diff --git a/src/rail/estimation/algos/pointEstimateHist.py b/src/rail/estimation/algos/point_est_hist.py similarity index 96% rename from src/rail/estimation/algos/pointEstimateHist.py rename to src/rail/estimation/algos/point_est_hist.py index dc81ab11..f58a26d9 100644 --- a/src/rail/estimation/algos/pointEstimateHist.py +++ b/src/rail/estimation/algos/point_est_hist.py @@ -9,11 +9,11 @@ import qp -class PointEstimateHist(PZSummarizer): +class PointEstHistSummarizer(PZSummarizer): """Summarizer which simply histograms a point estimate """ - name = 'PointEstimateHist' + name = 'PointEstHistSummarizer' config_options = PZSummarizer.config_options.copy() config_options.update(zmin=Param(float, 0.0, msg="The minimum redshift of the z grid"), zmax=Param(float, 3.0, msg="The maximum redshift of the z grid"), diff --git a/src/rail/estimation/algos/randomPZ.py b/src/rail/estimation/algos/random_gauss.py similarity index 96% rename from src/rail/estimation/algos/randomPZ.py rename to src/rail/estimation/algos/random_gauss.py index 59358513..0f21ef41 100644 --- a/src/rail/estimation/algos/randomPZ.py +++ b/src/rail/estimation/algos/random_gauss.py @@ -12,11 +12,11 @@ import qp -class RandomPZ(CatEstimator): +class RandomGaussEstimator(CatEstimator): """Random CatEstimator """ - name = 'RandomPZ' + name = 'RandomGaussEstimator' inputs = [('input', TableHandle)] config_options = CatEstimator.config_options.copy() config_options.update(rand_width=Param(float, 0.025, "ad hock width of PDF"), diff --git a/src/rail/estimation/algos/trainZ.py b/src/rail/estimation/algos/train_z.py similarity index 95% rename from src/rail/estimation/algos/trainZ.py rename to src/rail/estimation/algos/train_z.py index a6fbe145..aaab3353 100644 --- a/src/rail/estimation/algos/trainZ.py +++ b/src/rail/estimation/algos/train_z.py @@ -23,11 +23,11 @@ def __init__(self, zgrid, pdf, zmode): self.zmode = zmode -class Inform_trainZ(CatInformer): +class TrainZInformer(CatInformer): """Train an Estimator which returns a global PDF for all galaxies """ - name = 'Inform_trainZ' + name = 'TrainZInformer' config_options = CatInformer.config_options.copy() config_options.update(zmin=SHARED_PARAMS, zmax=SHARED_PARAMS, @@ -56,11 +56,11 @@ def run(self): self.add_data('model', self.model) -class TrainZ(CatEstimator): +class TrainZEstimator(CatEstimator): """CatEstimator which returns a global PDF for all galaxies """ - name = 'TrainZ' + name = 'TrainZEstimator' config_options = CatEstimator.config_options.copy() config_options.update(zmin=SHARED_PARAMS, zmax=SHARED_PARAMS, diff --git a/src/rail/estimation/algos/varInference.py b/src/rail/estimation/algos/var_inf.py similarity index 97% rename from src/rail/estimation/algos/varInference.py rename to src/rail/estimation/algos/var_inf.py index 3b728acf..44a2c945 100644 --- a/src/rail/estimation/algos/varInference.py +++ b/src/rail/estimation/algos/var_inf.py @@ -13,7 +13,7 @@ TEENY = 1.e-15 -class VarInferenceStack(PZSummarizer): +class VarInfStackSummarizer(PZSummarizer): """Variational inference summarizer based on notebook created by Markus Rau The summzarizer is appropriate for the likelihoods returned by template-based codes, for which the NaiveSummarizer are not appropriate. @@ -32,7 +32,7 @@ class VarInferenceStack(PZSummarizer): number of samples used in dirichlet to determind error bar """ - name = 'VarInferenceStack' + name = 'VarInfStackSummarizer' config_options = PZSummarizer.config_options.copy() config_options.update(zmin=Param(float, 0.0, msg="The minimum redshift of the z grid"), zmax=Param(float, 3.0, msg="The maximum redshift of the z grid"), diff --git a/src/rail/estimation/summarizer.py b/src/rail/estimation/summarizer.py index 66be219b..89c37442 100644 --- a/src/rail/estimation/summarizer.py +++ b/src/rail/estimation/summarizer.py @@ -106,7 +106,7 @@ def summarize(self, input_data): class SZPZSummarizer(RailStage): #pragma: no cover """The base class for classes that use two sets of data: a photometry sample with - spec-z values, and a photometry sample with unknown redshifts, e.g. simpleSOM and + spec-z values, and a photometry sample with unknown redshifts, e.g. minisom_som and outputs a QP Ensemble with bootstrap realization of the N(z) distribution """ name = 'SZPZtoNZSummarizer' diff --git a/src/rail/examples_data/goldenspike_data/goldenspike.yml b/src/rail/examples_data/goldenspike_data/goldenspike.yml index eb25393f..44c0637c 100644 --- a/src/rail/examples_data/goldenspike_data/goldenspike.yml +++ b/src/rail/examples_data/goldenspike_data/goldenspike.yml @@ -42,21 +42,21 @@ stages: - classname: QuantityCut name: quantity_cut nprocess: 1 -- classname: Inform_trainZ +- classname: TrainZInformer name: inform_trainZ nprocess: 1 - classname: Estimator name: estimate_bpz nprocess: 1 -- classname: TrainZ +- classname: TrainZEstimator name: estimate_trainZ nprocess: 1 -- classname: RandomPZ +- classname: RandomGaussEstimator name: estimate_randomZ nprocess: 1 -- classname: PointEstimateHist +- classname: PointEstHistSummarizer name: point_estimate_test nprocess: 1 -- classname: NaiveStack +- classname: NaiveStackSummarizer name: naive_stack_test nprocess: 1 diff --git a/src/rail/stages/__init__.py b/src/rail/stages/__init__.py index 28ae8024..361934af 100644 --- a/src/rail/stages/__init__.py +++ b/src/rail/stages/__init__.py @@ -4,11 +4,11 @@ from rail.estimation.estimator import * from rail.estimation.summarizer import * -from rail.estimation.algos.naiveStack import * -from rail.estimation.algos.randomPZ import * -from rail.estimation.algos.pointEstimateHist import * -from rail.estimation.algos.trainZ import * -from rail.estimation.algos.varInference import * +from rail.estimation.algos.naive_stack import * +from rail.estimation.algos.random_gauss import * +from rail.estimation.algos.point_est_hist import * +from rail.estimation.algos.train_z import * +from rail.estimation.algos.var_inf import * from rail.creation.degrader import * #from rail.creation.degradation.spectroscopic_degraders import * diff --git a/tests/estimation/test_algos.py b/tests/estimation/test_algos.py index 3b2e1511..db79febf 100644 --- a/tests/estimation/test_algos.py +++ b/tests/estimation/test_algos.py @@ -4,7 +4,7 @@ from rail.core.algo_utils import one_algo from rail.core.stage import RailStage -from rail.estimation.algos import randomPZ, trainZ +from rail.estimation.algos import random_gauss, train_z sci_ver_str = scipy.__version__.split(".") @@ -25,7 +25,7 @@ def test_random_pz(): } # zb_expected = np.array([1.359, 0.013, 0.944, 1.831, 2.982, 1.565, 0.308, 0.157, 0.986, 1.679]) train_algo = None - pz_algo = randomPZ.RandomPZ + pz_algo = random_gauss.RandomGaussEstimator results, rerun_results, rerun3_results = one_algo( "RandomPZ", train_algo, pz_algo, train_config_dict, estim_config_dict ) @@ -44,8 +44,8 @@ def test_train_pz(): zb_expected = np.repeat(0.1445183, 10) pdf_expected = np.zeros(shape=(301,)) pdf_expected[10:16] = [7, 23, 8, 23, 26, 13] - train_algo = trainZ.Inform_trainZ - pz_algo = trainZ.TrainZ + train_algo = train_z.TrainZInformer + pz_algo = train_z.TrainZEstimator results, rerun_results, rerun3_results = one_algo( "TrainZ", train_algo, pz_algo, train_config_dict, estim_config_dict ) diff --git a/tests/estimation/test_summarizers.py b/tests/estimation/test_summarizers.py index 980085f4..c78b7d95 100644 --- a/tests/estimation/test_summarizers.py +++ b/tests/estimation/test_summarizers.py @@ -7,7 +7,7 @@ from rail.core.data import QPHandle from rail.core.stage import RailStage from rail.core.utils import RAILDIR -from rail.estimation.algos import naiveStack, pointEstimateHist, varInference +from rail.estimation.algos import naive_stack, point_est_hist, var_inf testdata = os.path.join(RAILDIR, "rail/examples_data/testdata/output_BPZ_lite.fits") DS = RailStage.data_store @@ -29,17 +29,17 @@ def one_algo(key, summarizer_class, summary_kwargs): def test_naive_stack(): summary_config_dict = {} - summarizer_class = naiveStack.NaiveStack + summarizer_class = naive_stack.NaiveStackSummarizer results = one_algo("NaiveStack", summarizer_class, summary_config_dict) def test_point_estimate_hist(): summary_config_dict = {} - summarizer_class = pointEstimateHist.PointEstimateHist + summarizer_class = point_est_hist.PointEstHistSummarizer results = one_algo("PointEstimateHist", summarizer_class, summary_config_dict) def test_var_inference_stack(): summary_config_dict = {} - summarizer_class = varInference.VarInferenceStack + summarizer_class = var_inf.VarInfStackSummarizer results = one_algo("VariationalInference", summarizer_class, summary_config_dict)