comments
Browse files- utils/sdss_filtering.ipynb +24 -0
utils/sdss_filtering.ipynb
CHANGED
|
@@ -38,6 +38,13 @@
|
|
| 38 |
"import matplotlib.pyplot as plt\n",
|
| 39 |
"import numpy as np\n",
|
| 40 |
"\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
"def get_all_fits_files(root_dir):\n",
|
| 42 |
" # Use glob to recursively find all .fits files\n",
|
| 43 |
" pattern = os.path.join(root_dir, '**', '*.fits')\n",
|
|
@@ -65,6 +72,13 @@
|
|
| 65 |
}
|
| 66 |
],
|
| 67 |
"source": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
"# Initialize the list of confirmed FITS paths\n",
|
| 69 |
"confirmed_fits_paths = []\n",
|
| 70 |
"\n",
|
|
@@ -103,6 +117,11 @@
|
|
| 103 |
"latitudes = []\n",
|
| 104 |
"longitudes = []\n",
|
| 105 |
"\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
"for poly in tqdm(all_polys):\n",
|
| 107 |
" pts = list(poly.to_radec())[0]\n",
|
| 108 |
" ra = pts[0][0]\n",
|
|
@@ -186,6 +205,11 @@
|
|
| 186 |
"\n",
|
| 187 |
"THRESH = SDSS_FOV * 4\n",
|
| 188 |
"\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 189 |
"clustering = AgglomerativeClustering(n_clusters=None, metric='precomputed', linkage='single', distance_threshold=THRESH)\n",
|
| 190 |
"labels = clustering.fit_predict(angular_separations_matrix)"
|
| 191 |
]
|
|
|
|
| 38 |
"import matplotlib.pyplot as plt\n",
|
| 39 |
"import numpy as np\n",
|
| 40 |
"\n",
|
| 41 |
+
"\"\"\"\n",
|
| 42 |
+
"\n",
|
| 43 |
+
"Use this code after downloading all SDSS data first, using the file\n",
|
| 44 |
+
"titled sdss_downloading.\n",
|
| 45 |
+
"\n",
|
| 46 |
+
"\"\"\"\n",
|
| 47 |
+
"\n",
|
| 48 |
"def get_all_fits_files(root_dir):\n",
|
| 49 |
" # Use glob to recursively find all .fits files\n",
|
| 50 |
" pattern = os.path.join(root_dir, '**', '*.fits')\n",
|
|
|
|
| 72 |
}
|
| 73 |
],
|
| 74 |
"source": [
|
| 75 |
+
"\"\"\"\n",
|
| 76 |
+
"Computes a spherical polygon object for each FITS file using WCS coordinates.\n",
|
| 77 |
+
"Stores each in a list.\n",
|
| 78 |
+
"\n",
|
| 79 |
+
"\"\"\"\n",
|
| 80 |
+
"\n",
|
| 81 |
+
"\n",
|
| 82 |
"# Initialize the list of confirmed FITS paths\n",
|
| 83 |
"confirmed_fits_paths = []\n",
|
| 84 |
"\n",
|
|
|
|
| 117 |
"latitudes = []\n",
|
| 118 |
"longitudes = []\n",
|
| 119 |
"\n",
|
| 120 |
+
"\"\"\"\n",
|
| 121 |
+
"Get a list of all RA and DEC into a list before filtering.\n",
|
| 122 |
+
"\n",
|
| 123 |
+
"\"\"\"\n",
|
| 124 |
+
"\n",
|
| 125 |
"for poly in tqdm(all_polys):\n",
|
| 126 |
" pts = list(poly.to_radec())[0]\n",
|
| 127 |
" ra = pts[0][0]\n",
|
|
|
|
| 205 |
"\n",
|
| 206 |
"THRESH = SDSS_FOV * 4\n",
|
| 207 |
"\n",
|
| 208 |
+
"\"\"\"\n",
|
| 209 |
+
"Initial clustering phase using just RA DEC, not WCS polygon footprints.\n",
|
| 210 |
+
"\n",
|
| 211 |
+
"\"\"\"\n",
|
| 212 |
+
"\n",
|
| 213 |
"clustering = AgglomerativeClustering(n_clusters=None, metric='precomputed', linkage='single', distance_threshold=THRESH)\n",
|
| 214 |
"labels = clustering.fit_predict(angular_separations_matrix)"
|
| 215 |
]
|