Skip to content

Commit

Permalink
Add option to show large T candidate stars in SizeMag plot
Browse files Browse the repository at this point in the history
  • Loading branch information
rmjarvis committed Sep 13, 2024
1 parent 18b4320 commit dbc5734
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,6 @@ Changes from version 1.4.0 to 1.4.1
- Fixed a bug where reflux errors could cause the fit not to converge even though the
offending stars had already been flagged and removed from consideration.
- Fixed an error in TwoDHist stats that T_model was incorrectly using the star data.
- Fixed an error that caused the candidate stars not to display correctly in SizeMag plot.
- Added an option to show large T candidate stars in SizeMag plot that would otherwise be
off the top of the plot.
7 changes: 6 additions & 1 deletion piff/size_mag.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,16 @@ class SizeMagStats(Stats):
:param file_name: Name of the file to output to. [default: None]
:param zeropoint: Zeropoint to use = the magnitude of flux=1. [default: 30]
:param show_large_cand: Whether to display candidate stars with large sizes that otherwise
would be off the top of the plot. [default: False]
:param logger: A logger object for logging debug info. [default: None]
"""
_type_name = 'SizeMag'

def __init__(self, file_name=None, zeropoint=30, logger=None):
def __init__(self, file_name=None, zeropoint=30, show_large_cand=False, logger=None):
self.file_name = file_name
self.zeropoint = zeropoint
self.show_large_cand = show_large_cand

def compute(self, psf, stars, logger=None):
"""
Expand Down Expand Up @@ -109,6 +112,8 @@ def plot(self, logger=None, **kwargs):
xmax = np.ceil(np.max(self.m_star))
xmax = np.max(self.m_obj, initial=xmax) # Likewise, m_obj might be empty.
ymax = max(np.median(self.T_star)*2, np.max(self.T_star)*1.01)
if self.show_large_cand:
ymax = np.max(self.T_cand*1.01, initial=ymax)
ax.set_xlim(xmin, xmax)
ax.set_ylim(0, ymax)
ax.set_xlabel('Magnitude (ZP=%s)'%self.zeropoint, fontsize=15)
Expand Down

0 comments on commit dbc5734

Please sign in to comment.