diff --git a/README.rst b/README.rst index b3f959d..7438906 100644 --- a/README.rst +++ b/README.rst @@ -22,7 +22,7 @@ .. image:: https://img.shields.io/github/license/tomasstolker/calistar :target: https://github.com/tomasstolker/calistar/blob/main/LICENSE -*calistar* is a tool for finding a suitable calibration star for reference star differential imaging or interferometric observations. The package has been released on `PyPI `_ and is actively developed and maintained on Github. +*calistar* is a tool to search for a single calibration star. For example to be used for reference-star differential imaging or aperture masking interferometry. The package has been released on `PyPI `_ and is actively developed and maintained on Github. Documentation ------------- diff --git a/calistar/calistar.py b/calistar/calistar.py index 12cd49a..a4ba7b0 100644 --- a/calistar/calistar.py +++ b/calistar/calistar.py @@ -7,13 +7,17 @@ import urllib.request import warnings +from copy import copy +from pathlib import Path from typing import Dict, List, Optional, Tuple, Union import astropy.units as u import numpy as np import pandas as pd +import pooch from astropy.coordinates import SkyCoord +from astropy.table import Table from astroquery.gaia import Gaia from astroquery.simbad import Simbad from astroquery.vizier import Vizier @@ -24,28 +28,38 @@ import calistar -Gaia.MAIN_GAIA_TABLE = "gaiaedr3.gaia_source" +# No limit on the number of rows with a Gaia query Gaia.ROW_LIMIT = -1 + +# Only return the nearest source with a Vizier query Vizier.ROW_LIMIT = 1 class CaliStar: """ Class for finding calibration stars based on their separation - and magnitude difference with the requested ``gaia_source``. + and magnitude difference with the selected ``gaia_source``. """ @typechecked def __init__( self, gaia_source: Union[int, str], + gaia_release: Optional[str] = None, ) -> None: """ Parameters ---------- gaia_source : int, str - The GAIA DR3 source ID of the object for which - calibration source should be searched for. + The GAIA source ID of the object for which calibration + sources should be searched for. For example, set the + argument to ``6843672087120107264`` or + ``"6843672087120107264"`` for the star HD 206893 when + the DR2 or DR3 catalog as argument of ``gaia_release``. + gaia_release : str, None + Data release of the Gaia catalog that will be used for the + queries (``"DR2"``, ``"EDR3"``, or ``"DR3"``). The default + release is DR3 when the argument is set to ``None``. Returns ------- @@ -62,14 +76,50 @@ def __init__( # Set attributes of CaliStar - self.gaia_source = gaia_source # Gaia DR3 source ID + self.gaia_source = gaia_source # Gaia source ID if isinstance(gaia_source, str): self.gaia_source = int(self.gaia_source) - self.gaia_filters = ["GAIA G", "GAIA BP", "GAIA RP"] - self.twomass_filters = ["2MASS J", "2MASS H", "2MASS Ks"] - self.wise_filters = ["WISE W1", "WISE W2", "WISE W3", "WISE W4"] + # Gaia data release version + + self.gaia_release = gaia_release + + if self.gaia_release is None: + self.gaia_release = "DR3" + + if self.gaia_release not in ["DR2", "EDR3", "DR3"]: + raise ValueError( + "The argument of 'gaia_release' should " + "be set to 'DR2', 'EDR3', or 'DR3'." + ) + + # Set the Gaia source catalog + + if self.gaia_release == "DR2": + Gaia.MAIN_GAIA_TABLE = "gaiadr2.gaia_source" + self.gaia_idx = 2 + + elif self.gaia_release == "EDR3": + Gaia.MAIN_GAIA_TABLE = "gaiaedr3.gaia_source" + self.gaia_idx = 3 + + elif self.gaia_release == "DR3": + Gaia.MAIN_GAIA_TABLE = "gaiadr3.gaia_source" + self.gaia_idx = 3 + + # Filter IDs from the SVO Filter Profile Service + + self.all_filters = [ + f"GAIA/GAIA{self.gaia_idx}.G", + "2MASS/2MASS.J", + "2MASS/2MASS.H", + "2MASS/2MASS.Ks", + "WISE/WISE.W1", + "WISE/WISE.W2", + "WISE/WISE.W3", + "WISE/WISE.W4", + ] # Check if there is a new version available @@ -90,48 +140,154 @@ def __init__( print("Please have a look at the Github page:") print("https://github.com/tomasstolker/calistar") + # Create .calistar folder in the home directory + + self.calistar_folder = Path.home() / ".calistar" + + if not self.calistar_folder.exists(): + print(f"\nCreating .calistar folder in {Path.home()}...") + self.calistar_folder.mkdir(parents=False, exist_ok=False) + + # Download The Washington Visual Double Star Catalog + # https://cdsarc.cds.unistra.fr/viz-bin/cat/B/wds + + self.wds_file = Path.home() / ".calistar/wds_catalog.hdf5" + + url = "https://home.strw.leidenuniv.nl/~stolker/calistar/wds_catalog.hdf5" + + if not self.wds_file.exists(): + pooch.retrieve( + url=url, + known_hash="b0a63ed95bf060cccc3ce66afb36ed669d287ad85211cee9cde3bd57d48c622b", + fname="wds_catalog.hdf5", + path=self.calistar_folder, + progressbar=True, + ) + @typechecked def target_star( self, ) -> Dict[str, Union[str, float]]: """ - Function for finding calibration stars. - - Parameters - ---------- + Function for retrieving the the astrometric and + photometric properties of a target star of interest. The + function returns a dictionary with the properties, but it + also stores the data in a JSON file in the working folder. Returns ------- dict - Dictionary with the target properties. + Dictionary with the properties of the target star. """ target_dict = {} + # List all Gaia tables # for table_item in Gaia.load_tables(only_names=True): # print (table_item.get_qualified_name()) - # Gaia query for selected Gaia DR3 source + # Gaia query for selected Gaia source ID gaia_query = f""" SELECT * - FROM gaiadr3.gaia_source + FROM gaia{self.gaia_release.lower()}.gaia_source WHERE source_id = {self.gaia_source} """ # Launch the Gaia job and get the results - print("\n-> Querying GAIA DR3...\n") + print(f"\n-> Querying GAIA {self.gaia_release}...\n") gaia_job = Gaia.launch_job_async(gaia_query, dump_to_file=False, verbose=False) gaia_result = gaia_job.get_results() + # print(gaia_result.columns) + + if self.gaia_release == "DR2": + # Gaia DR2 VEGAMAG zero points + # https://www.cosmos.esa.int/web/gaia/iow_20180316 + + gaia_g_zp = (25.6914396869, 0.0011309370) + gaia_bp_zp = (25.3488107670, 0.0004899854) + gaia_rp_zp = (24.7626744847, 0.0035071711) + + elif self.gaia_release in ["EDR3", "DR3"]: + # Gaia (E)DR3 VEGAMAG zero points + # https://www.cosmos.esa.int/web/gaia/edr3-passbands + + gaia_g_zp = (25.6873668671, 0.0027553202) + gaia_bp_zp = (25.3385422158, 0.0027901700) + gaia_rp_zp = (24.7478955012, 0.0037793818) + + # Magnitude error, assuming Delta_f << f + # Delta_m = -2.5/ln(10) Delta_f/f + # Add in quadrature the uncertainty on the zero point + + mag_g_error = ( + -2.5 / np.log(10.0) / gaia_result["phot_g_mean_flux_over_error"][0] + ) + + mag_g_error = np.sqrt(mag_g_error**2 + gaia_g_zp[1] ** 2) + + mag_bp_error = ( + -2.5 / np.log(10.0) / gaia_result["phot_bp_mean_flux_over_error"][0] + ) + + mag_bp_error = np.sqrt(mag_bp_error**2 + gaia_bp_zp[1] ** 2) + + mag_rp_error = ( + -2.5 / np.log(10.0) / gaia_result["phot_rp_mean_flux_over_error"][0] + ) + + mag_rp_error = np.sqrt(mag_rp_error**2 + gaia_rp_zp[1] ** 2) + target_dict["Gaia ID"] = int(gaia_result["source_id"][0]) - target_dict["Gaia RA"] = float(gaia_result["ra"][0]) - target_dict["Gaia Dec"] = float(gaia_result["dec"][0]) - target_dict["Gaia G mag"] = float(gaia_result["phot_g_mean_mag"][0]) - # Create SkyCoord object from the RA and Dec of the selected Gaia DR3 source + target_dict["Gaia release"] = self.gaia_release + + target_dict["Gaia epoch"] = gaia_result["ref_epoch"][0] + + target_dict["Gaia RA"] = ( + float(gaia_result["ra"][0]), # (deg) + float(gaia_result["dec_error"][0] / 3600.0), # (deg) + ) + + target_dict["Gaia Dec"] = ( + float(gaia_result["dec"][0]), # (deg) + float(gaia_result["dec_error"][0] / 3600.0), # (deg) + ) + + target_dict["Gaia pm RA"] = ( + float(gaia_result["pmra"][0]), # (mas yr-1) + float(gaia_result["pmra_error"][0]), # (mas yr-1) + ) + + target_dict["Gaia pm Dec"] = ( + float(gaia_result["pmdec"][0]), # (mas yr-1) + float(gaia_result["pmdec_error"][0]), # (mas yr-1) + ) + + target_dict["Gaia parallax"] = ( + float(gaia_result["parallax"][0]), # (mas) + float(gaia_result["parallax_error"][0]), # (mas) + ) + + target_dict[f"GAIA/GAIA{self.gaia_idx}.G"] = ( + float(gaia_result["phot_g_mean_mag"][0]), + mag_g_error, + ) + + target_dict[f"GAIA/GAIA{self.gaia_idx}.Gbp"] = ( + float(gaia_result["phot_bp_mean_mag"][0]), + mag_bp_error, + ) + + target_dict[f"GAIA/GAIA{self.gaia_idx}.Grp"] = ( + float(gaia_result["phot_rp_mean_mag"][0]), + mag_rp_error, + ) + + # Create SkyCoord object from the RA and Dec of the selected Gaia source ID gaia_coord = SkyCoord( gaia_result["ra"][0], @@ -151,7 +307,7 @@ def target_star( f"({gaia_result['source_id'][0]})." ) - print(f"\nGAIA DR3 source ID = {gaia_result['source_id'][0]}") + print(f"\nGAIA {self.gaia_release} source ID = {gaia_result['source_id'][0]}") print(f"Reference epoch = {gaia_result['ref_epoch'][0]}") print( @@ -167,48 +323,62 @@ def target_star( f"\nProper motion RA = {gaia_result['pmra'][0]:.2f} " f"+/- {gaia_result['pmra_error'][0]:.2f} mas/yr" ) + print( f"Proper motion Dec = {gaia_result['pmdec'][0]:.2f} " f"+/- {gaia_result['pmdec_error'][0]:.2f} mas/yr" ) - print( - f"Radial velocity = {gaia_result['radial_velocity'][0]:.2f} " - f"+/- {gaia_result['radial_velocity_error'][0]:.2f} km/s" - ) + + if "radial_velocity" in gaia_result.columns and not np.ma.is_masked( + gaia_result["radial_velocity"] + ): + print( + f"Radial velocity = {gaia_result['radial_velocity'][0]:.2f} " + f"+/- {gaia_result['radial_velocity_error'][0]:.2f} km/s" + ) print(f"\nG mean mag = {gaia_result['phot_g_mean_mag'][0]:.6f}") print(f"BP mean mag = {gaia_result['phot_bp_mean_mag'][0]:.6f}") print(f"RP mean mag = {gaia_result['phot_rp_mean_mag'][0]:.6f}") - if not np.ma.is_masked(gaia_result["teff_gspphot"]): + if "teff_gspphot" in gaia_result.columns and not np.ma.is_masked( + gaia_result["teff_gspphot"] + ): print(f"\nEffective temperature = {gaia_result['teff_gspphot'][0]:.0f} K") print(f"Surface gravity = {gaia_result['logg_gspphot'][0]:.2f}") print(f"Metallicity = {gaia_result['mh_gspphot'][0]:.2f}") print(f"G-band extinction = {gaia_result['ag_gspphot'][0]:.2f}") - if gaia_result["non_single_star"][0] == 0: - print("\nNon single star = False") + if "non_single_star" in gaia_result.columns: + if gaia_result["non_single_star"][0] == 0: + print("\nNon single star = False") - elif gaia_result["non_single_star"][0] == 1: - print("\nNon single star = True") + elif gaia_result["non_single_star"][0] == 1: + print("\nNon single star = True") - else: - warnings.warn( - f"The 'non_single_star' value is {gaia_result['non_single_star'][0]}" + else: + warnings.warn( + f"The 'non_single_star' value is {gaia_result['non_single_star'][0]}" + ) + + if "classprob_dsc_combmod_star" in gaia_result.columns: + print( + "Single star probability from DSC-Combmod = " + f"{gaia_result['classprob_dsc_combmod_star'][0]:.2f}" ) - print( - "Single star probability from DSC-Combmod = " - f"{gaia_result['classprob_dsc_combmod_star'][0]:.2f}" - ) - print( f"Astrometric excess noise = {gaia_result['astrometric_excess_noise'][0]:.2f}" ) - print(f"\nXP continuous = {gaia_result['has_xp_continuous'][0]}") - print(f"XP sampled = {gaia_result['has_xp_sampled'][0]}") - print(f"RVS spectrum = {gaia_result['has_rvs'][0]}") + if "has_xp_continuous" in gaia_result.columns: + print(f"\nXP continuous = {gaia_result['has_xp_continuous'][0]}") + + if "has_xp_sampled" in gaia_result.columns: + print(f"XP sampled = {gaia_result['has_xp_sampled'][0]}") + + if "has_rvs" in gaia_result.columns: + print(f"RVS spectrum = {gaia_result['has_rvs'][0]}") # Add spectral type and 2MASS JHKs magnitudes to the Simbad output @@ -224,10 +394,12 @@ def target_star( "flux_error(K)", ) - # Simbad query for selected Gaia DR3 source + # Simbad query for selected Gaia source ID print("\n-> Querying Simbad...\n") - simbad_result = Simbad.query_object(f"GAIA DR3 {self.gaia_source}") + simbad_result = Simbad.query_object( + f"GAIA {self.gaia_release} {self.gaia_source}" + ) simbad_result = simbad_result[0] # print(simbad_result.columns) @@ -252,12 +424,25 @@ def target_star( ) target_dict["Simbad ID"] = simbad_result["MAIN_ID"] + target_dict["SpT"] = simbad_result["SP_TYPE"] - target_dict["2MASS J"] = float(simbad_result["FLUX_J"]) - target_dict["2MASS H"] = float(simbad_result["FLUX_H"]) - target_dict["2MASS Ks"] = float(simbad_result["FLUX_K"]) - # VizieR query for selected Gaia DR3 source + target_dict["2MASS/2MASS.J"] = ( + float(simbad_result["FLUX_J"]), + float(simbad_result["FLUX_ERROR_J"]), + ) + + target_dict["2MASS/2MASS.H"] = ( + float(simbad_result["FLUX_H"]), + float(simbad_result["FLUX_ERROR_H"]), + ) + + target_dict["2MASS/2MASS.Ks"] = ( + float(simbad_result["FLUX_K"]), + float(simbad_result["FLUX_ERROR_K"]), + ) + + # VizieR query for the selected Gaia source ID # Sort the result by distance from the queried object print("\n-> Querying VizieR...\n") @@ -267,7 +452,7 @@ def target_star( radius = u.Quantity(1.0 * u.arcmin) vizier_result = vizier_obj.query_object( - f"GAIA DR3 {self.gaia_source}", radius=radius + f"GAIA {self.gaia_release} {self.gaia_source}", radius=radius ) vizier_result = vizier_result["II/328/allwise"] @@ -301,12 +486,24 @@ def target_star( f"+/- {vizier_result['e_W4mag']:.3f}" ) - target_dict["WISE W1"] = float(vizier_result["W1mag"]) - target_dict["WISE W2"] = float(vizier_result["W2mag"]) - target_dict["WISE W3"] = float(vizier_result["W3mag"]) - target_dict["WISE W4"] = float(vizier_result["W4mag"]) + target_dict["WISE/WISE.W1"] = ( + float(vizier_result["W1mag"]), + float(vizier_result["e_W4mag"]), + ) + target_dict["WISE/WISE.W2"] = ( + float(vizier_result["W2mag"]), + float(vizier_result["e_W4mag"]), + ) + target_dict["WISE/WISE.W3"] = ( + float(vizier_result["W3mag"]), + float(vizier_result["e_W4mag"]), + ) + target_dict["WISE/WISE.W4"] = ( + float(vizier_result["W4mag"]), + float(vizier_result["e_W4mag"]), + ) - json_file = f"target_{self.gaia_source}.json" + json_file = f"target_{self.gaia_release.lower()}_{self.gaia_source}.json" with open(json_file, "w", encoding="utf-8") as open_file: json.dump(target_dict, open_file, indent=4) @@ -317,41 +514,54 @@ def target_star( def find_calib( self, search_radius: float = 0.1, - mag_range: Optional[Tuple[float, float]] = None, + g_mag_range: Optional[Tuple[float, float]] = None, ) -> pd.DataFrame: """ - Function for finding calibration stars. + Function for finding calibration stars. The function returns a + ``DataFrame`` with the sources that are queried from the Gaia + catalog, but it also stores the data in a CSV file in the + working folder. The table also contains 2MASS and WISE + magnitudes, and data from The Washington Visual Double Star + Catalog. It is recommended to open the CSV file in a + spreadsheet editor for easy visualization. Parameters ---------- search_radius : float - Radius (in degrees) of the cone that is used to - query the GAIA DR3 catalog to search for - calibration source in the vicinity of the - selected ``gaia_source`` (default: 0.1). - mag_range : tuple(float, float), None - Magnitude range in the Gaia G band that is used - for querying sources in the Gaia DR3 catalog. - A range of +/- 1 mag relative to the G-band - magnitude of the ``gaia_source`` is used if - the argument of ``mag_range`` is set to ``None``. + Radius (in degrees) of the cone that is used to query the + GAIA source catalog to search for calibration sources in + the vicinity of the selected ``gaia_source`` (default: + 0.1). The data release of the Gaia source catalog that is + used for the query can be set with the ``gaia_release`` + argument of the :class:`~calistar.calistar.CaliStar` + instance. + g_mag_range : tuple(float, float), None + Magnitude range relative to the the Gaia $G$ band of the + magnitude of the selected ``gaia_source``. The magnitude + range will be used for querying sources in the Gaia + catalog. The argument should be specified, for example, + as ``(-2.0, 5.0)`` if source are selected with a $G$ + magnitude that is at most 2 mag smaller and 5 mag larger + than the magnitude ``gaia_source``. A range of + :math:`\\pm` 1.0 mag (i.e. ``g_mag_range=(-1.0, 1.0)``) + is used if the argument of ``g_mag_range`` is set to + ``None``. Returns ------- pandas.DataFrame - The ``DataFrame`` with the list of queried sources. + A ``DataFrame`` with the table of queried sources. """ - json_file = f"target_{self.gaia_source}.json" + print("\n-> Finding calibration stars...\n") + + json_file = f"target_{self.gaia_release.lower()}_{self.gaia_source}.json" with open(json_file, "r", encoding="utf-8") as open_file: target_dict = json.load(open_file) - if mag_range is None: - mag_range = ( - target_dict["Gaia G mag"] - 1.0, - target_dict["Gaia G mag"] + 1.0, - ) + if g_mag_range is None: + g_mag_range = (-1.0, 1.0) # Add 2MASS JHKs magnitudes to the Simbad output @@ -359,6 +569,7 @@ def find_calib( Simbad.add_votable_fields( "sptype", + "ids", "flux(J)", "flux(H)", "flux(K)", @@ -367,54 +578,53 @@ def find_calib( "flux_error(K)", ) - print("\n-> Gaia cone search\n") - - # gaia_coord = SkyCoord( - # target_dict["Gaia RA"], - # target_dict["Gaia Dec"], - # frame="icrs", - # unit=(u.deg, u.deg), - # ) - - # radius = u.Quantity(search_radius * u.deg) - # gaia_job = Gaia.cone_search_async(gaia_coord, radius=radius) + print(f"Radius of search cone = {search_radius} deg") - print(f"\nRadius of search cone = {search_radius} deg") + mag_low = target_dict[f"GAIA/GAIA{self.gaia_idx}.G"][0] + g_mag_range[0] + mag_upp = target_dict[f"GAIA/GAIA{self.gaia_idx}.G"][0] + g_mag_range[1] gaia_query = f""" - SELECT *, DISTANCE({target_dict['Gaia RA']}, - {target_dict['Gaia Dec']}, ra, dec) AS ang_sep + SELECT *, DISTANCE({target_dict['Gaia RA'][0]}, + {target_dict['Gaia Dec'][0]}, ra, dec) AS ang_sep FROM gaiadr3.gaia_source - WHERE DISTANCE({target_dict['Gaia RA']}, - {target_dict['Gaia Dec']}, ra, dec) < {search_radius} - AND phot_g_mean_mag > {mag_range[0]} - AND phot_g_mean_mag < {mag_range[1]} + WHERE DISTANCE({target_dict['Gaia RA'][0]}, + {target_dict['Gaia Dec'][0]}, ra, dec) < {search_radius} + AND phot_g_mean_mag > {mag_low} + AND phot_g_mean_mag < {mag_upp} AND parallax IS NOT NULL ORDER BY ang_sep ASC """ # Launch the Gaia job and get the results - print("\n-> Querying GAIA DR3...\n") - gaia_job = Gaia.launch_job_async(gaia_query, dump_to_file=False, verbose=False) gaia_results = gaia_job.get_results() - print(f"Found {len(gaia_results)} object(s) with cone search") - - print("\n-> Finding calibration stars...\n") - - columns = ["Simbad ID", "Gaia ID", "SpT"] + print(f"Number of found sources: {len(gaia_results)}") - columns += self.gaia_filters - columns += self.twomass_filters - columns += self.wise_filters - - columns += [ + columns = [ + "Simbad ID", + "Gaia ID", + "SpT", + "Separation", "Non single star", "Single star probability", "Astrometric excess noise", ] + columns += self.all_filters + + columns += [ + "WDS ID", + "WDS epoch 1", + "WDS epoch 2", + "WDS sep 1", + "WDS sep 2", + "WDS PA 1", + "WDS PA 2", + "WDS mag 1", + "WDS mag 2", + ] + # Initiate all values in the dataframe to NaN cal_df = pd.DataFrame(index=range(len(gaia_results)), columns=columns) @@ -422,51 +632,75 @@ def find_calib( warnings.filterwarnings("ignore", category=UserWarning) - vizier_obj = Vizier(columns=["*", "+_r"], catalog="II/328/allwise") + vizier_obj = Vizier(columns=["*", "+_r"]) - for result_item in track(gaia_results, description="Processing..."): - cal_df.loc[result_item.index, "Gaia ID"] = result_item["source_id"] + for gaia_item in track(gaia_results, description="Processing..."): + cal_df.loc[gaia_item.index, "Gaia ID"] = gaia_item["source_id"] + + coord_target = SkyCoord( + target_dict["Gaia RA"][0], + target_dict["Gaia Dec"][0], + frame="icrs", + unit=(u.deg, u.deg), + ) + + coord_calib = SkyCoord( + gaia_item["ra"], + gaia_item["dec"], + frame="icrs", + unit=(u.deg, u.deg), + ) - cal_df.loc[result_item.index, "GAIA G"] = result_item["phot_g_mean_mag"] + separation = coord_target.separation(coord_calib) - cal_df.loc[result_item.index, "GAIA BP"] = result_item["phot_bp_mean_mag"] + cal_df.loc[gaia_item.index, "Separation"] = separation.deg - cal_df.loc[result_item.index, "GAIA RP"] = result_item["phot_rp_mean_mag"] + cal_df.loc[gaia_item.index, f"GAIA/GAIA{self.gaia_idx}.G"] = gaia_item[ + "phot_g_mean_mag" + ] - simbad_result = Simbad.query_object(f"GAIA DR3 {result_item['source_id']}") + simbad_result = Simbad.query_object( + f"GAIA {self.gaia_release} {gaia_item['source_id']}" + ) if simbad_result is not None: simbad_result = simbad_result[0] if np.ma.is_masked(simbad_result["MAIN_ID"]): - cal_df.loc[result_item.index, "Simbad ID"] = np.nan + cal_df.loc[gaia_item.index, "Simbad ID"] = np.nan else: - cal_df.loc[result_item.index, "Simbad ID"] = simbad_result["MAIN_ID"] + cal_df.loc[gaia_item.index, "Simbad ID"] = simbad_result["MAIN_ID"] if np.ma.is_masked(simbad_result["SP_TYPE"]): - cal_df.loc[result_item.index, "SpT"] = np.nan + cal_df.loc[gaia_item.index, "SpT"] = np.nan else: - cal_df.loc[result_item.index, "SpT"] = simbad_result["SP_TYPE"] + cal_df.loc[gaia_item.index, "SpT"] = simbad_result["SP_TYPE"] if np.ma.is_masked(simbad_result["FLUX_J"]): - cal_df.loc[result_item.index, "2MASS J"] = np.nan + cal_df.loc[gaia_item.index, "2MASS/2MASS.J"] = np.nan else: - cal_df.loc[result_item.index, "2MASS J"] = simbad_result["FLUX_J"] + cal_df.loc[gaia_item.index, "2MASS/2MASS.J"] = simbad_result[ + "FLUX_J" + ] if np.ma.is_masked(simbad_result["FLUX_H"]): - cal_df.loc[result_item.index, "2MASS H"] = np.nan + cal_df.loc[gaia_item.index, "2MASS/2MASS.H"] = np.nan else: - cal_df.loc[result_item.index, "2MASS H"] = simbad_result["FLUX_H"] + cal_df.loc[gaia_item.index, "2MASS/2MASS.H"] = simbad_result[ + "FLUX_H" + ] if np.ma.is_masked(simbad_result["FLUX_K"]): - cal_df.loc[result_item.index, "2MASS Ks"] = np.nan + cal_df.loc[gaia_item.index, "2MASS/2MASS.Ks"] = np.nan else: - cal_df.loc[result_item.index, "2MASS Ks"] = simbad_result["FLUX_K"] + cal_df.loc[gaia_item.index, "2MASS/2MASS.Ks"] = simbad_result[ + "FLUX_K" + ] radius = u.Quantity(1.0 * u.arcmin) vizier_result = vizier_obj.query_object( - f"GAIA DR3 {result_item['source_id']}", + f"GAIA {self.gaia_release} {gaia_item['source_id']}", radius=radius, catalog="II/328/allwise", ) @@ -474,53 +708,88 @@ def find_calib( if len(vizier_result) == 1: vizier_result = vizier_result["II/328/allwise"][0] - # Separation between Gaia and ALLWISE source is more than 100 mas - if vizier_result["_r"] > 0.1: - skip_source = True - else: - skip_source = False + # Check if the separation between the Gaia and + # the ALLWISE coordinates is at most 200 mas + skip_source = vizier_result["_r"] > 0.2 if skip_source or np.ma.is_masked(vizier_result["W1mag"]): - cal_df.loc[result_item.index, "WISE W1"] = np.nan + cal_df.loc[gaia_item.index, "WISE/WISE.W1"] = np.nan else: - cal_df.loc[result_item.index, "WISE W1"] = vizier_result["W1mag"] + cal_df.loc[gaia_item.index, "WISE/WISE.W1"] = vizier_result["W1mag"] if skip_source or np.ma.is_masked(vizier_result["W2mag"]): - cal_df.loc[result_item.index, "WISE W2"] = np.nan + cal_df.loc[gaia_item.index, "WISE/WISE.W2"] = np.nan else: - cal_df.loc[result_item.index, "WISE W2"] = vizier_result["W2mag"] + cal_df.loc[gaia_item.index, "WISE/WISE.W2"] = vizier_result["W2mag"] if skip_source or np.ma.is_masked(vizier_result["W3mag"]): - cal_df.loc[result_item.index, "WISE W3"] = np.nan + cal_df.loc[gaia_item.index, "WISE/WISE.W3"] = np.nan else: - cal_df.loc[result_item.index, "WISE W3"] = vizier_result["W3mag"] + cal_df.loc[gaia_item.index, "WISE/WISE.W3"] = vizier_result["W3mag"] if skip_source or np.ma.is_masked(vizier_result["W4mag"]): - cal_df.loc[result_item.index, "WISE W4"] = np.nan + cal_df.loc[gaia_item.index, "WISE/WISE.W4"] = np.nan else: - cal_df.loc[result_item.index, "WISE W4"] = vizier_result["W4mag"] + cal_df.loc[gaia_item.index, "WISE/WISE.W4"] = vizier_result["W4mag"] + + # This query returns no sources? + # gaia_query = f""" + # SELECT * + # FROM gaiadr3.allwise_best_neighbour + # WHERE source_id = {self.gaia_source} + # """ + # gaia_job = Gaia.launch_job_async(gaia_query, + # dump_to_file=False, verbose=False) + # gaia_result = gaia_job.get_results() else: - drop_indices.append(result_item.index) + drop_indices.append(gaia_item.index) - cal_df.loc[result_item.index, "Non single star"] = result_item[ + cal_df.loc[gaia_item.index, "Non single star"] = gaia_item[ "non_single_star" ] - cal_df.loc[result_item.index, "Single star probability"] = result_item[ + + cal_df.loc[gaia_item.index, "Single star probability"] = gaia_item[ "classprob_dsc_combmod_star" ] - cal_df.loc[result_item.index, "Astrometric excess noise"] = result_item[ + + cal_df.loc[gaia_item.index, "Astrometric excess noise"] = gaia_item[ "astrometric_excess_noise" ] + # Query The Washington Visual Double Star Catalog + + if simbad_result is not None: + simbad_ids = simbad_result["IDS"].split("|") + wds_id = list(filter(lambda x: x.startswith("WDS"), simbad_ids)) + + if len(wds_id) == 1: + wds_table = Table.read(self.wds_file, path="wds_catalog") + + id_crop = wds_id[0].split(" ")[-1][1:11] + id_idx = np.where(id_crop == wds_table["WDS"])[0] + + if len(id_idx) == 1: + wds_select = wds_table[id_idx] + + cal_df.loc[gaia_item.index, "WDS ID"] = wds_id[0] + cal_df.loc[gaia_item.index, "WDS epoch 1"] = wds_select["Obs1"] + cal_df.loc[gaia_item.index, "WDS epoch 2"] = wds_select["Obs2"] + cal_df.loc[gaia_item.index, "WDS sep 1"] = wds_select["sep1"] + cal_df.loc[gaia_item.index, "WDS sep 2"] = wds_select["sep2"] + cal_df.loc[gaia_item.index, "WDS PA 1"] = wds_select["pa1"] + cal_df.loc[gaia_item.index, "WDS PA 2"] = wds_select["pa2"] + cal_df.loc[gaia_item.index, "WDS mag 1"] = wds_select["mag1"] + cal_df.loc[gaia_item.index, "WDS mag 2"] = wds_select["mag2"] + warnings.filterwarnings("default", category=UserWarning) cal_df = cal_df.drop(index=drop_indices) cal_df["Gaia ID"] = cal_df["Gaia ID"].astype("int") - output_file = f"calib_find_{self.gaia_source}.csv" + output_file = f"calib_find_{self.gaia_release.lower()}_{self.gaia_source}.csv" - print(f"\nStoring output: {output_file}") + print(f"Storing output: {output_file}") cal_df.to_csv(path_or_buf=output_file, header=True, index=False) @@ -533,18 +802,32 @@ def select_calib( mag_diff: Union[float, Dict[str, float]] = 0.1, ) -> pd.DataFrame: """ - Function for selecting the calibration stars. + Function for selecting the calibration stars. The function + returns a ``DataFrame`` with the selected sources, but it also + stores the data in a CSV file in the working folder. It is + recommended to open the CSV file in a spreadsheet editor for + easy visualization. Parameters ---------- filter_names : list(str), None - List with the filter names (default: ['2MASS J', - '2MASS H', '2MASS Ks']). - mag_diff : float + List with filter names that are used in combination + with ``mag_diff`` for selecting sources. Any of the 2MASS, + WISE, and GAIA filter names from the `SVO Filter Profile + Service `_ can + be used. (default: ``['2MASS/2MASS.J', '2MASS/2MASS.H', + '2MASS/2MASS.Ks']``). + mag_diff : float, dict(str, float) Allowed magnitude difference between the selected target - as argument of ``gaia_source`` and the queried sources - with :func:`~calistar.calistar.CaliStar.find_calib()` - (default: 0.1). + (i.e. the argument of ``gaia_source``) and the sources + there were found with + :func:`~calistar.calistar.CaliStar.find_calib()` (default: + 0.1). The argument can be either a float, in which case the + same value is used for all filters listed in + ``filter_names``, or a dictionary in which case the keys + should be the filter names that are listed in + ``filter_names`` and the values are the allowed magnitude + differences for each filter. Returns ------- @@ -552,38 +835,56 @@ def select_calib( The ``DataFrame`` with the selected calibration stars. """ - json_file = f"target_{self.gaia_source}.json" + print("\n-> Selecting calibration stars...\n") + + json_file = f"target_{self.gaia_release.lower()}_{self.gaia_source}.json" with open(json_file, "r", encoding="utf-8") as open_file: target_dict = json.load(open_file) if filter_names is None: - filter_names = ["2MASS J", "2MASS H", "2MASS Ks"] + filter_names = ["2MASS/2MASS.J", "2MASS/2MASS.H", "2MASS/2MASS.Ks"] + + if not isinstance(mag_diff, dict): + diff_val = copy(mag_diff) + mag_diff = {} + + for filter_item in filter_names: + mag_diff[filter_item] = diff_val + + if sorted(filter_names) != sorted(list(mag_diff.keys())): + raise ValueError( + "The values in the list of 'filter_names', " + f"{filter_names}, is not equal to the keys in the " + f"dictionary of 'mag_diff', {list(mag_diff.keys())}." + ) cal_df = pd.read_csv( - filepath_or_buffer=f"calib_find_{self.gaia_source}.csv", + filepath_or_buffer=f"calib_find_{self.gaia_release.lower()}_{self.gaia_source}.csv", header=0, index_col=False, ) - print("\n-> Selecting calibration stars...\n") - drop_indices = [] for row_idx in track(range(len(cal_df)), description="Processing..."): for filter_item in filter_names: if np.isnan(cal_df.loc[row_idx, filter_item]) or ( - np.abs(cal_df.loc[row_idx, filter_item] - target_dict[filter_item]) - > mag_diff + np.abs( + cal_df.loc[row_idx, filter_item] - target_dict[filter_item][0] + ) + > mag_diff[filter_item] ): if row_idx not in drop_indices: drop_indices.append(row_idx) cal_df = cal_df.drop(index=drop_indices) - output_file = f"calib_select_{self.gaia_source}.csv" + print(f"Number of selected sources: {len(cal_df)}") + + output_file = f"calib_select_{self.gaia_release.lower()}_{self.gaia_source}.csv" - print(f"\nStoring output: {output_file}") + print(f"Storing output: {output_file}") cal_df.to_csv(path_or_buf=output_file, header=True, index=False) diff --git a/docs/conf.py b/docs/conf.py index 5c1036b..bf20f5b 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -25,61 +25,46 @@ # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. + extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.napoleon', 'sphinx.ext.viewcode', + 'sphinx_automodapi.automodapi', 'nbsphinx' ] -# Disable notebook timeout -nbsphinx_timeout = -1 - -# Allow errors from notebooks -nbsphinx_allow_errors = True - -autoclass_content = 'both' - -# Add any paths that contain templates here, relative to this directory. -templates_path = [] +numpydoc_show_class_members = False # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This pattern also affects html_static_path and html_extra_path. + exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', - 'tutorials/.ipynb_checkpoints/*'] + '.ipynb_checkpoints/*'] # -- Options for HTML output ------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = 'sphinx_book_theme' + +html_theme = 'pydata_sphinx_theme' html_theme_options = { - 'path_to_docs': 'docs', - 'repository_url': 'https://github.com/tomasstolker/calistar', - 'repository_branch': 'main', - 'launch_buttons': { - 'notebook_interface': 'jupyterlab', - }, + 'github_url': 'https://github.com/tomasstolker/calistar', 'use_edit_page_button': True, - 'use_issues_button': True, - 'use_repository_button': True, - 'use_download_button': True, } -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". +html_context = { + "github_user": "tomasstolker", + "github_repo": "calistar", + "github_version": "main", + "doc_path": "docs", +} + html_static_path = ['_static'] -# html_logo = '_static/calistar_logo.png' html_search_language = 'en' - -html_context = {'display_github': True, - 'github_user': 'tomasstolker', - 'github_repo': 'calistar', - 'github_version': 'main/docs/'} diff --git a/docs/tutorial.ipynb b/docs/tutorial.ipynb index fdee1ea..f55cfb0 100644 --- a/docs/tutorial.ipynb +++ b/docs/tutorial.ipynb @@ -13,7 +13,7 @@ "id": "09b2a5cd", "metadata": {}, "source": [ - "We start by first importing the `CaliStar` class from the `calistar` package." + "We start importing the `CaliStar` class from the `calistar` package." ] }, { @@ -31,7 +31,7 @@ "id": "f9864c75", "metadata": {}, "source": [ - "Next, we create an instance of `CaliStar` by providing as argument of `gaia_source` the Gaia DR3 source ID of a star. In this example, we will use the star HD 206893 and lookup the source ID on [Simbad](https://simbad.u-strasbg.fr/simbad/sim-basic?Ident=HD206893)." + "Next, we create an instance of the [CaliStar](https://calistar.readthedocs.io/en/latest/calistar.html#calistar.calistar.CaliStar) class by providing Gaia source ID of the target star and the (optional) Gaia data release that should be used. In this example, we will use the star HD 206893. The Gaia DR3 source ID of the star is easily found on [Simbad](https://simbad.u-strasbg.fr/simbad/sim-basic?Ident=HD206893)." ] }, { @@ -60,24 +60,32 @@ "metadata": {}, "output_type": "display_data" }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Downloading data from 'https://home.strw.leidenuniv.nl/~stolker/calistar/wds_catalog.hdf5' to file '/Users/tomasstolker/.calistar/wds_catalog.hdf5'.\n" + ] + }, { "name": "stdout", "output_type": "stream", "text": [ - "===============\n" + "===============\n", + "\n", + "Creating .calistar folder in /Users/tomasstolker...\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "100%|█████████████████████████████████████| 16.5M/16.5M [00:00<00:00, 5.54GB/s]\n" ] } ], "source": [ - "cal_star = CaliStar(gaia_source=6843672087120107264)" - ] - }, - { - "cell_type": "markdown", - "id": "656a0c1f", - "metadata": {}, - "source": [ - "Next, we run the required methods of `CaliStar`." + "cal_star = CaliStar(gaia_source=6843672087120107264, gaia_release=\"DR3\")" ] }, { @@ -159,7 +167,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "{'Gaia ID': 6843672087120107264, 'Gaia RA': 326.3417007918157, 'Gaia Dec': -12.783352283336647, 'Gaia G mag': 6.585951805114746, 'Simbad ID': 'HD 206893', 'SpT': 'F5V', '2MASS J': 5.86899995803833, '2MASS H': 5.686999797821045, '2MASS Ks': 5.5929999351501465, 'WISE W1': 5.572999954223633, 'WISE W2': 5.452000141143799, 'WISE W3': 5.629000186920166, 'WISE W4': 5.480999946594238}\n" + "{'Gaia ID': 6843672087120107264, 'Gaia release': 'DR3', 'Gaia epoch': 2016.0, 'Gaia RA': (326.3417007918157, 6.28893832779593e-06), 'Gaia Dec': (-12.783352283336647, 6.28893832779593e-06), 'Gaia pm RA': (94.11170797027064, 0.03547043353319168), 'Gaia pm Dec': (-0.4633855782241898, 0.025660403072834015), 'Gaia parallax': (24.527534260182925, 0.03544711321592331), 'GAIA/GAIA3.G': (6.585951805114746, 0.002761077445367911), 'GAIA/GAIA3.Gbp': (6.798026084899902, 0.0028371437114444007), 'GAIA/GAIA3.Grp': (6.21368932723999, 0.0038149464919949023), 'Simbad ID': 'HD 206893', 'SpT': 'F5V', '2MASS/2MASS.J': (5.86899995803833, 0.023000000044703484), '2MASS/2MASS.H': (5.686999797821045, 0.03400000184774399), '2MASS/2MASS.Ks': (5.5929999351501465, 0.020999999716877937), 'WISE/WISE.W1': (5.572999954223633, 0.0430000014603138), 'WISE/WISE.W2': (5.452000141143799, 0.0430000014603138), 'WISE/WISE.W3': (5.629000186920166, 0.0430000014603138), 'WISE/WISE.W4': (5.480999946594238, 0.0430000014603138)}\n" ] } ], @@ -178,19 +186,15 @@ "output_type": "stream", "text": [ "\n", - "-> Gaia cone search\n", - "\n", - "\n", - "Radius of search cone = 5.0 deg\n", + "-> Finding calibration stars...\n", "\n", - "-> Querying GAIA DR3...\n", - "\n" + "Radius of search cone = 3.0 deg\n" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "ed6b204f09bf491f917694897c1c3cd2", + "model_id": "08ff8f404a894250a7be8ec1da465c25", "version_major": 2, "version_minor": 0 }, @@ -206,10 +210,7 @@ "output_type": "stream", "text": [ "INFO: Query finished. [astroquery.utils.tap.core]\n", - "Found 59 object(s) with cone search\n", - "\n", - "-> Finding calibration stars...\n", - "\n" + "Number of found sources: 53\n" ] }, { @@ -239,13 +240,12 @@ "name": "stdout", "output_type": "stream", "text": [ - "\n", - "Storing output: calib_find_6843672087120107264.csv\n" + "Storing output: calib_find_dr3_6843672087120107264.csv\n" ] } ], "source": [ - "df = cal_star.find_calib(search_radius=5.)" + "df = cal_star.find_calib(search_radius=3., g_mag_range=(-1.0, 2.0))" ] }, { @@ -258,26 +258,42 @@ "name": "stdout", "output_type": "stream", "text": [ - " Simbad ID Gaia ID SpT GAIA G GAIA BP GAIA RP \\\n", - "0 HD 206893 6843672087120107264 F5V 6.585952 6.798026 6.213689 \n", - "1 HD 207006 6843703766798867072 G8III 7.264789 7.77279 6.595277 \n", - "2 HD 207503 6843863127265189760 A1/2III 6.279203 6.370432 6.091364 \n", - "3 * 50 Cap 6844193324351118336 F6V 6.898117 7.112482 6.524837 \n", - "4 * 44 Cap 6841731655255386240 A9/F0V 5.825697 5.950932 5.582501 \n", + " Simbad ID Gaia ID SpT Separation Non single star \\\n", + "0 HD 206893 6843672087120107264 F5V 0.0 0 \n", + "1 HD 207006 6843703766798867072 G8III 0.293244 0 \n", + "2 HD 206942 6843448783180406272 K2/3III 0.566973 0 \n", + "3 HD 206878 6843329348729972224 K3III 0.892679 0 \n", + "4 HD 207272 6844094574462996608 K5III 0.918348 0 \n", + "\n", + " Single star probability Astrometric excess noise GAIA/GAIA3.G 2MASS/2MASS.J \\\n", + "0 0.992999 0.174123 6.585952 5.869 \n", + "1 0.999932 0.115425 7.264789 5.799 \n", + "2 0.999987 0.126161 8.236968 6.228 \n", + "3 0.999984 0.127814 8.125083 6.217 \n", + "4 0.999971 0.134155 8.021875 5.864 \n", + "\n", + " 2MASS/2MASS.H ... WISE/WISE.W4 WDS ID WDS epoch 1 WDS epoch 2 \\\n", + "0 5.687 ... 5.481 NaN NaN NaN \n", + "1 5.317 ... 5.052 NaN NaN NaN \n", + "2 5.46 ... 5.151 NaN NaN NaN \n", + "3 5.582 ... 5.239 WDS J21453-1341A 1905 2015 \n", + "4 5.105 ... 4.698 NaN NaN NaN \n", + "\n", + " WDS sep 1 WDS sep 2 WDS PA 1 WDS PA 2 \\\n", + "0 NaN NaN NaN NaN \n", + "1 NaN NaN NaN NaN \n", + "2 NaN NaN NaN NaN \n", + "3 26.799999237060547 27.299999237060547 226 223 \n", + "4 NaN NaN NaN NaN \n", "\n", - " 2MASS J 2MASS H 2MASS Ks WISE W1 WISE W2 WISE W3 WISE W4 Non single star \\\n", - "0 5.869 5.687 5.593 5.573 5.452 5.629 5.481 0 \n", - "1 5.799 5.317 5.117 5.152 4.936 5.048 5.052 0 \n", - "2 5.894 5.853 5.794 5.814 5.735 5.829 5.798 0 \n", - "3 6.152 5.979 5.928 5.888 5.841 5.934 5.927 0 \n", - "4 5.405 5.238 5.201 5.191 5.019 5.216 5.139 0 \n", + " WDS mag 1 WDS mag 2 \n", + "0 NaN NaN \n", + "1 NaN NaN \n", + "2 NaN NaN \n", + "3 8.739999771118164 11.550000190734863 \n", + "4 NaN NaN \n", "\n", - " Single star probability Astrometric excess noise \n", - "0 0.992999 0.174123 \n", - "1 0.999932 0.115425 \n", - "2 0.000001 0.366081 \n", - "3 0.992964 0.124047 \n", - "4 0.998862 0.264402 \n" + "[5 rows x 24 columns]\n" ] } ], @@ -294,7 +310,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "62b25d38ad0d45b49d9f7fd029e85f9d", + "model_id": "5c07313df5624f0aaa983a2fc912e7c3", "version_major": 2, "version_minor": 0 }, @@ -341,13 +357,14 @@ "name": "stdout", "output_type": "stream", "text": [ - "\n", - "Storing output: calib_select_6843672087120107264.csv\n" + "Number of selected sources: 7\n", + "Storing output: calib_select_dr3_6843672087120107264.csv\n" ] } ], "source": [ - "df = cal_star.select_calib(filter_names=[\"2MASS Ks\", \"WISE W1\"], mag_diff=0.1)" + "df = cal_star.select_calib(filter_names=[\"2MASS/2MASS.Ks\", \"WISE/WISE.W1\"],\n", + " mag_diff={\"2MASS/2MASS.Ks\": 0.3, \"WISE/WISE.W1\": 0.5})" ] }, { @@ -360,20 +377,42 @@ "name": "stdout", "output_type": "stream", "text": [ - " Simbad ID Gaia ID SpT GAIA G GAIA BP GAIA RP \\\n", - "0 HD 206893 6843672087120107264 F5V 6.585952 6.798026 6.213689 \n", - "20 HD 208704 6840872971033892608 G1V 7.015011 7.324236 6.530556 \n", - "31 HD 206229 6893782982391182848 G8/K0(IV) 7.429806 7.871097 6.816071 \n", + " Simbad ID Gaia ID SpT Separation Non single star \\\n", + "0 HD 206893 6843672087120107264 F5V 0.000000 0 \n", + "3 HD 206878 6843329348729972224 K3III 0.892679 0 \n", + "9 HD 207503 6843863127265189760 A1/2III 1.054286 0 \n", + "20 HD 205827 6844675872517129728 K1III 1.882230 0 \n", + "23 * 45 Cap 6838704699744176768 A7IV/V 1.993162 0 \n", + "\n", + " Single star probability Astrometric excess noise GAIA/GAIA3.G \\\n", + "0 0.992999 0.174123 6.585952 \n", + "3 0.999984 0.127814 8.125083 \n", + "9 0.000001 0.366081 6.279203 \n", + "20 0.999920 0.136001 7.779989 \n", + "23 0.000001 0.232292 5.913185 \n", + "\n", + " 2MASS/2MASS.J 2MASS/2MASS.H ... WISE/WISE.W4 WDS ID \\\n", + "0 5.869 5.687 ... 5.481 NaN \n", + "3 6.217 5.582 ... 5.239 WDS J21453-1341A \n", + "9 5.894 5.853 ... 5.798 NaN \n", + "20 6.160 5.593 ... 5.338 NaN \n", + "23 5.565 5.459 ... 5.330 WDS J21440-1445AB \n", + "\n", + " WDS epoch 1 WDS epoch 2 WDS sep 1 WDS sep 2 WDS PA 1 WDS PA 2 \\\n", + "0 NaN NaN NaN NaN NaN NaN \n", + "3 1905.0 2015.0 26.799999 27.299999 226.0 223.0 \n", + "9 NaN NaN NaN NaN NaN NaN \n", + "20 NaN NaN NaN NaN NaN NaN \n", + "23 2008.0 2016.0 4.300000 4.200000 229.0 229.0 \n", "\n", - " 2MASS J 2MASS H 2MASS Ks WISE W1 WISE W2 WISE W3 WISE W4 \\\n", - "0 5.869 5.687 5.593 5.573 5.452 5.629 5.481 \n", - "20 6.028 5.715 5.661 5.661 5.559 5.665 5.606 \n", - "31 6.069 5.644 5.517 5.498 5.390 5.504 5.400 \n", + " WDS mag 1 WDS mag 2 \n", + "0 NaN NaN \n", + "3 8.74 11.55 \n", + "9 NaN NaN \n", + "20 NaN NaN \n", + "23 5.41 9.50 \n", "\n", - " Non single star Single star probability Astrometric excess noise \n", - "0 0 0.992999 0.174123 \n", - "20 0 0.997667 0.108770 \n", - "31 0 0.999591 0.127277 \n" + "[5 rows x 24 columns]\n" ] } ], diff --git a/requirements.txt b/requirements.txt index db0c685..0789336 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,5 +3,7 @@ astroquery matplotlib numpy pandas +pooch rich +tqdm typeguard diff --git a/setup.py b/setup.py index 1058a54..15d9eb6 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ setuptools.setup( name='calistar', version='0.0.1', - description='Tool for finding a suitable calibration star', + description='Tool to search for a single calibration star', long_description=open('README.rst').read(), long_description_content_type='text/x-rst', author='Tomas Stolker', diff --git a/tests/test_calistar.py b/tests/test_calistar.py index 1234a70..9024ec0 100644 --- a/tests/test_calistar.py +++ b/tests/test_calistar.py @@ -24,4 +24,4 @@ def test_find_calib(self) -> None: def test_select_calib(self) -> None: - self.cal_star.select_calib(filter_names=["2MASS H"], mag_diff=5.) + self.cal_star.select_calib(filter_names=["2MASS/2MASS.H"], mag_diff=5.)