Skip to content

Commit

Permalink
disallow pixels with zero flux error
Browse files Browse the repository at this point in the history
  • Loading branch information
andycasey committed Sep 30, 2022
1 parent a2d487c commit bb864f2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
7 changes: 7 additions & 0 deletions python/astra/sdss/datamodels/apogee.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,13 @@ def create_apogee_hdus(

wavelength = util.log_lambda_dispersion(crval, cdelt, num_pixels)

# Disallow zero fluxes.
bad_flux, bad_combined_flux = ((flux_error == 0), (combined_flux_error == 0))
flux[bad_flux] = np.nan
flux_error[bad_flux] = np.inf
combined_flux[bad_combined_flux] = np.nan
combined_flux_error[bad_combined_flux] = np.inf

DATA_HEADER_CARD = ("SPECTRAL DATA", None)

visit_mappings = [
Expand Down
7 changes: 7 additions & 0 deletions python/astra/sdss/datamodels/boss.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,13 @@ def create_boss_hdus(
meta.update(meta_combine)
wavelength = util.log_lambda_dispersion(crval, cdelt, num_pixels)

# Disallow zero fluxes.
bad_flux, bad_combined_flux = ((flux_error == 0), (combined_flux_error == 0))
flux[bad_flux] = np.nan
flux_error[bad_flux] = np.inf
combined_flux[bad_combined_flux] = np.nan
combined_flux_error[bad_combined_flux] = np.inf

DATA_HEADER_CARD = ("SPECTRAL DATA", None)

nanify = lambda x: np.nan if x == "NaN" else x
Expand Down
2 changes: 0 additions & 2 deletions python/astra/sdss/datamodels/combine.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,6 @@ def resample_visit_spectra(
np.uint64
)



return (
resampled_flux,
resampled_flux_error,
Expand Down

0 comments on commit bb864f2

Please sign in to comment.