In [1]:
import numpy as np
import pandas as pd
import gc
import matplotlib.pyplot as plt
%matplotlib notebook
First - test to see if there are any stars that would be selected by the parallax criterion, but not by the proper motion criterion.
In [2]:
gaia_dir = "/Users/adamamiller/Desktop/PS1_fits/gaia_stars/"
gaia_df = pd.read_hdf(gaia_dir + "parallax_ps1_gaia_mag_pm_plx.h5")
pxl_not_pm = np.where((gaia_df["parallax_over_error"] >= 8) &
(gaia_df["pm_over_error"] < 7.5))
In [3]:
gaia_df.iloc[pxl_not_pm]
Out[3]:
There are ~579k sources that satisfy the pxl cut but not the pm cut. These now need to be matched to the pxl cut stars in PS1 to see which (if any) of these stars need to be adjusted in the ZTF database.
In [4]:
pxl_ps1 = pd.read_hdf("parallax_ps1_gaia_cat_merge.h5")
In [5]:
pxl_objid = np.array(gaia_df["objid"].iloc[pxl_not_pm])
pxl_ps1_objid = np.array(pxl_ps1.index)
pxl_in_cat = np.isin(pxl_objid, pxl_ps1_objid)
In [6]:
print("There are {} pxl stars that need to be added to the catalog".format(len(pxl_objid[~pxl_in_cat])))
In [7]:
pxl_objid[~pxl_in_cat]
Out[7]:
In [8]:
del pxl_ps1
del gaia_df
gc.collect()
Out[8]:
In [9]:
gaia_dir = "/Users/adamamiller/Desktop/PS1_fits/gaia_stars/"
pm_df = pd.read_hdf(gaia_dir + "pm_ps1_gaia_mag_pm_plx.h5")
In [10]:
pm_ps1 = pd.read_hdf("pm_ps1_gaia_cat_merge.h5")
In [11]:
pm_objid = np.array(pm_df["objid"])
pm_ps1_objid =np.array(pm_ps1.index)
In [12]:
del pm_df
del pm_ps1
gc.collect()
Out[12]:
In [13]:
pm_in_cat = np.isin(pm_objid, pm_ps1_objid)
In [14]:
pxl_and_pm_objid = np.append(pm_objid[~pm_in_cat],
pxl_objid[~pxl_in_cat])
In [15]:
new_stars_df = pd.DataFrame(pxl_and_pm_objid, columns=["objid"])
In [17]:
new_stars_df.to_hdf("objid_for_gaia_stars_for_ztf_database.h5", "d1")
In [ ]: