Skip to content

Commit

Permalink
usability updates
Browse files Browse the repository at this point in the history
  • Loading branch information
karllark committed Jan 26, 2022
1 parent 49ce307 commit 3e94cee
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion measure_extinction/plotting/plot_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ def plot_extinction(
fig, ax = plt.subplots(figsize=(10, 7))

# read in extinction curve data for this star
if "_ext.fits" not in starpair:
if ".fits" not in starpair:
fname = "%s%s_ext.fits" % (path, starpair.lower())
else:
fname = starpair
Expand Down
6 changes: 5 additions & 1 deletion measure_extinction/plotting/plot_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,11 @@ def plot_spectrum(
fig, ax = plt.subplots(figsize=(13, 10))

# read in and plot all bands and spectra for this star
starobs = StarData("%s.dat" % star, path=path, use_corfac=True, deredden=deredden)
if ".dat" not in star:
fname = f"{star}.dat"
else:
fname = star
starobs = StarData(fname, path=path, use_corfac=True, deredden=deredden)
if norm_range is not None:
norm_range = norm_range * u.micron
# rebin spectra if desired
Expand Down
4 changes: 4 additions & 0 deletions measure_extinction/stardata.py
Original file line number Diff line number Diff line change
Expand Up @@ -842,10 +842,14 @@ def rebin_constres(self, waverange, resolution):
# rebin using a weighted average
owaves = self.waves.to(u.micron).value
for k in range(n_waves):
# check for zero uncs includes to avoid divide by zero
# errors when the flux uncertainty of a real measurement
# is zero for any reason
(indxs,) = np.where(
(owaves >= full_wave_min[k])
& (owaves < full_wave_max[k])
& (self.npts > 0.0)
& (self.uncs > 0.0)
)
if len(indxs) > 0:
weights = 1.0 / np.square(self.uncs[indxs].value)
Expand Down

0 comments on commit 3e94cee

Please sign in to comment.