Skip to content

Commit

Permalink
Remove find_apass_stars and replace uses of it
Browse files Browse the repository at this point in the history
  • Loading branch information
mwcraig committed Dec 3, 2023
1 parent d1a2cbd commit f020f16
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 349 deletions.
335 changes: 49 additions & 286 deletions stellarphot/notebooks/photometry/get_apass_comp_mags.ipynb

Large diffs are not rendered by default.

56 changes: 0 additions & 56 deletions stellarphot/utils/catalog_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
__all__ = [
'in_frame',
'catalog_search',
'find_apass_stars',
'find_known_variables',
]

Expand Down Expand Up @@ -122,61 +121,6 @@ def catalog_search(frame_wcs_or_center, shape, desired_catalog,
return cat[in_fov]


def find_apass_stars(image_or_center,
radius=1,
max_mag_error=0.05,
max_color_error=0.1):
"""
Get APASS data from Vizer.
Parameters
----------
image_or_center : `astropy.nddata.CCDData` or `astropy.coordinates.SkyCoord`
Either an image with a WCS (from which the RA/Dec will be extracted) or coordinate of
the center.
radius : float, optional
Radius, in degrees, around which to search. Not needed if the first argument is an image.
max_mag_error : float, optional
Maximum error in magnitude to allow. Default is 0.05.
max_color_error : float, optional
Maximum error in color to allow. Default is 0.1.
Returns
-------
all_apass : `astropy.table.Table`
Table of all APASS stars in the field of view.
apass_lower_error : `astropy.table.Table`
Table of APASS stars in the field of view with errors lower than the specified values.
"""
if isinstance(image_or_center, SkyCoord):
# Center was passed in, just use it.
cen_wcs = image_or_center
shape = None
else:
cen_wcs = image_or_center.wcs
shape = image_or_center.shape
# use the catalog_search function to find the APASS stars in the frame of the image read above
all_apass = catalog_search(cen_wcs, shape, 'II/336/apass9',
ra_column='RAJ2000', dec_column='DEJ2000', radius=radius,
clip_by_frame=False)

# Creates a boolean array of the APASS stars that have well defined
# magnitudes and color.
apass_lower_error = (all_apass['e_r_mag'] < max_mag_error) & (
all_apass['e_B-V'] < max_color_error)

# create new table of APASS stars that meet error restrictions
apass_lower_error = all_apass[apass_lower_error]

return all_apass, apass_lower_error


def find_known_variables(image):
"""
Get any known variable stars in image field from the VSX catalog.
Expand Down
11 changes: 6 additions & 5 deletions stellarphot/utils/comparison_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
from astropy.nddata import CCDData
from astropy import units as u

from stellarphot.utils.catalog_search import find_apass_stars, find_known_variables
from stellarphot.utils.catalog_search import find_known_variables
from stellarphot.photometry import *
from stellarphot import apass_dr9


__all__ = ['read_file', 'set_up', 'crossmatch_APASS2VSX', 'mag_scale',
Expand Down Expand Up @@ -113,9 +114,9 @@ def crossmatch_APASS2VSX(CCD, RD, vsx):
RD_angle : `astropy.units.Quantity`
Angular separation between APASS stars and input targets.
"""
apass, apass_in_bright = find_apass_stars(CCD)
ra = apass['RAJ2000']
dec = apass['DEJ2000']
apass = apass_dr9(CCD)
ra = apass['ra']
dec = apass['dec']
apass['coords'] = SkyCoord(ra=ra, dec=dec, unit=(u.hour, u.degree))
apass_coord = apass['coords']

Expand Down Expand Up @@ -223,4 +224,4 @@ def in_field(apass_good_coord, ccd, apass, good_stars):
apass_good_coord[xy_in]
nt = apass[good_stars]
ent = nt[xy_in]
return ent
return ent
3 changes: 1 addition & 2 deletions stellarphot/utils/tests/test_catalog_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
from astropy.nddata import CCDData

from ..catalog_search import in_frame, \
catalog_search, find_known_variables, \
find_apass_stars
catalog_search, find_known_variables
from ...tests.make_wcs import make_wcs

CCD_SHAPE = [2048, 3073]
Expand Down

0 comments on commit f020f16

Please sign in to comment.