From 3e832a085227ef1d4307117efa4fe574dd709086 Mon Sep 17 00:00:00 2001 From: Curtis McCully Date: Thu, 14 Mar 2024 16:50:56 -0400 Subject: [PATCH 1/2] Bugfixes to docs with newer version of banzai --- CHANGES.md | 4 +++ banzai_nres/frames.py | 11 ++------ docs/banzai_nres/ExampleReduction.ipynb | 35 ++++++++++++++++--------- 3 files changed, 29 insertions(+), 21 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 490d497d..232e63d8 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,7 @@ +1.1.4 (2024-03-14) +------------------ +- Fixes to documentation for updated BANZAI installs + 1.1.3 (2023-11-17) ------------------ - Fixes to use BANZAI LoggingAdapter diff --git a/banzai_nres/frames.py b/banzai_nres/frames.py index 2db461b8..cf6a62be 100644 --- a/banzai_nres/frames.py +++ b/banzai_nres/frames.py @@ -112,14 +112,8 @@ def get_output_data_products(self, runtime_context): fits_2d[0].header['L1ID1D'] = filename_1d output_product_2d = DataProduct.from_fits(fits_2d, filename_2d, self.get_output_directory(runtime_context)) - # make sure we pop all the fits garbage before we write the meta data. - summary_pdf_meta = fits_utils.sanitize_header(self.meta.copy()) - for keyword in ['NAXIS1', 'NAXIS2', 'EXTNAME', 'EXTVER']: - if keyword in summary_pdf_meta: - summary_pdf_meta.pop(keyword) - summary_buffer = BytesIO() - pp = PdfPages(summary_buffer, keep_empty=False, metadata=dict(summary_pdf_meta)) + pp = PdfPages(summary_buffer, keep_empty=False) for fig in self.summary_figures: fig.tight_layout() pp.savefig(fig) @@ -127,8 +121,7 @@ def get_output_data_products(self, runtime_context): pp.close() summary_buffer.seek(0) - output_summary = DataProduct(summary_buffer, filename_summary, self.get_output_directory(runtime_context), - meta=dict(summary_pdf_meta)) + output_summary = DataProduct(summary_buffer, filename_summary, self.get_output_directory(runtime_context)) return [output_product_1d, output_product_2d, output_summary] diff --git a/docs/banzai_nres/ExampleReduction.ipynb b/docs/banzai_nres/ExampleReduction.ipynb index d68c117e..d0d9ee53 100644 --- a/docs/banzai_nres/ExampleReduction.ipynb +++ b/docs/banzai_nres/ExampleReduction.ipynb @@ -195,11 +195,11 @@ "# THIS MAKES A FRESH DATABASE. DO NOT RUN ME UNLESS YOU WANT TO DELETE YOUR test.db AND MAKE A FRESH ONE\n", "full_phoenix_path=os.path.join(os.getcwd(), phoenix_dir)\n", "os.system(f'banzai_nres_create_db --db-address={os.environ[\"DB_ADDRESS\"]}')\n", - "os.system(f'banzai_nres_populate_phoenix_models --model-location={full_phoenix_path} --db-address={os.environ[\"DB_ADDRESS\"]}')\n", + "os.system(f'banzai_nres_populate_phoenix_models --model-location=\"{full_phoenix_path}\" --db-address={os.environ[\"DB_ADDRESS\"]}')\n", "os.system(f'banzai_add_site --site elp --latitude 30.67986944 --longitude -104.015175 --elevation 2027 --timezone -6 --db-address={os.environ[\"DB_ADDRESS\"]}')\n", "os.system(f'banzai_add_site --site lsc --latitude -30.1673833333 --longitude -70.8047888889 --elevation 2198 --timezone -4 --db-address={os.environ[\"DB_ADDRESS\"]}') \n", - "os.system(f'banzai_add_instrument --site lsc --camera fl09 --name nres01 --instrument-type 1m0-NRES-SciCam --db-address={os.environ[\"DB_ADDRESS\"]}')\n", - "os.system(f'banzai_add_instrument --site elp --camera fl17 --name nres02 --instrument-type 1m0-NRES-SciCam --db-address={os.environ[\"DB_ADDRESS\"]}')" + "os.system(f'banzai_add_instrument --site lsc --camera fl09 --name nres01 --instrument-type 1m0-NRES-SciCam --nx=4096 --ny=4096 --db-address={os.environ[\"DB_ADDRESS\"]}')\n", + "os.system(f'banzai_add_instrument --site elp --camera fl17 --name nres02 --instrument-type 1m0-NRES-SciCam --nx=4096 --ny=4096 --db-address={os.environ[\"DB_ADDRESS\"]}')" ] }, { @@ -334,6 +334,15 @@ " run_pipeline_stages([{'path': flat_file}], context)" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "mark_frames_as_good('*w92*')" + ] + }, { "cell_type": "code", "execution_count": null, @@ -362,6 +371,15 @@ " run_pipeline_stages([{'path': arc_file}], context)" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "mark_frames_as_good('*a92*')" + ] + }, { "cell_type": "code", "execution_count": null, @@ -389,18 +407,11 @@ "for science_file in science_files: \n", " run_pipeline_stages([{'path': science_file}], context)" ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -414,7 +425,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.5" + "version": "3.10.13" } }, "nbformat": 4, From 8324a446bf78b9d260f06a494c1520957f1e3cc0 Mon Sep 17 00:00:00 2001 From: Curtis McCully Date: Thu, 14 Mar 2024 17:17:47 -0400 Subject: [PATCH 2/2] Removed unused import --- banzai_nres/frames.py | 1 - 1 file changed, 1 deletion(-) diff --git a/banzai_nres/frames.py b/banzai_nres/frames.py index cf6a62be..0838239f 100644 --- a/banzai_nres/frames.py +++ b/banzai_nres/frames.py @@ -12,7 +12,6 @@ import os from astropy.coordinates import Angle from astropy import units -from banzai.utils import fits_utils logger = get_logger()