In [1]:
import numpy as np
import pandas as pd
from astropy.io import fits
from astropy.coordinates import SkyCoord
import astropy.units as u
import glob
import time
import gc

import matplotlib.pyplot as plt
from matplotlib.ticker import MultipleLocator
from matplotlib import rcParams
rcParams["font.family"] = "sans-serif"
rcParams['font.sans-serif'] = ['DejaVu Sans']

%matplotlib notebook

Merge the PS1 RF catalogs and the Gaia obvi stars catalog


In [2]:
gaia_dir = "/Users/adamamiller/Desktop/PS1_fits/gaia_stars/"
ps1_files = glob.glob("/Users/adamamiller/Desktop/PS1_fits/hdf5/*h5")

Parallax comparison


In [2]:
gaia_df = pd.read_hdf(gaia_dir + "parallax_ps1_gaia_mag_pm_plx.h5")
gaia_df.set_index("objid", inplace=True)

In [5]:
tstart = time.time()
for file_num, rf_file in enumerate(ps1_files):

    rf_df = pd.read_hdf(rf_file)
    rf_df.set_index("objid", inplace=True)
    
    tmp_df = gaia_df.join(rf_df, how='inner')
    coords = SkyCoord(np.array(tmp_df.raStack)*u.deg, np.array(tmp_df.decStack)*u.deg)
    tmp_df["b"] = coords.galactic.b
    tmp_df.to_hdf(gaia_dir + "tmp{}.h5".format(file_num), "d1")
    if file_num == 0:
        print(file_num, rf_file.split("/")[-1], 
              len(tmp_df),
              time.time() - tstart)
    else:
        print(file_num, rf_file.split("/")[-1], 
              len(tmp_df),
              time.time() - tnow)

    tnow = time.time()
    
    del rf_df
    del tmp_df
    gc.collect()


0 dec_0_0_classifications.h5 94289 41.419086933135986
1 dec_0_33_classifications.h5 91933 34.60858392715454
2 dec_0_66_classifications.h5 90666 30.844307899475098
3 dec_10_0_classifications.h5 99405 31.38301682472229
4 dec_10_33_classifications.h5 97169 31.32585597038269
5 dec_10_66_classifications.h5 96525 31.302745819091797
6 dec_11_0_classifications.h5 97156 31.08215570449829
7 dec_11_33_classifications.h5 99167 31.58281397819519
8 dec_11_66_classifications.h5 100331 35.911309003829956
9 dec_12_0_classifications.h5 100128 30.488455057144165
10 dec_12_33_classifications.h5 101937 30.703970193862915
11 dec_12_66_classifications.h5 99107 30.97070598602295
12 dec_13_0_classifications.h5 96423 30.048285961151123
13 dec_13_33_classifications.h5 96320 31.04361581802368
14 dec_13_66_classifications.h5 97726 30.198737859725952
15 dec_14_0_classifications.h5 97197 29.813304901123047
16 dec_14_33_classifications.h5 98205 30.40588092803955
17 dec_14_66_classifications.h5 98336 30.70422887802124
18 dec_15_0_classifications.h5 99096 30.58761692047119
19 dec_15_33_classifications.h5 98104 29.94754409790039
20 dec_15_66_classifications.h5 97933 30.622384309768677
21 dec_16_0_classifications.h5 98204 30.917298316955566
22 dec_16_33_classifications.h5 98141 29.942971229553223
23 dec_16_66_classifications.h5 98399 29.826049089431763
24 dec_17_0_classifications.h5 98105 29.756171941757202
25 dec_17_33_classifications.h5 99918 29.651715755462646
26 dec_17_66_classifications.h5 98690 29.68504309654236
27 dec_18_0_classifications.h5 98765 29.70946717262268
28 dec_18_33_classifications.h5 100416 29.478618144989014
29 dec_18_66_classifications.h5 98789 29.680600881576538
30 dec_19_0_classifications.h5 99493 29.908929109573364
31 dec_19_33_classifications.h5 99433 29.63300395011902
32 dec_19_66_classifications.h5 98386 29.502300262451172
33 dec_1_0_classifications.h5 91645 30.285778999328613
34 dec_1_33_classifications.h5 95208 30.519773960113525
35 dec_1_66_classifications.h5 95156 30.897879123687744
36 dec_20_0_classifications.h5 98630 29.813146829605103
37 dec_20_33_classifications.h5 97353 29.786048650741577
38 dec_20_66_classifications.h5 99232 29.26690983772278
39 dec_21_0_classifications.h5 98823 29.947048902511597
40 dec_21_33_classifications.h5 99150 29.574544191360474
41 dec_21_66_classifications.h5 100884 29.504095792770386
42 dec_22_0_classifications.h5 99902 33.991857051849365
43 dec_22_33_classifications.h5 100814 29.591295957565308
44 dec_22_66_classifications.h5 101776 29.473469972610474
45 dec_23_0_classifications.h5 100332 29.406378984451294
46 dec_23_33_classifications.h5 99696 29.353561878204346
47 dec_23_66_classifications.h5 100259 29.182213068008423
48 dec_24_0_classifications.h5 99892 29.3418710231781
49 dec_24_33_classifications.h5 98647 29.48740792274475
50 dec_24_66_classifications.h5 100024 29.082898139953613
51 dec_25_0_classifications.h5 101243 29.163349151611328
52 dec_25_33_classifications.h5 101872 29.753872871398926
53 dec_25_66_classifications.h5 102551 29.200275182724
54 dec_26_0_classifications.h5 102855 29.285308122634888
55 dec_26_33_classifications.h5 103887 29.091484785079956
56 dec_26_66_classifications.h5 103481 30.013936281204224
57 dec_27_0_classifications.h5 105253 29.924027919769287
58 dec_27_33_classifications.h5 107656 29.278735876083374
59 dec_27_66_classifications.h5 108287 29.138660192489624
60 dec_28_0_classifications.h5 108745 28.874452829360962
61 dec_28_33_classifications.h5 109676 28.87047290802002
62 dec_28_66_classifications.h5 110970 29.151466846466064
63 dec_29_0_classifications.h5 109728 28.90440320968628
64 dec_29_33_classifications.h5 110031 29.712536096572876
65 dec_29_66_classifications.h5 112358 28.89157509803772
66 dec_2_0_classifications.h5 94670 30.472698211669922
67 dec_2_33_classifications.h5 97044 30.150346040725708
68 dec_2_66_classifications.h5 97279 30.361199140548706
69 dec_30_0_classifications.h5 113563 29.044190168380737
70 dec_30_33_classifications.h5 111899 28.854284048080444
71 dec_30_66_classifications.h5 112434 29.114341020584106
72 dec_31_0_classifications.h5 111905 28.7533438205719
73 dec_31_33_classifications.h5 112657 28.86053991317749
74 dec_31_66_classifications.h5 112717 29.07374119758606
75 dec_32_0_classifications.h5 113317 29.78802800178528
76 dec_32_33_classifications.h5 116937 28.754822254180908
77 dec_32_66_classifications.h5 116547 28.549988985061646
78 dec_33_0_classifications.h5 118512 31.599729299545288
79 dec_33_33_classifications.h5 118398 28.62353277206421
80 dec_33_66_classifications.h5 116909 28.529049158096313
81 dec_34_0_classifications.h5 118632 28.633196115493774
82 dec_34_33_classifications.h5 117757 28.556080102920532
83 dec_34_66_classifications.h5 114566 28.407850980758667
84 dec_35_0_classifications.h5 115731 28.615055084228516
85 dec_35_33_classifications.h5 117449 28.404645204544067
86 dec_35_66_classifications.h5 121596 28.34767723083496
87 dec_36_0_classifications.h5 119720 28.263343811035156
88 dec_36_33_classifications.h5 118542 28.01060914993286
89 dec_36_66_classifications.h5 120515 28.22717833518982
90 dec_37_0_classifications.h5 120068 28.55782127380371
91 dec_37_33_classifications.h5 118366 29.378129243850708
92 dec_37_66_classifications.h5 117663 28.12534499168396
93 dec_38_0_classifications.h5 117560 28.207061052322388
94 dec_38_33_classifications.h5 116139 28.201305150985718
95 dec_38_66_classifications.h5 116930 28.6123149394989
96 dec_39_0_classifications.h5 114640 28.306334972381592
97 dec_39_33_classifications.h5 115652 28.246940851211548
98 dec_39_66_classifications.h5 114347 28.162203073501587
99 dec_3_0_classifications.h5 96741 30.115942239761353
100 dec_3_33_classifications.h5 95313 30.14418625831604
101 dec_3_66_classifications.h5 95232 29.80283498764038
102 dec_40_0_classifications.h5 227835 28.412088871002197
103 dec_40_33_classifications.h5 231056 28.622647047042847
104 dec_40_66_classifications.h5 225980 28.459558725357056
105 dec_41_0_classifications.h5 220574 28.23108673095703
106 dec_41_33_classifications.h5 226018 28.30326819419861
107 dec_41_66_classifications.h5 227380 28.591225147247314
108 dec_42_0_classifications.h5 229696 28.327476978302002
109 dec_42_33_classifications.h5 233726 28.74633526802063
110 dec_42_66_classifications.h5 237298 29.09958004951477
111 dec_43_0_classifications.h5 231872 28.348628044128418
112 dec_43_33_classifications.h5 231004 28.884250164031982
113 dec_43_66_classifications.h5 231228 28.455088138580322
114 dec_44_0_classifications.h5 227646 29.380253314971924
115 dec_44_33_classifications.h5 233552 28.391663074493408
116 dec_44_66_classifications.h5 242552 28.684706211090088
117 dec_45_0_classifications.h5 123456 28.58838701248169
118 dec_45_33_classifications.h5 126191 28.21933913230896
119 dec_45_66_classifications.h5 126747 28.306689977645874
120 dec_46_0_classifications.h5 128868 28.12840175628662
121 dec_46_33_classifications.h5 130594 28.257176160812378
122 dec_46_66_classifications.h5 129193 28.139732837677002
123 dec_47_0_classifications.h5 128488 28.306447982788086
124 dec_47_33_classifications.h5 128342 28.12757396697998
125 dec_47_66_classifications.h5 129516 28.404816150665283
126 dec_48_0_classifications.h5 128106 28.305490970611572
127 dec_48_33_classifications.h5 128247 28.179548740386963
128 dec_48_66_classifications.h5 126485 28.194268941879272
129 dec_49_0_classifications.h5 126331 28.06896710395813
130 dec_49_33_classifications.h5 128440 28.406728982925415
131 dec_49_66_classifications.h5 127669 28.434762001037598
132 dec_4_0_classifications.h5 94626 29.825312852859497
133 dec_4_33_classifications.h5 96478 29.786439895629883
134 dec_4_66_classifications.h5 96365 29.91296410560608
135 dec_50_0_classifications.h5 126336 27.91743493080139
136 dec_50_33_classifications.h5 126535 27.90759825706482
137 dec_50_66_classifications.h5 125357 27.660943746566772
138 dec_51_0_classifications.h5 124910 48.11861705780029
139 dec_51_33_classifications.h5 126223 27.888403177261353
140 dec_51_66_classifications.h5 127273 28.10023593902588
141 dec_52_0_classifications.h5 126048 27.96243190765381
142 dec_52_33_classifications.h5 125214 48.2680242061615
143 dec_52_66_classifications.h5 122969 28.731031894683838
144 dec_53_0_classifications.h5 121515 28.066300868988037
145 dec_53_33_classifications.h5 120767 27.928070068359375
146 dec_53_66_classifications.h5 121056 27.778514862060547
147 dec_54_0_classifications.h5 120205 27.783555030822754
148 dec_54_33_classifications.h5 120942 27.819480895996094
149 dec_54_66_classifications.h5 120548 27.542973041534424
150 dec_55_0_classifications.h5 117805 47.65267300605774
151 dec_55_33_classifications.h5 118404 48.49648928642273
152 dec_55_66_classifications.h5 117086 27.722830057144165
153 dec_56_0_classifications.h5 114708 27.714180946350098
154 dec_56_33_classifications.h5 117655 27.62304401397705
155 dec_56_66_classifications.h5 118101 27.62387204170227
156 dec_57_0_classifications.h5 115761 27.34796905517578
157 dec_57_33_classifications.h5 113306 27.324126958847046
158 dec_57_66_classifications.h5 110598 27.546737909317017
159 dec_58_0_classifications.h5 106920 27.231280088424683
160 dec_58_33_classifications.h5 103396 27.236581325531006
161 dec_58_66_classifications.h5 103717 27.281549215316772
162 dec_59_0_classifications.h5 101481 26.939723014831543
163 dec_59_33_classifications.h5 101782 28.166789054870605
164 dec_59_66_classifications.h5 103087 47.62511467933655
165 dec_5_0_classifications.h5 95224 30.80153799057007
166 dec_5_33_classifications.h5 97179 29.656848192214966
167 dec_5_66_classifications.h5 97832 29.835867166519165
168 dec_60_0_classifications.h5 101131 47.2285361289978
169 dec_60_33_classifications.h5 99815 47.117974042892456
170 dec_60_66_classifications.h5 99101 47.375301122665405
171 dec_61_0_classifications.h5 95913 26.633339166641235
172 dec_61_33_classifications.h5 94584 26.81354808807373
173 dec_61_66_classifications.h5 92792 26.280981063842773
174 dec_62_0_classifications.h5 88852 31.428834915161133
175 dec_62_33_classifications.h5 90208 46.528470039367676
176 dec_62_66_classifications.h5 90764 46.68044924736023
177 dec_63_0_classifications.h5 88861 46.821702003479004
178 dec_63_33_classifications.h5 84803 47.694157123565674
179 dec_63_66_classifications.h5 81788 26.097853899002075
180 dec_64_0_classifications.h5 80241 26.23176598548889
181 dec_64_33_classifications.h5 78099 26.193379163742065
182 dec_64_66_classifications.h5 74467 25.762430906295776
183 dec_65_0_classifications.h5 70140 25.965595960617065
184 dec_65_33_classifications.h5 67243 25.630488872528076
185 dec_65_66_classifications.h5 63984 25.725515842437744
186 dec_66_0_classifications.h5 61991 25.40790104866028
187 dec_66_33_classifications.h5 60517 25.416637897491455
188 dec_66_66_classifications.h5 59918 25.235332012176514
189 dec_67_0_classifications.h5 58692 25.781972885131836
190 dec_67_33_classifications.h5 60281 24.559016942977905
191 dec_67_66_classifications.h5 59462 24.76683282852173
192 dec_68_0_classifications.h5 60212 24.51240110397339
193 dec_68_33_classifications.h5 60289 24.57426166534424
194 dec_68_66_classifications.h5 58309 25.595977783203125
195 dec_69_0_classifications.h5 57125 25.012382984161377
196 dec_69_33_classifications.h5 56313 25.067456007003784
197 dec_69_66_classifications.h5 56277 24.854202270507812
198 dec_6_0_classifications.h5 97492 30.20679497718811
199 dec_6_33_classifications.h5 97891 30.707278728485107
200 dec_6_66_classifications.h5 98638 30.01970100402832
201 dec_70_0_classifications.h5 56583 24.476594924926758
202 dec_70_33_classifications.h5 55987 24.254637002944946
203 dec_70_66_classifications.h5 54933 24.345186948776245
204 dec_71_0_classifications.h5 53148 24.081419944763184
205 dec_71_33_classifications.h5 52590 24.044952154159546
206 dec_71_66_classifications.h5 50588 24.27274990081787
207 dec_72_0_classifications.h5 50250 24.023977279663086
208 dec_72_33_classifications.h5 48733 24.039103031158447
209 dec_72_66_classifications.h5 47589 24.138447999954224
210 dec_73_0_classifications.h5 45618 23.94219207763672
211 dec_73_33_classifications.h5 44140 23.980386972427368
212 dec_73_66_classifications.h5 44563 24.257189750671387
213 dec_74_0_classifications.h5 43223 23.736625909805298
214 dec_74_33_classifications.h5 41499 23.971942901611328
215 dec_74_66_classifications.h5 41307 23.87519407272339
216 dec_75_0_classifications.h5 39101 23.79548478126526
217 dec_75_33_classifications.h5 37470 23.732635021209717
218 dec_75_66_classifications.h5 37277 23.924208164215088
219 dec_76_0_classifications.h5 36208 23.765378952026367
220 dec_76_33_classifications.h5 34841 25.81965470314026
221 dec_76_66_classifications.h5 34327 25.747431993484497
222 dec_77_0_classifications.h5 33487 25.370325088500977
223 dec_77_33_classifications.h5 32900 25.198958158493042
224 dec_77_66_classifications.h5 32586 25.08876609802246
225 dec_78_0_classifications.h5 31612 24.64271092414856
226 dec_78_33_classifications.h5 30345 24.473982095718384
227 dec_78_66_classifications.h5 30205 25.49056577682495
228 dec_79_0_classifications.h5 29400 24.47417378425598
229 dec_79_33_classifications.h5 28247 24.153486967086792
230 dec_79_66_classifications.h5 27720 24.088993072509766
231 dec_7_0_classifications.h5 100286 30.231117010116577
232 dec_7_33_classifications.h5 100992 30.187638998031616
233 dec_7_66_classifications.h5 99921 30.074514865875244
234 dec_80_0_classifications.h5 26090 23.629951000213623
235 dec_80_33_classifications.h5 24790 24.018565893173218
236 dec_80_66_classifications.h5 24377 23.522764205932617
237 dec_81_0_classifications.h5 22683 23.54012703895569
238 dec_81_33_classifications.h5 21684 23.55947494506836
239 dec_81_66_classifications.h5 21113 23.584873914718628
240 dec_82_0_classifications.h5 20308 23.518210887908936
241 dec_82_33_classifications.h5 19253 23.56297278404236
242 dec_82_66_classifications.h5 18323 23.602715253829956
243 dec_83_0_classifications.h5 17490 23.418977737426758
244 dec_83_33_classifications.h5 16454 23.499852180480957
245 dec_83_66_classifications.h5 15839 23.499714612960815
246 dec_84_0_classifications.h5 15161 23.350075244903564
247 dec_84_33_classifications.h5 14595 23.32615303993225
248 dec_84_66_classifications.h5 13794 23.54663109779358
249 dec_85_0_classifications.h5 13153 23.436282873153687
250 dec_85_33_classifications.h5 12083 23.380831956863403
251 dec_85_66_classifications.h5 10533 23.543720960617065
252 dec_86_0_classifications.h5 9146 23.453465223312378
253 dec_86_33_classifications.h5 8055 23.483932971954346
254 dec_86_66_classifications.h5 6846 23.31130290031433
255 dec_87_0_classifications.h5 6202 23.4323410987854
256 dec_87_33_classifications.h5 5597 23.527246952056885
257 dec_87_66_classifications.h5 4564 23.434196949005127
258 dec_88_0_classifications.h5 4098 23.50858211517334
259 dec_88_33_classifications.h5 3467 23.651221990585327
260 dec_88_66_classifications.h5 2852 23.420425176620483
261 dec_89_0_classifications.h5 1945 23.733760118484497
262 dec_89_33_classifications.h5 1068 24.625287294387817
263 dec_89_66_classifications.h5 388 23.648685932159424
264 dec_8_0_classifications.h5 100635 30.176682949066162
265 dec_8_33_classifications.h5 98736 29.85608983039856
266 dec_8_66_classifications.h5 99162 30.165374279022217
267 dec_9_0_classifications.h5 100009 42.34365892410278
268 dec_9_33_classifications.h5 98902 37.61862587928772
269 dec_9_66_classifications.h5 99249 29.952848196029663
270 dec_neg0_33_classifications.h5 94667 30.77197790145874
271 dec_neg0_66_classifications.h5 93583 30.834872007369995
272 dec_neg10_0_classifications.h5 97430 33.267107009887695
273 dec_neg10_33_classifications.h5 97088 31.137880086898804
274 dec_neg10_66_classifications.h5 96356 31.299272298812866
275 dec_neg11_0_classifications.h5 96028 31.15967106819153
276 dec_neg11_33_classifications.h5 96167 31.193871021270752
277 dec_neg11_66_classifications.h5 97281 31.0381338596344
278 dec_neg12_0_classifications.h5 99217 31.969257354736328
279 dec_neg12_33_classifications.h5 102446 31.316720008850098
280 dec_neg12_66_classifications.h5 106057 31.471221923828125
281 dec_neg13_0_classifications.h5 105571 31.50740909576416
282 dec_neg13_33_classifications.h5 104886 31.784263134002686
283 dec_neg13_66_classifications.h5 105661 31.669065952301025
284 dec_neg14_0_classifications.h5 108113 31.463862895965576
285 dec_neg14_33_classifications.h5 108685 31.81374168395996
286 dec_neg14_66_classifications.h5 110093 32.007981061935425
287 dec_neg15_0_classifications.h5 112418 32.64596605300903
288 dec_neg15_33_classifications.h5 111597 32.09527802467346
289 dec_neg15_66_classifications.h5 113325 33.09901189804077
290 dec_neg16_0_classifications.h5 114012 32.67299699783325
291 dec_neg16_33_classifications.h5 112685 33.263739824295044
292 dec_neg16_66_classifications.h5 113347 32.20364689826965
293 dec_neg17_0_classifications.h5 114961 33.731241941452026
294 dec_neg17_33_classifications.h5 115535 32.53281211853027
295 dec_neg17_66_classifications.h5 115033 32.0850670337677
296 dec_neg18_0_classifications.h5 118619 32.369714975357056
297 dec_neg18_33_classifications.h5 119128 32.45751881599426
298 dec_neg18_66_classifications.h5 117530 32.25045299530029
299 dec_neg19_0_classifications.h5 115366 32.254831075668335
300 dec_neg19_33_classifications.h5 115235 32.34078121185303
301 dec_neg19_66_classifications.h5 113258 32.279906034469604
302 dec_neg1_0_classifications.h5 93790 30.485734939575195
303 dec_neg1_33_classifications.h5 94695 30.73168182373047
304 dec_neg1_66_classifications.h5 92981 30.796101093292236
305 dec_neg20_0_classifications.h5 114897 32.502808809280396
306 dec_neg20_33_classifications.h5 114262 32.46375393867493
307 dec_neg20_66_classifications.h5 115258 32.800366163253784
308 dec_neg21_0_classifications.h5 116062 33.03618574142456
309 dec_neg21_33_classifications.h5 116614 32.572696924209595
310 dec_neg21_66_classifications.h5 116984 32.50628399848938
311 dec_neg22_0_classifications.h5 117077 32.753671169281006
312 dec_neg22_33_classifications.h5 118108 32.83436679840088
313 dec_neg22_66_classifications.h5 118665 32.62451505661011
314 dec_neg23_0_classifications.h5 118968 36.1659369468689
315 dec_neg23_33_classifications.h5 118464 32.70527696609497
316 dec_neg23_66_classifications.h5 117979 32.68979597091675
317 dec_neg24_0_classifications.h5 116908 32.64708709716797
318 dec_neg24_33_classifications.h5 117383 33.422577142715454
319 dec_neg24_66_classifications.h5 117697 32.872031927108765
320 dec_neg25_0_classifications.h5 117798 33.08600687980652
321 dec_neg25_33_classifications.h5 118294 32.64702296257019
322 dec_neg25_66_classifications.h5 120545 34.13972210884094
323 dec_neg26_0_classifications.h5 120624 32.976577043533325
324 dec_neg26_33_classifications.h5 122075 34.16779112815857
325 dec_neg26_66_classifications.h5 122606 32.92556881904602
326 dec_neg27_0_classifications.h5 124870 32.75969910621643
327 dec_neg27_33_classifications.h5 124738 32.8132438659668
328 dec_neg27_66_classifications.h5 124731 32.87253785133362
329 dec_neg28_0_classifications.h5 126382 32.762139081954956
330 dec_neg28_33_classifications.h5 126793 33.43557119369507
331 dec_neg28_66_classifications.h5 127128 32.812058210372925
332 dec_neg29_0_classifications.h5 127126 32.78490591049194
333 dec_neg29_33_classifications.h5 129532 32.791465044021606
334 dec_neg29_66_classifications.h5 132360 32.65844106674194
335 dec_neg2_0_classifications.h5 92878 30.282257795333862
336 dec_neg2_33_classifications.h5 92466 30.370440244674683
337 dec_neg2_66_classifications.h5 92125 30.462766885757446
338 dec_neg30_0_classifications.h5 136309 32.314682960510254
339 dec_neg30_33_classifications.h5 136876 32.51701807975769
340 dec_neg30_66_classifications.h5 139068 30.924928903579712
341 dec_neg31_0_classifications.h5 132355 29.422233819961548
342 dec_neg31_33_classifications.h5 109800 27.562859058380127
343 dec_neg31_66_classifications.h5 70389 25.8278169631958
344 dec_neg32_0_classifications.h5 57391 31.217553853988647
345 dec_neg3_0_classifications.h5 90861 30.723570346832275
346 dec_neg3_33_classifications.h5 89125 30.379645824432373
347 dec_neg3_66_classifications.h5 89216 30.444947957992554
348 dec_neg4_0_classifications.h5 87721 30.595457077026367
349 dec_neg4_33_classifications.h5 88308 31.270986080169678
350 dec_neg4_66_classifications.h5 90499 31.180833101272583
351 dec_neg5_0_classifications.h5 92252 30.82522201538086
352 dec_neg5_33_classifications.h5 93905 37.04361867904663
353 dec_neg5_66_classifications.h5 95850 31.893579959869385
354 dec_neg6_0_classifications.h5 97485 31.20014476776123
355 dec_neg6_33_classifications.h5 98521 31.03166103363037
356 dec_neg6_66_classifications.h5 97625 30.567234754562378
357 dec_neg7_0_classifications.h5 97707 31.04857611656189
358 dec_neg7_33_classifications.h5 99189 30.78248906135559
359 dec_neg7_66_classifications.h5 101180 30.699903964996338
360 dec_neg8_0_classifications.h5 98967 31.047548055648804
361 dec_neg8_33_classifications.h5 98513 30.919209957122803
362 dec_neg8_66_classifications.h5 96392 30.87212085723877
363 dec_neg9_0_classifications.h5 96976 31.80940890312195
364 dec_neg9_33_classifications.h5 97006 31.518677949905396
365 dec_neg9_66_classifications.h5 97236 33.6173210144043

In [6]:
del gaia_df
gc.collect()


Out[6]:
0

In [7]:
tmp_files = glob.glob(gaia_dir + "tmp*h5")

for file_num, tmp_file in enumerate(tmp_files[0:100]):

    exec("tmp_df{} = pd.read_hdf(tmp_file)".format(file_num))

In [8]:
df_list = [tmp_df0, tmp_df1, tmp_df2, tmp_df3, tmp_df4, tmp_df5, tmp_df6, tmp_df7, tmp_df8, tmp_df9, tmp_df10, tmp_df11, tmp_df12, tmp_df13, tmp_df14, tmp_df15, tmp_df16, tmp_df17, tmp_df18, tmp_df19, tmp_df20, tmp_df21, tmp_df22, tmp_df23, tmp_df24, tmp_df25, tmp_df26, tmp_df27, tmp_df28, tmp_df29, tmp_df30, tmp_df31, tmp_df32, tmp_df33, tmp_df34, tmp_df35, tmp_df36, tmp_df37, tmp_df38, tmp_df39, tmp_df40, tmp_df41, tmp_df42, tmp_df43, tmp_df44, tmp_df45, tmp_df46, tmp_df47, tmp_df48, tmp_df49, tmp_df50, tmp_df51, tmp_df52, tmp_df53, tmp_df54, tmp_df55, tmp_df56, tmp_df57, tmp_df58, tmp_df59, tmp_df60, tmp_df61, tmp_df62, tmp_df63, tmp_df64, tmp_df65, tmp_df66, tmp_df67, tmp_df68, tmp_df69, tmp_df70, tmp_df71, tmp_df72, tmp_df73, tmp_df74, tmp_df75, tmp_df76, tmp_df77, tmp_df78, tmp_df79, tmp_df80, tmp_df81, tmp_df82, tmp_df83, tmp_df84, tmp_df85, tmp_df86, tmp_df87, tmp_df88, tmp_df89, tmp_df90, tmp_df91, tmp_df92, tmp_df93, tmp_df94, tmp_df95, tmp_df96, tmp_df97, tmp_df98, tmp_df99, tmp_df100, tmp_df101, tmp_df102, tmp_df103, tmp_df104, tmp_df105, tmp_df106, tmp_df107, tmp_df108, tmp_df109, tmp_df110, tmp_df111, tmp_df112, tmp_df113, tmp_df114, tmp_df115, tmp_df116, tmp_df117, tmp_df118, tmp_df119, tmp_df120, tmp_df121, tmp_df122, tmp_df123, tmp_df124, tmp_df125, tmp_df126, tmp_df127, tmp_df128, tmp_df129, tmp_df130, tmp_df131, tmp_df132, tmp_df133, tmp_df134, tmp_df135, tmp_df136, tmp_df137, tmp_df138, tmp_df139, tmp_df140, tmp_df141, tmp_df142, tmp_df143, tmp_df144, tmp_df145, tmp_df146, tmp_df147, tmp_df148, tmp_df149, tmp_df150, tmp_df151, tmp_df152, tmp_df153, tmp_df154, tmp_df155, tmp_df156, tmp_df157, tmp_df158, tmp_df159, tmp_df160, tmp_df161, tmp_df162, tmp_df163, tmp_df164, tmp_df165, tmp_df166, tmp_df167, tmp_df168, tmp_df169, tmp_df170, tmp_df171, tmp_df172, tmp_df173, tmp_df174, tmp_df175, tmp_df176, tmp_df177, tmp_df178, tmp_df179, tmp_df180, tmp_df181, tmp_df182, tmp_df183, tmp_df184, tmp_df185, tmp_df186, tmp_df187, tmp_df188, tmp_df189, tmp_df190, tmp_df191, tmp_df192, tmp_df193, tmp_df194, tmp_df195, tmp_df196, tmp_df197, tmp_df198, tmp_df199, tmp_df200, tmp_df201, tmp_df202, tmp_df203, tmp_df204, tmp_df205, tmp_df206, tmp_df207, tmp_df208, tmp_df209, tmp_df210, tmp_df211, tmp_df212, tmp_df213, tmp_df214, tmp_df215, tmp_df216, tmp_df217, tmp_df218, tmp_df219, tmp_df220, tmp_df221, tmp_df222, tmp_df223, tmp_df224, tmp_df225, tmp_df226, tmp_df227, tmp_df228, tmp_df229, tmp_df230, tmp_df231, tmp_df232, tmp_df233, tmp_df234, tmp_df235, tmp_df236, tmp_df237, tmp_df238, tmp_df239, tmp_df240, tmp_df241, tmp_df242, tmp_df243, tmp_df244, tmp_df245, tmp_df246, tmp_df247, tmp_df248, tmp_df249, tmp_df250, tmp_df251, tmp_df252, tmp_df253, tmp_df254, tmp_df255, tmp_df256, tmp_df257, tmp_df258, tmp_df259, tmp_df260, tmp_df261, tmp_df262, tmp_df263, tmp_df264, tmp_df265, tmp_df266, tmp_df267, tmp_df268, tmp_df269, tmp_df270, tmp_df271, tmp_df272, tmp_df273, tmp_df274, tmp_df275, tmp_df276, tmp_df277, tmp_df278, tmp_df279, tmp_df280, tmp_df281, tmp_df282, tmp_df283, tmp_df284, tmp_df285, tmp_df286, tmp_df287, tmp_df288, tmp_df289, tmp_df290, tmp_df291, tmp_df292, tmp_df293, tmp_df294, tmp_df295, tmp_df296, tmp_df297, tmp_df298, tmp_df299, tmp_df300, tmp_df301, tmp_df302, tmp_df303, tmp_df304, tmp_df305, tmp_df306, tmp_df307, tmp_df308, tmp_df309, tmp_df310, tmp_df311, tmp_df312, tmp_df313, tmp_df314, tmp_df315, tmp_df316, tmp_df317, tmp_df318, tmp_df319, tmp_df320, tmp_df321, tmp_df322, tmp_df323, tmp_df324, tmp_df325, tmp_df326, tmp_df327, tmp_df328, tmp_df329, tmp_df330, tmp_df331, tmp_df332, tmp_df333, tmp_df334, tmp_df335, tmp_df336, tmp_df337, tmp_df338, tmp_df339, tmp_df340, tmp_df341, tmp_df342, tmp_df343, tmp_df344, tmp_df345, tmp_df346, tmp_df347, tmp_df348, tmp_df349, tmp_df350, tmp_df351, tmp_df352, tmp_df353, tmp_df354, tmp_df355, tmp_df356, tmp_df357, tmp_df358, tmp_df359, tmp_df360, tmp_df361, tmp_df362, tmp_df363, tmp_df364, tmp_df365]

In [9]:
merge_df = pd.concat(df_list)

In [10]:
merge_df.to_hdf("parallax_ps1_gaia_cat_merge.h5", "d1")

In [11]:
del merge_df
gc.collect()


Out[11]:
0

Proper Motion comparison


In [3]:
pm_df = pd.read_hdf(gaia_dir + "pm_ps1_gaia_mag_pm_plx.h5")
pm_df.set_index("objid", inplace=True)

In [5]:
tstart = time.time()
last_quit = 30
for file_num, rf_file in enumerate(ps1_files):
    if file_num < last_quit:
        continue
        
    rf_df = pd.read_hdf(rf_file)
    rf_df.set_index("objid", inplace=True)
    
    tmp_df = pm_df.join(rf_df, how='inner')
    coords = SkyCoord(np.array(tmp_df.raStack)*u.deg, np.array(tmp_df.decStack)*u.deg)
    tmp_df["b"] = coords.galactic.b
    tmp_df.to_hdf(gaia_dir + "pm{}.h5".format(file_num), "d1")
    if file_num == last_quit:
        print(file_num, rf_file.split("/")[-1], 
              len(tmp_df),
              time.time() - tstart)
    else:
        print(file_num, rf_file.split("/")[-1], 
              len(tmp_df),
              time.time() - tnow)

    tnow = time.time()
    
    del rf_df
    del tmp_df
    gc.collect()


30 dec_19_0_classifications.h5 800796 490.47927618026733
31 dec_19_33_classifications.h5 803441 505.3153657913208
32 dec_19_66_classifications.h5 797890 500.23846411705017
33 dec_1_0_classifications.h5 610355 553.5933248996735
34 dec_1_33_classifications.h5 640352 684.4465179443359
35 dec_1_66_classifications.h5 653027 458.6304142475128
36 dec_20_0_classifications.h5 794646 500.07944774627686
37 dec_20_33_classifications.h5 775037 615.6037418842316
38 dec_20_66_classifications.h5 793433 449.11447191238403
39 dec_21_0_classifications.h5 783309 507.6632421016693
40 dec_21_33_classifications.h5 778636 571.3858978748322
41 dec_21_66_classifications.h5 778596 479.35382294654846
42 dec_22_0_classifications.h5 772734 387.45678877830505
43 dec_22_33_classifications.h5 762159 391.1565570831299
44 dec_22_66_classifications.h5 759374 403.75842213630676
45 dec_23_0_classifications.h5 758241 386.3645508289337
46 dec_23_33_classifications.h5 747348 380.7891561985016
47 dec_23_66_classifications.h5 745066 387.61574506759644
48 dec_24_0_classifications.h5 744518 389.13828682899475
49 dec_24_33_classifications.h5 734851 385.65231704711914
50 dec_24_66_classifications.h5 752595 381.88722920417786
51 dec_25_0_classifications.h5 770822 383.2148690223694
52 dec_25_33_classifications.h5 766239 380.79975605010986
53 dec_25_66_classifications.h5 761920 389.62687706947327
54 dec_26_0_classifications.h5 772151 412.6939928531647
55 dec_26_33_classifications.h5 761205 397.08271169662476
56 dec_26_66_classifications.h5 744851 438.33974981307983
57 dec_27_0_classifications.h5 742887 468.095201253891
58 dec_27_33_classifications.h5 753822 873.3910508155823
59 dec_27_66_classifications.h5 758557 839.6943409442902
60 dec_28_0_classifications.h5 763983 486.8080987930298
61 dec_28_33_classifications.h5 770383 501.97157192230225
62 dec_28_66_classifications.h5 781508 750.8372988700867
63 dec_29_0_classifications.h5 776732 541.696170091629
64 dec_29_33_classifications.h5 771550 441.51855397224426
65 dec_29_66_classifications.h5 781693 434.7644121646881
66 dec_2_0_classifications.h5 653516 436.7517099380493
67 dec_2_33_classifications.h5 683027 481.8557040691376
68 dec_2_66_classifications.h5 705556 567.1398739814758
69 dec_30_0_classifications.h5 784585 526.8752510547638
70 dec_30_33_classifications.h5 780931 472.0451719760895
71 dec_30_66_classifications.h5 774052 398.9258289337158
72 dec_31_0_classifications.h5 757417 386.95500111579895
73 dec_31_33_classifications.h5 754705 395.6094980239868
74 dec_31_66_classifications.h5 738700 383.827987909317
75 dec_32_0_classifications.h5 730752 390.3967800140381
76 dec_32_33_classifications.h5 737766 398.571163892746
77 dec_32_66_classifications.h5 724036 386.1680040359497
78 dec_33_0_classifications.h5 734230 385.5240240097046
79 dec_33_33_classifications.h5 747330 420.94294810295105
80 dec_33_66_classifications.h5 730067 396.4308612346649
81 dec_34_0_classifications.h5 733507 388.89764881134033
82 dec_34_33_classifications.h5 722703 387.8600239753723
83 dec_34_66_classifications.h5 704455 388.7037761211395
84 dec_35_0_classifications.h5 702060 387.6284248828888
85 dec_35_33_classifications.h5 712078 400.0953297615051
86 dec_35_66_classifications.h5 732052 407.49735975265503
87 dec_36_0_classifications.h5 719484 405.1263930797577
88 dec_36_33_classifications.h5 723561 388.14527678489685
89 dec_36_66_classifications.h5 725125 390.86670184135437
90 dec_37_0_classifications.h5 720638 446.8533420562744
91 dec_37_33_classifications.h5 694161 387.068904876709
92 dec_37_66_classifications.h5 675641 395.4902868270874
93 dec_38_0_classifications.h5 667277 387.7192723751068
94 dec_38_33_classifications.h5 654390 391.7951281070709
95 dec_38_66_classifications.h5 651426 397.5286989212036
96 dec_39_0_classifications.h5 633031 453.8918969631195
97 dec_39_33_classifications.h5 636160 449.3408930301666
98 dec_39_66_classifications.h5 621896 492.94522285461426
99 dec_3_0_classifications.h5 711602 461.8422210216522
100 dec_3_33_classifications.h5 714200 435.22819995880127
101 dec_3_66_classifications.h5 704539 426.3955340385437
102 dec_40_0_classifications.h5 1214027 495.1796860694885
103 dec_40_33_classifications.h5 1222650 778.9715099334717
104 dec_40_66_classifications.h5 1181446 402.36010003089905
105 dec_41_0_classifications.h5 1135506 392.79962968826294
106 dec_41_33_classifications.h5 1157302 380.1945185661316
107 dec_41_66_classifications.h5 1149804 393.9678473472595
108 dec_42_0_classifications.h5 1148694 681.716224193573
109 dec_42_33_classifications.h5 1161030 376.09755301475525
110 dec_42_66_classifications.h5 1175406 393.9131977558136
111 dec_43_0_classifications.h5 1155828 379.3506119251251
112 dec_43_33_classifications.h5 1138692 386.21690917015076
113 dec_43_66_classifications.h5 1126570 382.07362508773804
114 dec_44_0_classifications.h5 1116336 380.5390889644623
115 dec_44_33_classifications.h5 1138194 384.435555934906
116 dec_44_66_classifications.h5 1189128 374.53813004493713
117 dec_45_0_classifications.h5 611518 373.8026080131531
118 dec_45_33_classifications.h5 631579 443.2172110080719
119 dec_45_66_classifications.h5 640453 380.5504620075226
120 dec_46_0_classifications.h5 646838 388.9569089412689
121 dec_46_33_classifications.h5 652983 377.6499490737915
122 dec_46_66_classifications.h5 643670 411.52238488197327
123 dec_47_0_classifications.h5 637691 381.77841877937317
124 dec_47_33_classifications.h5 623278 394.4780333042145
125 dec_47_66_classifications.h5 627049 387.63204193115234
126 dec_48_0_classifications.h5 633528 393.7428050041199
127 dec_48_33_classifications.h5 637351 381.527606010437
128 dec_48_66_classifications.h5 627876 388.64561009407043
129 dec_49_0_classifications.h5 621346 384.6359097957611
130 dec_49_33_classifications.h5 619251 386.19359588623047
131 dec_49_66_classifications.h5 613690 401.90838098526
132 dec_4_0_classifications.h5 692411 383.62302899360657
133 dec_4_33_classifications.h5 702505 478.05760622024536
134 dec_4_66_classifications.h5 700174 381.71723675727844
135 dec_50_0_classifications.h5 600174 378.12193179130554
136 dec_50_33_classifications.h5 595709 377.5705268383026
137 dec_50_66_classifications.h5 592239 394.7410247325897
138 dec_51_0_classifications.h5 588410 398.81154894828796
139 dec_51_33_classifications.h5 593976 384.5032420158386
140 dec_51_66_classifications.h5 600282 379.00054717063904
141 dec_52_0_classifications.h5 586664 394.9115529060364
142 dec_52_33_classifications.h5 578202 381.40235805511475
143 dec_52_66_classifications.h5 575269 471.05260705947876
144 dec_53_0_classifications.h5 574480 418.74139285087585
145 dec_53_33_classifications.h5 578224 387.1577842235565
146 dec_53_66_classifications.h5 575385 396.72381591796875
147 dec_54_0_classifications.h5 571299 401.5738229751587
148 dec_54_33_classifications.h5 581275 397.4332082271576
149 dec_54_66_classifications.h5 571166 405.3920569419861
150 dec_55_0_classifications.h5 555431 390.4550349712372
151 dec_55_33_classifications.h5 551628 391.9244558811188
152 dec_55_66_classifications.h5 542733 380.74407982826233
153 dec_56_0_classifications.h5 531019 377.9718520641327
154 dec_56_33_classifications.h5 538052 375.2215428352356
155 dec_56_66_classifications.h5 532132 389.56990790367126
156 dec_57_0_classifications.h5 524473 432.7460060119629
157 dec_57_33_classifications.h5 500479 439.8597848415375
158 dec_57_66_classifications.h5 478351 398.0989489555359
159 dec_58_0_classifications.h5 460360 377.2797451019287
160 dec_58_33_classifications.h5 441638 376.7341032028198
161 dec_58_66_classifications.h5 440643 418.21381878852844
162 dec_59_0_classifications.h5 433519 418.34160113334656
163 dec_59_33_classifications.h5 434159 419.8943119049072
164 dec_59_66_classifications.h5 439118 422.12278294563293
165 dec_5_0_classifications.h5 686613 388.05866289138794
166 dec_5_33_classifications.h5 692607 386.3761558532715
167 dec_5_66_classifications.h5 699495 392.1425049304962
168 dec_60_0_classifications.h5 435795 388.93064188957214
169 dec_60_33_classifications.h5 433534 381.87097096443176
170 dec_60_66_classifications.h5 430804 382.8300359249115
171 dec_61_0_classifications.h5 415877 378.68668699264526
172 dec_61_33_classifications.h5 401735 473.33434200286865
173 dec_61_66_classifications.h5 387589 441.5496919155121
174 dec_62_0_classifications.h5 371296 378.1904990673065
175 dec_62_33_classifications.h5 380571 390.9993968009949
176 dec_62_66_classifications.h5 384651 381.1999189853668
177 dec_63_0_classifications.h5 378857 379.6456220149994
178 dec_63_33_classifications.h5 358500 377.79135394096375
179 dec_63_66_classifications.h5 344625 385.6945147514343
180 dec_64_0_classifications.h5 341989 380.1457140445709
181 dec_64_33_classifications.h5 325497 407.07633876800537
182 dec_64_66_classifications.h5 305148 392.07895708084106
183 dec_65_0_classifications.h5 288736 384.9093887805939
184 dec_65_33_classifications.h5 267586 380.8269202709198
185 dec_65_66_classifications.h5 247385 369.0037999153137
186 dec_66_0_classifications.h5 235848 373.1155300140381
187 dec_66_33_classifications.h5 225802 377.9298691749573
188 dec_66_66_classifications.h5 222624 385.65524673461914
189 dec_67_0_classifications.h5 218088 374.84373569488525
190 dec_67_33_classifications.h5 220727 380.5326840877533
191 dec_67_66_classifications.h5 218057 373.47817492485046
192 dec_68_0_classifications.h5 218581 380.4909541606903
193 dec_68_33_classifications.h5 216302 373.28163719177246
194 dec_68_66_classifications.h5 207374 368.71164202690125
195 dec_69_0_classifications.h5 200685 377.82079815864563
196 dec_69_33_classifications.h5 196631 379.99802899360657
197 dec_69_66_classifications.h5 193662 373.63645911216736
198 dec_6_0_classifications.h5 700286 478.96702098846436
199 dec_6_33_classifications.h5 709559 397.8689498901367
200 dec_6_66_classifications.h5 712838 384.33216404914856
201 dec_70_0_classifications.h5 191798 385.77703285217285
202 dec_70_33_classifications.h5 187996 380.084841966629
203 dec_70_66_classifications.h5 184043 372.7233238220215
204 dec_71_0_classifications.h5 176418 380.5249443054199
205 dec_71_33_classifications.h5 171673 383.9057490825653
206 dec_71_66_classifications.h5 164827 375.3410928249359
207 dec_72_0_classifications.h5 159186 394.6630051136017
208 dec_72_33_classifications.h5 152543 380.9152979850769
209 dec_72_66_classifications.h5 148104 390.7869780063629
210 dec_73_0_classifications.h5 141245 374.6623418331146
211 dec_73_33_classifications.h5 137087 387.5317687988281
212 dec_73_66_classifications.h5 135304 412.9150619506836
213 dec_74_0_classifications.h5 131841 380.7487738132477
214 dec_74_33_classifications.h5 126234 382.7300281524658
215 dec_74_66_classifications.h5 122757 379.51909017562866
216 dec_75_0_classifications.h5 116221 383.8978199958801
217 dec_75_33_classifications.h5 110896 382.02369689941406
218 dec_75_66_classifications.h5 107839 380.35241627693176
219 dec_76_0_classifications.h5 105612 377.49670124053955
220 dec_76_33_classifications.h5 100290 381.0842161178589
221 dec_76_66_classifications.h5 97397 378.35441398620605
222 dec_77_0_classifications.h5 95639 375.7300591468811
223 dec_77_33_classifications.h5 92313 374.90229511260986
224 dec_77_66_classifications.h5 89881 378.6854588985443
225 dec_78_0_classifications.h5 87305 382.90948009490967
226 dec_78_33_classifications.h5 84627 388.2641558647156
227 dec_78_66_classifications.h5 82487 378.8553659915924
228 dec_79_0_classifications.h5 80065 384.51878595352173
229 dec_79_33_classifications.h5 76857 401.30842995643616
230 dec_79_66_classifications.h5 74364 401.42065382003784
231 dec_7_0_classifications.h5 725713 409.46133685112
232 dec_7_33_classifications.h5 734445 451.5796310901642
233 dec_7_66_classifications.h5 731489 397.8581509590149
234 dec_80_0_classifications.h5 70581 373.5890347957611
235 dec_80_33_classifications.h5 66807 380.78718304634094
236 dec_80_66_classifications.h5 63950 384.68487191200256
237 dec_81_0_classifications.h5 60251 384.49052000045776
238 dec_81_33_classifications.h5 57919 384.0024468898773
239 dec_81_66_classifications.h5 55348 381.4531271457672
240 dec_82_0_classifications.h5 53062 377.07515811920166
241 dec_82_33_classifications.h5 51294 380.8139491081238
242 dec_82_66_classifications.h5 48278 378.79992723464966
243 dec_83_0_classifications.h5 45663 383.40514373779297
244 dec_83_33_classifications.h5 42976 384.35234093666077
245 dec_83_66_classifications.h5 41006 376.10813903808594
246 dec_84_0_classifications.h5 37981 377.6583821773529
247 dec_84_33_classifications.h5 36636 380.11888098716736
248 dec_84_66_classifications.h5 33992 386.99919509887695
249 dec_85_0_classifications.h5 31979 436.90270709991455
250 dec_85_33_classifications.h5 29151 399.22216606140137
251 dec_85_66_classifications.h5 25206 386.26906418800354
252 dec_86_0_classifications.h5 21838 380.76836681365967
253 dec_86_33_classifications.h5 19575 392.5801968574524
254 dec_86_66_classifications.h5 16602 444.0202991962433
255 dec_87_0_classifications.h5 14528 389.37066292762756
256 dec_87_33_classifications.h5 13065 376.6401789188385
257 dec_87_66_classifications.h5 10751 387.94010281562805
258 dec_88_0_classifications.h5 9609 375.1829791069031
259 dec_88_33_classifications.h5 8134 379.0950393676758
260 dec_88_66_classifications.h5 6712 580.2838730812073
261 dec_89_0_classifications.h5 4351 599.3350048065186
262 dec_89_33_classifications.h5 2410 663.5339300632477
263 dec_89_66_classifications.h5 871 587.2539188861847
264 dec_8_0_classifications.h5 750062 535.545551776886
265 dec_8_33_classifications.h5 737019 848.7231299877167
266 dec_8_66_classifications.h5 729383 429.6295051574707
267 dec_9_0_classifications.h5 742824 511.20267128944397
268 dec_9_33_classifications.h5 748567 536.573657989502
269 dec_9_66_classifications.h5 751390 776.7114338874817
270 dec_neg0_33_classifications.h5 678393 392.0236930847168
271 dec_neg0_66_classifications.h5 675041 412.383483171463
272 dec_neg10_0_classifications.h5 711520 407.9062600135803
273 dec_neg10_33_classifications.h5 712185 411.1081519126892
274 dec_neg10_66_classifications.h5 704438 396.8516821861267
275 dec_neg11_0_classifications.h5 696436 411.70273089408875
276 dec_neg11_33_classifications.h5 697500 429.0195381641388
277 dec_neg11_66_classifications.h5 700552 406.98169112205505
278 dec_neg12_0_classifications.h5 716650 406.06530928611755
279 dec_neg12_33_classifications.h5 741383 425.8729200363159
280 dec_neg12_66_classifications.h5 757077 408.7501187324524
281 dec_neg13_0_classifications.h5 762072 406.440682888031
282 dec_neg13_33_classifications.h5 768092 404.00602293014526
283 dec_neg13_66_classifications.h5 772968 397.9948091506958
284 dec_neg14_0_classifications.h5 792244 401.7813959121704
285 dec_neg14_33_classifications.h5 788791 390.6637408733368
286 dec_neg14_66_classifications.h5 801469 406.0607399940491
287 dec_neg15_0_classifications.h5 826791 408.45109605789185
288 dec_neg15_33_classifications.h5 832377 757.2079820632935
289 dec_neg15_66_classifications.h5 863089 402.58084297180176
290 dec_neg16_0_classifications.h5 866199 410.9230308532715
291 dec_neg16_33_classifications.h5 863325 400.9337000846863
292 dec_neg16_66_classifications.h5 873414 405.2216639518738
293 dec_neg17_0_classifications.h5 903116 411.99813413619995
294 dec_neg17_33_classifications.h5 915329 400.4179120063782
295 dec_neg17_66_classifications.h5 922768 413.18880319595337
296 dec_neg18_0_classifications.h5 951431 403.31184911727905
297 dec_neg18_33_classifications.h5 956567 411.19872999191284
298 dec_neg18_66_classifications.h5 928347 409.10492300987244
299 dec_neg19_0_classifications.h5 912767 407.4833040237427
300 dec_neg19_33_classifications.h5 919204 408.7531461715698
301 dec_neg19_66_classifications.h5 911961 416.4954979419708
302 dec_neg1_0_classifications.h5 669318 404.1250081062317
303 dec_neg1_33_classifications.h5 660705 638.2015843391418
304 dec_neg1_66_classifications.h5 647519 413.20920610427856
305 dec_neg20_0_classifications.h5 925321 413.1645770072937
306 dec_neg20_33_classifications.h5 938942 453.6357729434967
307 dec_neg20_66_classifications.h5 941849 404.61422419548035
308 dec_neg21_0_classifications.h5 937711 415.81551599502563
309 dec_neg21_33_classifications.h5 933385 413.3734509944916
310 dec_neg21_66_classifications.h5 932217 410.89885687828064
311 dec_neg22_0_classifications.h5 923795 421.76307678222656
312 dec_neg22_33_classifications.h5 926727 409.59266781806946
313 dec_neg22_66_classifications.h5 926397 417.14672899246216
314 dec_neg23_0_classifications.h5 938536 410.79341411590576
315 dec_neg23_33_classifications.h5 953945 422.8170909881592
316 dec_neg23_66_classifications.h5 951778 415.0290598869324
317 dec_neg24_0_classifications.h5 927828 411.2718291282654
318 dec_neg24_33_classifications.h5 928222 488.85467004776
319 dec_neg24_66_classifications.h5 947682 405.9099769592285
320 dec_neg25_0_classifications.h5 971902 414.3095371723175
321 dec_neg25_33_classifications.h5 982846 412.6185700893402
322 dec_neg25_66_classifications.h5 984783 419.5385160446167
323 dec_neg26_0_classifications.h5 988966 426.55426001548767
324 dec_neg26_33_classifications.h5 1018492 417.61334204673767
325 dec_neg26_66_classifications.h5 1033495 419.11683201789856
326 dec_neg27_0_classifications.h5 1057683 422.1968777179718
327 dec_neg27_33_classifications.h5 1064962 433.58386492729187
328 dec_neg27_66_classifications.h5 1064835 435.39455008506775
329 dec_neg28_0_classifications.h5 1073982 418.3204050064087
330 dec_neg28_33_classifications.h5 1094984 424.3140118122101
331 dec_neg28_66_classifications.h5 1107520 435.85741901397705
332 dec_neg29_0_classifications.h5 1110475 427.8917429447174
333 dec_neg29_33_classifications.h5 1149132 425.70124197006226
334 dec_neg29_66_classifications.h5 1178925 510.3772130012512
335 dec_neg2_0_classifications.h5 630900 427.14442110061646
336 dec_neg2_33_classifications.h5 627642 420.6468040943146
337 dec_neg2_66_classifications.h5 611411 412.7870659828186
338 dec_neg30_0_classifications.h5 1212770 423.57106614112854
339 dec_neg30_33_classifications.h5 1223495 425.3601505756378
340 dec_neg30_66_classifications.h5 1194425 413.5808720588684
341 dec_neg31_0_classifications.h5 1044774 441.13332295417786
342 dec_neg31_33_classifications.h5 774520 399.7613320350647
343 dec_neg31_66_classifications.h5 455170 386.17792105674744
344 dec_neg32_0_classifications.h5 353124 383.7046089172363
345 dec_neg3_0_classifications.h5 598185 409.2859630584717
346 dec_neg3_33_classifications.h5 579003 436.72743701934814
347 dec_neg3_66_classifications.h5 584757 427.22632598876953
348 dec_neg4_0_classifications.h5 574238 453.2446918487549
349 dec_neg4_33_classifications.h5 592576 417.2610869407654
350 dec_neg4_66_classifications.h5 601947 409.91581988334656
351 dec_neg5_0_classifications.h5 625994 425.21836280822754
352 dec_neg5_33_classifications.h5 649259 426.67724108695984
353 dec_neg5_66_classifications.h5 666715 407.4867699146271
354 dec_neg6_0_classifications.h5 678700 411.18267011642456
355 dec_neg6_33_classifications.h5 690481 447.3075051307678
356 dec_neg6_66_classifications.h5 684378 459.7576858997345
357 dec_neg7_0_classifications.h5 679641 413.42535185813904
358 dec_neg7_33_classifications.h5 685438 403.9921610355377
359 dec_neg7_66_classifications.h5 700735 438.93073296546936
360 dec_neg8_0_classifications.h5 690859 475.3974268436432
361 dec_neg8_33_classifications.h5 697726 461.5197367668152
362 dec_neg8_66_classifications.h5 693867 409.41863799095154
363 dec_neg9_0_classifications.h5 708074 428.4089050292969
364 dec_neg9_33_classifications.h5 709152 436.9818551540375
365 dec_neg9_66_classifications.h5 705988 413.19322896003723

In [6]:
del pm_df
gc.collect()


Out[6]:
14

In [4]:
pm_files = glob.glob(gaia_dir + "pm*h5")

for file_num, pm_file in enumerate(pm_files):

    exec("pm_df{} = pd.read_hdf(pm_file)".format(file_num))

In [8]:
pm_list = [pm_df0, pm_df1, pm_df2, pm_df3, pm_df4, pm_df5, pm_df6, pm_df7, pm_df8, pm_df9, pm_df10, pm_df11, pm_df12, pm_df13, pm_df14, pm_df15, pm_df16, pm_df17, pm_df18, pm_df19, pm_df20, pm_df21, pm_df22, pm_df23, pm_df24, pm_df25, pm_df26, pm_df27, pm_df28, pm_df29, pm_df30, pm_df31, pm_df32, pm_df33, pm_df34, pm_df35, pm_df36, pm_df37, pm_df38, pm_df39, pm_df40, pm_df41, pm_df42, pm_df43, pm_df44, pm_df45, pm_df46, pm_df47, pm_df48, pm_df49, pm_df50, pm_df51, pm_df52, pm_df53, pm_df54, pm_df55, pm_df56, pm_df57, pm_df58, pm_df59, pm_df60, pm_df61, pm_df62, pm_df63, pm_df64, pm_df65, pm_df66, pm_df67, pm_df68, pm_df69, pm_df70, pm_df71, pm_df72, pm_df73, pm_df74, pm_df75, pm_df76, pm_df77, pm_df78, pm_df79, pm_df80, pm_df81, pm_df82, pm_df83, pm_df84, pm_df85, pm_df86, pm_df87, pm_df88, pm_df89, pm_df90, pm_df91, pm_df92, pm_df93, pm_df94, pm_df95, pm_df96, pm_df97, pm_df98, pm_df99, pm_df100, pm_df101, pm_df102, pm_df103, pm_df104, pm_df105, pm_df106, pm_df107, pm_df108, pm_df109, pm_df110, pm_df111, pm_df112, pm_df113, pm_df114, pm_df115, pm_df116, pm_df117, pm_df118, pm_df119, pm_df120, pm_df121, pm_df122, pm_df123, pm_df124, pm_df125, pm_df126, pm_df127, pm_df128, pm_df129, pm_df130, pm_df131, pm_df132, pm_df133, pm_df134, pm_df135, pm_df136, pm_df137, pm_df138, pm_df139, pm_df140, pm_df141, pm_df142, pm_df143, pm_df144, pm_df145, pm_df146, pm_df147, pm_df148, pm_df149, pm_df150, pm_df151, pm_df152, pm_df153, pm_df154, pm_df155, pm_df156, pm_df157, pm_df158, pm_df159, pm_df160, pm_df161, pm_df162, pm_df163, pm_df164, pm_df165, pm_df166, pm_df167, pm_df168, pm_df169, pm_df170, pm_df171, pm_df172, pm_df173, pm_df174, pm_df175, pm_df176, pm_df177, pm_df178, pm_df179, pm_df180, pm_df181, pm_df182, pm_df183, pm_df184, pm_df185, pm_df186, pm_df187, pm_df188, pm_df189, pm_df190, pm_df191, pm_df192, pm_df193, pm_df194, pm_df195, pm_df196, pm_df197, pm_df198, pm_df199, pm_df200, pm_df201, pm_df202, pm_df203, pm_df204, pm_df205, pm_df206, pm_df207, pm_df208, pm_df209, pm_df210, pm_df211, pm_df212, pm_df213, pm_df214, pm_df215, pm_df216, pm_df217, pm_df218, pm_df219, pm_df220, pm_df221, pm_df222, pm_df223, pm_df224, pm_df225, pm_df226, pm_df227, pm_df228, pm_df229, pm_df230, pm_df231, pm_df232, pm_df233, pm_df234, pm_df235, pm_df236, pm_df237, pm_df238, pm_df239, pm_df240, pm_df241, pm_df242, pm_df243, pm_df244, pm_df245, pm_df246, pm_df247, pm_df248, pm_df249, pm_df250, pm_df251, pm_df252, pm_df253, pm_df254, pm_df255, pm_df256, pm_df257, pm_df258, pm_df259, pm_df260, pm_df261, pm_df262, pm_df263, pm_df264, pm_df265, pm_df266, pm_df267, pm_df268, pm_df269, pm_df270, pm_df271, pm_df272, pm_df273, pm_df274, pm_df275, pm_df276, pm_df277, pm_df278, pm_df279, pm_df280, pm_df281, pm_df282, pm_df283, pm_df284, pm_df285, pm_df286, pm_df287, pm_df288, pm_df289, pm_df290, pm_df291, pm_df292, pm_df293, pm_df294, pm_df295, pm_df296, pm_df297, pm_df298, pm_df299, pm_df300, pm_df301, pm_df302, pm_df303, pm_df304, pm_df305, pm_df306, pm_df307, pm_df308, pm_df309, pm_df310, pm_df311, pm_df312, pm_df313, pm_df314, pm_df315, pm_df316, pm_df317, pm_df318, pm_df319, pm_df320, pm_df321, pm_df322, pm_df323, pm_df324, pm_df325, pm_df326, pm_df327, pm_df328, pm_df329, pm_df330, pm_df331, pm_df332, pm_df333, pm_df334, pm_df335, pm_df336, pm_df337, pm_df338, pm_df339, pm_df340, pm_df341, pm_df342, pm_df343, pm_df344, pm_df345, pm_df346, pm_df347, pm_df348, pm_df349, pm_df350, pm_df351, pm_df352, pm_df353, pm_df354, pm_df355, pm_df356, pm_df357, pm_df358, pm_df359, pm_df360, pm_df361, pm_df362, pm_df363, pm_df364, pm_df365]

In [6]:
merge_pm = pd.concat(pm_list)

In [7]:
merge_df.to_hdf("pm_ps1_gaia_cat_merge.h5", "d1")

Start here if the merge file has already been created

Parallax analysis

Gaia-PS1 crossmatch sources with parallax_over_error > 8.


In [40]:
pxl_df = pd.read_hdf("parallax_ps1_gaia_cat_merge.h5")

In [41]:
pxl_df[0:10]


Out[41]:
pm_over_error parallax_over_error g_mag raStack decStack qualityFlag rf_score b
objid
108000028669249816 83.232492 26.920013 12.128826 2.866989 0.007826 76 0.974833 -61.214089
108000029940524268 62.967979 11.970542 15.538984 2.994026 0.003205 60 1.000000 -61.258982
108000030724739778 106.435865 20.437815 14.500710 3.072415 0.007779 60 0.997500 -61.279410
108000037305462434 417.887911 50.179569 13.282494 3.730547 0.001656 28 1.000000 -61.486198
108000045395010918 24.263833 9.774562 17.020859 4.539510 0.000384 60 0.994417 -61.717035
108000050523434788 175.836593 49.341476 12.911674 5.052402 0.003696 76 0.998750 -61.849262
108000053490031481 95.195011 73.739563 13.268054 5.349069 0.000808 60 0.994167 -61.926735
108000064954225930 173.700455 15.487198 15.870447 6.495432 0.004593 60 0.995833 -62.186016
108000071830558908 133.521787 19.403772 14.231335 7.183038 0.007104 60 0.998500 -62.321417
108000071934395405 15.493867 11.963029 17.280767 7.193439 0.004147 60 1.000000 -62.326289

In [42]:
N_pxl = len(pxl_df)
print("There are {} stars with PS1 scores that pass the pxl cut".format(N_pxl))
print("\t")
print("There are {} stars not in the PS1 RF catalog".format(38764553 - N_pxl))


There are 35599830 stars with PS1 scores that pass the pxl cut
	
There are 3164723 stars not in the PS1 RF catalog

In [43]:
np.percentile(pxl_df["rf_score"], [0.2325,1.925,50,86.39,86.4])


Out[43]:
array([ 0.50004762,  0.83      ,  0.99104167,  0.9996875 ,  1.        ])

The above percentile call reveals the following:

  • 14.6% of these Gaia stars have PS1_rf = 1
  • 50% of these Gaia stars have PS1_df > 0.99104167
  • 98.1% of these Gaia stars have PS1_df > .83 [the threshold for scanning]
  • 99.76% of these Gaia stars have PS1_df > .5 [classical classification threshold

In [44]:
high_lat = np.where(np.abs(pxl_df['b'] > 30))
low_lat = np.where(np.abs(pxl_df['b'] < 10))

In [45]:
col_dict = {'mustard': (226/256,153/256,48/256,1),
            'blue': (33/256,124/256,163/256, 1),
            'asphalt': (50/256,56/256,77/256, 1),
            'pale_mustard': (226/256,153/256,48/256,0.4),
            'pale_blue': (33/256,124/256,163/256,0.4),
            'pale_asphalt': (50/256,56/256,77/256,0.4)
           }
thresh = 0.83 #for nDet>2 sources

In [48]:
fig, ax = plt.subplots()
ax.hist(pxl_df["rf_score"], bins=50,
        histtype='stepfilled', 
        edgecolor=col_dict['blue'], linewidth=2,
        facecolor=col_dict['pale_blue'], label="Gaia stars")
ax.hist(pxl_df["rf_score"].iloc[low_lat], bins=50,
        histtype='stepfilled', 
        edgecolor=col_dict['mustard'], linewidth=2,
        facecolor=col_dict['pale_mustard'], label=r"$|b| < 10\degree$")

ax.hist(pxl_df["rf_score"].iloc[high_lat], bins=50,
        histtype='stepfilled', 
        edgecolor=col_dict['asphalt'], linewidth=2,
        facecolor=col_dict['pale_asphalt'], label=r"$|b| > 30\degree$")

ax.set_yscale("log")
ax.set_xlim(-0.01, 1.01)
ax.set_ylim(3e1, 3e7)
ax.tick_params(which="both", top=True, right=True, labelsize=11)
ax.xaxis.set_major_locator(MultipleLocator(0.1))
ax.xaxis.set_minor_locator(MultipleLocator(0.025))
ax.set_xlabel("RF score", fontsize=14)
ax.set_ylabel("N", fontsize=14)

ax.vlines([thresh], 10, 1e9, 
          linestyles=":", 
          color='k', lw=2, zorder=11)
# ax.text(thresh, 6e5, 'FoM threshold', 
#         color='k', 
#         rotation=90, ha="right", fontsize=14)
ax.text(thresh, 8e6, r'$\longleftarrow \mathrm{Galaxies}$ ', 
        color='k', 
        ha="right", fontsize=13)
ax.text(thresh, 8e6, r' $\mathrm{Stars} \longrightarrow$', 
        color='k', 
        ha="left", fontsize=13)

ax.legend(loc=2, bbox_to_anchor = (0.05,0,1,1), 
          bbox_transform=ax.transAxes)

fig.subplots_adjust(left=0.1,right=0.99,top=0.98,bottom=0.1)
fig.savefig("../paper/Figures/Gaia_PS1_cat_hist.pdf")



In [ ]:
fig, ax = plt.subplots()
ax.hist(merge_df["rf_score"][0:100000], bins=50,
        histtype='stepfilled', 
        edgecolor=col_dict['blue'], linewidth=2,
        facecolor=col_dict['pale_blue'], label="Gaia stars")
ax.set_yscale('log')

Proper Motion Analysis

Gaia sources with a pm SNR $\ge$ 7.5 are selected as stars in this subsample.


In [3]:
pm_df = pd.read_hdf("pm_ps1_gaia_cat_merge.h5")

In [4]:
N_pm = len(pm_df)
N_pm_and_pxl = len(np.where(pm_df["parallax_over_error"] >= 8)[0])
print("There are {} stars with PS1 scores that pass the pm cut".format(N_pm))
print("\tOf these, {:d} ({:d}) do (not) pass the pxl cut".format(N_pm_and_pxl, N_pm - N_pm_and_pxl))
print("\tThere are 35599830 stars in the pxl sample")
print("\t")
print("There are {} stars not in the PS1 RF catalog".format(234176264 - N_pm))


There are 225682755 stars with PS1 scores that pass the pm cut
	Of these, 35046891 (190635864) do (not) pass the pxl cut
	There are 35599830 stars in the pxl sample
	
There are 8493509 stars not in the PS1 RF catalog

In [5]:
np.percentile(pm_df["rf_score"], [0.552,5.551,50,91.7])


Out[5]:
array([0.5       , 0.83019643, 0.97919643, 1.        ])

The above percentile call reveals the following:

  • 8.3% of these Gaia stars have PS1_rf = 1
  • 50% of these Gaia stars have PS1_df > 0.97919643
  • 94.45% of these Gaia stars have PS1_df > .83 [the threshold for scanning]
  • 99.45% of these Gaia stars have PS1_df > .5 [classical classification threshold

In [8]:
np.percentile(pm_df["g_mag"], [1,5,25,50,75,95,99])


Out[8]:
array([13.38650322, 14.8205862 , 16.85657501, 18.00119591, 18.85796165,
       19.7301445 , 20.17969704])

In [9]:
high_lat = np.where(np.abs(pm_df['b'] > 30))
low_lat = np.where(np.abs(pm_df['b'] < 10))

In [10]:
col_dict = {'mustard': (226/256,153/256,48/256,1),
            'blue': (33/256,124/256,163/256, 1),
            'asphalt': (50/256,56/256,77/256, 1),
            'pale_mustard': (226/256,153/256,48/256,0.4),
            'pale_blue': (33/256,124/256,163/256,0.4),
            'pale_asphalt': (50/256,56/256,77/256,0.4)
           }
thresh = 0.83 #for nDet>2 sources

In [11]:
fig, ax = plt.subplots(figsize=(7,5))
ax.hist(pm_df["rf_score"], range=(0,1), bins=50,
        histtype='stepfilled', 
        edgecolor=col_dict['blue'], linewidth=2,
        facecolor=col_dict['pale_blue'], label="Gaia stars")
ax.hist(pm_df["rf_score"].iloc[low_lat], range=(0,1), bins=50,
        histtype='stepfilled', 
        edgecolor=col_dict['mustard'], linewidth=2,
        facecolor=col_dict['pale_mustard'], label=r"$|b| < 10\degree$")

ax.hist(pm_df["rf_score"].iloc[high_lat], range=(0,1), bins=50,
        histtype='stepfilled', 
        edgecolor=col_dict['asphalt'], linewidth=2,
        facecolor=col_dict['pale_asphalt'], label=r"$|b| > 30\degree$")

ax.set_yscale("log")
ax.set_xlim(-0.01, 1.01)
ax.set_ylim(5e3, 1.4e8)
ax.tick_params(which="both", top=True, right=True, labelsize=15)
ax.xaxis.set_major_locator(MultipleLocator(0.1))
ax.xaxis.set_minor_locator(MultipleLocator(0.025))
ax.set_xlabel("RF score", fontsize=15)
ax.set_ylabel("N", fontsize=15)

ax.vlines([thresh], 10, 3e10, 
          linestyles=":", 
          color='k', lw=2, zorder=11)
ax.text(thresh, 8e5, 'FoM threshold', 
        color='k', 
        rotation=90, ha="right", fontsize=14)
ax.text(thresh, 4e7, r'$\longleftarrow \mathrm{Galaxies}$ ', 
        color='k', 
        ha="right", fontsize=13)
ax.text(thresh, 4e7, r' $\mathrm{Stars} \longrightarrow$', 
        color='k', 
        ha="left", fontsize=13)

ax.legend(loc=2, bbox_to_anchor = (0.05,0,1,1), 
          bbox_transform=ax.transAxes, fontsize=13)

fig.subplots_adjust(left=0.105,right=0.98,top=0.98,bottom=0.11)
fig.savefig("../paper/Figures/Gaia_PS1_pm_hist.pdf")



In [ ]: