comments
Browse files- utils/keck_filtering.ipynb +22 -0
utils/keck_filtering.ipynb
CHANGED
|
@@ -28,6 +28,12 @@
|
|
| 28 |
"import numpy as np\n",
|
| 29 |
"import shutil\n",
|
| 30 |
"\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
"def get_all_fits_files(root_dir):\n",
|
| 32 |
" # Use glob to recursively find all .fits files\n",
|
| 33 |
" pattern = os.path.join(root_dir, '**', '*LR*.fits')\n",
|
|
@@ -103,6 +109,12 @@
|
|
| 103 |
"latitudes = list(df['dec'])\n",
|
| 104 |
"longitudes = list(df['ra'])\n",
|
| 105 |
"\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
"n_points = len(latitudes)\n",
|
| 107 |
"\n",
|
| 108 |
"# Repeat each point n_points times for lat1, lon1\n",
|
|
@@ -160,6 +172,11 @@
|
|
| 160 |
"KECK_FOV = 3768 * KECK_DEG_PER_PIXEL\n",
|
| 161 |
"THRESH = KECK_FOV * 2\n",
|
| 162 |
"\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 163 |
"clustering = AgglomerativeClustering(n_clusters=None, metric='precomputed', linkage='single', distance_threshold=THRESH)\n",
|
| 164 |
"labels = clustering.fit_predict(angular_separations_matrix)"
|
| 165 |
]
|
|
@@ -196,6 +213,11 @@
|
|
| 196 |
"RA_NAME = 'ra'\n",
|
| 197 |
"DEC_NAME = 'dec'\n",
|
| 198 |
"\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
"def max_subset_with_min_distance(points, min_distance):\n",
|
| 200 |
" subset = []\n",
|
| 201 |
" for i, row in points.iterrows():\n",
|
|
|
|
| 28 |
"import numpy as np\n",
|
| 29 |
"import shutil\n",
|
| 30 |
"\n",
|
| 31 |
+
"\"\"\"\n",
|
| 32 |
+
"Use this code after downloading imagery using\n",
|
| 33 |
+
"keck_downloading file.\n",
|
| 34 |
+
"\n",
|
| 35 |
+
"\"\"\"\n",
|
| 36 |
+
"\n",
|
| 37 |
"def get_all_fits_files(root_dir):\n",
|
| 38 |
" # Use glob to recursively find all .fits files\n",
|
| 39 |
" pattern = os.path.join(root_dir, '**', '*LR*.fits')\n",
|
|
|
|
| 109 |
"latitudes = list(df['dec'])\n",
|
| 110 |
"longitudes = list(df['ra'])\n",
|
| 111 |
"\n",
|
| 112 |
+
"\"\"\"\n",
|
| 113 |
+
"Code to compute all angular separations between pairwise images from single RA DEC\n",
|
| 114 |
+
"values.\n",
|
| 115 |
+
"\n",
|
| 116 |
+
"\"\"\"\n",
|
| 117 |
+
"\n",
|
| 118 |
"n_points = len(latitudes)\n",
|
| 119 |
"\n",
|
| 120 |
"# Repeat each point n_points times for lat1, lon1\n",
|
|
|
|
| 172 |
"KECK_FOV = 3768 * KECK_DEG_PER_PIXEL\n",
|
| 173 |
"THRESH = KECK_FOV * 2\n",
|
| 174 |
"\n",
|
| 175 |
+
"'''\n",
|
| 176 |
+
"Initial agglomerative clustering.\n",
|
| 177 |
+
"Since we don't have WCS info, the above threshold is very conservative.\n",
|
| 178 |
+
"'''\n",
|
| 179 |
+
"\n",
|
| 180 |
"clustering = AgglomerativeClustering(n_clusters=None, metric='precomputed', linkage='single', distance_threshold=THRESH)\n",
|
| 181 |
"labels = clustering.fit_predict(angular_separations_matrix)"
|
| 182 |
]
|
|
|
|
| 213 |
"RA_NAME = 'ra'\n",
|
| 214 |
"DEC_NAME = 'dec'\n",
|
| 215 |
"\n",
|
| 216 |
+
"\"\"\"\n",
|
| 217 |
+
"Only select images that are at least THRESH apart from each other.\n",
|
| 218 |
+
"\n",
|
| 219 |
+
"\"\"\"\n",
|
| 220 |
+
"\n",
|
| 221 |
"def max_subset_with_min_distance(points, min_distance):\n",
|
| 222 |
" subset = []\n",
|
| 223 |
" for i, row in points.iterrows():\n",
|