Skip to content

Commit

Permalink
updated functions in mast_api_psf
Browse files Browse the repository at this point in the history
  • Loading branch information
mrevalski committed Dec 11, 2024
1 parent 17ca360 commit 55e7c0a
Show file tree
Hide file tree
Showing 2 changed files with 220 additions and 75 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,7 @@
"\n",
"***\n",
"\n",
"The example above demonstrates how to extract and stack stars from a provided exposure. However, in many cases there may be an insufficient number of stars to create a high-quality median stack. In those cases, users can utilize the MAST cutout database described in [WFC3 ISR 2021-12](https://www.stsci.edu/files/live/sites/www/files/home/hst/instrumentation/wfc3/documentation/instrument-science-reports-isrs/_documents/2021/ISR_2021_12.pdf), with access instructions provided on the [PSF Search webpage](https://www.stsci.edu/hst/instrumentation/wfc3/data-analysis/psf/psf-search). The MAST API commands are listed on [this webpage](https://mast.stsci.edu/api/v0/pyex.html#MastCatalogsFilteredWfc3PsfUvisPy), with parameter options on [this webpage](https://mast.stsci.edu/api/v0/_w_f_c3__p_s_ffields.html). The examples below utilize sections of code from the `download_psf_cutouts.ipynb` developed by Dauphin et al. (*in preparation*). In this case, we set limits on the x and y detector locations, quality of fit, exposure time, isolation index, integrated flux (in electrons for WFC3/UVIS and WFPC2, and in electrons per second for WFC3/IR), the central pixel flux, sky flux, and exclude subarrays. The stellar centroids provided in the MAST database were calculated using hst1pass and the empirical PSF models described in [Section 2.2](#empirical). See [WFC3 ISR 2021-12](https://www.stsci.edu/files/live/sites/www/files/home/hst/instrumentation/wfc3/documentation/instrument-science-reports-isrs/_documents/2021/ISR_2021_12.pdf) for additional information.\n",
"The example above demonstrates how to extract and stack stars from a provided exposure. However, in many cases there may be an insufficient number of stars to create a high-quality median stack. In those cases, users can utilize the MAST cutout database described in [WFC3 ISR 2021-12](https://www.stsci.edu/files/live/sites/www/files/home/hst/instrumentation/wfc3/documentation/instrument-science-reports-isrs/_documents/2021/ISR_2021_12.pdf), with access instructions provided on the [PSF Search webpage](https://www.stsci.edu/hst/instrumentation/wfc3/data-analysis/psf/psf-search). The MAST API commands are listed on [this webpage](https://mast.stsci.edu/api/v0/pyex.html#MastCatalogsFilteredWfc3PsfUvisPy), with parameter options on [this webpage](https://mast.stsci.edu/api/v0/_w_f_c3__p_s_ffields.html). The examples below utilize sections of code from the `download_psf_cutouts.ipynb` developed by Dauphin et al. (2024) that is available on [Github](https://spacetelescope.github.io/hst_notebooks/notebooks/WFC3/mast_api_psf/download_psf_cutouts.html). In this case, we set limits on the x and y detector locations, quality of fit, exposure time, isolation index, integrated flux (in electrons for WFC3/UVIS and WFPC2, and in electrons per second for WFC3/IR), the central pixel flux, sky flux, and exclude subarrays. The stellar centroids provided in the MAST database were calculated using hst1pass and the empirical PSF models described in [Section 2.2](#empirical). See [WFC3 ISR 2021-12](https://www.stsci.edu/files/live/sites/www/files/home/hst/instrumentation/wfc3/documentation/instrument-science-reports-isrs/_documents/2021/ISR_2021_12.pdf) for additional information.\n",
"\n",
"<div class=\"alert alert-block alert-info\"><b>NOTE:</b> We explicitly assume that users have familiarized themselves with the contents of the \"download_psf_cutouts.ipynb\" notebook for this section. </div>"
]
Expand Down Expand Up @@ -1032,7 +1032,7 @@
"}\n",
"\n",
"filts = mast_api_psf.set_filters(parameters)\n",
"columns = ['id', 'rootname', 'filter', 'chip', 'exptime', 'psf_x_center', 'psf_y_center', 'pixc', 'sky', 'qfit', 'iso_index', 'subarray']\n",
"columns = ['id', 'rootname', 'filter', 'chip', 'exptime', 'psf_x_center', 'psf_y_center', 'pixc', 'sky', 'qfit', 'iso_index', 'subarray', 'x_raw', 'y_raw', 'x_cal', 'y_cal']\n",
"obs = mast_api_psf.mast_query_psf_database(detector=detector, filts=filts, columns=columns)\n",
"obs"
]
Expand All @@ -1042,7 +1042,7 @@
"id": "55d3e120-393d-45e4-937a-0d9f6f7613ef",
"metadata": {},
"source": [
"As described and detailed in the `download_psf_cutouts.ipynb`, the below cell constructs the filepaths for the cutouts, requests to download them from the MAST cutout service, and then extracts the files from a compressed tar folder. Finally, the filepaths for each cutout are saved to a list in `path_data` and passed to an array."
"As described and detailed in the [`download_psf_cutouts.ipynb`](https://spacetelescope.github.io/hst_notebooks/notebooks/WFC3/mast_api_psf/download_psf_cutouts.html), the below cell constructs the filepaths for the cutouts, requests to download them from the MAST cutout service, and then extracts the files from a compressed tar folder. Finally, the filepaths for each cutout are saved to a list in `path_data` and passed to an array."
]
},
{
Expand All @@ -1055,7 +1055,8 @@
"os.chdir(data_dir)\n",
"file_suffix = ['flc']\n",
"dataURIs = mast_api_psf.make_dataURIs(obs, detector=detector, file_suffix=file_suffix)\n",
"filename = mast_api_psf.download_request(dataURIs, filename='mastDownload.tar.gz', download_type='bundle.tar.gz')\n",
"# filename = mast_api_psf.download_request(dataURIs, filename='mastDownload.tar.gz', download_type='bundle.tar.gz')\n",
"filename = filename = mast_api_psf.download_request_bundle(dataURIs, filename='mastDownload.tar.gz')\n",
"tar = tarfile.open(filename, 'r:gz')\n",
"path_mast = tar.getnames()[0]\n",
"tar.extractall()\n",
Expand Down Expand Up @@ -1502,7 +1503,7 @@
"\n",
"**Author:** Mitchell Revalski<br>\n",
"**Created:** 15 Apr 2024<br>\n",
"**Updated:** 05 Jun 2024<br>\n",
"**Updated:** 11 Dec 2024<br>\n",
"**Source:** [https://github.com/spacetelescope/hst_notebooks](https://github.com/spacetelescope/hst_notebooks)\n",
"\n",
"<a id=\"additional\"></a>\n",
Expand All @@ -1528,6 +1529,11 @@
"* [Citing `matplotlib`](https://matplotlib.org/stable/users/project/citing.html)\n",
"* [Citing `numpy`](https://numpy.org/citing-numpy/)\n",
"* [Citing `photutils`](https://photutils.readthedocs.io/en/stable/getting_started/citation.html)\n",
"\n",
"<a id=\"history\"></a>\n",
"### Version History\n",
"- 05 Jun 2024: First release of the `hst_point_spread_function.ipynb` notebook, utilizing `astropy v6.0.1`, `numpy v1.26.4`, and `photutils v1.12.0`.\n",
"- 11 Dec 2024: Updated the functions in `mast_api_psf.py`, and the corresponding function calls in the notebook, to match those published in [download_psf_cutouts.ipynb](https://spacetelescope.github.io/hst_notebooks/notebooks/WFC3/mast_api_psf/download_psf_cutouts.html).\n",
"***\n",
"\n",
"[Top of Page](#top)\n",
Expand All @@ -1552,7 +1558,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.7"
"version": "3.11.9"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 55e7c0a

Please sign in to comment.