Skip to content

Commit

Permalink
Merge pull request #166 from FRBs/finder_dpi
Browse files Browse the repository at this point in the history
A few new Finder updates
  • Loading branch information
profxj authored Oct 10, 2023
2 parents ef68b9a + d64fa00 commit 6e6ab8d
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions frb/figures/finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ def from_hdu(hdu, title, **kwargs):
def generate(image, wcs, title, flip_ra=False, flip_dec=False,
log_stretch=False,
cutout=None,
primary_coord=None, secondary_coord=None,
primary_coord=None,
secondary_coord=None,
secondary_offset:bool=True,
third_coord=None, slit=None,
vmnx=None, extra_text=None, outfile=None, figsize=None):
"""
Expand All @@ -83,7 +85,12 @@ def generate(image, wcs, title, flip_ra=False, flip_dec=False,
If provided, place a mark in red at this coordinate
secondary_coord (astropy.coordinates.SkyCoord, optional):
If provided, place a mark in cyan at this coordinate
Assume it is an offset star (i.e. calculate offsets)
It is assumeed this is for an offset star (i.e. calculate offsets)
unless secondary_offset = False
secondary_offset (bool, optional):
If True, the secondary_coord provide is for an offset star
Otherwise, secondary_coord is considered the second
of a pair of scientific sources
third_coord (astropy.coordinates.SkyCoord, optional):
If provided, place a mark in yellow at this coordinate
slit (tuple, optional):
Expand Down Expand Up @@ -187,15 +194,24 @@ def generate(image, wcs, title, flip_ra=False, flip_dec=False,
# RA/DEC
dec_off = np.cos(PA) * sep # arcsec
ra_off = np.sin(PA) * sep # arcsec (East is *higher* RA)
ax.text(0.5, 1.22, 'Offset from Ref. Star (cyan) to Target (red):\nRA(to targ) = {:.2f} DEC(to targ) = {:.2f}'.format(
-1*ra_off.to('arcsec'), -1*dec_off.to('arcsec')),
if secondary_offset:
ax.text(0.5, 1.22, 'Offset from Ref. Star (cyan) to Target (red):\nRA(to targ) = {:.2f} DEC(to targ) = {:.2f}'.format(
-1*ra_off.to('arcsec'), -1*dec_off.to('arcsec')),
fontsize=15, horizontalalignment='center',transform=ax.transAxes, color='blue', va='top')
else:
ax.text(0.5, 1.22, 'Separation between Secondary target (cyan) to Primary Target (red):\n{:.2f} arcsec'.format(
sep.to('arcsec')),
fontsize=15, horizontalalignment='center',transform=ax.transAxes, color='blue', va='top')
# Add tertiary
if third_coord is not None:
c = SphericalCircle((third_coord.ra, third_coord.dec),
2*units.arcsec, transform=ax.get_transform('icrs'),
edgecolor='yellow', facecolor='none')
ax.add_patch(c)
sep = primary_coord.separation(third_coord).to('arcsec')
plt.text(0.5, -0.20, f'Third target (yellow) is {sep:.2f} from primary target (red)',
color='y',
fontsize=15, ha='center', va='top', transform=ax.transAxes)

# Slit
if ((slit is not None) and (flag_photu is True)):
Expand All @@ -216,7 +232,7 @@ def generate(image, wcs, title, flip_ra=False, flip_dec=False,

apermap.plot(color='purple', lw=1)

plt.text(0.5, -0.15, 'Slit PA={} deg'.format(pa_deg), color='purple',
plt.text(0.5, -0.15, 'Slit PA={:.2f} deg'.format(pa_deg), color='purple',
fontsize=15, ha='center', va='top', transform=ax.transAxes)

if ((slit is not None) and (flag_photu is False)):
Expand All @@ -235,7 +251,7 @@ def generate(image, wcs, title, flip_ra=False, flip_dec=False,
#ax.set_ylabel(r'\textbf{RA (SOUTH direction)}')

if outfile is not None:
plt.savefig(outfile, dpi=400)
plt.savefig(outfile, dpi=250)
plt.close()
else:
plt.show()
Expand Down

0 comments on commit 6e6ab8d

Please sign in to comment.