From 0af730cb8c87fc1d7a81b5c61b58052d6a92717a Mon Sep 17 00:00:00 2001 From: Tianqing Zhang Date: Tue, 30 Jul 2024 19:24:15 -0400 Subject: [PATCH 01/11] initial commit --- .../estimation_examples/pzflow_demo.ipynb | 184 ++++++++++++++++++ 1 file changed, 184 insertions(+) create mode 100644 examples/estimation_examples/pzflow_demo.ipynb diff --git a/examples/estimation_examples/pzflow_demo.ipynb b/examples/estimation_examples/pzflow_demo.ipynb new file mode 100644 index 0000000..452ec7e --- /dev/null +++ b/examples/estimation_examples/pzflow_demo.ipynb @@ -0,0 +1,184 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "327d391f-58bc-4b6a-9bbe-3987b969c8f4", + "metadata": {}, + "source": [ + "PZFlow Informer and Estimator Demo\n", + "\n", + "Author: Tianqing Zhang\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "916a05ad", + "metadata": {}, + "outputs": [], + "source": [ + "%matplotlib inline\n", + "import os\n", + "import matplotlib.pyplot as plt\n", + "import numpy as np\n", + "import pandas as pd\n", + "\n", + "import rail\n", + "from rail.core.data import TableHandle\n", + "from rail.core.stage import RailStage\n", + "import qp\n", + "import tables_io\n", + "\n", + "from rail.estimation.algos.pzflow_nf_default import PZFlowInformer, PZFlowEstimator\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d8ef87d3", + "metadata": {}, + "outputs": [], + "source": [ + "DS = RailStage.data_store\n", + "DS.__class__.allow_overwrite = True" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f79c3a7b", + "metadata": {}, + "outputs": [], + "source": [ + "from rail.utils.path_utils import find_rail_file\n", + "trainFile = find_rail_file('examples_data/testdata/test_dc2_training_9816.hdf5')\n", + "testFile = find_rail_file('examples_data/testdata/test_dc2_validation_9816.hdf5')\n", + "training_data = DS.read_file(\"training_data\", TableHandle, trainFile)\n", + "test_data = DS.read_file(\"test_data\", TableHandle, testFile)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "756d78a3", + "metadata": {}, + "outputs": [], + "source": [ + "pzflow_dict = dict(hdf5_groupname='photometry')\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1042a9f3", + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "# epoch = 200 gives a reasonable converged loss\n", + "pzflow_train = PZFlowInformer.make_stage(name='inform_pzflow',model='demo_pzflow.pkl',num_training_epochs = 200, **pzflow_dict)\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c4335359", + "metadata": {}, + "outputs": [], + "source": [ + "# delete after the ceci 2.0 pr merged\n", + "pzflow_train._aliases = dict()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c407f45b", + "metadata": {}, + "outputs": [], + "source": [ + "# training of the pzflow\n", + "pzflow_train.inform(training_data)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "156b6e3d", + "metadata": {}, + "outputs": [], + "source": [ + "pzflow_dict = dict(hdf5_groupname='photometry')\n", + "\n", + "pzflow_estimator = PZFlowEstimator.make_stage(name='estimate_pzflow',model='demo_pzflow.pkl',**pzflow_dict, chunk_size = 20000)\n", + "\n", + "pzflow_estimator._aliases = dict()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "00911d60", + "metadata": {}, + "outputs": [], + "source": [ + "# estimate using the test data\n", + "estimate_results = pzflow_estimator.estimate(test_data)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4cbdece3", + "metadata": {}, + "outputs": [], + "source": [ + "mode = estimate_results.data.ancil['zmode']\n", + "truth = np.array(training_data.data['photometry']['redshift'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ba076bab-c5ab-4292-8de9-415e7b30af5c", + "metadata": {}, + "outputs": [], + "source": [ + "# visualize the prediction. \n", + "plt.figure(figsize = (8,8))\n", + "plt.scatter(truth, mode, s = 0.5)\n", + "plt.xlabel('True Redshift')\n", + "plt.ylabel('Mode of Estimated Redshift')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ed5bf266-3b5c-4d9b-8428-77a2833cafef", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.4" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} From 0aca1c3f617b43a295171357fcd2f9e39eefc090 Mon Sep 17 00:00:00 2001 From: Tianqing Zhang Date: Wed, 31 Jul 2024 18:08:00 -0400 Subject: [PATCH 02/11] drop 3.9 --- .github/workflows/testing-and-coverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testing-and-coverage.yml b/.github/workflows/testing-and-coverage.yml index 4d8921a..8a1ffeb 100644 --- a/.github/workflows/testing-and-coverage.yml +++ b/.github/workflows/testing-and-coverage.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.9', '3.10', '3.11'] + python-version: ['3.10', '3.11'] steps: - uses: actions/checkout@v3 From adc1e8fee650848feb584576ed6371e7f338bdbf Mon Sep 17 00:00:00 2001 From: Tianqing Zhang Date: Wed, 31 Jul 2024 18:35:13 -0400 Subject: [PATCH 03/11] fix pipeline example smoke --- examples/core_examples/pipe_example.yml | 11 +++++++++++ examples/core_examples/pipe_example_config.yml | 11 ----------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/examples/core_examples/pipe_example.yml b/examples/core_examples/pipe_example.yml index 9ea1cdb..7bc5ce8 100644 --- a/examples/core_examples/pipe_example.yml +++ b/examples/core_examples/pipe_example.yml @@ -12,15 +12,26 @@ stages: module_name: rail.creation.engines.flowEngine name: flow_engine_test nprocess: 1 + aliases: + output: output_flow_engine_test - classname: LSSTErrorModel module_name: rail.creation.degraders.lsst_error_model name: lsst_error_model_test nprocess: 1 + aliases: + input: output_flow_engine_test + output: output_lsst_error_model_test - classname: ColumnMapper module_name: rail.tools.table_tools name: col_remapper_test nprocess: 1 + aliases: + input: output_lsst_error_model_test + output: output_col_remapper_test - classname: TableConverter module_name: rail.tools.table_tools name: table_conv_test nprocess: 1 + aliases: + input: output_col_remapper_test + output: output_table_conv_test diff --git a/examples/core_examples/pipe_example_config.yml b/examples/core_examples/pipe_example_config.yml index c871d35..55cbc37 100644 --- a/examples/core_examples/pipe_example_config.yml +++ b/examples/core_examples/pipe_example_config.yml @@ -1,7 +1,4 @@ col_remapper_test: - aliases: - input: output_lsst_error_model_test - output: output_col_remapper_test chunk_size: 100000 columns: mag_g_lsst_err: mag_err_g_lsst @@ -17,8 +14,6 @@ col_remapper_test: name: col_remapper_test output_mode: default flow_engine_test: - aliases: - output: output_flow_engine_test config: null model: ${FLOWDIR}/pretrained_flow.pkl n_samples: 50 @@ -36,9 +31,6 @@ lsst_error_model_test: y: 23.73 z: 24.16 airmass: 1.2 - aliases: - input: output_flow_engine_test - output: output_lsst_error_model_test bandNames: g: mag_g_lsst i: mag_i_lsst @@ -96,9 +88,6 @@ lsst_error_model_test: z: 0.69 tvis: 30.0 table_conv_test: - aliases: - input: output_col_remapper_test - output: output_table_conv_test config: null input: None name: table_conv_test From eead820f33a8d0862e310684fb0166c414fe1681 Mon Sep 17 00:00:00 2001 From: "Tianqing (TQ) Zhang" Date: Wed, 31 Jul 2024 16:10:08 -0700 Subject: [PATCH 04/11] Update smoke-test.yml --- .github/workflows/smoke-test.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/smoke-test.yml b/.github/workflows/smoke-test.yml index 483aec5..a1def73 100644 --- a/.github/workflows/smoke-test.yml +++ b/.github/workflows/smoke-test.yml @@ -32,9 +32,6 @@ jobs: pip install . pip install .[dev] if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - - name: (Temporarily) roll back ceci to pre-v2 - run: | - pip install ceci==1.17 - name: Run unit tests with pytest run: | python -m pytest tests From 0f4dfd7df508173012bf0e092d3480b7438155f6 Mon Sep 17 00:00:00 2001 From: Tianqing Zhang Date: Wed, 31 Jul 2024 20:31:41 -0400 Subject: [PATCH 05/11] change import path --- examples/estimation_examples/pzflow_demo.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/estimation_examples/pzflow_demo.ipynb b/examples/estimation_examples/pzflow_demo.ipynb index 452ec7e..f6d928a 100644 --- a/examples/estimation_examples/pzflow_demo.ipynb +++ b/examples/estimation_examples/pzflow_demo.ipynb @@ -29,7 +29,7 @@ "import qp\n", "import tables_io\n", "\n", - "from rail.estimation.algos.pzflow_nf_default import PZFlowInformer, PZFlowEstimator\n" + "from rail.estimation.algos.pzflow_nf import PZFlowInformer, PZFlowEstimator\n" ] }, { From e55c66740089684e262f741fed9b1612882afcae Mon Sep 17 00:00:00 2001 From: Tianqing Zhang Date: Thu, 1 Aug 2024 19:20:49 -0400 Subject: [PATCH 06/11] remove pzflow demo --- .../estimation_examples/pzflow_demo.ipynb | 184 ------------------ 1 file changed, 184 deletions(-) delete mode 100644 examples/estimation_examples/pzflow_demo.ipynb diff --git a/examples/estimation_examples/pzflow_demo.ipynb b/examples/estimation_examples/pzflow_demo.ipynb deleted file mode 100644 index f6d928a..0000000 --- a/examples/estimation_examples/pzflow_demo.ipynb +++ /dev/null @@ -1,184 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "327d391f-58bc-4b6a-9bbe-3987b969c8f4", - "metadata": {}, - "source": [ - "PZFlow Informer and Estimator Demo\n", - "\n", - "Author: Tianqing Zhang\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "916a05ad", - "metadata": {}, - "outputs": [], - "source": [ - "%matplotlib inline\n", - "import os\n", - "import matplotlib.pyplot as plt\n", - "import numpy as np\n", - "import pandas as pd\n", - "\n", - "import rail\n", - "from rail.core.data import TableHandle\n", - "from rail.core.stage import RailStage\n", - "import qp\n", - "import tables_io\n", - "\n", - "from rail.estimation.algos.pzflow_nf import PZFlowInformer, PZFlowEstimator\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "d8ef87d3", - "metadata": {}, - "outputs": [], - "source": [ - "DS = RailStage.data_store\n", - "DS.__class__.allow_overwrite = True" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "f79c3a7b", - "metadata": {}, - "outputs": [], - "source": [ - "from rail.utils.path_utils import find_rail_file\n", - "trainFile = find_rail_file('examples_data/testdata/test_dc2_training_9816.hdf5')\n", - "testFile = find_rail_file('examples_data/testdata/test_dc2_validation_9816.hdf5')\n", - "training_data = DS.read_file(\"training_data\", TableHandle, trainFile)\n", - "test_data = DS.read_file(\"test_data\", TableHandle, testFile)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "756d78a3", - "metadata": {}, - "outputs": [], - "source": [ - "pzflow_dict = dict(hdf5_groupname='photometry')\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "1042a9f3", - "metadata": {}, - "outputs": [], - "source": [ - "\n", - "# epoch = 200 gives a reasonable converged loss\n", - "pzflow_train = PZFlowInformer.make_stage(name='inform_pzflow',model='demo_pzflow.pkl',num_training_epochs = 200, **pzflow_dict)\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "c4335359", - "metadata": {}, - "outputs": [], - "source": [ - "# delete after the ceci 2.0 pr merged\n", - "pzflow_train._aliases = dict()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "c407f45b", - "metadata": {}, - "outputs": [], - "source": [ - "# training of the pzflow\n", - "pzflow_train.inform(training_data)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "156b6e3d", - "metadata": {}, - "outputs": [], - "source": [ - "pzflow_dict = dict(hdf5_groupname='photometry')\n", - "\n", - "pzflow_estimator = PZFlowEstimator.make_stage(name='estimate_pzflow',model='demo_pzflow.pkl',**pzflow_dict, chunk_size = 20000)\n", - "\n", - "pzflow_estimator._aliases = dict()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "00911d60", - "metadata": {}, - "outputs": [], - "source": [ - "# estimate using the test data\n", - "estimate_results = pzflow_estimator.estimate(test_data)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "4cbdece3", - "metadata": {}, - "outputs": [], - "source": [ - "mode = estimate_results.data.ancil['zmode']\n", - "truth = np.array(training_data.data['photometry']['redshift'])" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "ba076bab-c5ab-4292-8de9-415e7b30af5c", - "metadata": {}, - "outputs": [], - "source": [ - "# visualize the prediction. \n", - "plt.figure(figsize = (8,8))\n", - "plt.scatter(truth, mode, s = 0.5)\n", - "plt.xlabel('True Redshift')\n", - "plt.ylabel('Mode of Estimated Redshift')" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "ed5bf266-3b5c-4d9b-8428-77a2833cafef", - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.4" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} From f42e72ad3a1fe4494f9ed962413d3e4de8fec1e3 Mon Sep 17 00:00:00 2001 From: Tianqing Zhang Date: Thu, 1 Aug 2024 19:37:41 -0400 Subject: [PATCH 07/11] add back pzflow demo --- .../estimation_examples/pzflow_demo.ipynb | 191 ++++++++++++++++++ 1 file changed, 191 insertions(+) create mode 100644 examples/estimation_examples/pzflow_demo.ipynb diff --git a/examples/estimation_examples/pzflow_demo.ipynb b/examples/estimation_examples/pzflow_demo.ipynb new file mode 100644 index 0000000..ce813f3 --- /dev/null +++ b/examples/estimation_examples/pzflow_demo.ipynb @@ -0,0 +1,191 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "327d391f-58bc-4b6a-9bbe-3987b969c8f4", + "metadata": {}, + "source": [ + "PZFlow Informer and Estimator Demo\n", + "\n", + "Author: Tianqing Zhang\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "916a05ad", + "metadata": {}, + "outputs": [], + "source": [ + "%matplotlib inline\n", + "import os\n", + "import matplotlib.pyplot as plt\n", + "import numpy as np\n", + "import pandas as pd\n", + "\n", + "import rail\n", + "from rail.core.data import TableHandle\n", + "from rail.core.stage import RailStage\n", + "import qp\n", + "import tables_io\n", + "\n", + "from rail.estimation.algos.pzflow_nf import PZFlowInformer, PZFlowEstimator\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d8ef87d3", + "metadata": {}, + "outputs": [], + "source": [ + "DS = RailStage.data_store\n", + "DS.__class__.allow_overwrite = True" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f79c3a7b", + "metadata": {}, + "outputs": [], + "source": [ + "from rail.utils.path_utils import find_rail_file\n", + "trainFile = find_rail_file('examples_data/testdata/test_dc2_training_9816.hdf5')\n", + "testFile = find_rail_file('examples_data/testdata/test_dc2_validation_9816.hdf5')\n", + "training_data = DS.read_file(\"training_data\", TableHandle, trainFile)\n", + "test_data = DS.read_file(\"test_data\", TableHandle, testFile)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "756d78a3", + "metadata": {}, + "outputs": [], + "source": [ + "pzflow_dict = dict(hdf5_groupname='photometry',output_mode = 'not_fiducial' )\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0857e6bb-18eb-4f89-bc4b-29bed1ffa122", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1042a9f3", + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "# epoch = 200 gives a reasonable converged loss\n", + "pzflow_train = PZFlowInformer.make_stage(name='inform_pzflow',model='demo_pzflow.pkl',num_training_epochs = 30, **pzflow_dict)\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9ae0180b-b67f-4ac1-bf90-545c7c2fbb62", + "metadata": {}, + "outputs": [], + "source": [ + "pzflow_train.finalize()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c407f45b", + "metadata": {}, + "outputs": [], + "source": [ + "# training of the pzflow\n", + "pzflow_train.inform(training_data)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "156b6e3d", + "metadata": {}, + "outputs": [], + "source": [ + "pzflow_dict = dict(hdf5_groupname='photometry')\n", + "\n", + "pzflow_estimator = PZFlowEstimator.make_stage(name='estimate_pzflow',model='demo_pzflow.pkl',**pzflow_dict, chunk_size = 20000)\n", + "\n", + "pzflow_estimator._aliases = dict()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "00911d60", + "metadata": {}, + "outputs": [], + "source": [ + "# estimate using the test data\n", + "estimate_results = pzflow_estimator.estimate(test_data)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4cbdece3", + "metadata": {}, + "outputs": [], + "source": [ + "mode = estimate_results.data.ancil['zmode']\n", + "truth = np.array(training_data.data['photometry']['redshift'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ba076bab-c5ab-4292-8de9-415e7b30af5c", + "metadata": {}, + "outputs": [], + "source": [ + "# visualize the prediction. \n", + "plt.figure(figsize = (8,8))\n", + "plt.scatter(truth, mode, s = 0.5)\n", + "plt.xlabel('True Redshift')\n", + "plt.ylabel('Mode of Estimated Redshift')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ed5bf266-3b5c-4d9b-8428-77a2833cafef", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "rail_env", + "language": "python", + "name": "rail_env" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.4" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} From 57f1d8d50ce0a392f9d72f537e6a36a0e5cbd861 Mon Sep 17 00:00:00 2001 From: Tianqing Zhang Date: Thu, 1 Aug 2024 20:21:35 -0400 Subject: [PATCH 08/11] change kernel --- examples/estimation_examples/pzflow_demo.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/estimation_examples/pzflow_demo.ipynb b/examples/estimation_examples/pzflow_demo.ipynb index ce813f3..4ccf814 100644 --- a/examples/estimation_examples/pzflow_demo.ipynb +++ b/examples/estimation_examples/pzflow_demo.ipynb @@ -169,9 +169,9 @@ ], "metadata": { "kernelspec": { - "display_name": "rail_env", + "display_name": "Python 3 (ipykernel)", "language": "python", - "name": "rail_env" + "name": "python3" }, "language_info": { "codemirror_mode": { From 7a73d9bea6216fd33710e1cb8c810593b3839840 Mon Sep 17 00:00:00 2001 From: Tianqing Zhang Date: Fri, 2 Aug 2024 01:49:46 -0400 Subject: [PATCH 09/11] fix a bug --- examples/estimation_examples/pzflow_demo.ipynb | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/examples/estimation_examples/pzflow_demo.ipynb b/examples/estimation_examples/pzflow_demo.ipynb index 4ccf814..6d7b247 100644 --- a/examples/estimation_examples/pzflow_demo.ipynb +++ b/examples/estimation_examples/pzflow_demo.ipynb @@ -87,16 +87,6 @@ "pzflow_train = PZFlowInformer.make_stage(name='inform_pzflow',model='demo_pzflow.pkl',num_training_epochs = 30, **pzflow_dict)\n" ] }, - { - "cell_type": "code", - "execution_count": null, - "id": "9ae0180b-b67f-4ac1-bf90-545c7c2fbb62", - "metadata": {}, - "outputs": [], - "source": [ - "pzflow_train.finalize()" - ] - }, { "cell_type": "code", "execution_count": null, @@ -117,9 +107,7 @@ "source": [ "pzflow_dict = dict(hdf5_groupname='photometry')\n", "\n", - "pzflow_estimator = PZFlowEstimator.make_stage(name='estimate_pzflow',model='demo_pzflow.pkl',**pzflow_dict, chunk_size = 20000)\n", - "\n", - "pzflow_estimator._aliases = dict()" + "pzflow_estimator = PZFlowEstimator.make_stage(name='estimate_pzflow',model='demo_pzflow.pkl',**pzflow_dict, chunk_size = 20000)" ] }, { @@ -183,7 +171,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.4" + "version": "3.10.0" } }, "nbformat": 4, From 0de46fdafec834ec692c8330c588298edfdc7854 Mon Sep 17 00:00:00 2001 From: Tianqing Zhang Date: Fri, 2 Aug 2024 17:01:20 -0400 Subject: [PATCH 10/11] fix bug --- examples/estimation_examples/pzflow_demo.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/estimation_examples/pzflow_demo.ipynb b/examples/estimation_examples/pzflow_demo.ipynb index 6d7b247..fdc2565 100644 --- a/examples/estimation_examples/pzflow_demo.ipynb +++ b/examples/estimation_examples/pzflow_demo.ipynb @@ -129,7 +129,7 @@ "outputs": [], "source": [ "mode = estimate_results.data.ancil['zmode']\n", - "truth = np.array(training_data.data['photometry']['redshift'])" + "truth = np.array(test_data.data['photometry']['redshift'])" ] }, { From 1fca2e68c66b94cd8923eeb164c430cca5a06956 Mon Sep 17 00:00:00 2001 From: "Tianqing (TQ) Zhang" Date: Fri, 2 Aug 2024 15:40:04 -0700 Subject: [PATCH 11/11] use .read() to get the full estimated dataset --- examples/estimation_examples/pzflow_demo.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/estimation_examples/pzflow_demo.ipynb b/examples/estimation_examples/pzflow_demo.ipynb index fdc2565..12aec82 100644 --- a/examples/estimation_examples/pzflow_demo.ipynb +++ b/examples/estimation_examples/pzflow_demo.ipynb @@ -128,7 +128,7 @@ "metadata": {}, "outputs": [], "source": [ - "mode = estimate_results.data.ancil['zmode']\n", + "mode = estimate_results.read(force=True).ancil['zmode']\n", "truth = np.array(test_data.data['photometry']['redshift'])" ] },