In [109]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
plt.style.use('ggplot')
%matplotlib inline

In [81]:
keep_fake = pd.read_csv('keep_fake.csv')
found_fake = pd.read_csv('found_fake.csv')
found_res = pd.read_csv('found_res.csv')

In [82]:
keep_fake.columns


Out[82]:
Index(['x', 'y', 'xv', 'yv', 'flux', 'mag', 'unmasked_obs', 'x_final',
       'y_final', 'patch'],
      dtype='object')

In [137]:
fig = plt.figure(figsize=(24, 10))

fig.add_subplot(1,2,1)
n, bins, _ = plt.hist(keep_fake['mag'], bins=12, range=(20, 26), label='Total Simulated Objects')
n2, bins2, _ = plt.hist(found_fake['mag'], bins=bins, range=(20, 26), 
                        histtype='stepfilled', lw=6, label='Recovered Simulated Objects')
plt.xlabel('Simulated Object Magnitudes', size=28)
plt.ylabel('Simulated Object Counts', size=28)
plt.legend(fontsize=23)
plt.xticks(size=28)
plt.yticks(size=28)

fig.add_subplot(1,2,2)
plt.plot(bins[:-1]+0.25, n2/n, '-o', markersize=20, lw=8)
plt.xlabel('Simulated Object Magnitudes', size=28)
plt.ylabel('Fraction of recovered simulated objects', size=28)
plt.legend(fontsize=22)
plt.xticks(size=28)
plt.yticks(size=28)

plt.suptitle('Simulated Object Recovery', size=32)
plt.subplots_adjust(top=0.92)



In [138]:
fig = plt.figure(figsize=(24, 10))

fig.add_subplot(1,2,1)
n, bins, _ = plt.hist(keep_fake['mag'], bins=24, range=(20, 26), label='Total Simulated Objects')
n2, bins2, _ = plt.hist(found_fake['mag'], bins=bins, range=(20, 26), 
                        histtype='stepfilled', lw=6, label='Recovered Simulated Objects')
plt.xlabel('Simulated Object Magnitudes', size=28)
plt.ylabel('Simulated Object Counts', size=28)
plt.legend(fontsize=23)
plt.xticks(size=28)
plt.yticks(size=28)

fig.add_subplot(1,2,2)
plt.plot(bins[:-1]+0.125, n2/n, '-o', markersize=20, lw=8)
plt.xlabel('Simulated Object Magnitudes', size=28)
plt.ylabel('Fraction of recovered simulated objects', size=28)
plt.legend(fontsize=22)
plt.xticks(size=28)
plt.yticks(size=28)

plt.suptitle('Simulated Object Recovery', size=32)
plt.subplots_adjust(top=0.92)



In [114]:
plt.figure(figsize=(10, 10))
plt.plot(bins[:-1]+0.25, n2/n, '-o', markersize=20)
plt.xlabel('Simulated Object Magnitudes', size=22)
plt.ylabel('Fraction of recovered simulated objects', size=22)
plt.legend(fontsize=22)
plt.title('Simulated Object Recovery', size=28)
plt.xticks(size=22)
plt.yticks(size=22)


Out[114]:
(array([-0.2,  0. ,  0.2,  0.4,  0.6,  0.8,  1. ,  1.2]),
 <a list of 8 Text yticklabel objects>)

In [99]:
n2/n


Out[99]:
array([ 0.62790698,  0.875     ,  0.875     ,  0.90243902,  0.96666667,
        0.97727273,  0.8974359 ,  0.93333333,  0.40909091,  0.        ,
        0.        ,  0.        ])

In [38]:
keep_fake


Out[38]:
x y xv yv flux mag unmasked_obs x_final y_final patch
0 3305.0 2862.0 189.665222 34.609936 2117.384277 21.432501 7 3722 2938 0,3
1 108.0 2144.0 393.029480 216.829071 3728.582764 20.818141 13 972 2621 2,5
2 1191.0 1749.0 129.397659 58.372631 3292.639160 20.953140 13 1475 1877 2,5
3 3158.0 889.0 97.114906 32.111443 752.506042 22.555725 13 3371 959 2,5
4 733.0 1154.0 222.841461 34.646568 63.559986 25.239041 13 1223 1230 2,5
5 408.0 2488.0 405.572174 188.096786 3860.666260 20.780344 13 1300 2901 2,5
6 3006.0 21.0 323.802063 121.130768 460.648071 23.088577 13 3718 287 2,5
7 79.0 1510.0 294.700073 112.951569 73.852783 25.076083 8 727 1758 2,5
8 1867.0 2201.0 130.211731 42.661949 5051.555176 20.488437 13 2153 2294 2,5
9 3198.0 1884.0 191.860626 90.937599 511.169434 22.975588 13 3620 2084 2,5
10 2160.0 2430.0 420.752228 65.734528 445.612061 23.124608 10 3085 2574 2,5
11 1939.0 1367.0 365.740356 206.477249 1047.418823 22.196699 8 2743 1821 2,5
12 3305.0 2862.0 189.792892 33.902798 2117.384277 21.432501 13 3722 2936 2,5
13 2728.0 1159.0 318.751312 47.973686 2737.900879 21.153456 13 3429 1264 2,5
14 1172.0 436.0 373.086731 120.645622 1146.149902 22.098896 13 1993 701 2,5
15 1787.0 1686.0 140.032181 72.833832 258.473358 23.715961 9 2095 1846 2,5
16 1961.0 2125.0 257.785828 46.309196 895.258057 22.367129 8 2528 2226 2,5
17 1321.0 1047.0 434.031219 110.746376 40.472939 25.729088 13 2276 1290 2,5
18 2053.0 2595.0 402.588654 107.051483 1938.655029 21.528249 13 2938 2830 2,5
19 1767.0 185.0 435.455933 204.245850 1598.245605 21.737891 13 2725 634 2,5
20 2096.0 2538.0 367.111053 80.678917 1310.743408 21.953206 13 2903 2715 2,5
21 2203.0 2577.0 196.056061 114.422501 6657.672363 20.188694 9 2634 2828 2,5
22 1480.0 2696.0 356.434418 205.431625 36.706505 25.835142 10 2264 3148 2,5
23 1101.0 2690.0 474.458740 89.083366 6429.947266 20.226482 13 2145 2886 2,5
24 108.0 2144.0 393.711243 215.588669 3728.582764 20.818141 13 974 2618 4,6
25 1191.0 1749.0 129.581085 57.964317 3292.639160 20.953140 13 1476 1876 4,6
26 3158.0 889.0 97.215683 31.805052 752.506042 22.555725 13 3371 958 4,6
27 408.0 2488.0 406.163300 186.816986 3860.666260 20.780344 11 1301 2899 4,6
28 3006.0 21.0 324.182434 120.109131 460.648071 23.088577 13 3719 285 4,6
29 79.0 1510.0 295.054779 112.021736 73.852783 25.076083 13 728 1756 4,6
... ... ... ... ... ... ... ... ... ... ...
476 2203.0 2577.0 196.304276 113.996140 6657.672363 20.188694 10 2634 2827 4,4
477 1480.0 2696.0 356.880035 204.656509 36.706505 25.835142 13 2265 3146 4,4
478 1101.0 2690.0 474.651245 88.052025 6429.947266 20.226482 13 2145 2883 4,4
479 108.0 2144.0 393.205627 216.509445 3728.582764 20.818141 13 973 2620 3,4
480 1191.0 1749.0 129.445084 58.267403 3292.639160 20.953140 13 1475 1877 3,4
481 3158.0 889.0 97.140984 32.032467 752.506042 22.555725 13 3371 959 3,4
482 733.0 1154.0 222.869553 34.465366 63.559986 25.239041 13 1223 1229 3,4
483 408.0 2488.0 405.724976 187.766968 3860.666260 20.780344 13 1300 2901 3,4
484 3006.0 21.0 323.900452 120.867447 460.648071 23.088577 9 3718 286 3,4
485 79.0 1510.0 294.791840 112.711914 73.852783 25.076083 13 727 1758 3,4
486 411.0 1395.0 166.777100 96.215828 1022.156677 22.223206 13 778 1606 3,4
487 1867.0 2201.0 130.246384 42.556061 5051.555176 20.488437 13 2153 2294 3,4
488 3198.0 1884.0 191.934509 90.781570 511.169434 22.975588 6 3620 2083 3,4
489 2160.0 2430.0 420.805542 65.392395 445.612061 23.124608 13 3086 2573 3,4
490 1939.0 1367.0 365.908112 206.179794 1047.418823 22.196699 13 2744 1820 3,4
491 3305.0 2862.0 189.820404 33.748470 2117.384277 21.432501 9 3722 2936 3,4
492 2728.0 1159.0 318.790222 47.714500 2737.900879 21.153456 13 3429 1264 3,4
493 1172.0 436.0 373.184692 120.342232 1146.149902 22.098896 9 1993 700 3,4
494 1787.0 1686.0 140.091354 72.719948 258.473358 23.715961 13 2095 1846 3,4
495 1961.0 2125.0 257.823395 46.099579 895.258057 22.367129 9 2528 2226 3,4
496 1321.0 1047.0 434.121124 110.393433 40.472939 25.729088 13 2276 1289 3,4
497 2053.0 2595.0 402.675568 106.724106 1938.655029 21.528249 13 2939 2829 3,4
498 1767.0 185.0 435.621857 203.891724 1598.245605 21.737891 10 2725 633 3,4
499 1642.0 3371.0 102.407753 38.059231 256.970825 23.722290 13 1867 3454 3,4
500 2096.0 2538.0 367.176514 80.380402 1310.743408 21.953206 13 2904 2714 3,4
501 2203.0 2577.0 196.149033 114.263046 6657.672363 20.188694 13 2634 2828 3,4
502 1480.0 2696.0 356.601318 205.141754 36.706505 25.835142 13 2264 3147 3,4
503 1101.0 2690.0 474.531036 88.697563 6429.947266 20.226482 13 2145 2885 3,4
504 3198.0 1884.0 191.836868 90.987709 511.169434 22.975588 9 3620 2084 3,2
505 1642.0 3371.0 102.366814 38.169224 256.970825 23.722290 9 1867 3454 3,2

506 rows × 10 columns


In [39]:
found_fake


Out[39]:
x y xv yv flux mag unmasked_obs x_final y_final patch
0 3305.0 2862.0 189.665222 34.609936 2117.384277 21.432501 7 3722 2938 0,3
1 108.0 2144.0 393.029480 216.829071 3728.582764 20.818141 13 972 2621 2,5
2 1191.0 1749.0 129.397659 58.372631 3292.639160 20.953140 13 1475 1877 2,5
3 3158.0 889.0 97.114906 32.111443 752.506042 22.555725 13 3371 959 2,5
4 408.0 2488.0 405.572174 188.096786 3860.666260 20.780344 13 1300 2901 2,5
5 3006.0 21.0 323.802063 121.130768 460.648071 23.088577 13 3718 287 2,5
6 1867.0 2201.0 130.211731 42.661949 5051.555176 20.488437 13 2153 2294 2,5
7 3198.0 1884.0 191.860626 90.937599 511.169434 22.975588 13 3620 2084 2,5
8 2160.0 2430.0 420.752228 65.734528 445.612061 23.124608 10 3085 2574 2,5
9 1939.0 1367.0 365.740356 206.477249 1047.418823 22.196699 8 2743 1821 2,5
10 3305.0 2862.0 189.792892 33.902798 2117.384277 21.432501 13 3722 2936 2,5
11 2728.0 1159.0 318.751312 47.973686 2737.900879 21.153456 13 3429 1264 2,5
12 1172.0 436.0 373.086731 120.645622 1146.149902 22.098896 13 1993 701 2,5
13 1787.0 1686.0 140.032181 72.833832 258.473358 23.715961 9 2095 1846 2,5
14 1961.0 2125.0 257.785828 46.309196 895.258057 22.367129 8 2528 2226 2,5
15 2053.0 2595.0 402.588654 107.051483 1938.655029 21.528249 13 2938 2830 2,5
16 1767.0 185.0 435.455933 204.245850 1598.245605 21.737891 13 2725 634 2,5
17 2096.0 2538.0 367.111053 80.678917 1310.743408 21.953206 13 2903 2715 2,5
18 2203.0 2577.0 196.056061 114.422501 6657.672363 20.188694 9 2634 2828 2,5
19 1101.0 2690.0 474.458740 89.083366 6429.947266 20.226482 13 2145 2886 2,5
20 108.0 2144.0 393.711243 215.588669 3728.582764 20.818141 13 974 2618 4,6
21 1191.0 1749.0 129.581085 57.964317 3292.639160 20.953140 13 1476 1876 4,6
22 3158.0 889.0 97.215683 31.805052 752.506042 22.555725 13 3371 958 4,6
23 408.0 2488.0 406.163300 186.816986 3860.666260 20.780344 11 1301 2899 4,6
24 3006.0 21.0 324.182434 120.109131 460.648071 23.088577 13 3719 285 4,6
25 411.0 1395.0 167.001816 95.825279 1022.156677 22.223206 13 778 1605 4,6
26 1867.0 2201.0 130.345612 42.251144 5051.555176 20.488437 13 2153 2293 4,6
27 3198.0 1884.0 192.146423 90.332161 511.169434 22.975588 13 3620 2082 4,6
28 2160.0 2430.0 420.957428 64.407455 445.612061 23.124608 9 3086 2571 4,6
29 1939.0 1367.0 366.389587 205.322937 1047.418823 22.196699 11 2745 1818 4,6
... ... ... ... ... ... ... ... ... ... ...
363 1939.0 1367.0 366.188202 205.681900 1047.418823 22.196699 13 2744 1819 4,4
364 3305.0 2862.0 189.866135 33.490246 2117.384277 21.432501 13 3722 2935 4,4
365 2728.0 1159.0 318.854828 47.280838 2737.900879 21.153456 13 3429 1263 4,4
366 1172.0 436.0 373.348053 119.834511 1146.149902 22.098896 13 1993 699 4,4
367 1787.0 1686.0 140.190140 72.529335 258.473358 23.715961 13 2095 1845 4,4
368 1961.0 2125.0 257.885864 45.748844 895.258057 22.367129 9 2528 2225 4,4
369 2053.0 2595.0 402.820374 106.176285 1938.655029 21.528249 13 2939 2828 4,4
370 1767.0 185.0 435.898804 203.298996 1598.245605 21.737891 10 2726 632 4,4
371 1642.0 3371.0 102.459427 37.919899 256.970825 23.722290 13 1867 3454 4,4
372 2096.0 2538.0 367.285522 79.880890 1310.743408 21.953206 13 2904 2713 4,4
373 2203.0 2577.0 196.304276 113.996140 6657.672363 20.188694 10 2634 2827 4,4
374 108.0 2144.0 393.205627 216.509445 3728.582764 20.818141 13 973 2620 3,4
375 1191.0 1749.0 129.445084 58.267403 3292.639160 20.953140 13 1475 1877 3,4
376 3158.0 889.0 97.140984 32.032467 752.506042 22.555725 13 3371 959 3,4
377 408.0 2488.0 405.724976 187.766968 3860.666260 20.780344 13 1300 2901 3,4
378 3006.0 21.0 323.900452 120.867447 460.648071 23.088577 9 3718 286 3,4
379 411.0 1395.0 166.777100 96.215828 1022.156677 22.223206 13 778 1606 3,4
380 1867.0 2201.0 130.246384 42.556061 5051.555176 20.488437 13 2153 2294 3,4
381 2160.0 2430.0 420.805542 65.392395 445.612061 23.124608 13 3086 2573 3,4
382 1939.0 1367.0 365.908112 206.179794 1047.418823 22.196699 13 2744 1820 3,4
383 3305.0 2862.0 189.820404 33.748470 2117.384277 21.432501 9 3722 2936 3,4
384 2728.0 1159.0 318.790222 47.714500 2737.900879 21.153456 13 3429 1264 3,4
385 1172.0 436.0 373.184692 120.342232 1146.149902 22.098896 9 1993 700 3,4
386 1787.0 1686.0 140.091354 72.719948 258.473358 23.715961 13 2095 1846 3,4
387 1961.0 2125.0 257.823395 46.099579 895.258057 22.367129 9 2528 2226 3,4
388 2053.0 2595.0 402.675568 106.724106 1938.655029 21.528249 13 2939 2829 3,4
389 1767.0 185.0 435.621857 203.891724 1598.245605 21.737891 10 2725 633 3,4
390 1642.0 3371.0 102.407753 38.059231 256.970825 23.722290 13 1867 3454 3,4
391 2096.0 2538.0 367.176514 80.380402 1310.743408 21.953206 13 2904 2714 3,4
392 3198.0 1884.0 191.836868 90.987709 511.169434 22.975588 9 3620 2084 3,2

393 rows × 10 columns


In [76]:
y = np.array([x for x in '2,4tempExp'])

In [77]:
int(y[0])*10 + int(y[2])


Out[77]:
24

In [ ]: