In [1]:
%pylab inline
from astropy.io import fits
from numpy.lib.recfunctions import stack_arrays
Populating the interactive namespace from numpy and matplotlib
/home/rybizki/anaconda3/lib/python3.6/site-packages/astropy/extern/bundled/six.py:60: ResourceWarning: unclosed file <_io.TextIOWrapper name='/home/rybizki/anaconda3/lib/python3.6/site-packages/astropy/extern/bundled/six.py' mode='r' encoding='utf-8'>
class X(object):
In [2]:
mc = fits.getdata("../output/GDR3mock_extra/MCs_0/nbody.fits")
mc.dtype
print(len(mc))
mc = mc[np.random.choice(np.arange(len(mc)),int(len(mc)/100),replace=False)]
print(len(mc))
/home/rybizki/anaconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__
return f(*args, **kwds)
/home/rybizki/anaconda3/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__
return f(*args, **kwds)
2728627
27286
In [3]:
cl = fits.getdata("../output/GDR3mock_extra/Clusters_1/nbody.fits")
cl.dtype
print(len(cl))
cl = cl[np.random.choice(np.arange(len(cl)),int(len(cl)/1000),replace=False)]
print(len(cl))
441697
441
In [4]:
mw = fits.getdata("../output/GDR3mock/0/GDR3mock207.fits")
mw.dtype
print(len(mw))
1546654
In [5]:
x = stack_arrays((mc,cl,mw),usemask=False,asrecarray=True)
In [6]:
x = np.sort(x,order = 'source_id')
In [18]:
edges = round(len(x)/400)
edges_array = x[::edges].source_id
edges_array[0] = 0
edges_array = np.hstack((edges_array,[8931576916874782720]))
print(edges_array)
[ 0 161000525582565376 190241590646669312
205827580287254528 238741701382897664 260424586078715904
281214461174349824 376312424451538944 419212653748027392
434001497458475008 459290814653136896 473006912971997184
506257553345216512 518036827572011008 530296897617788928
561471797476720640 759627535381168128 944006495668797440
1040369721951649792 1255394304688390144 1474976775439122432
1741324705534574592 1790290699963334656 1808727482736574464
1819886048289751040 1822801609529229312 1825109106478809088
1827664749458882560 1832812559820914688 1838462125442334720
1857229242740244480 1864013813599174656 1871967199678169088
1929099026448252928 1960210463870418944 1971591440010051584
1980320050506104832 1997472672417579008 2006800825988415488
2016674749643489280 2020634984368308224 2023410014277861376
2026188170923606016 2029748561373036544 2031976584247771136
2034011161795493888 2037941537907671040 2045798957237403648
2052181725315858432 2059282715005419520 2063545693384998912
2073126425392578560 2080238410198417408 2092100903711539200
2128972270234763264 2163964193428996096 2171955100342288384
2179776957342810112 2191148037877792768 2202326978755821568
2211928292246683648 2231575809120796672 2286857948095315968
2639650169561284608 2844586217717104640 2928305335158439936
2947826648713527296 3014250448249946112 3033455136815972352
3047843655214694400 3059447729135550464 3101322766918352896
3113168321080459264 3128946862694858752 3154598675129303040
3242442335564333056 3328470908460335104 3351027045906776064
3370789496105730048 3398130467638083584 3428571374765998080
3445687163037941760 3480352737437155328 3733830299813937152
4035615867629731840 4036828663314907136 4037599867642576896
4038530810393919488 4039095306535567360 4039591701675769856
4040246907526709248 4040707156222148608 4041261550600716288
4041667820147179520 4042098966144221184 4042414835219038208
4042752179130335232 4043060523422449664 4043363473235640320
4043724868963794944 4044015036954312704 4044364131896131584
4045435915215044608 4045963199760039936 4046800684023021568
4048057700691476480 4048868040761147392 4049171128013291520
4049506513419501568 4049809463232692224 4050069944409260032
4050254799801679872 4050418042918666240 4050637910884483072
4050833967551610880 4051108433141694464 4051576584576958464
4052155511808720896 4052449425010720768 4052746739826819072
4053179122774441984 4054090617913868288 4056095405568425984
4056328948710113280 4056576201387409408 4058360193363214336
4059134971103674368 4059773409402290176 4060841035192860672
4061834065991434240 4062363893157068800 4062492261139611648
4062658802791481344 4062844929494220800 4063012433218764800
4063230067801587712 4063918843116912640 4064646857253453824
4064985884791930880 4065414763046240256 4066361579996708864
4067952504602624000 4068619805081468928 4069903038230298624
4071285845900918784 4073456488012578816 4076157988082024448
4077170191614607360 4077951291546927104 4079694739031457792
4084865329900027904 4088450768598728704 4089692289025179648
4090370584620302336 4091069564777922560 4092166636864274432
4093254363101790208 4094818177874132992 4096497029050531840
4097917357555449856 4099795632653336576 4101931537069506560
4103357569290993664 4104180175787261952 4105068890420150272
4106540724172881920 4107362780913336320 4108191091126173696
4109639525897076736 4110886028485591040 4112922083502063616
4116166123840339968 4117045630063345664 4118075357062496256
4119249051365408768 4120552178802753536 4123114934248669184
4125097937829101568 4132304137037545472 4138499163505557504
4144234456674205696 4145768687711813632 4148283751840874496
4151153339750416384 4154588729471664128 4156720235841323008
4160109549153419264 4164476053424701440 4173161748607533056
4183065084198649856 4194740488936357888 4201030485721219072
4203246001651187712 4204504083471532032 4207748673565622272
4214137351519076352 4236123701424160768 4249140888304877568
4252016626607587328 4252794771602407424 4253810170590658560
4254961050027294720 4256649796808343552 4259413384925020160
4261775445139128320 4263664062518263808 4265313123801497600
4267381442612297728 4269142035606274048 4274763254443540480
4280098668977061888 4285079628449579008 4288820063928057856
4292441202394923008 4294774812745662464 4297876672486572032
4302944081060823040 4307653873478139904 4311003638731374592
4313171051027628032 4315005620538310656 4317185780297498624
4319582887444742144 4322968180667449344 4346606340634836992
4372445757240770560 4414351272111505408 4471222102308945920
4479473318600114176 4490903429165613056 4505091733368864768
4508939336871313408 4513839894556049408 4517168391131234304
4523225497609437184 4537650746568474624 4587791466092298240
4651041147358019584 4651929999429861376 4654742378375020544
4657309325709017088 4658131141931302912 4659220586155737088
4685905458483953664 4752009334496428032 5048627575618797568
5219424715445108736 5233961496114888704 5237655511586832384
5241283796879278080 5247578260430127104 5253317539328425984
5255512336336158720 5259769920236814336 5297659812484481024
5305849353045278720 5309762411849318400 5313139321295863808
5323313445985058816 5331000028695625728 5335160855573037056
5337642556396142592 5340266987572428800 5343656403963740160
5350462621457842176 5354722576180445184 5359458413279444992
5372887470343979008 5404963145103966208 5410571788276989952
5424220988185247744 5442675225705578496 5508257452170149888
5521906755157622784 5529933739796201472 5540320791784062976
5546108208675815424 5583112135069663232 5595949689238192128
5601613136193912832 5614335276001263616 5621941697442217984
5640128856716214272 5671690544149954560 5700966140751118336
5716945240158371840 5766837504414056448 5792882426615169024
5802883584381419520 5818014616726274048 5824544513204420608
5827317722047840256 5831197726783569920 5833472822499868672
5834633528821678080 5835820554703077376 5836584268607782912
5844699317255798784 5848652851831635968 5850924511574097920
5852524266632773632 5854022419945095168 5857492066325495808
5858927272597127168 5860855678553292800 5862852907065409536
5865046604561514496 5869000963771072512 5871370892365266944
5874081463405641728 5875585801470869504 5876931225746145280
5879421001107767296 5881995988620541952 5884080800105758720
5887131841793622016 5888770698234560512 5890363031589748736
5893058312546549760 5895628043019354112 5900250699140169728
5904354901168750592 5913874541561511936 5919725420890030080
5924441569858945024 5926972130230009856 5929102227850395648
5930678309049335808 5931684087310843904 5932349738522247168
5933174578401509376 5934095969145585664 5935796020280557568
5937111070547116032 5938525764054941696 5940292851039469568
5942406318546485248 5944115818609508352 5947882333129408512
5950513670613106688 5952165721193578496 5953570931413614592
5956003807048499200 5957924550783008768 5959238638976892928
5960370448758734848 5961583038285479936 5963056933622513664
5965315330505965568 5968019063958405120 5969643214431322112
5971116078976204800 5972674464909885440 5976388340310605824
5978043002231193600 5979719860542767104 5980600672435830784
5983573786237075456 5986047549960617984 5988772071054770176
5991739515499184128 5995044510013325312 6000602713090424832
6009501438651138048 6018305022096310272 6022181968815325184
6026558643569164288 6028494643027509248 6029656311421992960
6032022529164443648 6035830893845676032 6046287902260854784
6054119551786811392 6057337650522619904 6060242697682157568
6064027697741299712 6070987949942505472 6076648098363342848
6090704048854401024 6105062502482051072 6131616773444730880
6189459537561387008 6225770977788166144 6260198885877088256
6362808609516027904 6442940742070435840 6618300339755941888
6652038613536079872 6679890273859796992 6706241753646628864
6716109767426703360 6722991267107569664 6726135492405886976
6728692372336541696 6733950168221089792 6736718979017998336
6755124150831939584 6762744900283793408 6780826540801261568
6866936202679812096 8931576916874782720]
In [20]:
np.save('edges.npy', edges_array)
Content source: jan-rybizki/Galaxia_wrap
Similar notebooks: