Answered step by step
Verified Expert Solution
Question
1 Approved Answer
example of how to do matching sources from both tables. I want to match RA, DEC, and MAGNITUDE from both tables using the astropy.coordinates in
example of how to do matching sources from both tables.
I want to match RA, DEC, and MAGNITUDE from both tables using the astropy.coordinates in python.
after matching i will find avg magnitude. but for now i need to do matching and find sources from table 1 and table 2.
I Sav i wa In [460]: from astropy.coordinates import SkyCoord from astropy import units as u import matplotlib import matplotlib.pyplot as plt import numpy as np Ludi will In [491]: sources1_catalog = sources2_catalog SkyCoord(sources1['Ra']*u.deg, sources1['Dec']*u.deg) SkyCoord(sources2[ 'Ra']*u.deg, sources 2 [ 'Dec']*u.deg) Ales repli Hey! In [492]: idx 1 d2d, d3d sources2_catalog.match_to_catalog_sky (sources1_catalog) In [499]: print (idx) [ 104 104 145 ... 1928 1928 1928] Ludi In [457]: sources Out[457] : oid sharpness roundness 1 roundness2 npix sky peak flux mag Ra Dec Net Flux Magnitude t64 float64 float64 float64 int64 float64 float64 float64 float64 float64 float64 float64 float64 376 0.23372558 -0.32439319 -0.020708864 121 0 0.37 1.5228675 -0.45665527 280.6016944722749 -32.41406448864322 0.65078583 20.466405 -32.41306162106435 46.251978 15.837174 756 0.69343672 0.32479461 0.22024824 121 0 1.9300001 4.0656664 -1.5228293 280.6150164349571 189 0.62060928 0.19269536 0.096122075 121 0 0.73000002 1.8261883 -0.65386389 280.6189545034659 -32.41229713929544 1e-08 40 136 0.53831395 0.13231372 0.39145163 121 0 0.88999999 2.1224319 -0.8170844 280.62985815258145 -32.410062238758506 15.507529 17.023643 539 0.43669408 0.25425812 0.11334094 121 0 0.65000004 1.6779299 -0.56193454 280.6264978283915 -32.4087976202356 7.748027 17.777022 309 0.5858907 0.30297569 0.16900701 121 0 0.88999999 1.9739544 -0.73834277 280.6196440844546 -32.40918961514882 15.851479 16.999826 505 0.22644197 0.32003176 0.37264751 121 0 0.60000002 2.1572622 -0.83475736 280.62817389347015 -32.40767009022534 14.552627 17.092647 385 0.85430502 -0.73716665 0.57351263 121 0 0.82999998 1.3305429 -0.31007219 280.5876594665204 -32.405818232363444 4.3513933 18.403429 359 0.52086471 0.15844784 -0.055095578 121 0 0.59000003 1.3554786 -0.33023169 280.63452845270984 -32.405605260550615 1e-08 40 105 0.88046045 0.040837343 0.27071315 121 0 0.81999999 1.3180466 -0.29982695 280.5909356755931 -32.40528302568887 0.87936398 20.139578 H. H. 109 0.42054536 -0.046495805 -0.13146191 121 0 0.42000002 1.1670347 -0.16770944 280.74555137973664 -32.095075661465444 6.1690796 18.024449 524 0.62134334 -0.42029707 -0.27173188 121 0 0.81 1.3970013 -0.36299199 280.78260779155437 -32.094044777596466 14.168769 17.12167 13.870411 17.144777 024 0.60506306 -0.29340503 -0.27030931 121 0 1.16 2.6707939 -1.0666009 280.804636414589 -32.09373772431194 571 0.63193959 -0.39105023 -0.58559029 121 0 0.84000003 1.7234126 -0.59097315 280.79726315890736 -32.09350453629439 3.7401229 18.567785 505 0.92300693 0.69874856 0.34392834 121 0 1.27 2.0179073 -0.76225303 280.7660874908567 -32.09349569480247 7.2386806 17.850851 781 0.47460248 0.21497803 -0.26625856 121 0 0.40000001 1.0569824 -0.060169345 280.7634521686467 -32.0911743274667 1e-08 40 176 0.77453385 0.083295447 0.33513884 121 0 0.80000001 1.5187892 -0.45374372 280.7694833952286 -32.09053879368178 2.8565164 18.860408 179 0.36496128 0.22660144 0.064935335 121 0 0.36000001 1.0484788 -0.051399163 280.78068854510235 -32.0900673727368 1e-08 40 .63 0.76715553 -0.097279146 0.091884663 121 0 19.889999 44.379513 -4.1179563 280.7918703355538 -32.08802153571204 354.85308 13.624879 776 0.79492515 -0.43692281 -0.18995366 121 0 0.82999998 1.2718391 -0.26108045 280.788678809335 -32.08761981837381 1e-08 40 In [458): sources 2 Out [458]: id sharpness roundness1 roundness2 npix sky peak flux mag Ra Dec Net Flux Magnitude 34 float64 float64 float64 int64 float64 float64 float64 float64 float64 float64 float64 float64 17 0.46736772 0.72964262 -0.21044723 121 0 0.41999999 1.104 1643 -0.10758425 280.83411668251966 -32.480405256477205 7.4958404 17.812949 25 0.34922253 0.28837457 0.34627782 121 0 0.52999997 1.3467992 -0.3232571 280.8372700674397 -32.47835178831433 1e-08 40 0.2493531 -0.041849143 -0.56369052 121 0 0.5 1.1595219 -0.16069742 280.85690870532324 -32.4767813603895 5.228944 18.203965 33 0.34433566 0.15019618 -0.6916781 121 0 0.51999998 1.3216559 -0.30279604 280.84025565358667 -32.47553478875814 0.90780011 20.105024 14 0.468474 0.32796289 -0.31358697 121 0 0.56 1.3265918 -0.30684329 280.8291574704897 -32.475017846699245 7.5443751 17.805942 53 0.22234555 0.62549225 -0.0070833039 121 0 0.50999999 1.8740278 -0.6819401 280.8333718920063 -32.47478405704362 1e-08 40 31 0.400814 0.072153611 -0.021394565 121 0 2.54 8.2536896 -2.2916203 280.8491756281926 -32.47162235375269 71.668246 15.361683 16 0.96766549 0.30676357 0.87417363 121 0 0.77999997 1.0234423 -0.025158411 280.84915816451456 -32.46964486365769 8.5801282 17.666266 12 0.57938773 0.12387339 0.87602522 121 0 0.83999997 1.779204 -0.62556434 280.8401281174599 -32.46813197875331 13.857174 17.145813 75 0.61713383 -0.82631377 0.14914153 121 0 0.68000001 1.4555796 -0.4075899 280.85779714105627 -32.46675795825541 1e-08 40 32 0.68615369 -0.51465452 -0.015033113 121 0 0.77999997 1.496578 -0.4377484 280.8199067299943 -32.126381151109776 7.8186474 17.767171 55 0.64410317 0.82726058 0.55162469 121 0 0.64999998 1.0167238 -0.018007525 280.83474083364786 -32.12344774444369 1e-08 40 28 0.62390288 -0.4045794 -0.69468091 121 0 0.85000002 1.2266466 -0.22179866 280.84841507004444 -32.1222926036603 23.439813 16.575115 23 0.98728318 0.38530532 -0.15620677 121 0 0 1.21 1.8374775 -0.66055505 280.8276571071946 -32.122249485118004 8.0192863 17.739661 14 0.49234766 0.071143235 -0.65073703 121 0 0.57999998 1.5153977 -0.45131654 280.8627796588635 -32.121362506841244 8.9477502 17.620715 15 0.56777501 0.49261358 0.20024011 121 0 0.81999999 1.5082153 -0.44615834 280.83823765342385 -32.11915380564735 10.426087 17.454697 74 0.94371936 0.63395769 0.21492466 121 0 0 1.03 1.3042431 -0.28839638 280.8319521498668 -32.11866996873066 18.593922 16.826573 76 0.42426153 0.68076879 -0.10378151 121 0 0.81 2.3830041 -0.94281195 280.83322608733386 -32. 11585590581592 17.019691 16.922621 38 0.88561484 -0.17393017 0.21446348 121 0 2.47 4.3316172 -1.5916252 280.85136355300057 -32.11469638487425 49.936121 15.753963 38 0.97791567 0.27557733 -0.50220647 121 0 1.23 1.6913451 -0.57058056 280.83938504512673 -32.11405698475207 21.06393 16.691151Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started