Created
July 7, 2018 04:32
-
-
Save jmatt/0407086ed1d6d181636377180f3aecc4 to your computer and use it in GitHub Desktop.
SDSS Webda MacMinn matching for Berkeley 20
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import astropy\n", | |
"import astropy.units as u\n", | |
"\n", | |
"from astroquery.sdss import SDSS\n", | |
"\n", | |
"import numpy as np\n", | |
"\n", | |
"import pandas as pd\n", | |
"\n", | |
"from astropixie.data import SDSSRegion\n", | |
"import astropixie_widgets as aww\n", | |
"\n", | |
"aww.config.setup_notebook(debug=False)\n", | |
"\n", | |
"\n", | |
"VERSION = 7" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"query = \"\"\"\n", | |
"SELECT TOP 3200\n", | |
" p.objID,\n", | |
" p.ra,\n", | |
" p.dec,\n", | |
" p.psfMag_u,\n", | |
" p.psfMag_g,\n", | |
" p.psfMag_r,\n", | |
" p.psfMag_i,\n", | |
" p.psfMag_z,\n", | |
" p.psfMag_u AS u,\n", | |
" p.psfMag_g AS g,\n", | |
" p.psfMag_r AS r,\n", | |
" p.psfMag_i AS i,\n", | |
" p.psfMag_z AS z,\n", | |
" (p.psfMag_u - p.extinction_u) AS u_corrected,\n", | |
" (p.psfMag_g - p.extinction_g) AS g_corrected,\n", | |
" (p.psfMag_r - p.extinction_r) AS r_corrected,\n", | |
" (p.psfMag_i - p.extinction_i) AS i_corrected,\n", | |
" (p.psfMag_z - p.extinction_z) AS z_corrected,\n", | |
" p.psfMagErr_u,\n", | |
" p.psfMagErr_g,\n", | |
" p.psfMagErr_r,\n", | |
" p.psfMagErr_i,\n", | |
" p.psfMagErr_z,\n", | |
" p.flags,\n", | |
" p.skyVersion,\n", | |
" p.specObjID,\n", | |
" p.raErr,\n", | |
" p.decErr,\n", | |
" p.extinction_u,\n", | |
" p.extinction_g,\n", | |
" p.extinction_r,\n", | |
" p.extinction_i,\n", | |
" p.extinction_z,\n", | |
" p.modelMag_u,\n", | |
" p.modelMag_g,\n", | |
" p.modelMag_r,\n", | |
" p.modelMag_i,\n", | |
" p.modelMag_z,\n", | |
" p.dered_u,\n", | |
" p.dered_g,\n", | |
" p.dered_r,\n", | |
" p.dered_i,\n", | |
" p.dered_z,\n", | |
" p.flags_u,\n", | |
" case when 0 = (p.flags_u & 0x800d00000000000) then 1 else 0 end as good_u,\n", | |
" case when 0 = (p.flags_g & 0x800d00000000000) then 1 else 0 end as good_g,\n", | |
" case when 0 = (p.flags_r & 0x800d00000000000) then 1 else 0 end as good_r,\n", | |
" case when 0 = (p.flags_i & 0x800d00000000000) then 1 else 0 end as good_i,\n", | |
" case when 0 = (p.flags_z & 0x800d00000000000) then 1 else 0 end as good_z,\n", | |
" p.clean,\n", | |
" p.score\n", | |
"FROM PhotoPrimary AS p\n", | |
"JOIN dbo.fGetNearbyObjEq(83.15416667, 0.18833333, 7.24)\n", | |
" AS r ON r.objID = p.objID\n", | |
"WHERE p.probPSF = 1\n", | |
"\"\"\"\n", | |
"\n", | |
"region = SDSSRegion()\n", | |
"region.cat = region.get_cat(query)\n", | |
"\n", | |
"webda_id_col = astropy.table.Column(data=[0] * len(region.cat), name='webda_id', dtype='int64')\n", | |
"webda_V_col = astropy.table.Column(data=[0.0] * len(region.cat), name='webda_V', dtype='float64')\n", | |
"webda_V_I_col = astropy.table.Column(data=[0.0] * len(region.cat), name='webda_V_I', dtype='float64')\n", | |
"V_lupton_col = astropy.table.Column(data=[0.0] * len(region.cat), name='V_lupton', dtype='float64')\n", | |
"ra_diff_col = astropy.table.Column(data=[0.0] * len(region.cat), name='ra_diff', dtype='float64')\n", | |
"dec_diff_col = astropy.table.Column(data=[0.0] * len(region.cat), name='dec_diff', dtype='float64')\n", | |
"colnames = region.cat.colnames\n", | |
"if 'webda_id' in colnames:\n", | |
" del region.cat['webda_id']\n", | |
"if 'webda_V' in colnames:\n", | |
" del region.cat['webda_V']\n", | |
"if 'webda_V_I' in colnames:\n", | |
" del region.cat['webda_V_I']\n", | |
"if 'ra_diff' in colnames:\n", | |
" del region.cat['ra_diff']\n", | |
"if 'dec_diff' in colnames:\n", | |
" del region.cat['dec_diff']\n", | |
"if 'V_lupton' in colnames:\n", | |
" del region.cat['V_lupton']\n", | |
"region.cat.add_column(webda_id_col)\n", | |
"region.cat.add_column(webda_V_col)\n", | |
"region.cat.add_column(webda_V_I_col)\n", | |
"region.cat.add_column(V_lupton_col)\n", | |
"region.cat.add_column(ra_diff_col)\n", | |
"region.cat.add_column(dec_diff_col)\n", | |
"region.cat" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"coord_strs_source = '''\n", | |
"0001\t383\t5 32 28.192\t00 11 30.26\n", | |
"0003\t383\t5 32 37.882\t00 09 42.00\n", | |
"0006\t383\t5 32 28.229\t00 12 58.45\n", | |
"0011\t383\t5 32 36.763\t00 11 04.83\n", | |
"0016\t383\t5 32 30.995\t00 13 38.83\n", | |
"0018\t383\t5 32 29.692\t00 12 25.97\n", | |
"0025\t383\t5 32 38.997\t00 09 27.24\n", | |
"0029\t383\t5 32 42.341\t00 12 28.39\n", | |
"0041\t383\t5 32 41.368\t00 09 25.18\n", | |
"0045\t383\t5 32 29.721\t00 08 53.50\n", | |
"0058\t383\t5 32 38.405\t00 12 36.67\n", | |
"0080\t383\t5 32 28.521\t00 10 47.58\n", | |
"0084\t383\t5 32 44.212\t00 10 37.32\n", | |
"0090\t383\t5 32 46.460\t00 12 34.97\n", | |
"0093\t383\t5 32 35.225\t00 08 51.66\n", | |
"0117\t383\t5 32 46.802\t00 11 19.68\n", | |
"0165\t383\t5 32 38.759\t00 13 42.46\n", | |
"'''\n", | |
"\n", | |
"\n", | |
"def coords_source():\n", | |
" coords_source = []\n", | |
" for line in coord_strs_source.split('\\n'):\n", | |
" if line:\n", | |
" parsed = line.split('\\t')\n", | |
" ra = parsed[-2].replace(' ', ':')\n", | |
" dec = parsed[-1].replace(' ', ':')\n", | |
" coords_source.append((int(parsed[0]), '{0} {1}'.format(ra, dec)))\n", | |
" return coords_source\n", | |
"\n", | |
"\n", | |
"def create_coords(cat):\n", | |
" coords = []\n", | |
" for row in region.cat:\n", | |
" coords.append((row,\n", | |
" astropy.coordinates.SkyCoord(\n", | |
" ra=row['ra']*u.degree, \n", | |
" dec=row['dec']*u.degree,\n", | |
" frame='icrs')))\n", | |
" return coords\n", | |
"\n", | |
"def create_coords2(cat):\n", | |
" coords = []\n", | |
" for row in region.cat:\n", | |
" coords.append({'id': row['objID'],\n", | |
" 'ra': row['ra'],\n", | |
" 'dec': row['dec']})\n", | |
" return coords\n", | |
"\n", | |
"\n", | |
"coords = create_coords(region.cat)\n", | |
"coords2 = create_coords2(region.cat)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"def is_match(c1, c2, atol=1.e-4):\n", | |
" if np.isclose([c1.ra.degree], [c2.ra.degree], rtol=1.e-4, atol=atol)[0] \\\n", | |
" and np.isclose([c1.dec.degree], [c2.dec.degree], rtol=1.e-4, atol=atol)[0]:\n", | |
" return True\n", | |
"\n", | |
" \n", | |
"def match_coord(coord_str):\n", | |
" \"\"\"Return a list of tuples with the SDSS objID and row for objects close to the coord_str location.\"\"\"\n", | |
" coord = astropy.coordinates.SkyCoord(coord_str, unit=(u.hourangle, u.deg), frame='icrs')\n", | |
" matches = []\n", | |
" for row, c in coords:\n", | |
" match = is_match(coord, c)\n", | |
" if match:\n", | |
" matches.append(row['objID'])\n", | |
" matches_row = []\n", | |
" for row in region.cat:\n", | |
" if row['objID'] in matches:\n", | |
" matches_row.append(row)\n", | |
" return matches_row\n", | |
"\n", | |
"\n", | |
"def match_coords():\n", | |
" rows = []\n", | |
" for webda_id, c in coords_source():\n", | |
" rows.append((webda_id, match_coord(c)))\n", | |
" return rows\n", | |
"\n", | |
"mcs = match_coords()\n", | |
"len(mcs)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"# Identify potentially bad rows.\n", | |
"bad_objids = []\n", | |
"potentially_bad_objids = []\n", | |
"for row in region.cat:\n", | |
" if row['clean'] != 1:\n", | |
" good_phot = row['good_u'] & row['good_g'] & row['good_r']\n", | |
" if not good_phot:\n", | |
" bad_objids.append(row['objID'])\n", | |
" else:\n", | |
" potentially_bad_objids.append(row['objID'])\n", | |
"#len(potentially_bad_objids)\n", | |
"len(bad_objids)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"macminn_dat_str = ''' 0001 577.2 68.7 13.331 0.580\n", | |
" 0002 188.4 64.2 13.596 0.718\n", | |
" 0003 223.9 546.3 13.682 1.034\n", | |
" 0004 580.1 622.4 14.318 0.730\n", | |
" 0005 511.4 549.2 14.798 1.488\n", | |
" 0006 866.5 68.6 14.929 0.861\n", | |
" 0007 567.5 450.1 15.024 0.968\n", | |
" 0008 546.9 598.4 15.154 1.427\n", | |
" 0009 488.8 166.4 15.316 0.870\n", | |
" 0010 385.0 612.3 15.756 1.213\n", | |
" 0011 495.5 490.8 16.177 1.248\n", | |
" 0012 292.5 727.9 16.209 1.278\n", | |
" 0013 791.9 404.3 16.226 0.627\n", | |
" 0014 292.5 727.9 16.243 -0.669\n", | |
" 0015 543.3 505.6 16.362 1.120\n", | |
" 0016 999.5 204.3 16.525 0.888\n", | |
" 0017 548.4 406.6 16.531 0.874\n", | |
" 0018 760.4 141.2 16.571 0.838\n", | |
" 0019 413.4 346.3 16.707 0.741\n", | |
" 0020 510.5 465.6 16.871 0.458\n", | |
" 0021 478.5 510.7 16.891 0.752\n", | |
" 0022 642.1 495.8 16.904 1.181\n", | |
" 0023 526.4 466.7 16.908 0.284\n", | |
" 0024 529.1 519.9 16.954 0.535\n", | |
" 0025 175.7 602.1 16.959 0.802\n", | |
" 0026 202.3 91.5 17.036 1.318\n", | |
" 0027 198.9 316.7 17.073 1.197\n", | |
" 0028 536.0 557.7 17.111 1.158\n", | |
" 0029 774.4 763.1 17.140 1.129\n", | |
" 0030 534.4 269.2 17.199 1.147\n", | |
" 0031 470.8 406.0 17.351 1.135\n", | |
" 0032 449.5 249.8 17.398 0.600\n", | |
" 0033 678.4 501.9 17.433 1.151\n", | |
" 0034 614.0 435.8 17.469 1.136\n", | |
" 0035 790.6 334.5 17.487 0.817\n", | |
" 0036 414.1 375.7 17.496 0.378\n", | |
" 0037 456.8 318.5 17.511 1.126\n", | |
" 0038 263.6 497.1 17.561 1.025\n", | |
" 0039 601.9 329.4 17.606 1.135\n", | |
" 0040 544.2 444.6 17.622 0.594\n", | |
" 0041 169.4 718.9 17.632 1.398\n", | |
" 0042 564.3 471.5 17.679 1.126\n", | |
" 0043 579.7 383.4 17.679 0.417\n", | |
" 0044 540.6 556.0 17.692 0.796\n", | |
" 0045 63.1 145.5 17.692 1.278\n", | |
" 0046 857.5 11.7 17.767 0.966\n", | |
" 0047 396.5 441.0 17.849 0.367\n", | |
" 0048 99.3 557.2 17.869 0.774\n", | |
" 0049 517.3 535.2 17.910 0.815\n", | |
" 0050 446.7 407.8 17.952 0.737\n", | |
" 0051 328.2 841.7 17.973 2.013\n", | |
" 0052 28.7 976.3 17.981 1.324\n", | |
" 0053 254.0 538.9 18.023 0.596\n", | |
" 0054 500.0 295.0 18.073 0.745\n", | |
" 0055 262.8 228.6 18.103 0.825\n", | |
" 0056 513.4 605.8 18.105 0.785\n", | |
" 0057 400.0 420.3 18.110 0.784\n", | |
" 0058 797.3 569.6 18.123 0.800\n", | |
" 0059 297.3 336.7 18.124 0.895\n", | |
" 0060 540.8 514.1 18.127 0.846\n", | |
" 0061 629.5 429.3 18.148 0.837\n", | |
" 0062 482.6 489.7 18.154 0.796\n", | |
" 0063 538.9 538.1 18.167 0.814\n", | |
" 0064 521.7 470.6 18.178 0.729\n", | |
" 0065 403.4 271.6 18.200 0.769\n", | |
" 0066 678.4 209.1 18.207 1.106\n", | |
" 0067 577.9 429.2 18.209 0.935\n", | |
" 0068 349.4 107.5 18.228 1.036\n", | |
" 0069 402.9 209.3 18.236 0.738\n", | |
" 0070 82.1 546.3 18.240 0.761\n", | |
" 0071 625.4 425.4 18.241 0.796\n", | |
" 0072 820.6 142.8 18.246 0.961\n", | |
" 0073 615.1 647.3 18.252 0.841\n", | |
" 0074 537.8 605.2 18.260 0.860\n", | |
" 0075 580.9 864.5 18.264 0.957\n", | |
" 0076 656.3 517.6 18.266 0.783\n", | |
" 0077 623.9 391.4 18.270 0.798\n", | |
" 0078 389.3 436.2 18.278 0.746\n", | |
" 0079 624.7 646.8 18.286 0.829\n", | |
" 0080 436.9 84.9 18.292 0.968\n", | |
" 0081 396.2 256.8 18.303 0.764\n", | |
" 0082 303.2 618.4 18.311 0.821\n", | |
" 0083 584.9 474.6 18.319 0.883\n", | |
" 0084 407.1 857.0 18.323 1.282\n", | |
" 0085 393.5 658.7 18.341 0.772\n", | |
" 0086 529.4 377.1 18.363 0.733\n", | |
" 0087 761.0 359.0 18.366 0.802\n", | |
" 0088 598.9 573.5 18.405 0.679\n", | |
" 0089 778.5 524.0 18.407 0.781\n", | |
" 0090 793.8 967.2 18.425 1.127\n", | |
" 0091 510.7 541.7 18.431 0.986\n", | |
" 0092 579.5 569.5 18.437 0.753\n", | |
" 0093 58.4 416.3 18.437 0.775\n", | |
" 0094 676.0 297.9 18.453 0.760\n", | |
" 0095 456.8 603.3 18.472 0.754\n", | |
" 0096 658.9 500.0 18.494 0.799\n", | |
" 0097 462.3 630.3 18.500 0.772\n", | |
" 0098 749.7 636.3 18.509 0.795\n", | |
" 0099 602.7 753.1 18.528 1.186\n", | |
" 0100 253.5 651.1 18.532 2.179\n", | |
" 0101 30.9 237.2 18.565 1.27\n", | |
" 0102 574.0 259.5 18.580 0.738\n", | |
" 0103 8.9 854.0 18.595 0.802\n", | |
" 0104 423.9 391.6 18.596 0.729\n", | |
" 0105 518.5 485.0 18.597 0.727\n", | |
" 0106 531.2 714.8 18.611 0.880\n", | |
" 0107 354.9 144.8 18.621 0.766\n", | |
" 0108 516.5 447.5 18.659 0.722\n", | |
" 0109 560.5 150.0 18.673 0.877\n", | |
" 0110 679.3 542.9 18.683 0.755\n", | |
" 0111 668.3 414.7 18.687 0.734\n", | |
" 0112 93.9 412.1 18.697 1.352\n", | |
" 0113 370.6 383.1 18.704 0.706\n", | |
" 0114 548.2 884.9 18.708 1.045\n", | |
" 0115 718.0 265.9 18.729 0.761\n", | |
" 0116 643.3 389.7 18.751 2.235\n", | |
" 0117 546.5 985.2 18.758 2.685\n", | |
" 0118 533.7 498.7 18.773 0.801\n", | |
" 0119 275.3 387.0 18.785 0.770\n", | |
" 0120 669.9 551.9 18.789 0.760\n", | |
" 0121 684.7 340.6 18.810 0.684\n", | |
" 0122 587.8 293.7 18.811 0.726\n", | |
" 0123 441.8 489.0 18.814 0.736\n", | |
" 0124 330.3 817.2 18.832 1.061\n", | |
" 0125 399.7 450.0 18.838 0.744\n", | |
" 0126 777.5 191.8 18.841 0.767\n", | |
" 0127 213.4 567.0 18.843 0.801\n", | |
" 0128 323.0 514.5 18.849 0.758\n", | |
" 0129 487.6 566.1 18.853 0.482\n", | |
" 0130 474.8 541.9 18.856 0.996\n", | |
" 0131 269.8 567.2 18.859 0.765\n", | |
" 0132 563.5 479.5 18.864 0.710\n", | |
" 0133 571.6 522.5 18.868 0.797\n", | |
" 0134 441.2 340.4 18.894 0.756\n", | |
" 0135 570.3 575.4 18.900 0.785\n", | |
" 0136 523.5 475.6 18.916 0.838\n", | |
" 0137 358.3 381.6 18.923 0.791\n", | |
" 0138 244.2 28.0 18.929 0.881\n", | |
" 0139 416.9 658.9 18.939 0.768\n", | |
" 0140 509.2 475.1 18.943 0.772\n", | |
" 0141 125.6 476.7 18.947 0.823\n", | |
" 0142 672.3 844.9 18.947 1.205\n", | |
" 0143 608.4 331.3 18.965 0.903\n", | |
" 0144 957.7 542.2 18.969 1.163\n", | |
" 0145 247.7 711.5 18.997 1.827\n", | |
" 0146 611.3 544.2 19.015 0.877\n", | |
" 0147 473.9 440.4 19.034 0.745\n", | |
" 0148 340.3 476.2 19.036 0.785\n", | |
" 0149 589.9 145.0 19.046 1.217\n", | |
" 0150 394.0 933.2 19.052 0.876\n", | |
" 0151 932.3 105.5 19.055 1.587\n", | |
" 0152 389.6 493.8 19.068 0.743\n", | |
" 0153 62.6 322.3 19.078 0.726\n", | |
" 0154 224.9 979.8 19.085 1.310\n", | |
" 0155 29.1 973.3 19.085 -0.772\n", | |
" 0156 168.8 410.9 19.109 0.832\n", | |
" 0157 488.7 464.1 19.114 0.801\n", | |
" 0158 523.0 483.1 19.123 0.806\n", | |
" 0159 761.2 493.8 19.124 1.113\n", | |
" 0160 808.3 434.6 19.129 0.926\n", | |
" 0161 207.8 72.2 19.133 3.231\n", | |
" 0162 787.3 330.8 19.138 0.763\n", | |
" 0163 296.1 181.8 19.168 0.838\n", | |
" 0164 788.5 125.7 19.171 1.938\n", | |
" 0165 1013.4 586.93 19.186 1.442\n", | |
" 0166 660.8 491.519 19.191 0.792\n", | |
" 0167 472.1 540.965 19.210 0.422\n", | |
" 0168 628.9 434.197 19.212 1.048\n", | |
" 0169 505.7 496.455 19.220 0.803\n", | |
" 0170 676.6 362.076 19.242 0.820\n", | |
" 0171 679.2 215.839 19.265 0.751\n", | |
" 0172 465.7 248.155 19.280 0.769\n", | |
" 0173 749.2 365.309 19.289 0.805\n", | |
" 0174 463.3 471.362 19.307 0.763\n", | |
" 0175 422.9 634.475 19.308 1.068\n", | |
" 0176 816.3 203.371 19.311 0.827\n", | |
" 0177 408.7 275.421 19.317 0.800\n", | |
" 0178 568.7 288.991 19.327 0.757\n", | |
" 0179 776.3 738.568 19.327 1.601\n", | |
" 0180 603.5 606.161 19.336 0.940\n", | |
" 0181 377.2 1010.14 19.338 2.466\n", | |
" 0182 510.8 397.755 19.339 0.832\n", | |
" 0183 521.6 748.791 19.342 1.057\n", | |
" 0184 490.5 564.065 19.348 0.794\n", | |
" 0185 812.3 756.309 19.359 0.834\n", | |
" 0186 454.017 378.646 19.361 0.774\n", | |
" 0187 509.978 491.109 19.367 0.809\n", | |
" 0188 566.808 492.675 19.406 0.833\n", | |
" 0189 725.587 431.861 19.423 0.861\n", | |
" 0190 836.775 795.983 19.424 1.783\n", | |
" 0191 702.863 313.839 19.441 0.790\n", | |
" 0192 391.491 564.507 19.460 0.803\n", | |
" 0193 236.851 700.948 19.465 0.899\n", | |
" 0194 945.117 297.258 19.491 0.844\n", | |
" 0195 868.295 268.568 19.495 0.898\n", | |
" 0196 471.438 627.751 19.505 0.799\n", | |
" 0197 100.801 124.834 19.507 1.016\n", | |
" 0198 980.362 639.356 19.518 1.408\n", | |
" 0199 629.316 834.558 19.518 1.183\n", | |
" 0200 632.844 516.271 19.552 0.827\n", | |
" 0201 289.649 783.135 19.554 0.863\n", | |
" 0202 614.976 801.15 19.557 0.841\n", | |
" 0203 350.069 261.878 19.565 0.786\n", | |
" 0204 547.975 445.649 19.571 0.801\n", | |
" 0205 608.492 417.19 19.574 0.868\n", | |
" 0206 907.931 924.381 19.607 1.178\n", | |
" 0207 662.68 353.712 19.620 0.875\n", | |
" 0208 605.845 479.598 19.621 0.806\n", | |
" 0209 162.848 371.422 19.621 1.164\n", | |
" 0210 453.005 340.839 19.622 0.842\n", | |
" 0211 795.591 391.393 19.631 1.662\n", | |
" 0212 714.398 97.052 19.631 0.982\n", | |
" 0213 356.317 992.699 19.638 0.511\n", | |
" 0214 39.666 730.617 19.647 0.899\n", | |
" 0215 336.627 520.173 19.669 0.890\n", | |
" 0216 307.929 838.373 19.674 0.994\n", | |
" 0217 214.262 816.425 19.685 1.927\n", | |
" 0218 650.21 899.237 19.699 0.871\n", | |
" 0219 41.008 619.532 19.711 1.211\n", | |
" 0220 303.364 535.074 19.721 0.804\n", | |
" 0221 884.03 599.149 19.739 0.915\n", | |
" 0222 633.461 962.639 19.753 1.277\n", | |
" 0223 270.183 728.866 19.766 0.839\n", | |
" 0224 190.004 839.339 19.770 0.888\n", | |
" 0225 850.603 305.777 19.771 0.867\n", | |
" 0226 609.818 294.833 19.774 0.904\n", | |
" 0227 119.696 344.659 19.774 0.799\n", | |
" 0228 474.717 457.608 19.791 0.843\n", | |
" 0229 681.133 803.976 19.794 0.944\n", | |
" 0230 671.496 284.415 19.796 1.892\n", | |
" 0231 768.937 486.074 19.800 1.326\n", | |
" 0232 671.496 284.415 19.801 1.611\n", | |
" 0233 683.689 103.414 19.802 0.886\n", | |
" 0234 629.133 444.234 19.829 0.823\n", | |
" 0235 840.806 980.633 19.831 1.093\n", | |
" 0236 429.337 472.887 19.831 0.827\n", | |
" 0237 363.062 428.678 19.835 0.807\n", | |
" 0238 890.703 473.568 19.837 0.927\n", | |
" 0239 730.862 279.342 19.842 2.448\n", | |
" 0240 503.644 569.002 19.873 0.845\n", | |
" 0241 531.645 451.352 19.874 0.953\n", | |
" 0242 372.679 764.366 19.875 0.868\n", | |
" 0243 144.156 934.352 19.880 0.898\n", | |
" 0244 280.704 648.553 19.884 0.881\n", | |
" 0245 326.026 657.86 19.898 0.953\n", | |
" 0246 650.996 300.297 19.908 0.895\n", | |
" 0247 793.088 485.996 19.908 1.064\n", | |
" 0248 526.12 458.184 19.914 0.971\n", | |
" 0249 244.826 645.354 19.935 0.942\n", | |
" 0250 830.884 371.494 19.938 0.868\n", | |
" 0251 839.706 338.621 19.938 0.883\n", | |
" 0252 665.842 254.807 19.964 0.841\n", | |
" 0253 751.054 610.88 19.966 0.956\n", | |
" 0254 306.975 317.116 19.973 0.832\n", | |
" 0255 655.969 432.906 19.974 0.794\n", | |
" 0256 420.318 604.627 19.986 2.211\n", | |
" 0257 369.584 602.954 19.989 0.971\n", | |
" 0258 485.668 660.422 19.991 0.845\n", | |
" 0259 909.801 740.719 20.015 1.689\n", | |
" 0260 899.657 575.7 20.023 0.867\n", | |
" 0261 225.082 977.079 20.027 0.528\n", | |
" 0262 438.605 395.275 20.032 0.783\n", | |
" 0263 914.029 739.145 20.034 0.365\n", | |
" 0264 291.726 575.844 20.038 0.888\n", | |
" 0265 914.029 739.145 20.040 -0.005\n", | |
" 0266 688.52 489.719 20.043 0.901\n", | |
" 0267 710.588 616.605 20.044 0.859\n", | |
" 0268 273.446 971.03 20.051 1.043\n", | |
" 0269 644.668 279.335 20.054 2.617\n", | |
" 0270 800.879 994.51 20.055 1.076\n", | |
" 0271 501.697 185.805 20.057 0.864\n", | |
" 0272 21.575 957.909 20.060 1.038\n", | |
" 0273 753.167 53.87 20.061 1.022\n", | |
" 0274 418.422 476.94 20.088 0.825\n", | |
" 0275 416.765 935.674 20.116 0.925\n", | |
" 0276 356.274 688.929 20.123 0.970\n", | |
" 0277 595.754 483.865 20.130 0.853\n", | |
" 0278 669.372 333.478 20.143 0.893\n", | |
" 0279 572.36 29.86 20.148 0.846\n", | |
" 0280 243.789 757.15 20.155 0.949\n", | |
" 0281 559.539 668.768 20.158 0.917\n", | |
" 0282 543.348 751.539 20.175 0.930\n", | |
" 0283 907.535 368.369 20.177 0.907\n", | |
" 0284 644.207 618.528 20.191 0.830\n", | |
" 0285 517.884 765.026 20.194 0.927\n", | |
" 0286 334.516 781.07 20.206 1.069\n", | |
" 0287 950.294 78.806 20.215 0.939\n", | |
" 0288 62.19 763.442 20.215 1.293\n", | |
" 0289 507.246 341.738 20.217 0.853\n", | |
" 0290 539.832 394.912 20.226 0.982\n", | |
" 0291 980.99 534.348 20.257 1.632\n", | |
" 0292 558. 537.109 20.274 0.985\n", | |
" 0293 678.679 704.699 20.276 0.912\n", | |
" 0294 271.654 285.077 20.299 0.894\n", | |
" 0295 995.228 735.899 20.303 0.977\n", | |
" 0296 473.48 570.896 20.308 0.862\n", | |
" 0297 444.824 496.429 20.312 0.890\n", | |
" 0298 25.522 485.876 20.319 0.840\n", | |
" 0299 459.198 457.356 20.324 0.855\n", | |
" 0300 729.872 443.808 20.337 0.926\n", | |
" 0301 317.029 529.489 20.357 0.954\n", | |
" 0302 559.055 313.351 20.373 1.019\n", | |
" 0303 241.791 616.679 20.374 0.953\n", | |
" 0304 633.679 533.742 20.422 0.929\n", | |
" 0305 386.204 652.065 20.425 0.950\n", | |
" 0306 1008.77 626.34 20.464 0.965\n", | |
" 0307 576.135 579.398 20.485 0.928\n", | |
" 0308 715.605 571.991 20.488 0.946\n", | |
" 0309 669.755 100.552 20.495 1.792\n", | |
" 0310 520.592 422.116 20.519 0.994\n", | |
" 0311 709.011 156.416 20.539 0.947\n", | |
" 0312 892.723 850.874 20.549 1.080\n", | |
" 0313 471.467 55.817 20.568 0.914\n", | |
" 0314 126.637 979.961 20.578 2.088\n", | |
" 0315 164.082 742.485 20.584 1.102\n", | |
" 0316 553.044 1015.01 20.594 1.001\n", | |
" 0317 343.101 114.154 20.599 2.788\n", | |
" 0318 837.804 175.775 20.599 1.159\n", | |
" 0319 511.085 380.282 20.617 1.068\n", | |
" 0320 518.278 456.289 20.707 1.014\n", | |
" 0321 657.941 354.791 20.724 0.954\n", | |
" 0322 61.681 247.995 20.728 2.263\n", | |
" 0323 563.237 518.146 20.732 0.926\n", | |
" 0324 306.519 730.848 20.739 1.227\n", | |
" 0325 120.741 181.482 20.754 1.350\n", | |
" 0326 557.871 491.038 20.759 1.025\n", | |
" 0327 617.932 704.527 20.760 1.156\n", | |
" 0328 378.456 414.731 20.772 1.002\n", | |
" 0329 356.539 995.089 20.800 1.455\n", | |
" 0330 659.086 431.414 20.807 1.058\n", | |
" 0331 826.517 541.985 20.842 1.071\n", | |
" 0332 576.207 754.766 20.847 0.996\n", | |
" 0333 739.863 809.372 20.850 1.859\n", | |
" 0334 860.892 956.711 20.854 2.237\n", | |
" 0335 589.649 590.732 20.875 1.164\n", | |
" 0336 455.887 616.781 20.910 1.111\n", | |
" 0337 998.799 522.662 20.916 1.212\n", | |
" 0338 844.171 367.729 20.925 1.037\n", | |
" 0339 156.204 276.807 20.941 1.793\n", | |
" 0340 686.153 164.643 20.955 1.018\n", | |
" 0341 899.338 927.256 20.961 1.061\n", | |
" 0342 540.396 157.251 20.964 1.183\n", | |
" 0343 435.201 568.924 20.965 1.241\n", | |
" 0344 390.051 416.594 20.966 2.135\n", | |
" 0345 705.455 418.541 20.967 0.994\n", | |
" 0346 1017.05 124.43 20.971 1.024\n", | |
" 0347 420.313 253.844 20.979 0.977\n", | |
" 0348 870.386 7.173 20.984 1.402\n", | |
" 0349 24.954 233.159 20.999 1.085\n", | |
" 0350 719.895 608.573 21.021 0.960\n", | |
" 0351 328.048 769.524 21.021 1.966\n", | |
" 0352 397.95 595.733 21.045 1.043\n", | |
" 0353 435.814 397.808 21.048 1.188\n", | |
" 0354 731.578 39.485 21.059 1.047\n", | |
" 0355 486.112 209.85 21.066 1.142\n", | |
" 0356 422.244 761.847 21.073 1.100\n", | |
" 0357 854.379 261.7 21.088 2.478\n", | |
" 0358 424.334 452.648 21.093 1.014\n", | |
" 0359 64.723 615.221 21.096 1.118\n", | |
" 0360 1004.47 604.993 21.103 1.127\n", | |
" 0361 639.979 162.54 21.122 1.042\n", | |
" 0362 552.325 528.605 21.122 1.221\n", | |
" 0363 288.015 603.776 21.143 1.014\n", | |
" 0364 171.078 535.451 21.219 1.110\n", | |
" 0365 230.552 112.869 21.221 0.818\n", | |
" 0366 982.319 469.005 21.221 2.722\n", | |
" 0367 123.103 875.365 21.228 3.000\n", | |
" 0368 94.178 424.645 21.235 0.913\n", | |
" 0369 657.365 684.162 21.237 1.174\n", | |
" 0370 420.347 357.33 21.255 1.100\n", | |
" 0371 535.282 320.686 21.255 1.050\n", | |
" 0372 519.96 518.542 21.276 1.162\n", | |
" 0373 99.567 871.698 21.287 0.689\n", | |
" 0374 862.493 379.628 21.303 2.118\n", | |
" 0375 651.431 319.274 21.307 1.039\n", | |
" 0376 737.89 629.573 21.330 0.797\n", | |
" 0377 522.4 498.5 21.334 2.352\n", | |
" 0378 983.728 198.466 21.340 1.383\n", | |
" 0379 236.058 596.454 21.380 1.099\n", | |
" 0380 657.91 382.606 21.383 2.973\n", | |
" 0381 506.674 466.813 21.429 1.320\n", | |
" 0382 79.941 288.094 21.446 1.124\n", | |
" 0383 982.933 476.318 21.455 1.261\n", | |
" 0384 98.218 78.499 21.472 1.199\n", | |
" 0385 192.102 625.981 21.505 1.264\n", | |
" 0386 300.658 303.891 21.508 1.163\n", | |
" 0387 715.741 210.975 21.509 1.171\n", | |
" 0388 936.084 341.707 21.520 1.903\n", | |
" 0389 718.121 382.404 21.521 2.410\n", | |
" 0390 525.207 354.194 21.531 1.153\n", | |
" 0391 166.503 772.303 21.542 1.138\n", | |
" 0392 602.201 280.156 21.544 0.911\n", | |
" 0393 154.234 78.065 21.555 1.137\n", | |
" 0394 523.556 339.173 21.559 1.038\n", | |
" 0395 916.621 530.065 21.561 1.193\n", | |
" 0396 413.349 327.311 21.572 1.260\n", | |
" 0397 537.437 476.869 21.584 1.026\n", | |
" 0398 983.233 491.748 21.588 1.188\n", | |
" 0399 602.476 502.392 21.591 0.959\n", | |
" 0400 173.542 1010.92 21.620 2.482\n", | |
" 0401 276.055 1017.37 21.631 1.067\n", | |
" 0402 438.96 165.558 21.647 1.136\n", | |
" 0403 315.614 407.014 21.661 1.787\n", | |
" 0404 515.6 439.024 21.663 1.030\n", | |
" 0405 461.975 334.568 21.666 1.202\n", | |
" 0406 438.218 378.75 21.691 2.580\n", | |
" 0407 673.955 166.541 21.693 1.646\n", | |
" 0408 215.06 398.492 21.724 1.307\n", | |
" 0409 741.809 354.151 21.732 1.238\n", | |
" 0410 71.799 754.333 21.784 1.120\n", | |
" 0411 491.6 352.62 21.785 1.136\n", | |
" 0412 904.196 775.724 21.813 1.233\n", | |
" 0413 11.656 835.098 21.814 1.292\n", | |
" 0414 448.985 562.515 21.820 1.487\n", | |
" 0415 419.585 608.453 21.823 1.212\n", | |
" 0416 908.682 276.158 21.863 3.017\n", | |
" 0417 549.456 173.26 21.865 1.771\n", | |
" 0418 455.487 898.283 21.884 1.302\n", | |
" 0419 263.443 508.431 21.886 1.252\n", | |
" 0420 550.949 491.556 21.888 1.168\n", | |
" 0421 79.835 389.321 21.904 1.218\n", | |
" 0422 456.685 678.179 21.952 2.777\n", | |
" 0423 566.941 393.581 21.954 1.256\n", | |
" 0424 922.832 801.582 21.983 2.107\n", | |
" 0425 854.636 970.685 21.985 2.091\n", | |
" 0426 641.29 135.045 21.994 1.280\n", | |
" 0427 419.738 43.138 22.095 1.376\n", | |
" 0428 950.933 26.661 22.150 3.438\n", | |
" 0429 193.064 919.366 22.157 2.217\n", | |
"'''\n", | |
"\n", | |
"\n", | |
"macminn_dat = [l.split() for l in macminn_dat_str.split('\\n') if l]\n", | |
"macminn_dat = [{'webda': int(l[0]), 'x': float(l[1]), 'y': float(l[2]), 'V': float(l[3]), 'V_I': float(l[4])} for l in macminn_dat]\n", | |
"\n", | |
"\n", | |
"mcs_ones = []\n", | |
"\n", | |
"\n", | |
"for m in mcs:\n", | |
" if m[1]:\n", | |
" mcs_ones.append((m[0], m[1][0]))\n", | |
"mcs_ones\n", | |
"\n", | |
"cross = []\n", | |
"for id_, sdss_row in mcs_ones:\n", | |
" macminn_ = macminn_dat[id_ - 1]\n", | |
" for c in sdss_row.columns:\n", | |
" macminn_[c] = sdss_row[c]\n", | |
" cross.append(macminn_)\n", | |
"\n", | |
"cross" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"webda_xy_str = \"\"\"\n", | |
"0001\t13.33\t-422.10\t81.7\n", | |
"0002\t13.60\t-426.60\t-307.1\n", | |
"0003\t13.68\t55.50\t-271.6\n", | |
"0004\t14.32\t131.60\t84.6\n", | |
"0005\t14.80\t58.40\t15.9\n", | |
"0006\t14.93\t-422.20\t371\n", | |
"0007\t15.02\t-40.70\t72\n", | |
"0008\t15.15\t107.60\t51.4\n", | |
"0009\t15.32\t-324.40\t-6.7\n", | |
"0010\t15.76\t121.50\t-110.5\n", | |
"0011\t16.18\t0.00\t0\n", | |
"0012\t16.21\t237.10\t-203\n", | |
"0013\t16.23\t-86.50\t296.4\n", | |
"0014\t16.24\t237.10\t-203\n", | |
"0015\t16.36\t14.80\t47.8\n", | |
"0016\t16.52\t-286.50\t504\n", | |
"0017\t16.53\t-84.20\t52.9\n", | |
"0018\t16.57\t-349.60\t264.9\n", | |
"0019\t16.71\t-144.50\t-82.1\n", | |
"0020\t16.87\t-25.20\t15\n", | |
"0021\t16.89\t19.90\t-17\n", | |
"0022\t16.90\t5.00\t146.6\n", | |
"0023\t16.91\t-24.10\t30.9\n", | |
"0024\t16.95\t29.10\t33.6\n", | |
"0025\t16.96\t111.30\t-319.8\n", | |
"0026\t17.04\t-399.30\t-293.2\n", | |
"0027\t17.07\t-174.10\t-296.6\n", | |
"0028\t17.11\t66.90\t40.5\n", | |
"0029\t17.14\t272.30\t278.9\n", | |
"0030\t17.20\t-221.60\t38.9\n", | |
"0031\t17.35\t-84.80\t-24.7\n", | |
"0032\t17.40\t-241.00\t-46\n", | |
"0033\t17.43\t11.10\t182.9\n", | |
"0034\t17.47\t-55.00\t118.5\n", | |
"0035\t17.49\t-156.30\t295.1\n", | |
"0036\t17.50\t-115.10\t-81.4\n", | |
"0037\t17.51\t-172.30\t-38.7\n", | |
"0038\t17.56\t6.30\t-231.9\n", | |
"0039\t17.61\t-161.40\t106.4\n", | |
"0040\t17.62\t-46.20\t48.7\n", | |
"0041\t17.63\t228.10\t-326.1\n", | |
"0042\t17.68\t-19.30\t68.8\n", | |
"0043\t17.68\t-107.40\t84.2\n", | |
"0044\t17.69\t65.20\t45.1\n", | |
"0045\t17.69\t-345.30\t-432.4\n", | |
"0046\t17.77\t-479.10\t362\n", | |
"0047\t17.85\t-49.80\t-99\n", | |
"0048\t17.87\t66.40\t-396.2\n", | |
"0049\t17.91\t44.40\t21.8\n", | |
"0050\t17.95\t-83.00\t-48.8\n", | |
"0051\t17.97\t350.90\t-167.3\n", | |
"0052\t17.98\t485.50\t-466.8\n", | |
"0053\t18.02\t48.10\t-241.5\n", | |
"0054\t18.07\t-195.80\t4.5\n", | |
"0055\t18.10\t-262.20\t-232.7\n", | |
"0056\t18.11\t115.00\t17.9\n", | |
"0057\t18.11\t-70.50\t-95.5\n", | |
"0058\t18.12\t78.80\t301.8\n", | |
"0059\t18.12\t-154.10\t-198.2\n", | |
"0060\t18.13\t23.30\t45.3\n", | |
"0061\t18.15\t-61.50\t134\n", | |
"0062\t18.15\t-1.10\t-12.9\n", | |
"0063\t18.17\t47.30\t43.4\n", | |
"0064\t18.18\t-20.20\t26.2\n", | |
"0065\t18.20\t-219.20\t-92.1\n", | |
"0066\t18.21\t-281.70\t182.9\n", | |
"0067\t18.21\t-61.60\t82.4\n", | |
"0068\t18.23\t-383.30\t-146.1\n", | |
"0069\t18.24\t-281.50\t-92.6\n", | |
"0070\t18.24\t55.50\t-413.4\n", | |
"0071\t18.24\t-65.40\t129.9\n", | |
"0072\t18.25\t-348.00\t325.1\n", | |
"0073\t18.25\t156.50\t119.6\n", | |
"0074\t18.26\t114.40\t42.3\n", | |
"0075\t18.26\t373.70\t85.4\n", | |
"0076\t18.27\t26.80\t160.8\n", | |
"0077\t18.27\t-99.40\t128.4\n", | |
"0078\t18.28\t-54.60\t-106.2\n", | |
"0079\t18.29\t156.00\t129.2\n", | |
"0080\t18.29\t-405.90\t-58.6\n", | |
"0081\t18.30\t-234.00\t-99.3\n", | |
"0082\t18.31\t127.60\t-192.3\n", | |
"0083\t18.32\t-16.20\t89.4\n", | |
"0084\t18.32\t366.20\t-88.4\n", | |
"0085\t18.34\t167.90\t-102\n", | |
"0086\t18.36\t-113.70\t33.9\n", | |
"0087\t18.37\t-131.80\t265.5\n", | |
"0088\t18.41\t82.70\t103.4\n", | |
"0089\t18.41\t33.20\t283\n", | |
"0090\t18.43\t476.40\t298.3\n", | |
"0091\t18.43\t50.90\t15.2\n", | |
"0092\t18.44\t78.70\t84\n", | |
"0093\t18.44\t-74.50\t-437.1\n", | |
"0094\t18.45\t-192.90\t180.5\n", | |
"0095\t18.47\t112.50\t-38.7\n", | |
"0096\t18.49\t9.20\t163.4\n", | |
"0097\t18.50\t139.50\t-33.2\n", | |
"0098\t18.51\t145.50\t254.2\n", | |
"0099\t18.53\t262.30\t107.2\n", | |
"0100\t18.53\t160.30\t-242\n", | |
"0101\t18.57\t-253.60\t-464.6\n", | |
"0102\t18.58\t-231.30\t78.5\n", | |
"0103\t18.59\t363.20\t-486.6\n", | |
"0104\t18.60\t-99.20\t-71.6\n", | |
"0105\t18.60\t-5.80\t23\n", | |
"0106\t18.61\t224.00\t35.7\n", | |
"0107\t18.62\t-346.00\t-140.6\n", | |
"0108\t18.66\t-43.30\t21\n", | |
"0109\t18.67\t-340.80\t65\n", | |
"0110\t18.68\t52.10\t183.8\n", | |
"0111\t18.69\t-76.10\t172.8\n", | |
"0112\t18.70\t-78.70\t-401.6\n", | |
"0113\t18.70\t-107.70\t-124.9\n", | |
"0114\t18.71\t394.10\t52.7\n", | |
"0115\t18.73\t-224.90\t222.5\n", | |
"0116\t18.75\t-101.10\t147.8\n", | |
"0117\t18.76\t494.40\t51\n", | |
"0118\t18.77\t7.90\t38.2\n", | |
"0119\t18.79\t-103.80\t-220.2\n", | |
"0120\t18.79\t61.10\t174.4\n", | |
"0121\t18.81\t-150.20\t189.2\n", | |
"0122\t18.81\t-197.10\t92.3\n", | |
"0123\t18.81\t-1.80\t-53.7\n", | |
"0124\t18.83\t326.40\t-165.2\n", | |
"0125\t18.84\t-40.80\t-95.8\n", | |
"0126\t18.84\t-299.00\t282\n", | |
"0127\t18.84\t76.20\t-282.1\n", | |
"0128\t18.85\t23.70\t-172.5\n", | |
"0129\t18.85\t75.30\t-7.9\n", | |
"0130\t18.86\t51.10\t-20.7\n", | |
"0131\t18.86\t76.40\t-225.7\n", | |
"0132\t18.86\t-11.30\t68\n", | |
"0133\t18.87\t31.70\t76.1\n", | |
"0134\t18.89\t-150.40\t-54.3\n", | |
"0135\t18.90\t84.60\t74.8\n", | |
"0136\t18.92\t-15.20\t28\n", | |
"0137\t18.92\t-109.20\t-137.2\n", | |
"0138\t18.93\t-462.80\t-251.3\n", | |
"0139\t18.94\t168.10\t-78.6\n", | |
"0140\t18.94\t-15.70\t13.7\n", | |
"0141\t18.95\t-14.10\t-369.9\n", | |
"0142\t18.95\t354.10\t176.8\n", | |
"0143\t18.96\t-159.50\t112.9\n", | |
"0144\t18.97\t51.40\t462.2\n", | |
"0145\t19.00\t220.70\t-247.8\n", | |
"0146\t19.02\t53.40\t115.8\n", | |
"0147\t19.03\t-50.40\t-21.6\n", | |
"0148\t19.04\t-14.60\t-155.2\n", | |
"0149\t19.05\t-345.80\t94.4\n", | |
"0150\t19.05\t442.40\t-101.5\n", | |
"0151\t19.05\t-385.30\t436.8\n", | |
"0152\t19.07\t3.00\t-105.9\n", | |
"0153\t19.08\t-168.50\t-432.9\n", | |
"0154\t19.09\t489.00\t-270.6\n", | |
"0155\t19.09\t482.50\t-466.4\n", | |
"0156\t19.11\t-79.90\t-326.7\n", | |
"0157\t19.11\t-26.70\t-6.8\n", | |
"0158\t19.12\t-7.70\t27.5\n", | |
"0159\t19.12\t3.00\t265.7\n", | |
"0160\t19.13\t-56.20\t312.8\n", | |
"0161\t19.13\t-418.60\t-287.7\n", | |
"0162\t19.14\t-160.00\t291.8\n", | |
"0163\t19.17\t-309.00\t-199.4\n", | |
"0164\t19.17\t-365.10\t293\n", | |
"0165\t19.19\t96.13\t517.9\n", | |
"0166\t19.19\t0.72\t165.3\n", | |
"0167\t19.21\t50.17\t-23.4\n", | |
"0168\t19.21\t-56.60\t133.4\n", | |
"0169\t19.22\t5.65\t10.2\n", | |
"0170\t19.24\t-128.72\t181.1\n", | |
"0171\t19.27\t-274.96\t183.7\n", | |
"0172\t19.28\t-242.64\t-29.8\n", | |
"0173\t19.29\t-125.49\t253.7\n", | |
"0174\t19.31\t-19.44\t-32.2\n", | |
"0175\t19.31\t143.68\t-72.6\n", | |
"0176\t19.31\t-287.43\t320.8\n", | |
"0177\t19.32\t-215.38\t-86.8\n", | |
"0178\t19.33\t-201.81\t73.2\n", | |
"0179\t19.33\t247.77\t280.8\n", | |
"0180\t19.34\t115.36\t108\n", | |
"0181\t19.34\t519.34\t-118.3\n", | |
"0182\t19.34\t-93.05\t15.3\n", | |
"0183\t19.34\t257.99\t26.1\n", | |
"0184\t19.35\t73.27\t-5\n", | |
"0185\t19.36\t265.51\t316.8\n", | |
"0186\t19.36\t-112.15\t-41.48\n", | |
"0187\t19.37\t0.31\t14.48\n", | |
"0188\t19.41\t1.88\t71.31\n", | |
"0189\t19.42\t-58.94\t230.09\n", | |
"0190\t19.42\t305.18\t341.27\n", | |
"0191\t19.44\t-176.96\t207.36\n", | |
"0192\t19.46\t73.71\t-104.01\n", | |
"0193\t19.46\t210.15\t-258.65\n", | |
"0194\t19.49\t-193.54\t449.62\n", | |
"0195\t19.50\t-222.23\t372.79\n", | |
"0196\t19.50\t136.95\t-24.06\n", | |
"0197\t19.51\t-365.97\t-394.7\n", | |
"0198\t19.52\t148.56\t484.86\n", | |
"0199\t19.52\t343.76\t133.82\n", | |
"0200\t19.55\t25.47\t137.34\n", | |
"0201\t19.55\t292.33\t-205.85\n", | |
"0202\t19.56\t310.35\t119.48\n", | |
"0203\t19.57\t-228.92\t-145.43\n", | |
"0204\t19.57\t-45.15\t52.48\n", | |
"0205\t19.57\t-73.61\t112.99\n", | |
"0206\t19.61\t433.58\t412.43\n", | |
"0207\t19.62\t-137.09\t167.18\n", | |
"0208\t19.62\t-11.20\t110.35\n", | |
"0209\t19.62\t-119.38\t-332.65\n", | |
"0210\t19.62\t-149.96\t-42.5\n", | |
"0211\t19.63\t-99.41\t300.09\n", | |
"0212\t19.63\t-393.75\t218.9\n", | |
"0213\t19.64\t501.90\t-139.18\n", | |
"0214\t19.65\t239.82\t-455.83\n", | |
"0215\t19.67\t29.37\t-158.87\n", | |
"0216\t19.67\t347.57\t-187.57\n", | |
"0217\t19.68\t325.62\t-281.24\n", | |
"0218\t19.70\t408.44\t154.71\n", | |
"0219\t19.71\t128.73\t-454.49\n", | |
"0220\t19.72\t44.27\t-192.14\n", | |
"0221\t19.74\t108.35\t388.53\n", | |
"0222\t19.75\t471.84\t137.96\n", | |
"0223\t19.77\t238.07\t-225.32\n", | |
"0224\t19.77\t348.54\t-305.5\n", | |
"0225\t19.77\t-185.02\t355.1\n", | |
"0226\t19.77\t-195.97\t114.32\n", | |
"0227\t19.77\t-146.14\t-375.8\n", | |
"0228\t19.79\t-33.19\t-20.78\n", | |
"0229\t19.79\t313.18\t185.63\n", | |
"0230\t19.80\t-206.38\t176\n", | |
"0231\t19.80\t-4.73\t273.44\n", | |
"0232\t19.80\t-206.38\t176\n", | |
"0233\t19.80\t-387.39\t188.19\n", | |
"0234\t19.83\t-46.57\t133.63\n", | |
"0235\t19.83\t489.83\t345.31\n", | |
"0236\t19.83\t-17.91\t-66.16\n", | |
"0237\t19.84\t-62.12\t-132.44\n", | |
"0238\t19.84\t-17.23\t395.2\n", | |
"0239\t19.84\t-211.46\t235.36\n", | |
"0240\t19.87\t78.20\t8.14\n", | |
"0241\t19.87\t-39.45\t36.14\n", | |
"0242\t19.88\t273.57\t-122.82\n", | |
"0243\t19.88\t443.55\t-351.34\n", | |
"0244\t19.88\t157.75\t-214.8\n", | |
"0245\t19.90\t167.06\t-169.47\n", | |
"0246\t19.91\t-190.50\t155.5\n", | |
"0247\t19.91\t-4.80\t297.59\n", | |
"0248\t19.91\t-32.62\t30.62\n", | |
"0249\t19.93\t154.55\t-250.67\n", | |
"0250\t19.94\t-119.31\t335.38\n", | |
"0251\t19.94\t-152.18\t344.21\n", | |
"0252\t19.96\t-235.99\t170.34\n", | |
"0253\t19.97\t120.08\t255.55\n", | |
"0254\t19.97\t-173.68\t-188.52\n", | |
"0255\t19.97\t-57.89\t160.47\n", | |
"0256\t19.99\t113.83\t-75.18\n", | |
"0257\t19.99\t112.15\t-125.92\n", | |
"0258\t19.99\t169.62\t-9.83\n", | |
"0259\t20.02\t249.92\t414.3\n", | |
"0260\t20.02\t84.90\t404.16\n", | |
"0261\t20.03\t486.28\t-270.42\n", | |
"0262\t20.03\t-95.53\t-56.89\n", | |
"0263\t20.03\t248.34\t418.53\n", | |
"0264\t20.04\t85.04\t-203.77\n", | |
"0265\t20.04\t248.34\t418.53\n", | |
"0266\t20.04\t-1.08\t193.02\n", | |
"0267\t20.04\t125.81\t215.09\n", | |
"0268\t20.05\t480.23\t-222.05\n", | |
"0269\t20.05\t-211.47\t149.17\n", | |
"0270\t20.05\t503.71\t305.38\n", | |
"0271\t20.06\t-304.99\t6.2\n", | |
"0272\t20.06\t467.11\t-473.93\n", | |
"0273\t20.06\t-436.93\t257.67\n", | |
"0274\t20.09\t-13.86\t-77.08\n", | |
"0275\t20.12\t444.87\t-78.74\n", | |
"0276\t20.12\t198.13\t-139.23\n", | |
"0277\t20.13\t-6.93\t100.25\n", | |
"0278\t20.14\t-157.32\t173.87\n", | |
"0279\t20.15\t-460.94\t76.86\n", | |
"0280\t20.16\t266.35\t-251.71\n", | |
"0281\t20.16\t177.97\t64.04\n", | |
"0282\t20.18\t260.74\t47.85\n", | |
"0283\t20.18\t-122.43\t412.03\n", | |
"0284\t20.19\t127.73\t148.71\n", | |
"0285\t20.19\t274.23\t22.38\n", | |
"0286\t20.21\t290.27\t-160.98\n", | |
"0287\t20.21\t-411.99\t454.79\n", | |
"0288\t20.21\t272.64\t-433.31\n", | |
"0289\t20.22\t-149.06\t11.75\n", | |
"0290\t20.23\t-95.89\t44.33\n", | |
"0291\t20.26\t43.55\t485.49\n", | |
"0292\t20.27\t46.31\t62.5\n", | |
"0293\t20.28\t213.90\t183.18\n", | |
"0294\t20.30\t-205.72\t-223.85\n", | |
"0295\t20.30\t245.10\t499.73\n", | |
"0296\t20.31\t80.10\t-22.02\n", | |
"0297\t20.31\t5.63\t-50.68\n", | |
"0298\t20.32\t-4.92\t-469.98\n", | |
"0299\t20.32\t-33.44\t-36.3\n", | |
"0300\t20.34\t-46.99\t234.37\n", | |
"0301\t20.36\t38.69\t-178.47\n", | |
"0302\t20.37\t-177.45\t63.55\n", | |
"0303\t20.37\t125.88\t-253.71\n", | |
"0304\t20.42\t42.94\t138.18\n", | |
"0305\t20.43\t161.27\t-109.3\n", | |
"0306\t20.46\t135.54\t513.27\n", | |
"0307\t20.48\t88.60\t80.63\n", | |
"0308\t20.49\t81.19\t220.11\n", | |
"0309\t20.50\t-390.25\t174.25\n", | |
"0310\t20.52\t-68.68\t25.09\n", | |
"0311\t20.54\t-334.38\t213.51\n", | |
"0312\t20.55\t360.07\t397.22\n", | |
"0313\t20.57\t-434.98\t-24.03\n", | |
"0314\t20.58\t489.16\t-368.86\n", | |
"0315\t20.58\t251.69\t-331.42\n", | |
"0316\t20.59\t524.21\t57.54\n", | |
"0317\t20.60\t-376.65\t-152.4\n", | |
"0318\t20.60\t-315.02\t342.3\n", | |
"0319\t20.62\t-110.52\t15.58\n", | |
"0320\t20.71\t-34.51\t22.78\n", | |
"0321\t20.72\t-136.01\t162.44\n", | |
"0322\t20.73\t-242.80\t-433.82\n", | |
"0323\t20.73\t27.35\t67.74\n", | |
"0324\t20.74\t240.05\t-188.98\n", | |
"0325\t20.75\t-309.32\t-374.76\n", | |
"0326\t20.76\t0.24\t62.37\n", | |
"0327\t20.76\t213.73\t122.43\n", | |
"0328\t20.77\t-76.07\t-117.04\n", | |
"0329\t20.80\t504.29\t-138.96\n", | |
"0330\t20.81\t-59.39\t163.59\n", | |
"0331\t20.84\t51.19\t331.02\n", | |
"0332\t20.85\t263.97\t80.71\n", | |
"0333\t20.85\t318.57\t244.36\n", | |
"0334\t20.85\t465.91\t365.39\n", | |
"0335\t20.88\t99.93\t94.15\n", | |
"0336\t20.91\t125.98\t-39.61\n", | |
"0337\t20.92\t31.86\t503.3\n", | |
"0338\t20.93\t-123.07\t348.67\n", | |
"0339\t20.94\t-213.99\t-339.3\n", | |
"0340\t20.95\t-326.16\t190.65\n", | |
"0341\t20.96\t436.46\t403.84\n", | |
"0342\t20.96\t-333.55\t44.9\n", | |
"0343\t20.96\t78.12\t-60.3\n", | |
"0344\t20.97\t-74.21\t-105.45\n", | |
"0345\t20.97\t-72.26\t209.96\n", | |
"0346\t20.97\t-366.37\t521.55\n", | |
"0347\t20.98\t-236.96\t-75.19\n", | |
"0348\t20.98\t-483.63\t374.89\n", | |
"0349\t21.00\t-257.64\t-470.55\n", | |
"0350\t21.02\t117.77\t224.39\n", | |
"0351\t21.02\t278.72\t-167.45\n", | |
"0352\t21.05\t104.93\t-97.55\n", | |
"0353\t21.05\t-92.99\t-59.69\n", | |
"0354\t21.06\t-451.32\t236.08\n", | |
"0355\t21.07\t-280.95\t-9.39\n", | |
"0356\t21.07\t271.05\t-73.26\n", | |
"0357\t21.09\t-229.10\t358.88\n", | |
"0358\t21.09\t-38.15\t-71.17\n", | |
"0359\t21.10\t124.42\t-430.78\n", | |
"0360\t21.10\t114.19\t508.97\n", | |
"0361\t21.12\t-328.26\t144.48\n", | |
"0362\t21.12\t37.81\t56.83\n", | |
"0363\t21.14\t112.98\t-207.49\n", | |
"0364\t21.22\t44.65\t-324.42\n", | |
"0365\t21.22\t-377.93\t-264.95\n", | |
"0366\t21.22\t-21.80\t486.82\n", | |
"0367\t21.23\t384.57\t-372.4\n", | |
"0368\t21.23\t-66.16\t-401.32\n", | |
"0369\t21.24\t193.36\t161.87\n", | |
"0370\t21.25\t-133.47\t-75.15\n", | |
"0371\t21.25\t-170.11\t39.78\n", | |
"0372\t21.28\t27.74\t24.46\n", | |
"0373\t21.29\t380.90\t-395.93\n", | |
"0374\t21.30\t-111.17\t366.99\n", | |
"0375\t21.31\t-171.53\t155.93\n", | |
"0376\t21.33\t138.77\t242.39\n", | |
"0377\t21.33\t7.70\t26.9\n", | |
"0378\t21.34\t-292.33\t488.23\n", | |
"0379\t21.38\t105.65\t-259.44\n", | |
"0380\t21.38\t-108.19\t162.41\n", | |
"0381\t21.43\t-23.99\t11.17\n", | |
"0382\t21.45\t-202.71\t-415.56\n", | |
"0383\t21.45\t-14.48\t487.43\n", | |
"0384\t21.47\t-412.30\t-397.28\n", | |
"0385\t21.50\t135.18\t-303.4\n", | |
"0386\t21.51\t-186.91\t-194.84\n", | |
"0387\t21.51\t-279.83\t220.24\n", | |
"0388\t21.52\t-149.09\t440.58\n", | |
"0389\t21.52\t-108.40\t222.62\n", | |
"0390\t21.53\t-136.61\t29.71\n", | |
"0391\t21.54\t281.50\t-329\n", | |
"0392\t21.54\t-210.64\t106.7\n", | |
"0393\t21.55\t-412.74\t-341.27\n", | |
"0394\t21.56\t-151.63\t28.06\n", | |
"0395\t21.56\t39.27\t421.12\n", | |
"0396\t21.57\t-163.49\t-82.15\n", | |
"0397\t21.58\t-13.93\t41.94\n", | |
"0398\t21.59\t0.95\t487.73\n", | |
"0399\t21.59\t11.59\t106.98\n", | |
"0400\t21.62\t520.12\t-321.96\n", | |
"0401\t21.63\t526.57\t-219.44\n", | |
"0402\t21.65\t-325.24\t-56.54\n", | |
"0403\t21.66\t-83.79\t-179.89\n", | |
"0404\t21.66\t-51.78\t20.1\n", | |
"0405\t21.67\t-156.23\t-33.52\n", | |
"0406\t21.69\t-112.05\t-57.28\n", | |
"0407\t21.69\t-324.26\t178.46\n", | |
"0408\t21.72\t-92.31\t-280.44\n", | |
"0409\t21.73\t-136.65\t246.31\n", | |
"0410\t21.78\t263.53\t-423.7\n", | |
"0411\t21.79\t-138.18\t-3.9\n", | |
"0412\t21.81\t284.92\t408.7\n", | |
"0413\t21.81\t344.30\t-483.84\n", | |
"0414\t21.82\t71.71\t-46.51\n", | |
"0415\t21.82\t117.65\t-75.92\n", | |
"0416\t21.86\t-214.64\t413.18\n", | |
"0417\t21.86\t-317.54\t53.96\n", | |
"0418\t21.88\t407.48\t-40.01\n", | |
"0419\t21.89\t17.63\t-232.06\n", | |
"0420\t21.89\t0.76\t55.45\n", | |
"0421\t21.90\t-101.48\t-415.67\n", | |
"0422\t21.95\t187.38\t-38.81\n", | |
"0423\t21.95\t-97.22\t71.44\n", | |
"0424\t21.98\t310.78\t427.33\n", | |
"0425\t21.98\t479.88\t359.14\n", | |
"0426\t21.99\t-355.76\t145.79\n", | |
"0427\t22.09\t-447.66\t-75.76\n", | |
"0428\t22.15\t-464.14\t455.43\n", | |
"0429\t22.16\t428.57\t-302.44\n", | |
"\"\"\"\n", | |
"\n", | |
"webda_xy = [l.split() for l in webda_xy_str.split('\\n') if l]\n", | |
"webda_xy = [{'webda': int(l[0]), 'V': float(l[1]), 'x': float(l[2]), 'y': float(l[3])} for l in webda_xy]\n", | |
"webda_xy_p = []\n", | |
"i = 0\n", | |
"for w in webda_xy:\n", | |
" webda_xy_p.append({'webda': int(w['webda']), 'webda_V': float(w['V']), 'V': float(macminn_dat[i]['V']), 'x': float(w['x']), 'y': float(w['y']),\n", | |
" 'V_I': float(macminn_dat[i]['V_I'])})\n", | |
" i += 1\n", | |
"webda_xy = webda_xy_p\n", | |
"webda_xy[164]" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"row = sdss_11_map = cross[3]\n", | |
"g = row['g']\n", | |
"r = row['r']\n", | |
"i = row['i']\n", | |
"B = g + 0.3130 * (g - r) + 0.2271 # sigma = 0.0107\n", | |
"V = g - 0.5784 * (g - r) - 0.0038 # sigma = 0.0054\n", | |
"I = r - 1.2444 * (r - i) - 0.3820\n", | |
"V_I = row['V_I']\n", | |
"B_V = 0.98*(g-r) + 0.22 # or 0.90*(g-r) + 0.21 # Depends on | Rc-Ic < 1.15 and U-B < 0 | Rc-Ic < 1.15 |\n", | |
"(B, row['V'], V, B_V, B-V, V_I, V-I)\n" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"\"\"\"\n", | |
"SDSS 11 is the SDSS coordinates for Webda/Macminn object 0011. In the Webda location char this is considered the center, or (0, 0).\n", | |
"\"\"\"\n", | |
"webda_11 = cross[3]\n", | |
"sdss_11_coo = astropy.coordinates.SkyCoord(ra=webda_11['ra']*u.degree, dec=webda_11['dec']*u.degree, frame='icrs')\n", | |
"sdss_11_coo" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"def match_coord2(coord):\n", | |
" \"\"\"Return a list of tuples with the SDSS objID and row for objects close to the coord location.\"\"\"\n", | |
" matches = []\n", | |
" for id_, c in coords:\n", | |
" match = is_match(coord, c, atol=1.e-3)\n", | |
" #if not match:\n", | |
" # match = is_match(coord, c, atol=1.e-3)\n", | |
" if match:\n", | |
" matches.append(id_)\n", | |
" matches_row = []\n", | |
" for row in region.cat:\n", | |
" if row['objID'] in matches:\n", | |
" matches_row.append(row)\n", | |
" return matches_row\n", | |
"\n", | |
"\n", | |
"def match_webda_row(row):\n", | |
" x, y = row['x'], row['y']\n", | |
" ra_offset = - x * 8.333333e-5 * u.degree # 8.45e-5 * u.degree # 8.5\n", | |
" dec_offset = - y * 8.333333e-5 * u.degree # 8.45e-5 * u.degree\n", | |
" webda_coord = astropy.coordinates.SkyCoord(ra=sdss_11_coo.ra-ra_offset,\n", | |
" dec=sdss_11_coo.dec-dec_offset, frame='icrs')\n", | |
" return match_coord2(webda_coord)\n", | |
"\n", | |
"\n", | |
"webda_matches = []\n", | |
"\n", | |
"\n", | |
"for w in webda_xy[:2]:\n", | |
" match_ = match_webda_row(w)\n", | |
" if match_:\n", | |
" webda_matches.append((w, match_))" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"len(webda_matches)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import math\n", | |
"sdss_ra = sdss_11_coo.ra.value\n", | |
"sdss_dec = sdss_11_coo.dec.value\n", | |
"\n", | |
"\n", | |
"def is_match2_p(ra1, dec1, ra2, dec2, atol=1.e-4):\n", | |
" if math.isclose(ra1, ra2, abs_tol=atol) \\\n", | |
" and math.isclose(dec1, dec2, abs_tol=atol):\n", | |
" return True\n", | |
"\n", | |
" \n", | |
"def match_coord2_p(ra, dec):\n", | |
" \"\"\"Return a list of tuples with the SDSS objID and row for objects close to the coord location.\"\"\"\n", | |
" matches = []\n", | |
" for m_ in coords2:\n", | |
" id_, ra2, dec2 = m_.values()\n", | |
" match = is_match2_p(ra, dec, ra2, dec2, atol=1.e-4)\n", | |
" if not match:\n", | |
" match = is_match2_p(ra, dec, ra2, dec2, atol=1.e-3)\n", | |
" if match:\n", | |
" matches.append(id_)\n", | |
" matches_row = []\n", | |
" for row in region.cat:\n", | |
" if row['objID'] in matches:\n", | |
" matches_row.append(row)\n", | |
" return matches_row\n", | |
"\n", | |
"\n", | |
"def calc_ra_dec_p(x, y):\n", | |
" ra_offset = - x * 8.345e-5 #* u.degree # 8.45e-5 * u.degree # 8.5\n", | |
" dec_offset = - y * 8.345e-5 #* u.degree # 8.45e-5 * u.degree\n", | |
" return (sdss_ra - ra_offset, sdss_dec - dec_offset)\n", | |
"\n", | |
"\n", | |
"def match_webda_row_p(row):\n", | |
" x, y = row['x'], row['y']\n", | |
" return match_coord2_p(*calc_ra_dec_p(x, y))\n", | |
"\n", | |
"\n", | |
"webda_matches = []\n", | |
"\n", | |
"\n", | |
"for w in webda_xy:\n", | |
" match_ = match_webda_row_p(w)\n", | |
" if match_:\n", | |
" webda_matches.append((w, match_))\n", | |
"\n", | |
"len(webda_matches)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"def V_lupton(row):\n", | |
" return row['g'] - 0.5784 * (row['g'] - row['r']) - 0.0038\n", | |
"\n", | |
"large_diff = []\n", | |
"\n", | |
"def V_close_row(row_list, match_V):\n", | |
" best, best_V = row_list[0], V_lupton(row_list[0])\n", | |
" diff_V = abs(best_V - match_V)\n", | |
" for r in row_list:\n", | |
" # Note astronomers are insane so max is actually min mathematically.\n", | |
" V = V_lupton(r)\n", | |
" if abs(match_V - V) < diff_V:\n", | |
" best = r\n", | |
" diff_V = abs(match_V - V)\n", | |
" best_V = V\n", | |
" if diff_V > 0.3:\n", | |
" print(\"Large difference ({0:.4f}) in webda_V versus V_lupton! {1}\".format(diff_V, str(best['objID'])))\n", | |
" large_diff.append(best['objID'])\n", | |
" return best\n", | |
"\n", | |
"table_rows_V = []\n", | |
"\n", | |
"for webda, row_list in webda_matches:\n", | |
" if row_list and len(row_list) >= 1:\n", | |
" row = V_close_row(row_list, webda['V'])\n", | |
" row['webda_id'] = webda['webda']\n", | |
" row['webda_V'] = webda['V']\n", | |
" row['webda_V_I'] = webda['V_I']\n", | |
" ra_calc, dec_calc = calc_ra_dec_p(webda['x'], webda['y'])\n", | |
" row['ra_diff'] = row['ra'] - ra_calc\n", | |
" row['dec_diff'] = row['dec'] - dec_calc\n", | |
" row['V_lupton'] = V_lupton(row)\n", | |
" table_rows_V.append(V_close_row(row_list, webda['V']))\n", | |
"\n", | |
"#t = astropy.table.Table(names=[c for c in table_rows_V[0].columns], dtype=['int64', 'float64', 'float64', 'float64', 'float64', 'float64', 'float64', 'float64'], rows=table_rows_V)\n", | |
"#t_dropped = t.to_pandas().drop_duplicates()\n", | |
"#t\n", | |
"#table_rows_V[0].dtype.fields\n", | |
"\n", | |
"names = [c for c in table_rows_V[0].columns]\n", | |
"dtypes = [dt.name for dt, _ in table_rows_V[0].dtype.fields.values()]\n", | |
"t = astropy.table.Table(names=names,\n", | |
" dtype=dtypes,\n", | |
" rows=table_rows_V)\n", | |
"t_dropped = astropy.table.Table.from_pandas(t.to_pandas().drop_duplicates())\n", | |
"\n", | |
"len(t_dropped)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"direct_matches_rows = [m[1] for m in mcs_ones]\n", | |
"first_direct_match_row = direct_matches_rows[0]\n", | |
"names = [c for c in first_direct_match_row.colnames]\n", | |
"dtypes = [dt.name for dt, _ in first_direct_match_row.dtype.fields.values()]\n", | |
"t_dm = astropy.table.Table(names=names,\n", | |
" dtype=dtypes,\n", | |
" rows=direct_matches_rows)\n", | |
"direct_matches = t_dm\n", | |
"direct_matches.to_pandas().to_pickle('sdss_macminn.dataframe.direct_matches.v{0}.bz2.pickle'.format(VERSION))\n", | |
"direct_matches.to_pandas().to_csv('sdss_macminn.direct_matches.v{0}.csv'.format(VERSION))" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"t_dropped.to_pandas().to_pickle('sdss_macminn.dataframe.v{0}.bz2.pickle'.format(VERSION))" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"region_all = region.cat\n", | |
"region_all.to_pandas().to_pickle('sdss_macminn.dataframe.region_all.v{0}.bz2.pickle'.format(VERSION))\n", | |
"region_all.to_pandas().to_csv('sdss_macminn.region_all.v{0}.csv'.format(VERSION))" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"#region_all_df = region_all.to_pandas()\n", | |
"clean_good_region_all = region_all[region_all['clean'] == 1]\n", | |
"clean_good_region_all\n", | |
"clean_good_region_all.to_pandas().to_pickle('sdss_macminn.dataframe.clean_good_region_all.v{0}.bz2.pickle'.format(VERSION))\n", | |
"clean_good_region_all.to_pandas().to_csv('sdss_macminn.clean_good_region_all.v{0}.csv'.format(VERSION))" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"indirect_matches = t_dropped\n", | |
"indirect_matches.to_pickle('sdss_macminn.dataframe.indirect_matches.v{0}.bz2.pickle'.format(VERSION))\n", | |
"indirect_matches.to_csv('sdss_macminn.indirect_matches.v{0}.csv'.format(VERSION))" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"sdss_macminn_load_7_1 = pd.read_pickle('sdss_macminn.dataframe.v7.1.bz2.pickle')\n", | |
"sdss_macminn_load_7_1.to_csv('sdss_macminn.v{0}.1.csv'.format(VERSION))\n", | |
"sdss_macminn_load_7_2 = pd.read_pickle('sdss_macminn.dataframe.v7.2.bz2.pickle')\n", | |
"sdss_macminn_load_7_2.to_csv('sdss_macminn.v{0}.2.csv')\n" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"set(bad_objids)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"set(potentially_bad_objids)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"set(large_diff)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"def get_row(table, value, column_name='objID'):\n", | |
" for r in table:\n", | |
" if r[column_name] == value:\n", | |
" return r\n", | |
"bad_rows = [1237671557008589073, #118845.16588455047\n", | |
" 1237671557008589155, #157778.37164358902\n", | |
" 1237671557008589161, #278.9200682216321\n", | |
" 1237671557008589162, #385.92629703175436\n", | |
" 1237671557008589166, #849.1310767578651\n", | |
" 1237671557008589402]\n", | |
"\n", | |
"for objid in bad_rows:\n", | |
" r = get_row(t_dropped, objid)\n", | |
" print(r['clean'])\n", | |
" \n", | |
"for r in t_dropped:\n", | |
" if r['clean'] == 0:\n", | |
" r.index\n" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"df1 = t_dropped.to_pandas()\n", | |
"i = 0\n", | |
"indices = []\n", | |
"unclean_objids = []\n", | |
"\n", | |
"\n", | |
"def get_objid(i):\n", | |
" i1 = 0\n", | |
" for r in t_dropped:\n", | |
" if i1 == i:\n", | |
" return np.int64(r['objID'])\n", | |
" i1 += 1\n", | |
"\n", | |
"\n", | |
"for idx, row in df1.iterrows():\n", | |
" if row['clean'] == 0:\n", | |
" indices.append(i)\n", | |
" unclean_objids.append(get_objid(i))\n", | |
" i += 1\n", | |
"df_sdss_macminn2 = df1.drop(df1.index[indices])\n", | |
"df_sdss_macminn2 = df_sdss_macminn2.drop_duplicates().reset_index(drop=True)\n", | |
"df_sdss_macminn2.to_pickle('sdss_macminn.dataframe.v{0}.2.bz2.pickle'.format(VERSION))\n", | |
"indices\n", | |
"set.intersection(set(large_diff), set(unclean_objids))\n", | |
"len(df_sdss_macminn2)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.6.5" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment