Skip to content

Commit

Permalink
change np.NaN to np.nan in FIMS-SPEAR nb
Browse files Browse the repository at this point in the history
  • Loading branch information
ttdu authored Aug 13, 2024
2 parents 3d7e51c + daa21e0 commit 8d92b5b
Showing 1 changed file with 9 additions and 9 deletions.
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

0 comments on commit 8d92b5b

Please sign in to comment.