/[escript]/trunk/escript/py_src/test_util_unary_with_tagged_data.py
ViewVC logotype

Diff of /trunk/escript/py_src/test_util_unary_with_tagged_data.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 395 by gross, Wed Dec 21 02:41:59 2005 UTC revision 396 by gross, Wed Dec 21 05:08:25 2005 UTC
# Line 1375  class Test_util_unary_with_tagged_data(T Line 1375  class Test_util_unary_with_tagged_data(T
1375        self.failUnless(isinstance(res,Data),"wrong type of result.")        self.failUnless(isinstance(res,Data),"wrong type of result.")
1376        self.failUnlessEqual(res.getShape(),(),"wrong shape of result.")        self.failUnlessEqual(res.getShape(),(),"wrong shape of result.")
1377        self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")        self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1378       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1379       def test_clip_taggedData_rank0(self):
1380          arg=Data(-0.586456381539,self.functionspace)
1381          arg.setTaggedValue(1,0.209563153277)
1382          res=clip(arg,-0.3,0.5)
1383          ref=Data(-0.3,self.functionspace)
1384          ref.setTaggedValue(1,0.209563153277)
1385          self.failUnless(isinstance(res,Data),"wrong type of result.")
1386          self.failUnlessEqual(res.getShape(),(),"wrong shape of result.")
1387          self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1388       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1389       def test_clip_taggedData_rank1(self):
1390          arg=Data(numarray.array([-0.55774515991639473, -0.091560877171301236]),self.functionspace)
1391          arg.setTaggedValue(1,numarray.array([0.66746629096576049, 0.29687459606292088]))
1392          res=clip(arg,-0.3,0.5)
1393          ref=Data(numarray.array([-0.29999999999999999, -0.091560877171301236]),self.functionspace)
1394          ref.setTaggedValue(1,numarray.array([0.5, 0.29687459606292088]))
1395          self.failUnless(isinstance(res,Data),"wrong type of result.")
1396          self.failUnlessEqual(res.getShape(),(2,),"wrong shape of result.")
1397          self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1398       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1399       def test_clip_taggedData_rank2(self):
1400          arg=Data(numarray.array([[0.92078283012674222, 0.082966604818023537, -0.44955157461118889, 0.20379872665296062, -0.027334825618857694], [0.2545815386580188, 0.63863229466603832, -0.2636242975469909, 0.31732729387167513, -0.33927475782076022], [-0.86480384733397719, 0.63899360745381273, -0.14244318620875474, -0.28418136656865478, 0.52805530986754579], [-0.72182500154188611, -0.5520656722291335, -0.53596757119473004, -0.3496219738666011, 0.026421982468125993]]),self.functionspace)
1401          arg.setTaggedValue(1,numarray.array([[-0.61641779923056816, 0.72414040414314074, 0.74658958249612439, -0.83506986304109487, -0.27184762551498576], [-0.91880091709204414, 0.13957485854328522, 0.044242311261486256, -0.47633342462252881, 0.14077523635761846], [0.97315993643550813, -0.69880173278152213, 0.34287512312623369, -0.17545687063500126, 0.4117608764449725], [-0.65151651119897513, 0.07746827744971152, 0.76062795648091908, 0.63018904248319307, -0.37035138194082373]]))
1402          res=clip(arg,-0.3,0.5)
1403          ref=Data(numarray.array([[0.5, 0.082966604818023537, -0.29999999999999999, 0.20379872665296062, -0.027334825618857694], [0.2545815386580188, 0.5, -0.2636242975469909, 0.31732729387167513, -0.29999999999999999], [-0.29999999999999999, 0.5, -0.14244318620875474, -0.28418136656865478, 0.5], [-0.29999999999999999, -0.29999999999999999, -0.29999999999999999, -0.29999999999999999, 0.026421982468125993]]),self.functionspace)
1404          ref.setTaggedValue(1,numarray.array([[-0.29999999999999999, 0.5, 0.5, -0.29999999999999999, -0.27184762551498576], [-0.29999999999999999, 0.13957485854328522, 0.044242311261486256, -0.29999999999999999, 0.14077523635761846], [0.5, -0.29999999999999999, 0.34287512312623369, -0.17545687063500126, 0.4117608764449725], [-0.29999999999999999, 0.07746827744971152, 0.5, 0.5, -0.29999999999999999]]))
1405          self.failUnless(isinstance(res,Data),"wrong type of result.")
1406          self.failUnlessEqual(res.getShape(),(4, 5),"wrong shape of result.")
1407          self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1408       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1409       def test_clip_taggedData_rank3(self):
1410          arg=Data(numarray.array([[[-0.93595611718046134, 0.15030385020288572], [-0.075765264835379709, 0.11334342086568139]], [[-0.85963167087054893, 0.31195616074306898], [-0.90301388731995025, -0.43484977485230036]], [[-0.35904775125395316, -0.26262746461074271], [-0.40250105120701685, -0.89652871806573153]], [[0.43650836668275272, -0.3757431381089118], [-0.30636747598259539, -0.84093431369407745]], [[0.47390187035348164, -0.10390754716923678], [0.51126763372526352, 0.15832367335744291]], [[0.67025430776305206, 0.82371861770706922], [0.96960307597921713, 0.090296012972978623]]]),self.functionspace)
1411          arg.setTaggedValue(1,numarray.array([[[-0.41422621266137605, 0.66937169235210336], [-0.46879447383017303, 0.52242494387680716]], [[-0.14585330598553226, 0.71730332341970882], [-0.69219830659242065, -0.22634999681297296]], [[0.6272045132079489, -0.63463675295257649], [-0.084877856284922171, -0.80679549099060122]], [[0.019282801790388548, 0.078272411760595517], [-0.72424186578333605, 0.11824563331903692]], [[0.05228289224929239, -0.5210500081800693], [-0.52205651032033651, -0.011427130000266184]], [[0.37440287860429255, -0.22324475885669171], [0.44468789932497854, 0.93805307645514624]]]))
1412          res=clip(arg,-0.3,0.5)
1413          ref=Data(numarray.array([[[-0.29999999999999999, 0.15030385020288572], [-0.075765264835379709, 0.11334342086568139]], [[-0.29999999999999999, 0.31195616074306898], [-0.29999999999999999, -0.29999999999999999]], [[-0.29999999999999999, -0.26262746461074271], [-0.29999999999999999, -0.29999999999999999]], [[0.43650836668275272, -0.29999999999999999], [-0.29999999999999999, -0.29999999999999999]], [[0.47390187035348164, -0.10390754716923678], [0.5, 0.15832367335744291]], [[0.5, 0.5], [0.5, 0.090296012972978623]]]),self.functionspace)
1414          ref.setTaggedValue(1,numarray.array([[[-0.29999999999999999, 0.5], [-0.29999999999999999, 0.5]], [[-0.14585330598553226, 0.5], [-0.29999999999999999, -0.22634999681297296]], [[0.5, -0.29999999999999999], [-0.084877856284922171, -0.29999999999999999]], [[0.019282801790388548, 0.078272411760595517], [-0.29999999999999999, 0.11824563331903692]], [[0.05228289224929239, -0.29999999999999999], [-0.29999999999999999, -0.011427130000266184]], [[0.37440287860429255, -0.22324475885669171], [0.44468789932497854, 0.5]]]))
1415          self.failUnless(isinstance(res,Data),"wrong type of result.")
1416          self.failUnlessEqual(res.getShape(),(6, 2, 2),"wrong shape of result.")
1417          self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")
1418       #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1419       def test_clip_taggedData_rank4(self):
1420          arg=Data(numarray.array([[[[-0.97160016541599048, -0.43464196910924269, -0.23690005500198974, -0.54505821229189078], [0.75723735103604484, 0.47728350383465212, -0.18251619176764877, 0.99025221671542263], [-0.33126525295723441, -0.55097518327671136, 0.46386393103124957, -0.5028567057894]], [[-0.96428397806042776, -0.32723838098616564, -0.51713937973626223, 0.085602827397356585], [0.39080321493740078, -0.85653662913195427, 0.16921767079099848, 0.39501968814837984], [-0.094819423058470464, 0.32719847739349617, 0.62624242042874534, 0.034850296976497885]]], [[[-0.37578612340398809, -0.95145289363650298, -0.85275150976030334, 0.89051350131703133], [-0.10582668740299472, -0.13140703934766851, 0.58226666842363484, -0.85098889641917208], [-0.73422134882814771, -0.74056143316833989, -0.85585388778247506, 0.37383179934715027]], [[-0.60621611229601191, 0.83398721692112243, 0.79208200862070988, -0.76887710240427642], [-0.88684756867392589, -0.73572431861923282, -0.85514288036024833, -0.90625444381469755], [-0.63116702698441807, -0.62921521603185582, -0.027679572698908084, -0.49500631740870782]]], [[[-0.15914337383288424, 0.095371185176566842, 0.37912475459494721, 0.4024421559252549], [0.17156871625876557, -0.16181202305035125, -0.54126597465794779, 0.83987886819444846], [0.069057416726155507, -0.49106958817623569, 0.93467757049987465, 0.28287952469825028]], [[0.68942704651852793, 0.81096750450878519, 0.37481094259877334, 0.1471418138825642], [0.20070329637746753, -0.78818450250007777, -0.152719755269904, 0.92798318613388875], [0.83301083132574871, 0.20846747979704916, -0.32414811917626918, 0.82969746085395513]]]]),self.functionspace)
1421          arg.setTaggedValue(1,numarray.array([[[[-0.36196197753514481, 0.77440039326442012, -0.87338825838538359, 0.98628288992701973], [-0.86385653721960209, -0.095672296296486437, 0.97906517488663858, 0.019998954995007034], [0.051167693979698559, 0.28975749676662454, -0.36804371490310661, 0.050635603877595692]], [[-0.6385293149409712, -0.90985051701987807, -0.69600231371520249, -0.32236913709792292], [0.38715429363993836, 0.52397282032521209, -0.39983434790593364, -0.56617869533507559], [-0.65564890024253941, -0.49218838180277347, 0.044380484975500512, -0.03600367808098448]]], [[[-0.90989197666954391, 0.75234794134747851, 0.75416516181827009, -0.44742433054519326], [0.0043609042230479123, 0.68736358896449423, -0.91760739014087522, -0.051928216578162489], [0.49324932691969869, -0.73846202351943213, -0.58343447923298308, -0.88740891097177732]], [[-0.57612097838084186, -0.68345113210291419, 0.28725377558437426, -0.70369648221104031], [-0.33883006688905759, 0.23641388111792661, -0.62579793663903915, 0.5329371352222847], [-0.045959609245912469, 0.08851424399081087, 0.10939786381011385, -0.56148257689693759]]], [[[-0.0193463842052497, 0.91513147036489806, -0.66676371736626283, -0.48232555642646879], [-0.56241036893974305, 0.90529235043557299, -0.16265277717097537, -0.32665027468083485], [-0.35940366396570367, -0.9797279130755483, -0.31377987720228839, 0.8283948486411099]], [[0.19189387156386983, -0.10747463664656132, 0.18670232305419088, 0.4988825432691899], [-0.71382834702133491, 0.99952010964477589, 0.56177755545088326, -0.21795844922005014], [-0.60392884386678669, -0.64095031591082718, -0.24641710816927898, -0.64897637790561413]]]]))
1422          res=clip(arg,-0.3,0.5)
1423          ref=Data(numarray.array([[[[-0.29999999999999999, -0.29999999999999999, -0.23690005500198974, -0.29999999999999999], [0.5, 0.47728350383465212, -0.18251619176764877, 0.5], [-0.29999999999999999, -0.29999999999999999, 0.46386393103124957, -0.29999999999999999]], [[-0.29999999999999999, -0.29999999999999999, -0.29999999999999999, 0.085602827397356585], [0.39080321493740078, -0.29999999999999999, 0.16921767079099848, 0.39501968814837984], [-0.094819423058470464, 0.32719847739349617, 0.5, 0.034850296976497885]]], [[[-0.29999999999999999, -0.29999999999999999, -0.29999999999999999, 0.5], [-0.10582668740299472, -0.13140703934766851, 0.5, -0.29999999999999999], [-0.29999999999999999, -0.29999999999999999, -0.29999999999999999, 0.37383179934715027]], [[-0.29999999999999999, 0.5, 0.5, -0.29999999999999999], [-0.29999999999999999, -0.29999999999999999, -0.29999999999999999, -0.29999999999999999], [-0.29999999999999999, -0.29999999999999999, -0.027679572698908084, -0.29999999999999999]]], [[[-0.15914337383288424, 0.095371185176566842, 0.37912475459494721, 0.4024421559252549], [0.17156871625876557, -0.16181202305035125, -0.29999999999999999, 0.5], [0.069057416726155507, -0.29999999999999999, 0.5, 0.28287952469825028]], [[0.5, 0.5, 0.37481094259877334, 0.1471418138825642], [0.20070329637746753, -0.29999999999999999, -0.152719755269904, 0.5], [0.5, 0.20846747979704916, -0.29999999999999999, 0.5]]]]),self.functionspace)
1424          ref.setTaggedValue(1,numarray.array([[[[-0.29999999999999999, 0.5, -0.29999999999999999, 0.5], [-0.29999999999999999, -0.095672296296486437, 0.5, 0.019998954995007034], [0.051167693979698559, 0.28975749676662454, -0.29999999999999999, 0.050635603877595692]], [[-0.29999999999999999, -0.29999999999999999, -0.29999999999999999, -0.29999999999999999], [0.38715429363993836, 0.5, -0.29999999999999999, -0.29999999999999999], [-0.29999999999999999, -0.29999999999999999, 0.044380484975500512, -0.03600367808098448]]], [[[-0.29999999999999999, 0.5, 0.5, -0.29999999999999999], [0.0043609042230479123, 0.5, -0.29999999999999999, -0.051928216578162489], [0.49324932691969869, -0.29999999999999999, -0.29999999999999999, -0.29999999999999999]], [[-0.29999999999999999, -0.29999999999999999, 0.28725377558437426, -0.29999999999999999], [-0.29999999999999999, 0.23641388111792661, -0.29999999999999999, 0.5], [-0.045959609245912469, 0.08851424399081087, 0.10939786381011385, -0.29999999999999999]]], [[[-0.0193463842052497, 0.5, -0.29999999999999999, -0.29999999999999999], [-0.29999999999999999, 0.5, -0.16265277717097537, -0.29999999999999999], [-0.29999999999999999, -0.29999999999999999, -0.29999999999999999, 0.5]], [[0.19189387156386983, -0.10747463664656132, 0.18670232305419088, 0.4988825432691899], [-0.29999999999999999, 0.5, 0.5, -0.21795844922005014], [-0.29999999999999999, -0.29999999999999999, -0.24641710816927898, -0.29999999999999999]]]]))
1425          self.failUnless(isinstance(res,Data),"wrong type of result.")
1426          self.failUnlessEqual(res.getShape(),(3, 2, 3, 4),"wrong shape of result.")
1427          self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result")

Legend:
Removed from v.395  
changed lines
  Added in v.396

  ViewVC Help
Powered by ViewVC 1.1.26