|
29 | 29 | }, |
30 | 30 | { |
31 | 31 | "cell_type": "code", |
32 | | - "execution_count": 1, |
| 32 | + "execution_count": null, |
33 | 33 | "metadata": {}, |
34 | 34 | "outputs": [], |
35 | 35 | "source": [ |
|
53 | 53 | }, |
54 | 54 | { |
55 | 55 | "cell_type": "code", |
56 | | - "execution_count": 3, |
| 56 | + "execution_count": null, |
57 | 57 | "metadata": {}, |
58 | 58 | "outputs": [], |
59 | 59 | "source": [ |
60 | 60 | "truth_catalog_pickle_file = output_dir / \"truth_catalog.pkl\"\n", |
61 | 61 | "GCRCatalogs.set_root_dir(\"/data/scratch/dc2_nfs/\")\n", |
62 | 62 | "if truth_catalog_pickle_file.exists():\n", |
63 | | - " with open(truth_catalog_pickle_file, \"rb\") as inputp: \n", |
| 63 | + " with open(truth_catalog_pickle_file, \"rb\") as inputp:\n", |
64 | 64 | " truth_cat_data = pickle.load(inputp)\n", |
65 | | - "else: \n", |
66 | | - " truth_cat = GCRCatalogs.load_catalog(\"desc_dc2_run2.2i_dr6_truth\") \n", |
| 65 | + "else:\n", |
| 66 | + " truth_cat = GCRCatalogs.load_catalog(\"desc_dc2_run2.2i_dr6_truth\")\n", |
67 | 67 | " print(sorted(truth_cat.list_all_quantities()))\n", |
68 | 68 | " truth_cat_data = truth_cat.get_quantities([\n", |
69 | | - " \"id\", \"match_objectId\", \"cosmodc2_id\", \"ra\", \"dec\", \"truth_type\", \n", |
| 69 | + " \"id\", \"match_objectId\", \"cosmodc2_id\", \"ra\", \"dec\", \"truth_type\",\n", |
70 | 70 | " \"flux_g\", \"flux_i\", \"flux_r\", \"flux_u\", \"flux_y\", \"flux_z\",\n", |
71 | 71 | " \"redshift\",\n", |
72 | 72 | " ])\n", |
|
95 | 95 | "source": [ |
96 | 96 | "galaxy_params_pickle_file = output_dir / \"galaxy_params.pkl\"\n", |
97 | 97 | "if galaxy_params_pickle_file.exists():\n", |
98 | | - " with open(galaxy_params_pickle_file, \"rb\") as inputp: \n", |
| 98 | + " with open(galaxy_params_pickle_file, \"rb\") as inputp:\n", |
99 | 99 | " galaxy_params_data = pickle.load(inputp)\n", |
100 | 100 | "else:\n", |
101 | 101 | " config_overwrite = dict(\n", |
|
243 | 243 | "source": [ |
244 | 244 | "psf_params_pickle_file = output_dir / \"psf_params.pkl\"\n", |
245 | 245 | "if psf_params_pickle_file.exists():\n", |
246 | | - " with open(psf_params_pickle_file, \"rb\") as inputp: \n", |
| 246 | + " with open(psf_params_pickle_file, \"rb\") as inputp:\n", |
247 | 247 | " psf_params_data = pickle.load(inputp)\n", |
248 | 248 | "else:\n", |
249 | 249 | " psf_params = GCRCatalogs.load_catalog(\"desc_dc2_run2.2i_dr6_object_with_truth_match\")\n", |
250 | 250 | " print(sorted(psf_params.list_all_quantities()))\n", |
251 | 251 | " psf_params_data = psf_params.get_quantities([\n", |
252 | 252 | " \"objectId\",\n", |
253 | 253 | " \"blendedness\",\n", |
254 | | - " \"IxxPSF_pixel_g\", \"IxxPSF_pixel_z\", \n", |
255 | | - " \"IxxPSF_pixel_r\", \"IxxPSF_pixel_i\", \"IxxPSF_pixel_u\", \n", |
256 | | - " \"IxxPSF_pixel_y\", \"IyyPSF_pixel_g\", \"IyyPSF_pixel_z\", \n", |
257 | | - " \"IyyPSF_pixel_r\", \"IyyPSF_pixel_i\", \"IyyPSF_pixel_u\", \n", |
258 | | - " \"IyyPSF_pixel_y\", \"IxyPSF_pixel_g\", \"IxyPSF_pixel_z\", \n", |
259 | | - " \"IxyPSF_pixel_r\", \"IxyPSF_pixel_i\", \"IxyPSF_pixel_u\", \n", |
| 254 | + " \"IxxPSF_pixel_g\", \"IxxPSF_pixel_z\",\n", |
| 255 | + " \"IxxPSF_pixel_r\", \"IxxPSF_pixel_i\", \"IxxPSF_pixel_u\",\n", |
| 256 | + " \"IxxPSF_pixel_y\", \"IyyPSF_pixel_g\", \"IyyPSF_pixel_z\",\n", |
| 257 | + " \"IyyPSF_pixel_r\", \"IyyPSF_pixel_i\", \"IyyPSF_pixel_u\",\n", |
| 258 | + " \"IyyPSF_pixel_y\", \"IxyPSF_pixel_g\", \"IxyPSF_pixel_z\",\n", |
| 259 | + " \"IxyPSF_pixel_r\", \"IxyPSF_pixel_i\", \"IxyPSF_pixel_u\",\n", |
260 | 260 | " \"IxyPSF_pixel_y\", \"psf_fwhm_g\", \"psf_fwhm_z\", \"psf_fwhm_r\",\n", |
261 | 261 | " \"psf_fwhm_i\", \"psf_fwhm_u\", \"psf_fwhm_y\"\n", |
262 | 262 | " ])\n", |
|
280 | 280 | "outputs": [], |
281 | 281 | "source": [ |
282 | 282 | "truth_galaxy_df = truth_cat_df.merge(\n", |
283 | | - " galaxy_params_df, \n", |
284 | | - " left_on=\"cosmodc2_id\", \n", |
285 | | - " right_on=\"galaxy_id\", \n", |
286 | | - " how=\"left\" \n", |
| 283 | + " galaxy_params_df,\n", |
| 284 | + " left_on=\"cosmodc2_id\",\n", |
| 285 | + " right_on=\"galaxy_id\",\n", |
| 286 | + " how=\"left\"\n", |
287 | 287 | ")\n", |
288 | 288 | "cosmodc2_mask = ~(np.isnan(truth_galaxy_df[\"ellipticity_1_true\"].values))\n", |
289 | 289 | "truth_galaxy_df[\"cosmodc2_mask\"] = cosmodc2_mask\n", |
290 | 290 | "truth_galaxy_psf_df = truth_galaxy_df.merge(\n", |
291 | | - " psf_params_df, \n", |
292 | | - " left_on=\"match_objectId\", \n", |
293 | | - " right_on=\"objectId\", \n", |
294 | | - " how=\"left\" \n", |
| 291 | + " psf_params_df,\n", |
| 292 | + " left_on=\"match_objectId\",\n", |
| 293 | + " right_on=\"objectId\",\n", |
| 294 | + " how=\"left\"\n", |
295 | 295 | ")" |
296 | 296 | ] |
297 | 297 | }, |
|
495 | 495 | "metadata": {}, |
496 | 496 | "outputs": [], |
497 | 497 | "source": [ |
498 | | - "# create a pickle file \n", |
| 498 | + "# create a pickle file\n", |
499 | 499 | "truth_galaxy_psf_df.to_pickle(output_dir / f\"merged_catalog_with_flux_over_{flux_min}.pkl\")" |
500 | 500 | ] |
501 | 501 | } |
|
0 commit comments