[Yt-svn] commit/yt: 2 new changesets
Bitbucket
commits-noreply at bitbucket.org
Thu Jun 2 16:16:47 PDT 2011
2 new changesets in yt:
http://bitbucket.org/yt_analysis/yt/changeset/0a0d6b65c8ab/
changeset: 0a0d6b65c8ab
branches:
user: Cameron Hummels
date: 2011-06-03 01:11:54
summary: Fixing a bug with strip_colormap_data, in that it called an outdated module. Also added one more colormap to the default yt library of colormaps. RdBu is a colormapping that goes from red to blue with white in the middle--good for visualizing temperature, metallicity and age without other colors present.
affected #: 2 files (12.2 KB)
--- a/yt/visualization/_colormap_data.py Thu May 26 21:53:30 2011 -0400
+++ b/yt/visualization/_colormap_data.py Thu Jun 02 19:11:54 2011 -0400
@@ -4,6 +4,188 @@
color_map_luts = {}
+### RdBu ###
+
+color_map_luts['RdBu'] = \
+ (
+array([ 0.40392157, 0.4154556 , 0.42698963, 0.43852365, 0.45005768,
+ 0.4615917 , 0.47312573, 0.48465976, 0.49619378, 0.50772781,
+ 0.51926183, 0.53079586, 0.54232988, 0.55386391, 0.56539794,
+ 0.57693196, 0.58846599, 0.60000001, 0.61153404, 0.62306807,
+ 0.63460209, 0.64613612, 0.65767014, 0.66920417, 0.68073819,
+ 0.69227222, 0.7008074 , 0.70634373, 0.71188006, 0.7174164 ,
+ 0.72295273, 0.72848906, 0.73402539, 0.73956172, 0.74509805,
+ 0.75063439, 0.75617072, 0.76170705, 0.76724338, 0.77277971,
+ 0.77831605, 0.78385238, 0.78938871, 0.79492504, 0.80046137,
+ 0.8059977 , 0.81153404, 0.81707037, 0.8226067 , 0.82814303,
+ 0.83367936, 0.8392157 , 0.84382931, 0.84844292, 0.85305653,
+ 0.85767014, 0.86228375, 0.86689736, 0.87151096, 0.87612457,
+ 0.88073818, 0.88535179, 0.8899654 , 0.89457901, 0.89919262,
+ 0.90380623, 0.90841984, 0.91303345, 0.91764706, 0.92226067,
+ 0.92687428, 0.93148789, 0.9361015 , 0.94071511, 0.94532872,
+ 0.94994233, 0.95455594, 0.95755479, 0.95893887, 0.96032296,
+ 0.96170704, 0.96309112, 0.9644752 , 0.96585929, 0.96724337,
+ 0.96862745, 0.97001154, 0.97139562, 0.9727797 , 0.97416378,
+ 0.97554787, 0.97693195, 0.97831603, 0.97970012, 0.9810842 ,
+ 0.98246828, 0.98385237, 0.98523645, 0.98662053, 0.98800461,
+ 0.9893887 , 0.99077278, 0.99215686, 0.99123414, 0.99031142,
+ 0.9893887 , 0.98846598, 0.98754325, 0.98662053, 0.98569781,
+ 0.98477509, 0.98385237, 0.98292964, 0.98200692, 0.9810842 ,
+ 0.98016148, 0.97923876, 0.97831603, 0.97739331, 0.97647059,
+ 0.97554787, 0.97462515, 0.97370242, 0.9727797 , 0.97185698,
+ 0.97093426, 0.97001154, 0.96908881, 0.9657055 , 0.95986159,
+ 0.95401769, 0.94817378, 0.94232988, 0.93648597, 0.93064206,
+ 0.92479816, 0.91895425, 0.91311035, 0.90726644, 0.90142254,
+ 0.89557863, 0.88973472, 0.88389082, 0.87804691, 0.87220301,
+ 0.8663591 , 0.86051519, 0.85467129, 0.84882738, 0.84298348,
+ 0.83713957, 0.83129567, 0.82545176, 0.81960785, 0.80991927,
+ 0.80023069, 0.79054211, 0.78085353, 0.77116495, 0.76147637,
+ 0.75178779, 0.74209921, 0.73241063, 0.72272205, 0.71303347,
+ 0.70334489, 0.6936563 , 0.68396772, 0.67427914, 0.66459056,
+ 0.65490198, 0.6452134 , 0.63552482, 0.62583624, 0.61614766,
+ 0.60645908, 0.5967705 , 0.58708192, 0.57739334, 0.56647446,
+ 0.55432528, 0.54217611, 0.53002694, 0.51787776, 0.50572859,
+ 0.49357942, 0.48143024, 0.46928107, 0.45713189, 0.44498272,
+ 0.43283355, 0.42068437, 0.4085352 , 0.39638602, 0.38423685,
+ 0.37208768, 0.3599385 , 0.34778933, 0.33564016, 0.32349098,
+ 0.31134181, 0.29919263, 0.28704346, 0.27489429, 0.26274511,
+ 0.25751635, 0.2522876 , 0.24705884, 0.24183008, 0.23660132,
+ 0.23137256, 0.2261438 , 0.22091504, 0.21568629, 0.21045753,
+ 0.20522877, 0.20000001, 0.19477125, 0.18954249, 0.18431374,
+ 0.17908498, 0.17385622, 0.16862746, 0.1633987 , 0.15816994,
+ 0.15294118, 0.14771243, 0.14248367, 0.13725491, 0.13202615,
+ 0.12725875, 0.12295272, 0.11864668, 0.11434064, 0.11003461,
+ 0.10572857, 0.10142254, 0.0971165 , 0.09281046, 0.08850443,
+ 0.08419839, 0.07989235, 0.07558632, 0.07128028, 0.06697424,
+ 0.06266821, 0.05836217, 0.05405613, 0.0497501 , 0.04544406,
+ 0.04113803, 0.03683199, 0.03252595, 0.02821992, 0.02391388,
+ 0.01960784]),
+array([ 0. , 0.00369089, 0.00738178, 0.01107266, 0.01476355,
+ 0.01845444, 0.02214533, 0.02583622, 0.02952711, 0.03321799,
+ 0.03690888, 0.04059977, 0.04429066, 0.04798155, 0.05167243,
+ 0.05536332, 0.05905421, 0.0627451 , 0.06643599, 0.07012688,
+ 0.07381776, 0.07750865, 0.08119954, 0.08489043, 0.08858132,
+ 0.0922722 , 0.09965398, 0.11072665, 0.12179931, 0.13287197,
+ 0.14394464, 0.1550173 , 0.16608997, 0.17716263, 0.1882353 ,
+ 0.19930796, 0.21038063, 0.22145329, 0.23252596, 0.24359862,
+ 0.25467129, 0.26574395, 0.27681661, 0.28788928, 0.29896194,
+ 0.31003461, 0.32110727, 0.33217994, 0.3432526 , 0.35432527,
+ 0.36539793, 0.3764706 , 0.3870819 , 0.3976932 , 0.40830451,
+ 0.41891581, 0.42952712, 0.44013842, 0.45074972, 0.46136103,
+ 0.47197233, 0.48258363, 0.49319494, 0.50380624, 0.51441755,
+ 0.52502885, 0.53564015, 0.54625146, 0.55686276, 0.56747407,
+ 0.57808537, 0.58869667, 0.59930798, 0.60991928, 0.62053058,
+ 0.63114189, 0.64175319, 0.65121109, 0.65951559, 0.66782009,
+ 0.67612459, 0.68442908, 0.69273358, 0.70103808, 0.70934258,
+ 0.71764708, 0.72595157, 0.73425607, 0.74256057, 0.75086507,
+ 0.75916956, 0.76747406, 0.77577856, 0.78408306, 0.79238756,
+ 0.80069205, 0.80899655, 0.81730105, 0.82560555, 0.83391004,
+ 0.84221454, 0.85051904, 0.85882354, 0.86312957, 0.86743561,
+ 0.87174165, 0.87604768, 0.88035372, 0.88465975, 0.88896579,
+ 0.89327182, 0.89757786, 0.9018839 , 0.90618993, 0.91049597,
+ 0.914802 , 0.91910804, 0.92341408, 0.92772011, 0.93202615,
+ 0.93633218, 0.94063822, 0.94494426, 0.94925029, 0.95355633,
+ 0.95786236, 0.9621684 , 0.96647443, 0.96724337, 0.9644752 ,
+ 0.96170704, 0.95893887, 0.95617071, 0.95340254, 0.95063437,
+ 0.94786621, 0.94509804, 0.94232988, 0.93956171, 0.93679354,
+ 0.93402538, 0.93125721, 0.92848905, 0.92572088, 0.92295272,
+ 0.92018455, 0.91741638, 0.91464822, 0.91188005, 0.90911189,
+ 0.90634372, 0.90357555, 0.90080739, 0.89803922, 0.89311804,
+ 0.88819685, 0.88327567, 0.87835449, 0.8734333 , 0.86851212,
+ 0.86359093, 0.85866975, 0.85374857, 0.84882738, 0.8439062 ,
+ 0.83898502, 0.83406383, 0.82914265, 0.82422146, 0.81930028,
+ 0.8143791 , 0.80945791, 0.80453673, 0.79961554, 0.79469436,
+ 0.78977318, 0.78485199, 0.77993081, 0.77500963, 0.76870436,
+ 0.76101501, 0.75332566, 0.74563631, 0.73794696, 0.73025761,
+ 0.72256826, 0.71487891, 0.70718956, 0.69950021, 0.69181086,
+ 0.68412151, 0.67643216, 0.66874281, 0.66105346, 0.65336411,
+ 0.64567476, 0.63798541, 0.63029606, 0.62260671, 0.61491736,
+ 0.60722801, 0.59953866, 0.59184931, 0.58415996, 0.57647061,
+ 0.5695502 , 0.56262978, 0.55570937, 0.54878895, 0.54186853,
+ 0.53494812, 0.5280277 , 0.52110729, 0.51418687, 0.50726645,
+ 0.50034604, 0.49342562, 0.48650521, 0.47958479, 0.47266437,
+ 0.46574396, 0.45882354, 0.45190313, 0.44498271, 0.43806229,
+ 0.43114188, 0.42422146, 0.41730105, 0.41038063, 0.40346021,
+ 0.39584776, 0.38754326, 0.37923876, 0.37093426, 0.36262976,
+ 0.35432526, 0.34602077, 0.33771627, 0.32941177, 0.32110727,
+ 0.31280277, 0.30449827, 0.29619378, 0.28788928, 0.27958478,
+ 0.27128028, 0.26297578, 0.25467128, 0.24636679, 0.23806229,
+ 0.22975779, 0.22145329, 0.21314879, 0.20484429, 0.1965398 ,
+ 0.1882353 ]),
+array([ 0.12156863, 0.12341407, 0.12525952, 0.12710496, 0.1289504 ,
+ 0.13079585, 0.13264129, 0.13448674, 0.13633218, 0.13817763,
+ 0.14002307, 0.14186851, 0.14371396, 0.1455594 , 0.14740485,
+ 0.14925029, 0.15109574, 0.15294118, 0.15478662, 0.15663207,
+ 0.15847751, 0.16032296, 0.1621684 , 0.16401385, 0.16585929,
+ 0.16770473, 0.17124184, 0.17647059, 0.18169935, 0.18692811,
+ 0.19215687, 0.19738563, 0.20261439, 0.20784314, 0.2130719 ,
+ 0.21830066, 0.22352942, 0.22875818, 0.23398694, 0.23921569,
+ 0.24444445, 0.24967321, 0.25490197, 0.26013073, 0.26535949,
+ 0.27058825, 0.275817 , 0.28104576, 0.28627452, 0.29150328,
+ 0.29673204, 0.3019608 , 0.31011151, 0.31826222, 0.32641293,
+ 0.33456364, 0.34271436, 0.35086507, 0.35901578, 0.36716649,
+ 0.3753172 , 0.38346792, 0.39161863, 0.39976934, 0.40792005,
+ 0.41607076, 0.42422148, 0.43237219, 0.4405229 , 0.44867361,
+ 0.45682432, 0.46497504, 0.47312575, 0.48127646, 0.48942717,
+ 0.49757788, 0.50572859, 0.5151096 , 0.5257209 , 0.53633221,
+ 0.54694351, 0.55755481, 0.56816612, 0.57877742, 0.58938872,
+ 0.60000002, 0.61061133, 0.62122263, 0.63183393, 0.64244523,
+ 0.65305654, 0.66366784, 0.67427914, 0.68489045, 0.69550175,
+ 0.70611305, 0.71672435, 0.72733566, 0.73794696, 0.74855826,
+ 0.75916956, 0.76978087, 0.78039217, 0.78777395, 0.79515572,
+ 0.8025375 , 0.80991927, 0.81730105, 0.82468282, 0.8320646 ,
+ 0.83944638, 0.84682815, 0.85420993, 0.8615917 , 0.86897348,
+ 0.87635526, 0.88373703, 0.89111881, 0.89850058, 0.90588236,
+ 0.91326413, 0.92064591, 0.92802769, 0.93540946, 0.94279124,
+ 0.95017301, 0.95755479, 0.96493656, 0.9680892 , 0.96701269,
+ 0.96593618, 0.96485967, 0.96378316, 0.96270665, 0.96163014,
+ 0.96055364, 0.95947713, 0.95840062, 0.95732411, 0.9562476 ,
+ 0.95517109, 0.95409458, 0.95301807, 0.95194156, 0.95086505,
+ 0.94978855, 0.94871204, 0.94763553, 0.94655902, 0.94548251,
+ 0.944406 , 0.94332949, 0.94225298, 0.94117647, 0.93840831,
+ 0.93564014, 0.93287198, 0.93010381, 0.92733564, 0.92456748,
+ 0.92179931, 0.91903115, 0.91626298, 0.91349481, 0.91072665,
+ 0.90795848, 0.90519032, 0.90242215, 0.89965399, 0.89688582,
+ 0.89411765, 0.89134949, 0.88858132, 0.88581316, 0.88304499,
+ 0.88027682, 0.87750866, 0.87474049, 0.87197233, 0.86851212,
+ 0.86435987, 0.86020762, 0.85605537, 0.85190312, 0.84775087,
+ 0.84359863, 0.83944638, 0.83529413, 0.83114188, 0.82698963,
+ 0.82283738, 0.81868513, 0.81453288, 0.81038063, 0.80622839,
+ 0.80207614, 0.79792389, 0.79377164, 0.78961939, 0.78546714,
+ 0.78131489, 0.77716264, 0.77301039, 0.76885815, 0.7647059 ,
+ 0.7611688 , 0.75763169, 0.75409459, 0.75055749, 0.74702039,
+ 0.74348329, 0.73994619, 0.73640909, 0.73287199, 0.72933489,
+ 0.72579779, 0.72226069, 0.71872358, 0.71518648, 0.71164938,
+ 0.70811228, 0.70457518, 0.70103808, 0.69750098, 0.69396388,
+ 0.69042678, 0.68688968, 0.68335258, 0.67981547, 0.67627837,
+ 0.66874281, 0.65720878, 0.64567476, 0.63414073, 0.62260671,
+ 0.61107268, 0.59953866, 0.58800463, 0.5764706 , 0.56493658,
+ 0.55340255, 0.54186853, 0.5303345 , 0.51880047, 0.50726645,
+ 0.49573242, 0.4841984 , 0.47266437, 0.46113034, 0.44959632,
+ 0.43806229, 0.42652827, 0.41499424, 0.40346022, 0.39192619,
+ 0.38039216]),
+array([ 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
+ 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
+ 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
+ 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
+ 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
+ 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
+ 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
+ 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
+ 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
+ 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
+ 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
+ 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
+ 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
+ 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
+ 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
+ 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
+ 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
+ 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
+ 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
+ 1., 1., 1., 1., 1., 1., 1., 1., 1.]),
+ )
+
### algae ###
color_map_luts['algae'] = \
@@ -223,162 +405,159 @@
color_map_luts['gist_stern'] = \
(
-array([ 0. , 0.06588235, 0.13176471, 0.19764706, 0.26352941,
- 0.32941176, 0.39529412, 0.46326797, 0.53098039, 0.59686274,
- 0.68627448, 0.79921568, 0.86509803, 0.93150326, 0.99477124,
- 0.97647059, 0.95816995, 0.9398693 , 0.92156865, 0.90326799,
- 0.88235296, 0.86274512, 0.84444446, 0.82614381, 0.80784316,
- 0.78823532, 0.76732028, 0.74901963, 0.73071897, 0.71241832,
- 0.69411767, 0.67581701, 0.63712427, 0.61568633, 0.59738568,
- 0.57908502, 0.55843144, 0.53856215, 0.52026149, 0.50196083,
- 0.48366016, 0.4653595 , 0.44627454, 0.42483663, 0.40653597,
- 0.38823532, 0.36993467, 0.35163401, 0.33019611, 0.31111114,
- 0.29281048, 0.27450983, 0.25620917, 0.22692813, 0.19607845,
- 0.17777779, 0.15947714, 0.14117648, 0.12235296, 0.1006536 ,
- 0.08235295, 0.06405229, 0.04575164, 0.02745098, 0.19032622,
- 0.25359477, 0.2572549 , 0.26091503, 0.26457516, 0.2682353 ,
- 0.27189543, 0.27555556, 0.27921569, 0.28287582, 0.28679737,
- 0.29411764, 0.29777778, 0.30143791, 0.30509804, 0.30875817,
- 0.3124183 , 0.31607843, 0.31973856, 0.32339869, 0.32705882,
- 0.33071896, 0.33437909, 0.33803922, 0.34169935, 0.34535948,
- 0.34901961, 0.35267974, 0.35633987, 0.36 , 0.36366013,
- 0.36732026, 0.37333333, 0.37856209, 0.38222222, 0.38588235,
- 0.38954248, 0.39320261, 0.39686275, 0.40052288, 0.40418301,
- 0.40784314, 0.41150327, 0.4151634 , 0.41882353, 0.42248366,
- 0.42614379, 0.42980392, 0.43346405, 0.43712418, 0.44078431,
- 0.44444445, 0.44810458, 0.45254902, 0.45934641, 0.46300654,
- 0.46666667, 0.4703268 , 0.47398693, 0.47764706, 0.48130719,
- 0.48496732, 0.48862745, 0.49228758, 0.49777777, 0.50352942,
- 0.50718956, 0.51084968, 0.51450983, 0.51816994, 0.52183009,
- 0.5254902 , 0.52915035, 0.53281046, 0.53647061, 0.54300653,
- 0.54771244, 0.55137256, 0.5550327 , 0.55869283, 0.56235295,
- 0.56601309, 0.56967321, 0.57333336, 0.57699347, 0.58065362,
- 0.58431373, 0.58797388, 0.59163399, 0.59529414, 0.59895426,
- 0.6026144 , 0.60627452, 0.60993466, 0.61359479, 0.61725491,
- 0.62222224, 0.62849674, 0.63215689, 0.635817 , 0.63947715,
- 0.64313726, 0.64679741, 0.65045752, 0.65411767, 0.65777779,
- 0.66143793, 0.66509805, 0.66875819, 0.67241832, 0.67607844,
- 0.67973858, 0.6833987 , 0.68705885, 0.69071896, 0.69437911,
- 0.69803922, 0.70169937, 0.70875816, 0.7129412 , 0.71660132,
- 0.72026146, 0.72392158, 0.72758172, 0.73124185, 0.73490197,
- 0.73856211, 0.74222223, 0.7466667 , 0.75346406, 0.75712421,
- 0.76078431, 0.76444447, 0.76810458, 0.77176473, 0.77542485,
- 0.77908499, 0.78274511, 0.78640524, 0.79189544, 0.79764707,
- 0.80130721, 0.80496733, 0.80862747, 0.81228759, 0.81594774,
- 0.81960784, 0.823268 , 0.82692811, 0.83058826, 0.83424837,
- 0.83790852, 0.84156864, 0.84522877, 0.8488889 , 0.85254903,
- 0.85620917, 0.85986929, 0.86352943, 0.86718955, 0.87111116,
- 0.87843137, 0.88209153, 0.88575164, 0.88941179, 0.8930719 ,
- 0.89673205, 0.90039217, 0.9040523 , 0.90771243, 0.91137256,
- 0.9150327 , 0.91869282, 0.92235296, 0.92601308, 0.92967323,
- 0.93333333, 0.93699349, 0.9406536 , 0.94431375, 0.94797386,
- 0.95163401, 0.95764708, 0.96287583, 0.96653596, 0.97019609,
- 0.97385623, 0.97751635, 0.98117649, 0.98483661, 0.98849676,
- 0.99215686]),
-array([ 0. , 0.00366013, 0.00732026, 0.01098039, 0.01464052,
- 0.01830065, 0.02196078, 0.02562092, 0.02928105, 0.03294118,
- 0.0379085 , 0.04418301, 0.04784314, 0.05150327, 0.0551634 ,
- 0.05882353, 0.06248366, 0.06614379, 0.06980392, 0.07346405,
- 0.07712418, 0.08078431, 0.08444444, 0.08810458, 0.09176471,
- 0.09542484, 0.09908497, 0.1027451 , 0.10640523, 0.11006536,
- 0.11372549, 0.11738562, 0.12444444, 0.12862745, 0.13228758,
- 0.13594771, 0.13960784, 0.14326797, 0.14692811, 0.15058824,
- 0.15424837, 0.1579085 , 0.16156863, 0.16522876, 0.16888889,
- 0.17254902, 0.17620915, 0.17986928, 0.18352941, 0.18718954,
- 0.19084967, 0.1945098 , 0.19816994, 0.20366013, 0.20941176,
- 0.2130719 , 0.21673203, 0.22039216, 0.22405229, 0.22771242,
- 0.23137255, 0.23503268, 0.23869281, 0.24235294, 0.24888888,
- 0.25359477, 0.2572549 , 0.26091503, 0.26457516, 0.2682353 ,
- 0.27189543, 0.27555556, 0.27921569, 0.28287582, 0.28679737,
- 0.29411764, 0.29777778, 0.30143791, 0.30509804, 0.30875817,
- 0.3124183 , 0.31607843, 0.31973856, 0.32339869, 0.32705882,
- 0.33071896, 0.33437909, 0.33803922, 0.34169935, 0.34535948,
- 0.34901961, 0.35267974, 0.35633987, 0.36 , 0.36366013,
- 0.36732026, 0.37333333, 0.37856209, 0.38222222, 0.38588235,
- 0.38954248, 0.39320261, 0.39686275, 0.40052288, 0.40418301,
- 0.40784314, 0.41150327, 0.4151634 , 0.41882353, 0.42248366,
- 0.42614379, 0.42980392, 0.43346405, 0.43712418, 0.44078431,
- 0.44444445, 0.44810458, 0.45254902, 0.45934641, 0.46300654,
- 0.46666667, 0.4703268 , 0.47398693, 0.47764706, 0.48130719,
- 0.48496732, 0.48862745, 0.49228758, 0.49777777, 0.50352942,
- 0.50718956, 0.51084968, 0.51450983, 0.51816994, 0.52183009,
- 0.5254902 , 0.52915035, 0.53281046, 0.53647061, 0.54300653,
- 0.54771244, 0.55137256, 0.5550327 , 0.55869283, 0.56235295,
- 0.56601309, 0.56967321, 0.57333336, 0.57699347, 0.58065362,
- 0.58431373, 0.58797388, 0.59163399, 0.59529414, 0.59895426,
- 0.6026144 , 0.60627452, 0.60993466, 0.61359479, 0.61725491,
- 0.62222224, 0.62849674, 0.63215689, 0.635817 , 0.63947715,
- 0.64313726, 0.64679741, 0.65045752, 0.65411767, 0.65777779,
- 0.66143793, 0.66509805, 0.66875819, 0.67241832, 0.67607844,
- 0.67973858, 0.6833987 , 0.68705885, 0.69071896, 0.69437911,
- 0.69803922, 0.70169937, 0.70875816, 0.7129412 , 0.71660132,
- 0.72026146, 0.72392158, 0.72758172, 0.73124185, 0.73490197,
- 0.73856211, 0.74222223, 0.7466667 , 0.75346406, 0.75712421,
- 0.76078431, 0.76444447, 0.76810458, 0.77176473, 0.77542485,
- 0.77908499, 0.78274511, 0.78640524, 0.79189544, 0.79764707,
- 0.80130721, 0.80496733, 0.80862747, 0.81228759, 0.81594774,
- 0.81960784, 0.823268 , 0.82692811, 0.83058826, 0.83424837,
- 0.83790852, 0.84156864, 0.84522877, 0.8488889 , 0.85254903,
- 0.85620917, 0.85986929, 0.86352943, 0.86718955, 0.87111116,
- 0.87843137, 0.88209153, 0.88575164, 0.88941179, 0.8930719 ,
- 0.89673205, 0.90039217, 0.9040523 , 0.90771243, 0.91137256,
- 0.9150327 , 0.91869282, 0.92235296, 0.92601308, 0.92967323,
- 0.93333333, 0.93699349, 0.9406536 , 0.94431375, 0.94797386,
- 0.95163401, 0.95764708, 0.96287583, 0.96653596, 0.97019609,
- 0.97385623, 0.97751635, 0.98117649, 0.98483661, 0.98849676,
- 0.99215686]),
-array([ 0. , 0.00366013, 0.01071895, 0.01803922, 0.02535948,
- 0.03267974, 0.04 , 0.04732026, 0.05464052, 0.06196078,
- 0.07189542, 0.08444444, 0.09176471, 0.09908497, 0.10640523,
- 0.11372549, 0.12104575, 0.12836601, 0.13568628, 0.14300654,
- 0.1503268 , 0.15764706, 0.16496732, 0.17228758, 0.17960784,
- 0.18692811, 0.19424837, 0.20156863, 0.20888889, 0.21620915,
- 0.22352941, 0.23084967, 0.2449673 , 0.25333333, 0.2606536 ,
- 0.26797386, 0.27529412, 0.28261438, 0.28993464, 0.2972549 ,
- 0.30457516, 0.31189543, 0.31921569, 0.32653595, 0.33385621,
- 0.34117647, 0.34849673, 0.35581699, 0.36313726, 0.37045752,
- 0.37777778, 0.38509804, 0.3924183 , 0.40339869, 0.41490196,
- 0.42222222, 0.42954248, 0.43686275, 0.44418301, 0.45150327,
- 0.45882353, 0.46614379, 0.47346405, 0.48078431, 0.49385617,
- 0.50326797, 0.51058824, 0.5179085 , 0.52522876, 0.53254902,
- 0.53986928, 0.54718954, 0.55450981, 0.56183007, 0.56967318,
- 0.5843137 , 0.59163399, 0.59895425, 0.60627451, 0.61359477,
- 0.62091503, 0.6282353 , 0.63555556, 0.64287582, 0.65019608,
- 0.65751634, 0.6648366 , 0.67215686, 0.67947713, 0.68679739,
- 0.69411765, 0.70143791, 0.70875817, 0.71607843, 0.72339869,
- 0.73071896, 0.74274509, 0.75320262, 0.76052288, 0.76784314,
- 0.7751634 , 0.78248366, 0.78980392, 0.79712418, 0.80444445,
- 0.81176471, 0.81908497, 0.82640523, 0.83372549, 0.84104575,
- 0.84836601, 0.85568628, 0.86300654, 0.8703268 , 0.87764706,
- 0.88496732, 0.89228758, 0.90117647, 0.91477124, 0.9220915 ,
- 0.92941177, 0.93673203, 0.94405229, 0.95137255, 0.95869281,
- 0.96601307, 0.97333333, 0.9806536 , 0.99163394, 0.99372556,
- 0.979085 , 0.96444453, 0.94901963, 0.93124193, 0.91660131,
- 0.90196089, 0.88732027, 0.86928116, 0.85411767, 0.82797401,
- 0.80653599, 0.7905883 , 0.77594777, 0.76130724, 0.74509812,
- 0.72810461, 0.71346413, 0.69882355, 0.68366025, 0.66562092,
- 0.6509805 , 0.63633988, 0.62169944, 0.60392159, 0.58849682,
- 0.57385625, 0.55921575, 0.54248372, 0.52601313, 0.51137262,
- 0.49019612, 0.46248371, 0.44784313, 0.43320268, 0.41830063,
- 0.4000001 , 0.38535946, 0.37071902, 0.35607843, 0.33856216,
- 0.32287583, 0.30823533, 0.2935948 , 0.27712421, 0.2603922 ,
- 0.24575164, 0.23111115, 0.21568625, 0.19790855, 0.18326794,
- 0.16862752, 0.15398689, 0.12235305, 0.10509801, 0.09045755,
- 0.0732026 , 0.05725492, 0.04261438, 0.02797386, 0.01176472,
- 0.00392158, 0.01594769, 0.03372556, 0.06091499, 0.07529416,
- 0.08627447, 0.10091509, 0.11555552, 0.13019612, 0.14483659,
- 0.15686277, 0.17019608, 0.18483662, 0.20679742, 0.2282353 ,
- 0.24052291, 0.2551634 , 0.26980398, 0.28444443, 0.29882359,
- 0.3098039 , 0.32444452, 0.33908495, 0.35372555, 0.36836601,
- 0.38039219, 0.39372551, 0.40836604, 0.42300657, 0.43764708,
- 0.45098043, 0.46300654, 0.47764712, 0.49228757, 0.50797404,
- 0.53725488, 0.54823538, 0.5626144 , 0.57725499, 0.59189546,
- 0.60653602, 0.61882357, 0.63189549, 0.64653601, 0.66117652,
- 0.67581707, 0.68941179, 0.70117656, 0.71581701, 0.73045762,
- 0.74509804, 0.75973867, 0.77098041, 0.78509813, 0.79973859,
- 0.81437916, 0.83607851, 0.8554249 , 0.87006542, 0.88470593,
- 0.89934648, 0.9129412 , 0.92470597, 0.93934642, 0.95398703,
- 0.96862745]),
+array([ 0. , 0.0716923 , 0.14338459, 0.21507689, 0.28676919,
+ 0.35846148, 0.43015378, 0.50184608, 0.57353837, 0.64523067,
+ 0.71692297, 0.78861526, 0.86030756, 0.93199986, 0.99899382,
+ 0.97945625, 0.95991869, 0.94038112, 0.92084356, 0.90130599,
+ 0.88176843, 0.86223087, 0.8426933 , 0.82315574, 0.80361817,
+ 0.78408061, 0.76454305, 0.74500548, 0.72546792, 0.70593035,
+ 0.68639279, 0.66685523, 0.64731766, 0.6277801 , 0.60824253,
+ 0.58870497, 0.5691674 , 0.54962984, 0.53009228, 0.51055471,
+ 0.49101715, 0.47147958, 0.45194202, 0.43240446, 0.41286689,
+ 0.39332933, 0.37379176, 0.3542542 , 0.33471664, 0.31517907,
+ 0.29564151, 0.27610394, 0.25656638, 0.23702881, 0.21749125,
+ 0.19795369, 0.17841612, 0.15887856, 0.13934099, 0.11980343,
+ 0.10026587, 0.0807283 , 0.06119074, 0.04165317, 0.25098039,
+ 0.25490196, 0.25882353, 0.2627451 , 0.26666667, 0.27058824,
+ 0.2745098 , 0.27843137, 0.28235294, 0.28627451, 0.29019608,
+ 0.29411765, 0.29803922, 0.30196078, 0.30588235, 0.30980392,
+ 0.31372549, 0.31764706, 0.32156863, 0.3254902 , 0.32941176,
+ 0.33333333, 0.3372549 , 0.34117647, 0.34509804, 0.34901961,
+ 0.35294118, 0.35686275, 0.36078431, 0.36470588, 0.36862745,
+ 0.37254902, 0.37647059, 0.38039216, 0.38431373, 0.38823529,
+ 0.39215686, 0.39607843, 0.4 , 0.40392157, 0.40784314,
+ 0.41176471, 0.41568627, 0.41960784, 0.42352941, 0.42745098,
+ 0.43137255, 0.43529412, 0.43921569, 0.44313725, 0.44705882,
+ 0.45098039, 0.45490196, 0.45882353, 0.4627451 , 0.46666667,
+ 0.47058824, 0.4745098 , 0.47843137, 0.48235294, 0.48627451,
+ 0.49019608, 0.49411765, 0.49803922, 0.50196078, 0.50588235,
+ 0.50980392, 0.51372549, 0.51764706, 0.52156863, 0.5254902 ,
+ 0.52941176, 0.53333333, 0.5372549 , 0.54117647, 0.54509804,
+ 0.54901961, 0.55294118, 0.55686275, 0.56078431, 0.56470588,
+ 0.56862745, 0.57254902, 0.57647059, 0.58039216, 0.58431373,
+ 0.58823529, 0.59215686, 0.59607843, 0.6 , 0.60392157,
+ 0.60784314, 0.61176471, 0.61568627, 0.61960784, 0.62352941,
+ 0.62745098, 0.63137255, 0.63529412, 0.63921569, 0.64313725,
+ 0.64705882, 0.65098039, 0.65490196, 0.65882353, 0.6627451 ,
+ 0.66666667, 0.67058824, 0.6745098 , 0.67843137, 0.68235294,
+ 0.68627451, 0.69019608, 0.69411765, 0.69803922, 0.70196078,
+ 0.70588235, 0.70980392, 0.71372549, 0.71764706, 0.72156863,
+ 0.7254902 , 0.72941176, 0.73333333, 0.7372549 , 0.74117647,
+ 0.74509804, 0.74901961, 0.75294118, 0.75686275, 0.76078431,
+ 0.76470588, 0.76862745, 0.77254902, 0.77647059, 0.78039216,
+ 0.78431373, 0.78823529, 0.79215686, 0.79607843, 0.8 ,
+ 0.80392157, 0.80784314, 0.81176471, 0.81568627, 0.81960784,
+ 0.82352941, 0.82745098, 0.83137255, 0.83529412, 0.83921569,
+ 0.84313725, 0.84705882, 0.85098039, 0.85490196, 0.85882353,
+ 0.8627451 , 0.86666667, 0.87058824, 0.8745098 , 0.87843137,
+ 0.88235294, 0.88627451, 0.89019608, 0.89411765, 0.89803922,
+ 0.90196078, 0.90588235, 0.90980392, 0.91372549, 0.91764706,
+ 0.92156863, 0.9254902 , 0.92941176, 0.93333333, 0.9372549 ,
+ 0.94117647, 0.94509804, 0.94901961, 0.95294118, 0.95686275,
+ 0.96078431, 0.96470588, 0.96862745, 0.97254902, 0.97647059,
+ 0.98039216, 0.98431373, 0.98823529, 0.99215686, 0.99607843, 1. ]),
+array([ 0. , 0.00392157, 0.00784314, 0.01176471, 0.01568627,
+ 0.01960784, 0.02352941, 0.02745098, 0.03137255, 0.03529412,
+ 0.03921569, 0.04313725, 0.04705882, 0.05098039, 0.05490196,
+ 0.05882353, 0.0627451 , 0.06666667, 0.07058824, 0.0745098 ,
+ 0.07843137, 0.08235294, 0.08627451, 0.09019608, 0.09411765,
+ 0.09803922, 0.10196078, 0.10588235, 0.10980392, 0.11372549,
+ 0.11764706, 0.12156863, 0.1254902 , 0.12941176, 0.13333333,
+ 0.1372549 , 0.14117647, 0.14509804, 0.14901961, 0.15294118,
+ 0.15686275, 0.16078431, 0.16470588, 0.16862745, 0.17254902,
+ 0.17647059, 0.18039216, 0.18431373, 0.18823529, 0.19215686,
+ 0.19607843, 0.2 , 0.20392157, 0.20784314, 0.21176471,
+ 0.21568627, 0.21960784, 0.22352941, 0.22745098, 0.23137255,
+ 0.23529412, 0.23921569, 0.24313725, 0.24705882, 0.25098039,
+ 0.25490196, 0.25882353, 0.2627451 , 0.26666667, 0.27058824,
+ 0.2745098 , 0.27843137, 0.28235294, 0.28627451, 0.29019608,
+ 0.29411765, 0.29803922, 0.30196078, 0.30588235, 0.30980392,
+ 0.31372549, 0.31764706, 0.32156863, 0.3254902 , 0.32941176,
+ 0.33333333, 0.3372549 , 0.34117647, 0.34509804, 0.34901961,
+ 0.35294118, 0.35686275, 0.36078431, 0.36470588, 0.36862745,
+ 0.37254902, 0.37647059, 0.38039216, 0.38431373, 0.38823529,
+ 0.39215686, 0.39607843, 0.4 , 0.40392157, 0.40784314,
+ 0.41176471, 0.41568627, 0.41960784, 0.42352941, 0.42745098,
+ 0.43137255, 0.43529412, 0.43921569, 0.44313725, 0.44705882,
+ 0.45098039, 0.45490196, 0.45882353, 0.4627451 , 0.46666667,
+ 0.47058824, 0.4745098 , 0.47843137, 0.48235294, 0.48627451,
+ 0.49019608, 0.49411765, 0.49803922, 0.50196078, 0.50588235,
+ 0.50980392, 0.51372549, 0.51764706, 0.52156863, 0.5254902 ,
+ 0.52941176, 0.53333333, 0.5372549 , 0.54117647, 0.54509804,
+ 0.54901961, 0.55294118, 0.55686275, 0.56078431, 0.56470588,
+ 0.56862745, 0.57254902, 0.57647059, 0.58039216, 0.58431373,
+ 0.58823529, 0.59215686, 0.59607843, 0.6 , 0.60392157,
+ 0.60784314, 0.61176471, 0.61568627, 0.61960784, 0.62352941,
+ 0.62745098, 0.63137255, 0.63529412, 0.63921569, 0.64313725,
+ 0.64705882, 0.65098039, 0.65490196, 0.65882353, 0.6627451 ,
+ 0.66666667, 0.67058824, 0.6745098 , 0.67843137, 0.68235294,
+ 0.68627451, 0.69019608, 0.69411765, 0.69803922, 0.70196078,
+ 0.70588235, 0.70980392, 0.71372549, 0.71764706, 0.72156863,
+ 0.7254902 , 0.72941176, 0.73333333, 0.7372549 , 0.74117647,
+ 0.74509804, 0.74901961, 0.75294118, 0.75686275, 0.76078431,
+ 0.76470588, 0.76862745, 0.77254902, 0.77647059, 0.78039216,
+ 0.78431373, 0.78823529, 0.79215686, 0.79607843, 0.8 ,
+ 0.80392157, 0.80784314, 0.81176471, 0.81568627, 0.81960784,
+ 0.82352941, 0.82745098, 0.83137255, 0.83529412, 0.83921569,
+ 0.84313725, 0.84705882, 0.85098039, 0.85490196, 0.85882353,
+ 0.8627451 , 0.86666667, 0.87058824, 0.8745098 , 0.87843137,
+ 0.88235294, 0.88627451, 0.89019608, 0.89411765, 0.89803922,
+ 0.90196078, 0.90588235, 0.90980392, 0.91372549, 0.91764706,
+ 0.92156863, 0.9254902 , 0.92941176, 0.93333333, 0.9372549 ,
+ 0.94117647, 0.94509804, 0.94901961, 0.95294118, 0.95686275,
+ 0.96078431, 0.96470588, 0.96862745, 0.97254902, 0.97647059,
+ 0.98039216, 0.98431373, 0.98823529, 0.99215686, 0.99607843, 1. ]),
+array([ 0. , 0.00784314, 0.01568627, 0.02352941, 0.03137255,
+ 0.03921569, 0.04705882, 0.05490196, 0.0627451 , 0.07058824,
+ 0.07843137, 0.08627451, 0.09411765, 0.10196078, 0.10980392,
+ 0.11764706, 0.1254902 , 0.13333333, 0.14117647, 0.14901961,
+ 0.15686275, 0.16470588, 0.17254902, 0.18039216, 0.18823529,
+ 0.19607843, 0.20392157, 0.21176471, 0.21960784, 0.22745098,
+ 0.23529412, 0.24313725, 0.25098039, 0.25882353, 0.26666667,
+ 0.2745098 , 0.28235294, 0.29019608, 0.29803922, 0.30588235,
+ 0.31372549, 0.32156863, 0.32941176, 0.3372549 , 0.34509804,
+ 0.35294118, 0.36078431, 0.36862745, 0.37647059, 0.38431373,
+ 0.39215686, 0.4 , 0.40784314, 0.41568627, 0.42352941,
+ 0.43137255, 0.43921569, 0.44705882, 0.45490196, 0.4627451 ,
+ 0.47058824, 0.47843137, 0.48627451, 0.49411765, 0.50196078,
+ 0.50980392, 0.51764706, 0.5254902 , 0.53333333, 0.54117647,
+ 0.54901961, 0.55686275, 0.56470588, 0.57254902, 0.58039216,
+ 0.58823529, 0.59607843, 0.60392157, 0.61176471, 0.61960784,
+ 0.62745098, 0.63529412, 0.64313725, 0.65098039, 0.65882353,
+ 0.66666667, 0.6745098 , 0.68235294, 0.69019608, 0.69803922,
+ 0.70588235, 0.71372549, 0.72156863, 0.72941176, 0.7372549 ,
+ 0.74509804, 0.75294118, 0.76078431, 0.76862745, 0.77647059,
+ 0.78431373, 0.79215686, 0.8 , 0.80784314, 0.81568627,
+ 0.82352941, 0.83137255, 0.83921569, 0.84705882, 0.85490196,
+ 0.8627451 , 0.87058824, 0.87843137, 0.88627451, 0.89411765,
+ 0.90196078, 0.90980392, 0.91764706, 0.9254902 , 0.93333333,
+ 0.94117647, 0.94901961, 0.95686275, 0.96470588, 0.97254902,
+ 0.98039216, 0.98823529, 0.99607843, 0.99165624, 0.97496871,
+ 0.95828118, 0.94159366, 0.92490613, 0.90821861, 0.89153108,
+ 0.87484355, 0.85815603, 0.8414685 , 0.82478098, 0.80809345,
+ 0.79140592, 0.7747184 , 0.75803087, 0.74134335, 0.72465582,
+ 0.70796829, 0.69128077, 0.67459324, 0.65790572, 0.64121819,
+ 0.62453066, 0.60784314, 0.59115561, 0.57446809, 0.55778056,
+ 0.54109303, 0.52440551, 0.50771798, 0.49103045, 0.47434293,
+ 0.4576554 , 0.44096788, 0.42428035, 0.40759282, 0.3909053 ,
+ 0.37421777, 0.35753025, 0.34084272, 0.32415519, 0.30746767,
+ 0.29078014, 0.27409262, 0.25740509, 0.24071756, 0.22403004,
+ 0.20734251, 0.19065499, 0.17396746, 0.15727993, 0.14059241,
+ 0.12390488, 0.10721736, 0.09052983, 0.0738423 , 0.05715478,
+ 0.04046725, 0.02377972, 0.0070922 , 0.00850906, 0.02330744,
+ 0.03810581, 0.05290418, 0.06770255, 0.08250092, 0.0972993 ,
+ 0.11209767, 0.12689604, 0.14169441, 0.15649279, 0.17129116,
+ 0.18608953, 0.2008879 , 0.21568627, 0.23048465, 0.24528302,
+ 0.26008139, 0.27487976, 0.28967814, 0.30447651, 0.31927488,
+ 0.33407325, 0.34887162, 0.36367 , 0.37846837, 0.39326674,
+ 0.40806511, 0.42286349, 0.43766186, 0.45246023, 0.4672586 ,
+ 0.48205697, 0.49685535, 0.51165372, 0.52645209, 0.54125046,
+ 0.55604883, 0.57084721, 0.58564558, 0.60044395, 0.61524232,
+ 0.6300407 , 0.64483907, 0.65963744, 0.67443581, 0.68923418,
+ 0.70403256, 0.71883093, 0.7336293 , 0.74842767, 0.76322605,
+ 0.77802442, 0.79282279, 0.80762116, 0.82241953, 0.83721791,
+ 0.85201628, 0.86681465, 0.88161302, 0.89641139, 0.91120977,
+ 0.92600814, 0.94080651, 0.95560488, 0.97040326, 0.98520163, 1. ]),
array([ 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
--- a/yt/visualization/image_writer.py Thu May 26 21:53:30 2011 -0400
+++ b/yt/visualization/image_writer.py Thu Jun 02 19:11:54 2011 -0400
@@ -291,9 +291,9 @@
return mapped.copy("C")
def strip_colormap_data(fn = "color_map_data.py",
- cmaps = ("jet", "algae", "hot", "gist_stern")):
+ cmaps = ("jet", "algae", "hot", "gist_stern", "RdBu")):
import pprint
- import _colormap_data as rcm
+ import color_maps as rcm
f = open(fn, "w")
f.write("### Auto-generated colormap tables, taken from Matplotlib ###\n\n")
f.write("from numpy import array\n")
http://bitbucket.org/yt_analysis/yt/changeset/82d559eebfbd/
changeset: 82d559eebfbd
branches:
user: Cameron Hummels
date: 2011-06-03 01:14:30
summary: Merging.
affected #: 15 files (25.2 KB)
--- a/yt/analysis_modules/two_point_functions/two_point_functions.py Thu Jun 02 19:11:54 2011 -0400
+++ b/yt/analysis_modules/two_point_functions/two_point_functions.py Thu Jun 02 19:14:30 2011 -0400
@@ -610,7 +610,7 @@
added_points = False
@parallel_blocking_call
- def write_out_means(self):
+ def write_out_means(self, fn = "%s.txt"):
r"""Writes out the weighted-average value for each function for
each dimension for each ruler length to a text file. The data is written
to files of the name 'function_name.txt' in the current working
@@ -621,7 +621,7 @@
>>> tpf.write_out_means()
"""
for fset in self._fsets:
- fp = self._write_on_root("%s.txt" % fset.function.__name__)
+ fp = self._write_on_root(fn % fset.function.__name__)
fset._avg_bin_hits()
line = "# length".ljust(sep)
line += "count".ljust(sep)
@@ -643,7 +643,7 @@
fp.close()
@parallel_root_only
- def write_out_arrays(self):
+ def write_out_arrays(self, fn = "%s.h5"):
r"""Writes out the raw probability bins and the bin edges to an HDF5 file
for each of the functions. The files are named
'function_name.txt' and saved in the current working directory.
@@ -654,7 +654,7 @@
"""
if self.mine == 0:
for fset in self._fsets:
- f = h5py.File("%s.h5" % fset.function.__name__, "w")
+ f = h5py.File(fn % fset.function.__name__, "w")
bin_names = []
prob_names = []
bin_counts = []
--- a/yt/data_objects/data_containers.py Thu Jun 02 19:11:54 2011 -0400
+++ b/yt/data_objects/data_containers.py Thu Jun 02 19:14:30 2011 -0400
@@ -581,8 +581,8 @@
--------
>>> pf = load("RedshiftOutput0005")
- >>> ray = pf.h._ray((0.2, 0.74), (0.4, 0.91))
- >>> print ray["Density"], ray["t"]
+ >>> ray = pf.h._ray((0.2, 0.74, 0.11), (0.4, 0.91, 0.31))
+ >>> print ray["Density"], ray["t"], ray["dts"]
"""
AMR1DData.__init__(self, pf, fields, **kwargs)
self.start_point = na.array(start_point, dtype='float64')
@@ -1517,8 +1517,8 @@
def _initialize_source(self, source = None):
if source is None:
- check, source = self._partition_hierarchy_2d(self.axis)
- self._check_region = check
+ source = self.pf.h.all_data()
+ self._check_region = False
#self._okay_to_serialize = (not check)
else:
self._distributed = False
@@ -1565,19 +1565,22 @@
# _project_level, then it would be more memory conservative
if self.preload_style == 'all':
print "Preloading %s grids and getting %s" % (
- len(self.source._grids), self._get_dependencies(fields))
- self._preload(self.source._grids,
+ len(self.source._get_grid_objs()),
+ self._get_dependencies(fields))
+ self._preload([g for g in self._get_grid_objs()],
self._get_dependencies(fields), self.hierarchy.io)
# By changing the remove-from-tree method to accumulate, we can avoid
# having to do this by level, and instead do it by CPU file
for level in range(0, self._max_level+1):
if self.preload_style == 'level':
- self._preload(self.source.select_grids(level),
+ self._preload([g for g in self._get_grid_objs()
+ if g.Level == level],
self._get_dependencies(fields), self.hierarchy.io)
self._add_level_to_tree(tree, level, fields)
mylog.debug("End of projecting level level %s, memory usage %0.3e",
level, get_memory_usage()/1024.)
# Note that this will briefly double RAM usage
+ tree = self.merge_quadtree_buffers(tree)
coord_data, field_data, weight_data, dxs = [], [], [], []
for level in range(0, self._max_level + 1):
npos, nvals, nwvals = tree.get_all_from_level(level, False)
@@ -1591,7 +1594,6 @@
else:
ds = 0.0
dxs.append(na.ones(nvals.shape[0], dtype='float64') * ds)
- del tree
coord_data = na.concatenate(coord_data, axis=0).transpose()
field_data = na.concatenate(field_data, axis=0).transpose()
weight_data = na.concatenate(weight_data, axis=0).transpose()
@@ -1609,7 +1611,6 @@
data['pdy'] = data['pdx'] # generalization is out the window!
data['fields'] = field_data
# Now we run the finalizer, which is ignored if we don't need it
- data = self._mpi_catdict(data)
field_data = na.vsplit(data.pop('fields'), len(fields))
for fi, field in enumerate(fields):
self[field] = field_data[fi].ravel()
@@ -1654,7 +1655,9 @@
to_add, weight_proj[used_points].ravel())
def _add_level_to_tree(self, tree, level, fields):
- grids_to_project = self.source.select_grids(level)
+ grids_to_project = [g for g in self._get_grid_objs()
+ if g.Level == level]
+ if len(grids_to_project) == 0: return
dls, convs = self._get_dls(grids_to_project[0], fields)
zero_out = (level != self._max_level)
pbar = get_pbar('Projecting level % 2i / % 2i ' \
--- a/yt/data_objects/derived_quantities.py Thu Jun 02 19:11:54 2011 -0400
+++ b/yt/data_objects/derived_quantities.py Thu Jun 02 19:14:30 2011 -0400
@@ -388,7 +388,7 @@
# symmetry.
dxes = na.unique(data['dx']) # unique returns a sorted array,
dyes = na.unique(data['dy']) # so these will all have the same
- dzes = na.unique(data['dx']) # order.
+ dzes = na.unique(data['dz']) # order.
# We only need one dim to figure out levels, we'll use x.
dx = 1./data.pf.domain_dimensions[0]
levels = (na.log(dx / dxes) / na.log(data.pf.refine_by)).astype('int')
--- a/yt/frontends/ramses/setup.py Thu Jun 02 19:11:54 2011 -0400
+++ b/yt/frontends/ramses/setup.py Thu Jun 02 19:14:30 2011 -0400
@@ -9,6 +9,7 @@
["yt/frontends/ramses/_ramses_reader.pyx"],
language="c++",
include_dirs=["yt/frontends/ramses/ramses_headers/"],
+ libraries=["stdc++"],
depends=glob.glob("yt/frontends/ramses/ramses_headers/*.hh")
)
config.make_config_py() # installs __config__.py
--- a/yt/frontends/setup.py Thu Jun 02 19:11:54 2011 -0400
+++ b/yt/frontends/setup.py Thu Jun 02 19:14:30 2011 -0400
@@ -15,4 +15,5 @@
config.add_subpackage("art")
config.add_subpackage("maestro")
config.add_subpackage("castro")
+ config.add_subpackage("stream")
return config
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/frontends/stream/api.py Thu Jun 02 19:14:30 2011 -0400
@@ -0,0 +1,39 @@
+"""
+API for yt.frontends.stream
+
+Author: Matthew Turk <matthewturk at gmail.com>
+Affiliation: Columbia University
+Homepage: http://yt.enzotools.org/
+License:
+ Copyright (C) 2011 Matthew Turk. All Rights Reserved.
+
+ This file is part of yt.
+
+ yt is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+"""
+
+from .data_structures import \
+ StreamGrid, \
+ StreamHierarchy, \
+ StreamStaticOutput, \
+ StreamHandler
+
+from .fields import \
+ StreamFieldContainer, \
+ StreamFieldInfo, \
+ add_stream_field
+
+from .io import \
+ IOHandlerStream
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/frontends/stream/data_structures.py Thu Jun 02 19:14:30 2011 -0400
@@ -0,0 +1,259 @@
+"""
+Data structures for Streaming, in-memory datasets
+
+Author: Matthew Turk <matthewturk at gmail.com>
+Affiliation: Columbia University
+Homepage: http://yt.enzotools.org/
+License:
+ Copyright (C) 2011 Matthew Turk. All Rights Reserved.
+
+ This file is part of yt.
+
+ yt is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+"""
+
+import weakref
+import numpy as na
+
+from yt.utilities.io_handler import io_registry
+from yt.funcs import *
+from yt.config import ytcfg
+from yt.data_objects.grid_patch import \
+ AMRGridPatch
+from yt.data_objects.hierarchy import \
+ AMRHierarchy
+from yt.data_objects.static_output import \
+ StaticOutput
+from yt.utilities.logger import ytLogger as mylog
+
+from .fields import \
+ StreamFieldContainer, \
+ add_stream_field
+
+class StreamGrid(AMRGridPatch):
+ """
+ Class representing a single In-memory Grid instance.
+ """
+
+ __slots__ = ['proc_num']
+ _id_offset = 0
+ def __init__(self, id, hierarchy):
+ """
+ Returns an instance of StreamGrid with *id*, associated with *filename*
+ and *hierarchy*.
+ """
+ #All of the field parameters will be passed to us as needed.
+ AMRGridPatch.__init__(self, id, filename = None, hierarchy = hierarchy)
+ self._children_ids = []
+ self._parent_id = -1
+ self.Level = -1
+
+ def _guess_properties_from_parent(self):
+ rf = self.pf.refine_by
+ my_ind = self.id - self._id_offset
+ le = self.LeftEdge
+ self.dds = self.Parent.dds/rf
+ ParentLeftIndex = na.rint((self.LeftEdge-self.Parent.LeftEdge)/self.Parent.dds)
+ self.start_index = rf*(ParentLeftIndex + self.Parent.get_global_startindex()).astype('int64')
+ self.LeftEdge = self.Parent.LeftEdge + self.Parent.dds * ParentLeftIndex
+ self.RightEdge = self.LeftEdge + self.ActiveDimensions*self.dds
+ self.hierarchy.grid_left_edge[my_ind,:] = self.LeftEdge
+ self.hierarchy.grid_right_edge[my_ind,:] = self.RightEdge
+ self._child_mask = None
+ self._child_index_mask = None
+ self._child_indices = None
+ self._setup_dx()
+
+ def set_filename(self, filename):
+ pass
+
+ def __repr__(self):
+ return "StreamGrid_%04i" % (self.id)
+
+ @property
+ def Parent(self):
+ if self._parent_id == -1: return None
+ return self.hierarchy.grids[self._parent_id - self._id_offset]
+
+ @property
+ def Children(self):
+ return [self.hierarchy.grids[cid - self._id_offset]
+ for cid in self._children_ids]
+
+class StreamHandler(object):
+ def __init__(self, left_edges, right_edges, dimensions,
+ levels, parent_ids, particle_count, processor_ids,
+ fields):
+ self.left_edges = left_edges
+ self.right_edges = right_edges
+ self.dimensions = dimensions
+ self.levels = levels
+ self.parent_ids = parent_ids
+ self.particle_count = particle_count
+ self.processor_ids = processor_ids
+ self.num_grids = self.levels.size
+ self.fields = fields
+
+ def get_fields(self):
+ return self.fields.all_fields
+
+class StreamHierarchy(AMRHierarchy):
+
+ grid = StreamGrid
+
+ def __init__(self, pf, data_style = None):
+ self.data_style = data_style
+ self.float_type = 'float64'
+ self.parameter_file = weakref.proxy(pf) # for _obtain_enzo
+ self.stream_handler = pf.stream_handler
+ self.float_type = "float64"
+ self.directory = os.getcwd()
+ AMRHierarchy.__init__(self, pf, data_style)
+
+ def _initialize_data_storage(self):
+ pass
+
+ def _count_grids(self):
+ self.num_grids = self.stream_handler.num_grids
+
+ def _setup_unknown_fields(self):
+ for field in self.field_list:
+ if field in self.parameter_file.field_info: continue
+ mylog.info("Adding %s to list of fields", field)
+ cf = None
+ if self.parameter_file.has_key(field):
+ def external_wrapper(f):
+ def _convert_function(data):
+ return data.convert(f)
+ return _convert_function
+ cf = external_wrapper(field)
+ # Note that we call add_field on the field_info directly. This
+ # will allow the same field detection mechanism to work for 1D, 2D
+ # and 3D fields.
+ self.pf.field_info.add_field(
+ field, lambda a, b: None,
+ convert_function=cf, take_log=False)
+
+
+ def _parse_hierarchy(self):
+ self.grid_dimensions = self.stream_handler.dimensions
+ self.grid_left_edge[:] = self.stream_handler.left_edges
+ self.grid_right_edge[:] = self.stream_handler.right_edges
+ self.grid_levels[:] = self.stream_handler.levels
+ self.grid_procs = self.stream_handler.processor_ids
+ self.grid_particle_count[:] = self.stream_handler.particle_count
+ mylog.debug("Copying reverse tree")
+ reverse_tree = self.stream_handler.parent_ids.tolist()
+ # Initial setup:
+ mylog.debug("Reconstructing parent-child relationships")
+ self.grids = []
+ # We enumerate, so it's 0-indexed id and 1-indexed pid
+ self.filenames = ["-1"] * self.num_grids
+ for id,pid in enumerate(reverse_tree):
+ self.grids.append(self.grid(id, self))
+ self.grids[-1].Level = self.grid_levels[id, 0]
+ if pid >= 0:
+ self.grids[-1]._parent_id = pid
+ self.grids[pid]._children_ids.append(self.grids[-1].id)
+ self.max_level = self.grid_levels.max()
+ mylog.debug("Preparing grids")
+ for i, grid in enumerate(self.grids):
+ if (i%1e4) == 0: mylog.debug("Prepared % 7i / % 7i grids", i, self.num_grids)
+ grid.filename = None
+ grid._prepare_grid()
+ grid.proc_num = self.grid_procs[i]
+ self.grids = na.array(self.grids, dtype='object')
+ mylog.debug("Prepared")
+
+ def _initialize_grid_arrays(self):
+ AMRHierarchy._initialize_grid_arrays(self)
+ self.grid_procs = na.zeros((self.num_grids,1),'int32')
+
+ def save_data(self, *args, **kwargs):
+ pass
+
+ def _detect_fields(self):
+ self.field_list = list(set(self.stream_handler.get_fields()))
+
+ def _setup_derived_fields(self):
+ self.derived_field_list = []
+ for field in self.parameter_file.field_info:
+ try:
+ fd = self.parameter_file.field_info[field].get_dependencies(
+ pf = self.parameter_file)
+ except:
+ continue
+ available = na.all([f in self.field_list for f in fd.requested])
+ if available: self.derived_field_list.append(field)
+ for field in self.field_list:
+ if field not in self.derived_field_list:
+ self.derived_field_list.append(field)
+
+ def _setup_classes(self):
+ dd = self._get_data_reader_dict()
+ AMRHierarchy._setup_classes(self, dd)
+ self.object_types.sort()
+
+ def _populate_grid_objects(self):
+ for g in self.grids:
+ g._setup_dx()
+ self.max_level = self.grid_levels.max()
+
+ def _setup_data_io(self):
+ self.io = io_registry[self.data_style](self.stream_handler)
+
+class StreamStaticOutput(StaticOutput):
+ _hierarchy_class = StreamHierarchy
+ _fieldinfo_class = StreamFieldContainer
+ _data_style = 'stream'
+
+ def __init__(self, stream_handler):
+ #if parameter_override is None: parameter_override = {}
+ #self._parameter_override = parameter_override
+ #if conversion_override is None: conversion_override = {}
+ #self._conversion_override = conversion_override
+
+ self.stream_handler = stream_handler
+ StaticOutput.__init__(self, "InMemoryParameterFile", self._data_style)
+
+ self.field_info = self._fieldinfo_class()
+ self.units = {}
+ self.time_units = {}
+
+ def _parse_parameter_file(self):
+ self.basename = self.stream_handler.name
+ self.parameters['CurrentTimeIdentifier'] = time.time()
+ self.unique_identifier = self.parameters["CurrentTimeIdentifier"]
+ self.domain_left_edge = self.stream_handler.domain_left_edge[:]
+ self.domain_right_edge = self.stream_handler.domain_right_edge[:]
+ self.refine_by = self.stream_handler.refine_by
+ self.dimensionality = self.stream_handler.dimensionality
+ self.domain_dimensions = self.stream_handler.domain_dimensions
+ self.current_time = self.stream_handler.simulation_time
+ if self.stream_handler.cosmology_simulation:
+ self.cosmological_simulation = 1
+ self.current_redshift = self.stream_handler.current_redshift
+ self.omega_lambda = self.stream_handler.omega_lambda
+ self.omega_matter = self.stream_handler.omega_matter
+ self.hubble_constant = self.stream_handler.hubble_constant
+ else:
+ self.current_redshift = self.omega_lambda = self.omega_matter = \
+ self.hubble_constant = self.cosmological_simulation = 0.0
+
+ def _set_units(self):
+ pass
+
+ @classmethod
+ def _is_valid(cls, *args, **kwargs):
+ return False
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/frontends/stream/definitions.py Thu Jun 02 19:14:30 2011 -0400
@@ -0,0 +1,26 @@
+"""
+Definitions specific to the Streaming API
+
+Author: Matthew Turk <matthewturk at gmail.com>
+Affiliation: Columbia University
+Homepage: http://yt.enzotools.org/
+
+License:
+ Copyright (C) 2011 Matthew Turk. All Rights Reserved.
+
+ This file is part of yt.
+
+ yt is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+"""
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/frontends/stream/fields.py Thu Jun 02 19:14:30 2011 -0400
@@ -0,0 +1,50 @@
+"""
+Fields specific to Streaming data
+
+Author: Matthew Turk <matthewturk at gmail.com>
+Affiliation: KIPAC/SLAC/Stanford
+Homepage: http://yt.enzotools.org/
+License:
+ Copyright (C) 2008-2011 Matthew Turk. All Rights Reserved.
+
+ This file is part of yt.
+
+ yt is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+"""
+
+import numpy as na
+
+from yt.data_objects.field_info_container import \
+ CodeFieldInfoContainer, \
+ ValidateParameter, \
+ ValidateDataField, \
+ ValidateProperty, \
+ ValidateSpatial, \
+ ValidateGridType
+import yt.data_objects.universal_fields
+from yt.utilities.physical_constants import \
+ mh
+import yt.utilities.amr_utils as amr_utils
+
+class StreamFieldContainer(CodeFieldInfoContainer):
+ """
+ This is a container for Streaming-specific fields.
+ """
+ _shared_state = {}
+ _field_list = {}
+StreamFieldInfo = StreamFieldContainer()
+add_stream_field = StreamFieldInfo.add_field
+
+add_field = add_stream_field
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/frontends/stream/io.py Thu Jun 02 19:14:30 2011 -0400
@@ -0,0 +1,71 @@
+"""
+Enzo-specific IO functions
+
+Author: Matthew Turk <matthewturk at gmail.com>
+Affiliation: KIPAC/SLAC/Stanford
+Homepage: http://yt.enzotools.org/
+License:
+ Copyright (C) 2007-2011 Matthew Turk. All Rights Reserved.
+
+ This file is part of yt.
+
+ yt is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+"""
+
+from collections import defaultdict
+
+import exceptions
+import os
+
+from yt.utilities.io_handler import \
+ BaseIOHandler, _axis_ids
+from yt.utilities.logger import ytLogger as mylog
+
+class IOHandlerStream(BaseIOHandler):
+
+ _data_style = "stream"
+
+ def __init__(self, stream_handler):
+ self.fields = stream_handler.fields
+ BaseIOHandler.__init__(self)
+
+ def _read_data_set(self, grid, field):
+ # This is where we implement processor-locking
+ #if grid.id not in self.grids_in_memory:
+ # mylog.error("Was asked for %s but I have %s", grid.id, self.grids_in_memory.keys())
+ # raise KeyError
+ tr = self.fields[grid.id][field]
+ # If it's particles, we copy.
+ if len(tr.shape) == 1: return tr.copy()
+ # New in-place unit conversion breaks if we don't copy first
+ return tr
+
+ def modify(self, field):
+ return field
+
+ def _read_field_names(self, grid):
+ return self.fields[grid.id].keys()
+
+ def _read_data_slice(self, grid, field, axis, coord):
+ sl = [slice(0,-0), slice(0,-0), slice(0,-0)]
+ sl[axis] = slice(coord, coord + 1)
+ sl = tuple(reversed(sl))
+ tr = self.fields[grid.id][field][sl].swapaxes(0,2)
+ # In-place unit conversion requires we return a copy
+ return tr.copy()
+
+ @property
+ def _read_exception(self):
+ return KeyError
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/frontends/stream/misc.py Thu Jun 02 19:14:30 2011 -0400
@@ -0,0 +1,25 @@
+"""
+Miscellaneous functions that are Streaming-specific
+
+Author: Matthew Turk <matthewturk at gmail.com>
+Affiliation: KIPAC/SLAC/Stanford
+Homepage: http://yt.enzotools.org/
+License:
+ Copyright (C) 2008-2011 Matthew Turk. All Rights Reserved.
+
+ This file is part of yt.
+
+ yt is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+"""
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/frontends/stream/setup.py Thu Jun 02 19:14:30 2011 -0400
@@ -0,0 +1,12 @@
+#!/usr/bin/env python
+import setuptools
+import os, sys, os.path
+
+import os.path
+
+def configuration(parent_package='',top_path=None):
+ from numpy.distutils.misc_util import Configuration
+ config = Configuration('stream',parent_package,top_path)
+ config.make_config_py() # installs __config__.py
+ config.make_svn_version_py()
+ return config
--- a/yt/utilities/_amr_utils/QuadTree.pyx Thu Jun 02 19:11:54 2011 -0400
+++ b/yt/utilities/_amr_utils/QuadTree.pyx Thu Jun 02 19:14:30 2011 -0400
@@ -31,6 +31,7 @@
cimport cython
from stdlib cimport malloc, free, abs
+from cython.operator cimport dereference as deref, preincrement as inc
cdef extern from "stdlib.h":
# NOTE that size_t might not be int
@@ -78,13 +79,14 @@
node.nvals = nvals
node.val = <np.float64_t *> malloc(
nvals * sizeof(np.float64_t))
- for i in range(nvals):
- node.val[i] = val[i]
- node.weight_val = weight_val
for i in range(2):
for j in range(2):
node.children[i][j] = NULL
node.level = level
+ if val != NULL:
+ for i in range(nvals):
+ node.val[i] = val[i]
+ node.weight_val = weight_val
return node
cdef void QTN_free(QuadTreeNode *node):
@@ -103,9 +105,11 @@
cdef np.int64_t po2[80]
cdef QuadTreeNode ***root_nodes
cdef np.int64_t top_grid_dims[2]
+ cdef int merged
def __cinit__(self, np.ndarray[np.int64_t, ndim=1] top_grid_dims,
int nvals):
+ self.merged = 1
cdef int i, j
cdef QuadTreeNode *node
cdef np.int64_t pos[2]
@@ -134,6 +138,90 @@
self.root_nodes[i][j] = QTN_initialize(
pos, nvals, vals, weight_val, 0)
+ cdef int count_total_cells(self, QuadTreeNode *root):
+ cdef int total = 0
+ cdef int i, j
+ if root.children[0][0] == NULL: return 1
+ for i in range(2):
+ for j in range(2):
+ total += self.count_total_cells(root.children[i][j])
+ return total + 1
+
+ cdef int fill_buffer(self, QuadTreeNode *root, int curpos,
+ np.ndarray[np.int32_t, ndim=1] refined,
+ np.ndarray[np.float64_t, ndim=2] values,
+ np.ndarray[np.float64_t, ndim=1] wval):
+ cdef int i, j
+ for i in range(self.nvals):
+ values[curpos, i] = root.val[i]
+ wval[curpos] = root.weight_val
+ if root.children[0][0] != NULL: refined[curpos] = 1
+ else: return curpos+1
+ curpos += 1
+ for i in range(2):
+ for j in range(2):
+ curpos = self.fill_buffer(root.children[i][j], curpos,
+ refined, values, wval)
+ return curpos
+
+ cdef int unfill_buffer(self, QuadTreeNode *root, int curpos,
+ np.ndarray[np.int32_t, ndim=1] refined,
+ np.ndarray[np.float64_t, ndim=2] values,
+ np.ndarray[np.float64_t, ndim=1] wval):
+ cdef int i, j
+ for i in range(self.nvals):
+ root.val[i] = values[curpos, i]
+ root.weight_val = wval[curpos]
+ if refined[curpos] == 0: return curpos+1
+ curpos += 1
+ cdef QuadTreeNode *child
+ cdef np.int64_t pos[2]
+ for i in range(2):
+ for j in range(2):
+ pos[0] = root.pos[0]*2 + i
+ pos[1] = root.pos[1]*2 + j
+ child = QTN_initialize(pos, self.nvals, NULL, 0.0, root.level+1)
+ root.children[i][j] = child
+ curpos = self.unfill_buffer(child, curpos, refined, values, wval)
+ return curpos
+
+
+ def frombuffer(self, np.ndarray[np.int32_t, ndim=1] refined,
+ np.ndarray[np.float64_t, ndim=2] values,
+ np.ndarray[np.float64_t, ndim=1] wval):
+ self.merged = 1 # Just on the safe side
+ cdef int curpos = 0
+ cdef QuadTreeNode *root
+ for i in range(self.top_grid_dims[0]):
+ for j in range(self.top_grid_dims[1]):
+ curpos = self.unfill_buffer(self.root_nodes[i][j], curpos,
+ refined, values, wval)
+
+ def tobuffer(self):
+ cdef int total = 0
+ for i in range(self.top_grid_dims[0]):
+ for j in range(self.top_grid_dims[1]):
+ total += self.count_total_cells(self.root_nodes[i][j])
+ # We now have four buffers:
+ # Refined or not (total,) int32
+ # Values in each node (total, nvals) float64
+ # Weight values in each node (total,) float64
+ cdef np.ndarray[np.int32_t, ndim=1] refined
+ refined = np.zeros(total, dtype='int32')
+ cdef np.ndarray[np.float64_t, ndim=2] values
+ values = np.zeros((total, self.nvals), dtype='float64')
+ cdef np.ndarray[np.float64_t, ndim=1] wval
+ wval = np.zeros(total, dtype='float64')
+ cdef int curpos = 0
+ for i in range(self.top_grid_dims[0]):
+ for j in range(self.top_grid_dims[1]):
+ curpos = self.fill_buffer(self.root_nodes[i][j], curpos,
+ refined, values, wval)
+ return (refined, values, wval)
+
+ def get_args(self):
+ return (self.top_grid_dims[0], self.top_grid_dims[1], self.nvals)
+
cdef void add_to_position(self,
int level, np.int64_t pos[2],
np.float64_t *val,
@@ -189,7 +277,7 @@
@cython.boundscheck(False)
@cython.wraparound(False)
def get_all_from_level(self, int level, int count_only = 0):
- cdef int i, j
+ cdef int i, j, vi
cdef int total = 0
vals = []
for i in range(self.top_grid_dims[0]):
@@ -207,10 +295,15 @@
cdef np.int64_t *pdata = <np.int64_t *> npos.data
cdef np.float64_t *vdata = <np.float64_t *> nvals.data
cdef np.float64_t *wdata = <np.float64_t *> nwvals.data
+ cdef np.float64_t wtoadd
+ cdef np.float64_t *vtoadd = <np.float64_t *> alloca(
+ sizeof(np.float64_t)*self.nvals)
for i in range(self.top_grid_dims[0]):
for j in range(self.top_grid_dims[1]):
+ for vi in range(self.nvals): vtoadd[vi] = 0.0
+ wtoadd = 0.0
curpos += self.fill_from_level(self.root_nodes[i][j],
- level, curpos, pdata, vdata, wdata)
+ level, curpos, pdata, vdata, wdata, vtoadd, wtoadd)
return npos, nvals, nwvals
cdef int count_at_level(self, QuadTreeNode *node, int level):
@@ -232,22 +325,33 @@
np.int64_t curpos,
np.int64_t *pdata,
np.float64_t *vdata,
- np.float64_t *wdata):
+ np.float64_t *wdata,
+ np.float64_t *vtoadd,
+ np.float64_t wtoadd):
cdef int i, j
if node.level == level:
if node.children[0][0] != NULL: return 0
for i in range(self.nvals):
- vdata[self.nvals * curpos + i] = node.val[i]
- wdata[curpos] = node.weight_val
+ vdata[self.nvals * curpos + i] = node.val[i] + vtoadd[i]
+ wdata[curpos] = node.weight_val + wtoadd
pdata[curpos * 2] = node.pos[0]
pdata[curpos * 2 + 1] = node.pos[1]
return 1
if node.children[0][0] == NULL: return 0
cdef np.int64_t added = 0
+ if self.merged == 1:
+ for i in range(self.nvals):
+ vtoadd[i] += node.val[i]
+ wtoadd += node.weight_val
for i in range(2):
for j in range(2):
added += self.fill_from_level(node.children[i][j],
- level, curpos + added, pdata, vdata, wdata)
+ level, curpos + added, pdata, vdata, wdata,
+ vtoadd, wtoadd)
+ if self.merged == 1:
+ for i in range(self.nvals):
+ vtoadd[i] -= node.val[i]
+ wtoadd -= node.weight_val
return added
def __dealloc__(self):
@@ -257,3 +361,37 @@
QTN_free(self.root_nodes[i][j])
free(self.root_nodes[i])
free(self.root_nodes)
+
+cdef void QTN_merge_nodes(QuadTreeNode *n1, QuadTreeNode *n2):
+ # We have four choices when merging nodes.
+ # 1. If both nodes have no refinement, then we add values of n2 to n1.
+ # 2. If both have refinement, we call QTN_merge_nodes on all four children.
+ # 3. If n2 has refinement and n1 does not, we detach n2's children and
+ # attach them to n1.
+ # 4. If n1 has refinement and n2 does not, we add the value of n2 to n1.
+ cdef int i, j
+
+ QTN_add_value(n1, n2.val, n2.weight_val)
+ if n1.children[0][0] == n2.children[0][0] == NULL:
+ pass
+ elif n1.children[0][0] != NULL and n2.children[0][0] != NULL:
+ for i in range(2):
+ for j in range(2):
+ QTN_merge_nodes(n1.children[i][j], n2.children[i][j])
+ elif n1.children[0][0] == NULL and n2.children[0][0] != NULL:
+ for i in range(2):
+ for j in range(2):
+ n1.children[i][j] = n2.children[i][j]
+ n2.children[i][j] = NULL
+ elif n1.children[0][0] != NULL and n2.children[0][0] == NULL:
+ pass
+ else:
+ raise RuntimeError
+
+def merge_quadtrees(QuadTree qt1, QuadTree qt2):
+ cdef int i, j
+ for i in range(qt1.top_grid_dims[0]):
+ for j in range(qt1.top_grid_dims[1]):
+ QTN_merge_nodes(qt1.root_nodes[i][j],
+ qt2.root_nodes[i][j])
+ qt1.merged = 1
--- a/yt/utilities/parallel_tools/parallel_analysis_interface.py Thu Jun 02 19:11:54 2011 -0400
+++ b/yt/utilities/parallel_tools/parallel_analysis_interface.py Thu Jun 02 19:14:30 2011 -0400
@@ -36,6 +36,8 @@
from yt.utilities.definitions import \
x_dict, y_dict
import yt.utilities.logger
+from yt.utilities.amr_utils import \
+ QuadTree, merge_quadtrees
exe_name = os.path.basename(sys.executable)
# At import time, we determined whether or not we're being run in parallel.
@@ -1253,6 +1255,74 @@
if not obj._distributed: return True
return (obj._owner == MPI.COMM_WORLD.rank)
+ def _send_quadtree(self, target, qt, tgd, args):
+ sizebuf = na.zeros(1, 'int64')
+ buf = qt.tobuffer()
+ sizebuf[0] = buf[0].size
+ MPI.COMM_WORLD.Send([sizebuf, MPI.LONG], dest=target)
+ MPI.COMM_WORLD.Send([buf[0], MPI.INT], dest=target)
+ MPI.COMM_WORLD.Send([buf[1], MPI.DOUBLE], dest=target)
+ MPI.COMM_WORLD.Send([buf[2], MPI.DOUBLE], dest=target)
+
+ def _recv_quadtree(self, target, tgd, args):
+ sizebuf = na.zeros(1, 'int64')
+ MPI.COMM_WORLD.Recv(sizebuf, source=target)
+ buf = [na.empty((sizebuf[0],), 'int32'),
+ na.empty((sizebuf[0], args[2]),'float64'),
+ na.empty((sizebuf[0],),'float64')]
+ MPI.COMM_WORLD.Recv([buf[0], MPI.INT], source=target)
+ MPI.COMM_WORLD.Recv([buf[1], MPI.DOUBLE], source=target)
+ MPI.COMM_WORLD.Recv([buf[2], MPI.DOUBLE], source=target)
+ qt = QuadTree(tgd, args[2])
+ qt.frombuffer(*buf)
+ return qt
+
+ @parallel_passthrough
+ def merge_quadtree_buffers(self, qt):
+ # This is a modified version of pairwise reduction from Lisandro Dalcin,
+ # in the reductions demo of mpi4py
+ size = MPI.COMM_WORLD.size
+ rank = MPI.COMM_WORLD.rank
+
+ mask = 1
+
+ args = qt.get_args() # Will always be the same
+ tgd = na.array([args[0], args[1]], dtype='int64')
+ sizebuf = na.zeros(1, 'int64')
+
+ while mask < size:
+ if (mask & rank) != 0:
+ target = (rank & ~mask) % size
+ print "SENDING FROM %02i to %02i" % (rank, target)
+ self._send_quadtree(target, qt, tgd, args)
+ #qt = self._recv_quadtree(target, tgd, args)
+ else:
+ target = (rank | mask)
+ if target < size:
+ print "RECEIVING FROM %02i on %02i" % (target, rank)
+ qto = self._recv_quadtree(target, tgd, args)
+ merge_quadtrees(qt, qto)
+ del qto
+ #self._send_quadtree(target, qt, tgd, args)
+ mask <<= 1
+
+ if rank == 0:
+ buf = qt.tobuffer()
+ sizebuf[0] = buf[0].size
+ MPI.COMM_WORLD.Bcast([sizebuf, MPI.LONG], root=0)
+ if rank != 0:
+ buf = [na.empty((sizebuf[0],), 'int32'),
+ na.empty((sizebuf[0], args[2]),'float64'),
+ na.empty((sizebuf[0],),'float64')]
+ MPI.COMM_WORLD.Bcast([buf[0], MPI.INT], root=0)
+ MPI.COMM_WORLD.Bcast([buf[1], MPI.DOUBLE], root=0)
+ MPI.COMM_WORLD.Bcast([buf[2], MPI.DOUBLE], root=0)
+ self.refined = buf[0]
+ if rank != 0:
+ qt = QuadTree(tgd, args[2])
+ qt.frombuffer(*buf)
+ return qt
+
__tocast = 'c'
def _send_array(arr, dest, tag = 0):
Repository URL: https://bitbucket.org/yt_analysis/yt/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the yt-svn
mailing list