Skip to content

Commit

Permalink
Bugfixes to docs with newer version of banzai
Browse files Browse the repository at this point in the history
  • Loading branch information
cmccully committed Mar 14, 2024
1 parent a5efc83 commit 3e832a0
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 21 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
11 changes: 2 additions & 9 deletions banzai_nres/frames.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,23 +112,16 @@ 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)
pyplot.close(fig)
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]

Expand Down
35 changes: 23 additions & 12 deletions docs/banzai_nres/ExampleReduction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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\"]}')"
]
},
{
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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"
},
Expand All @@ -414,7 +425,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
"version": "3.10.13"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 3e832a0

Please sign in to comment.