Skip to content

Commit

Permalink
pytest: all tests now pass
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Jensen committed Sep 19, 2024
1 parent dcc1ae6 commit c75dfe7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
9 changes: 6 additions & 3 deletions flows/photometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,15 @@ def make_epsf(self, stars):
logger.info("Building ePSF...")

# from photutils docs: recentering_boxsize must have odd values and be greater than or equal to 3
discrete_width = int(np.round(2 * self.fwhm))
rcb = discrete_width if discrete_width % 2 else discrete_width + 1
rcb = int(np.round(2 * self.fwhm))
rcb = rcb if rcb % 2 else rcb + 1
# from photutils docs: fit_boxsize must have odd values
fb = int(np.round(1.5 * self.fwhm))
fb = fb if fb % 2 else fb + 1

builder = self.epsf_builder(
oversampling=1, shape=1 * self.star_size,
fitter=EPSFFitter(fit_boxsize=max(int(np.round(1.5 * self.fwhm)), 5)),
fitter=EPSFFitter(fit_boxsize=max(fb, 5)),
recentering_boxsize=max(rcb, 5),
norm_radius=max(self.fwhm, 5), maxiters=100,
progress_bar=multiprocessing.parent_process() is None and logger.getEffectiveLevel() <= 20
Expand Down
10 changes: 6 additions & 4 deletions flows/visibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
import astropy.units as u
import matplotlib.pyplot as plt
import numpy as np
from astropy.coordinates import AltAz, SkyCoord, get_moon, get_sun
from astropy.coordinates import AltAz, SkyCoord, get_body, get_sun
from astropy.time import Time
from astropy.visualization import quantity_support
from matplotlib import pyplot
from matplotlib.dates import DateFormatter
from tendrils import api

Expand Down Expand Up @@ -95,7 +96,7 @@ def visibility(target: Target, siteid: Optional[int] = None, date=None, output=N

# The Sun and Moon:
altaz_sun = get_sun(times).transform_to(AltAzFrame)
altaz_moon = get_moon(times).transform_to(AltAzFrame)
altaz_moon = get_body("moon", times).transform_to(AltAzFrame)

sundown_astro = (altaz_sun.alt < -6 * u.deg)
if np.any(sundown_astro):
Expand All @@ -110,7 +111,7 @@ def visibility(target: Target, siteid: Optional[int] = None, date=None, output=N
plt.grid(ls=':', lw=0.5)
ax.plot(times.datetime, altaz_sun.alt, color='y', label='Sun')
ax.plot(times.datetime, altaz_moon.alt, color=[0.75] * 3, ls='--', label='Moon')
objsc = ax.scatter(times.datetime, altaz_obj.alt, c=altaz_obj.az, label=target.name, lw=0, s=8,
objsc = ax.scatter(times.datetime, altaz_obj.alt.deg, c=altaz_obj.az.deg, label=target.name, lw=0, s=8,
cmap='twilight')
ax.fill_between(times.datetime, 0 * u.deg, 90 * u.deg, altaz_sun.alt < -0 * u.deg, color='0.5',
zorder=0) # , label='Night'
Expand Down Expand Up @@ -139,5 +140,6 @@ def visibility(target: Target, siteid: Optional[int] = None, date=None, output=N
if output:
return plotpaths

plt.show()
if pyplot.isinteractive():
plt.show()
return ax

0 comments on commit c75dfe7

Please sign in to comment.