Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change np.NaN to np.nan in FIMS-SPEAR notebook. (second try) #86

Merged
merged 2 commits into from
Aug 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@
"\n",
"# Load the data with astropy.\n",
"l_n064 = Table.read('mccm_fims-spear_fims-ap100-n064_sky-starless_long_v1.0_hp-map-hsi.fits.gz', \n",
" hdu=1).filled(np.NaN) # The \".filled(np.NaN)\" is important; see \"a note about NaNs\" below.\n",
" hdu=1).filled(np.nan) # The \".filled(np.nan)\" is important; see \"a note about NaNs\" below.\n",
"\n",
"# Integrate over wavelength and plot the data.\n",
"hp.mollview(np.sum(l_n064['INTEN_BSUB'], axis=1), coord='G', max=5e6, unit='photon cm-2 s-1 sr-1', title='') # Galactic coordinates"
Expand Down Expand Up @@ -367,21 +367,21 @@
"hdul.close()\n",
"\n",
"l_n064 = Table.read('mccm_fims-spear_fims-ap100-n064_sky-starless_long_v1.0_hp-map-hsi.fits.gz', \n",
" hdu=1).filled(np.NaN)\n",
" hdu=1).filled(np.nan)\n",
"\n",
"s_n064 = Table.read('mccm_fims-spear_fims-ap100-n064_sky-starless_short_v1.0_hp-map-hsi.fits.gz', \n",
" hdu=1).filled(np.NaN)\n",
" hdu=1).filled(np.nan)\n",
"\n",
"l_highres = Table.read(file_highres, \n",
" hdu=1).filled(np.NaN) # this one may take a minute"
"l_highres = Table.read(file_highres,\n",
" hdu=1).filled(np.nan) # this one may take a minute"
]
},
{
"cell_type": "markdown",
"id": "c6020dd5",
"metadata": {},
"source": [
"(A note about NaNs: You might be wondering why we needed `.filled(np.NaN)`. There are regions of the sky without coverage by FIMS-SPEAR, which are represented as NaN values in the FITS binary table. By default, `astropy.Table` masks these pixels with the `numpy` fill value for masking floats, 1e20. But the `healpy` fill value for masking bad data is -1.6375e+30. Plus, we're sometimes going to need to sum arrays over the wavelength axis, and we don't want to sum up either of these fill values. So, here we're bypassing the problem entirely by using NaNs instead of masking fill values.)"
"(A note about NaNs: You might be wondering why we needed `.filled(np.nan)`. There are regions of the sky without coverage by FIMS-SPEAR, which are represented as NaN values in the FITS binary table. By default, `astropy.Table` masks these pixels with the `numpy` fill value for masking floats, 1e20. But the `healpy` fill value for masking bad data is -1.6375e+30. Plus, we're sometimes going to need to sum arrays over the wavelength axis, and we don't want to sum up either of these fill values. So, here we're bypassing the problem entirely by using NaNs instead of masking fill values.)"
]
},
{
Expand Down Expand Up @@ -766,9 +766,9 @@
"source": [
"# Load the data\n",
"l_n064_spear = Table.read('mccm_fims-spear_spear-ap100-n064_sky-starless_long_v1.0_hp-map-hsi.fits.gz', \n",
" hdu=1).filled(np.NaN)\n",
" hdu=1).filled(np.nan)\n",
"s_n064_spear = Table.read('mccm_fims-spear_spear-ap100-n064_sky-starless_short_v1.0_hp-map-hsi.fits.gz', \n",
" hdu=1).filled(np.NaN)"
" hdu=1).filled(np.nan)"
]
},
{
Expand Down Expand Up @@ -1554,7 +1554,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.16"
"version": "3.12.4"
}
},
"nbformat": 4,
Expand Down
Loading