diff --git a/stellarphot/notebooks/photometry/04-transform-pared-back.ipynb b/stellarphot/notebooks/photometry/04-transform-pared-back.ipynb index f204cc7e..6b12ca50 100755 --- a/stellarphot/notebooks/photometry/04-transform-pared-back.ipynb +++ b/stellarphot/notebooks/photometry/04-transform-pared-back.ipynb @@ -18,7 +18,7 @@ "%matplotlib inline\n", "import matplotlib.pyplot as plt\n", "\n", - "from stellarphot.utils.magnitude_transforms import get_cat, f, opts_to_str, calc_residual, transform_to_catalog" + "from stellarphot.utils.magnitude_transforms import f, opts_to_str, calc_residual, transform_to_catalog" ] }, { @@ -72,7 +72,7 @@ "our_filters = ['SI']\n", "\n", "aavso_band_names = dict(\n", - " B='B', \n", + " B='B',\n", " V='V',\n", " gp='SG',\n", " rp='SR',\n", @@ -90,7 +90,7 @@ ")\n", "\n", "cat_filter = dict(\n", - " B='Bmag', \n", + " B='Bmag',\n", " V='Vmag',\n", " gp='g_mag',\n", " rp='r_mag',\n", @@ -154,16 +154,16 @@ }, "outputs": [], "source": [ - "output_table = [] \n", + "output_table = []\n", "\n", "for k, group in zip(our_filters, filter_groups.groups):\n", " print(f'Transforming band {k}')\n", " by_bjd = group.group_by('bjd')\n", - " \n", - " transform_to_catalog(by_bjd, f'mag_inst', aavso_band_names[k], \n", - " obs_error_column='mag_error', \n", + "\n", + " transform_to_catalog(by_bjd, f'mag_inst', aavso_band_names[k],\n", + " obs_error_column='mag_error',\n", " zero_point_range=[12, 25],\n", - " c_delta=0.5, # b_delta=0.1, \n", + " c_delta=0.5, # b_delta=0.1,\n", " cat_filter=cat_filter[k], cat_color=cat_color_colums[k],\n", " in_place=True);\n", " output_table.append(by_bjd.copy())\n", diff --git a/stellarphot/utils/magnitude_transforms.py b/stellarphot/utils/magnitude_transforms.py index 7a78720e..23134cb8 100644 --- a/stellarphot/utils/magnitude_transforms.py +++ b/stellarphot/utils/magnitude_transforms.py @@ -9,12 +9,11 @@ from astropy.coordinates import SkyCoord, match_coordinates_sky from astropy import units as u -from astroquery.vizier import Vizier +from ..core import apass_dr9 __all__ = [ "f", - "get_cat", "opts_to_str", "calc_residual", "filter_transform", @@ -48,37 +47,6 @@ def f(X, a, b, c, d, z): return a * mag_inst + b * mag_inst**2 + c * color + d * color**2 + z -def get_cat(image): - """ - Get the APASS catalog entries within 1 degree of first object in - Astropy table 'image'. - - Parameters - ---------- - - image : `astropy.table.Table` - Table containing the image information. Must have columns - ``RA`` and ``Dec``. - - Returns - ------- - - `astropy.table.Table` - Table containing the APASS catalog entries within 1 degree of - first object in Astropy table. - """ - our_coords = SkyCoord(image["RA"], image["Dec"], unit="degree") - # Get catalog via cone search - Vizier.ROW_LIMIT = -1 # Set row_limit to have no limit - desired_catalog = "II/336/apass9" - a_star = our_coords[0] - rad = 1 * u.degree - cat = Vizier.query_region(a_star, radius=rad, catalog=desired_catalog) - cat = cat[0] - cat_coords = SkyCoord(cat["RAJ2000"], cat["DEJ2000"]) - return cat, cat_coords - - def opts_to_str(opts): """ Convert the options from a fit to a string. @@ -632,7 +600,10 @@ def transform_to_catalog( ): our_coords = SkyCoord(one_image["RA"], one_image["Dec"], unit="degree") if cat is None or cat_coords is None: - cat, cat_coords = get_cat(one_image) + cat = apass_dr9( + our_coords[0], radius=1 * u.degree, clip_by_frame=False, padding=0 + ) + cat_coords = SkyCoord(cat["ra"], cat["dec"]) cat["color"] = cat[cat_color[0]] - cat[cat_color[1]] cat_idx, d2d, _ = our_coords.match_to_catalog_sky(cat_coords)