How to use test_absent method in green

Best Python code snippet using green

CFML_exti.py

Source:CFML_exti.py Github

copy

Full Screen

...200 print(" ")201 def gen_hkl(x):202 g = np.mgrid[-x: x + 1, -x: x + 1, -x: x + 1]203 return np.vstack(list(map(np.ravel, g)))204 def test_absent(hkl, cond):205 # lines of hkl with h+k = 2n + 1 #reflections pouvant obeir a206 # la regle d"extinction207 p_hkl = hkl.T[cond]208 # reflecions obeissant a la regle209 absent_hkl = [True for hh in p_hkl if hkl_absent(hh, SpaceGroup)]210 return len(p_hkl) == len(absent_hkl)211 def end_action(num_exti):212 nonlocal integral_condition213 if iunit:214 print(f"# {num_exti:3d} : {Hkl_Ref_Conditions[num_exti]}")215 integral_condition = True216 # !---- C-face centred ----!217 # ! Hkl_Ref_Conditions(1) = "(h k l) h+k=2n : xy0 centered base"218 num_exti = 1219 hkl = gen_hkl(6) # colomn of hkl220 cond = np.asarray((hkl[0] + hkl[1]) % 2, dtype=bool)221 if test_absent(hkl, cond):222 end_action(num_exti)223 IC.append(ex_r['Ccen'])224 # !---- A-face centred ----!225 # ! Hkl_Ref_Conditions(2) = "(h k l) k+l=2n : 0yz centered base"226 num_exti = 2227 hkl = gen_hkl(6) # colomn of hkl228 cond = np.asarray((hkl[1] + hkl[2]) % 2, dtype=bool)229 if test_absent(hkl, cond):230 end_action(num_exti)231 IC.append(ex_r['Acen'])232 # !---- B-face centred ----!233 # ! Hkl_Ref_Conditions(3) = "(h k l) h+l=2n : x0z centered base"234 num_exti = 3235 hkl = gen_hkl(6) # colomn of hkl236 cond = np.asarray((hkl[0] + hkl[2]) % 2, dtype=bool)237 if test_absent(hkl, cond):238 end_action(num_exti)239 IC.append(ex_r['Bcen'])240 # !---- Body centred (I) ----!241 # ! Hkl_Ref_Conditions(4) = "(h k l) h+k+l=2n : body centred"242 num_exti = 4243 hkl = gen_hkl(3) # colomn of hkl244 cond = np.asarray(hkl.sum(0) % 2, dtype=bool)245 if test_absent(hkl, cond):246 end_action(num_exti)247 IC.append(ex_r['Icen'])248 # !---- all-face centred (F) ----!249 # ! Hkl_Ref_Conditions(5) = "(h k l) h,k,l same parity: all-face cent"250 num_exti = 5251 hkl = gen_hkl(6) # colomn of hkl252 c1 = np.sum(hkl % 2, axis=0)253 cond = np.asarray(np.logical_or((c1 == 1), (c1 == 2)))254 if test_absent(hkl, cond):255 end_action(num_exti)256 # !---- R network ----!257 # ! Hkl_Ref_Conditions(6) = "(h k l) -h+k+l=3n : Rhombohedrally centred (R)"258 num_exti = 6259 hkl = gen_hkl(6) # colomn of hkl260 cond = np.asarray((-hkl[0] + hkl[1] + hkl[2]) % 3, dtype=bool)261 if test_absent(hkl, cond):262 end_action(num_exti)263 IC.append(ex_r['Rceno'])264 if not integral_condition:265 if iunit:266 print(" =====>>> no general reflection condition")267 return IC268def Screw_Axis_Conditions(SpaceGroup, Iunit):269 """270 # !---- Arguments ----!271 type (Space_Group_Type), intent(in) :: spacegroup272 integer, optional, intent(in) :: iunit273 # !---- Local variables ----!274 integer :: h, k,l275 integer :: n, n_ext276 integer, dimension(3) :: hh277 integer :: num_exti278 logical :: serial_condition279 """280 SAC = []281 serial_condition = False282 def gen_hkl(x):283 g = np.mgrid[-x: x + 1, -x: x + 1, -x: x + 1]284 return np.vstack(map(np.ravel, g))285 def test_absent(hkl, cond):286 # lines of hkl with h+k = 2n + 1 #reflections pouvant obeir a287 # la regle d"extinction288 p_hkl = hkl.T[cond]289 # reflecions obeissant a la regle290 absent_hkl = [hh for hh in p_hkl if hkl_absent(hh, SpaceGroup)]291 return len(p_hkl) == len(absent_hkl)292 def end_action(num_exti):293 nonlocal serial_condition294 if Iunit:295 print(f"# {num_exti:3d} : {Hkl_Ref_Conditions[num_exti]}")296 serial_condition = True297 SAC.append(ex_r[num_exti])298 def screw_21_41(xyz, num_exti):299 """300 xyz = 0 , 1, 2301 """302 hkl = np.zeros((3, 13))303 hkl[xyz] = np.arange(-6, 7)304 cond = np.asarray(hkl[xyz] % 2, dtype=bool)305 if test_absent(hkl, cond):306 end_action(num_exti)307 def screw_42_43(xyz, num_exti):308 """309 xyz = 0 , 1, 2310 """311 hkl = np.zeros((3, 13))312 hkl[xyz] = np.arange(-6, 7)313 cond = np.asarray(hkl[xyz] % 4, dtype=bool)314 if test_absent(hkl, cond):315 end_action(num_exti)316 end_action(num_exti + 1)317 if (Iunit):318 print(" ")319 print(" >>> Serial reflections conditions for screw axes:")320 print("---------------------------------------------------")321 print(" ")322 # !SCREW AXES: 33 extinctions323 # check if "Monoclinic", "Orthorhombic" "Tetragonal" "Cubic"324 if (SpaceGroup.no in range(1, 143)) or (SpaceGroup.no > 194):325 # ! Hkl_Ref_Conditions(40) = "(h 0 0) h=2n : screw axis // [100] with a/2 translation (21) # noqa E501326 num_exti = 40327 screw_21_41(0, num_exti)328 # ! Hkl_Ref_Conditions(44) = "(0 k 0) k=2n : screw axis // [010] with b/2 translation (21) # noqa E501329 num_exti = 44330 screw_21_41(1, num_exti)331 # ! Hkl_Ref_Conditions(48) = "(0 0 l) l=2n : screw axis // [00l] with c/2 translation (21) # noqa E501332 num_exti = 48333 screw_21_41(2, num_exti)334 if (SpaceGroup.no > 194): # "Cubic" then335 # ! 41336 # ! Hkl_Ref_Conditions(41) = "(h 0 0) h=2n : screw axis // [100] with 2a/4 translation (42)" # noqa E501337 num_exti = 41338 screw_21_41(0, num_exti)339 # Hkl_Ref_Conditions(42) = "(h 0 0) h=4n : screw axis // [100] with a/4 translation (41)" # noqa E501340 # Hkl_Ref_Conditions(43) = "(h 0 0) h=4n : screw axis //341 # [100] with 3a/4 translation (43)" # ! cubic342 num_exti = 42343 screw_42_43(0, num_exti)344 # ! Hkl_Ref_Conditions(45) = "(0 k 0) k=2n : screw axis // [010] with 2b/4 translation (42)" # ! cubic345 num_exti = 45346 screw_21_41(1, num_exti)347 # ! Hkl_Ref_Conditions(46) = "(0 k 0) k=4n : screw axis // [010] with b/4 translation (41)" # ! cubic348 # ! Hkl_Ref_Conditions(47) = "(0 k 0) k=4n : screw axis // [010] with 3b/4 translation (43)" # ! cubic349 num_exti = 46350 screw_42_43(1, num_exti)351 # ! Hkl_Ref_Conditions(49) = "(0 0 l) l=2n : screw axis // [00l] with c/2 translation (21)" # ! monoclinic, ortho. and cubic352 num_exti = 49353 screw_21_41(2, num_exti)354 # ! Hkl_Ref_Conditions(50) = "(0 0 l) l=4n : screw axis // [00l] with c/4 translation (41)" # ! tetragonal and cubic355 # ! Hkl_Ref_Conditions(51) = "(0 0 l) l=4n : screw axis // [00l] with 3c/4 translation (43)" # ! tetragonal and cubic356 num_exti = 50357 screw_42_43(2, num_exti)358 if (SpaceGroup.no in range(143, 195)): # hexagonal cell --> Rombo + Hexagonal groups359 # ! Hkl_Ref_Conditions(52) = "(0 0 0 l) l=2n : screw axis // [00l] axis with 3c/6 translation (63)"360 num_exti = 52361 screw_21_41(2, num_exti)362 # ! Hkl_Ref_Conditions(53) = "(0 0 0 l) l=3n : screw axis // [00l] axis with c/3 translation (31)"363 # ! Hkl_Ref_Conditions(54) = "(0 0 0 l) l=3n : screw axis // [00l] axis with 2c/3 translation (32)"364 # ! Hkl_Ref_Conditions(55) = "(0 0 0 l) l=3n : screw axis // [00l] axis with 2c/6 translation (62)"365 # ! Hkl_Ref_Conditions(56) = "(0 0 0 l) l=3n : screw axis // [00l] axis with 4c/6 translation (64)"366 num_exti = 53367 hkl = np.zeros((3, 13))368 hkl[2] = np.arange(-6, 7)369 cond = np.asarray(hkl[2] % 3, dtype=bool)370 if test_absent(hkl, cond):371 end_action(num_exti)372 end_action(num_exti + 1)373 if (SpaceGroup.no in range(168, 195)):374 end_action(num_exti + 2)375 end_action(num_exti + 3)376 if (SpaceGroup.no in range(168, 195)): # Hexagonal groups377 # ! Hkl_Ref_Conditions(57)="(0 0 0 l) l=6n : screw axis // [00l] axis with c/6 translation (61)"378 # ! Hkl_Ref_Conditions(58)="(0 0 0 l) l=6n : screw axis // [00l] axis with 5c/6 translation (65)"379 num_exti = 57380 hkl = np.zeros((3, 13))381 hkl[2] = np.arange(-6, 7)382 cond = np.asarray(hkl[2] % 6, dtype=bool)383 if test_absent(hkl, cond):384 end_action(num_exti)385 end_action(num_exti + 1)386 if not serial_condition:387 if Iunit:388 print(" =====>>> no serial reflection condition")389 return SAC390def Glide_Planes_Conditions(SpaceGroup, Iunit):391 """392 # !---- Arguments ----!393 type (Space_Group_Type), intent(in) :: spacegroup394 integer, optional, intent(in) :: iunit395 # !---- Local variables ----!396 integer :: h, k,l, m397 integer :: n, n_ext398 integer, dimension(3) :: hh399 integer :: num_exti400 logical :: zonal_condition401 """402 GPC = []403 zonal_condition = False404 def gen_hkl(x):405 g = np.mgrid[-x: x + 1, -x: x + 1, -x: x + 1]406 return np.vstack(map(np.ravel, g))407 def gen_hk0(zero, x):408 g = np.mgrid[-x: x + 1, -x: x + 1]409 hkl = np.vstack(list(map(np.ravel, g)))410 hkl = np.insert(hkl, zero, np.zeros_like(hkl[0]), 0)411 return hkl412 def gen_hhl(l_diff, x):413 g1, g2 = np.mgrid[-x: x + 1, -x: x + 1]414 hkl = np.tile(g1.flat, (3, 1))415 hkl[l_diff] = g2.flat416 return hkl417 def test_absent(hkl, cond):418 p_hkl = hkl.T[cond] # la regle d"extinction419 absent_hkl = [hh for hh in p_hkl if hkl_absent(420 hh, SpaceGroup)] # ref. good with rule421 return len(p_hkl) == len(absent_hkl)422 def end_action(num_exti):423 nonlocal zonal_condition424 if Iunit:425 print(f"# {num_exti:3d} : {Hkl_Ref_Conditions[num_exti]}")426 zonal_condition = True427 GPC.append(ex_r[num_exti])428 def glide_abc(tras, mir, num_exti):429 """430 xyz = 0 , 1, 2431 """432 g = np.mgrid[-6:7, -6:7]433 hkl = np.vstack(list(map(np.ravel, g)))434 hkl = np.insert(hkl, mir, np.zeros_like(hkl[0]), 0)435 cond = np.asarray(hkl[tras] % 2, dtype=bool)436 if test_absent(hkl, cond):437 end_action(num_exti)438 if Iunit:439 print(" ")440 print(" >>> Zonal reflections conditions for glide planes:")441 print("---------------------------------------------------")442 print(" ")443 # !GLIDE PLANES and screw axes: table 2.13.2444 # !-------------445 # !446 # ! 0 k l: k=2n b/2 monoclinic, orthorhombic, tetragonal and cubic447 # ! 0 k l: l=2n c/2 monoclinic, orthorhombic, tetragonal and cubic448 # ! 0 k l: k+l=2n b/2 + c/2 monoclinic, orthorhombic, tetragonal and cubic449 # ! 0 k l: k+l=4n b/4 +- c/4 orthorhombic and cubic450 # !451 # !452 # ! h 0 l: h=2n a/2 monoclinic, orthorhombic, tetragonal and cubic453 # ! h 0 l: l=2n c/2 monoclinic, orthorhombic, tetragonal and cubic454 # ! h 0 l: l+h=2n c/2 + a/2 monoclinic, orthorhombic, tetragonal and cubic455 # ! h 0 l: l+h=4n c/4 +- a/4 orthorhombic and cubic456 # !457 # ! h k 0: h=2n a/2 monoclinic, orthorhombic, tetragonal and cubic458 # ! h k 0: k=2n b/2 monoclinic, orthorhombic, tetragonal and cubic459 # ! h k 0: h+k=2n a/2 + b/2 monoclinic, orthorhombic, tetragonal and cubic460 # ! h k 0: h+k=4n a/4 +- b/4 monoclinic, orthorhombic, tetragonal and cubic461 # check if "Monoclinic", "Orthorhombic" "Tetragonal" "Cubic"462 if (SpaceGroup.no in range(1, 143)) or (SpaceGroup.no > 194):463 # !---- glide plane b/2:464 # ! Hkl_Ref_Conditions(7) = "(0 k l) k=2n : 0yz glide plane with b/2 translation"465 num_exti = 7466 glide_abc(tras=1, mir=0, num_exti=num_exti)467 # !---- glide plane c/2:468 # ! Hkl_Ref_Conditions(8) = "(0 k l) l=2n : 0yz glide plane with c/2 translation"469 num_exti = 8470 glide_abc(tras=2, mir=0, num_exti=num_exti)471 # !---- glide plane b/2 + c/2:472 # !Hkl_Ref_Conditions(9) = "(0 k l) k+l=2n : 0yz glide plane with b/2 + c/2 translation"473 num_exti = 9474 hkl = gen_hk0(0, 6) # colomn of hkl475 cond = np.asarray((hkl[1] + hkl[2]) % 2, dtype=bool)476 if test_absent(hkl, cond):477 end_action(num_exti)478 # !---- glide plane a/2:479 # ! Hkl_Ref_Conditions(11) = "(h 0 l) h=2n : x0z glide plane with a/2 translation"480 num_exti = 11481 glide_abc(tras=0, mir=1, num_exti=num_exti)482 # !---- glide plane c/2:483 # ! Hkl_Ref_Conditions(12) = "(h 0 l) l=2n : x0z glide plane with c/2 translation"484 num_exti = 12485 glide_abc(tras=2, mir=1, num_exti=num_exti)486 # !---- glide plane c/2 + a/2:487 # ! Hkl_Ref_Conditions(13) = "(h 0 l) l+h=2n : x0z glide plane with a/2 + c/2 translations"488 num_exti = 13489 hkl = gen_hk0(1, 6) # colomn of hkl490 cond = np.asarray((hkl[0] + hkl[2]) % 2, dtype=bool)491 if test_absent(hkl, cond):492 end_action(num_exti)493 # !---- glide plane a/2:494 # ! Hkl_Ref_Conditions(15) = "(h k 0) h=2n : xy0 glide plane with a/2 translation"495 num_exti = 15496 glide_abc(tras=0, mir=2, num_exti=num_exti)497 # !---- glide plane b/2:498 # !Hkl_Ref_Conditions(16) = "(h k 0) k=2n : xy0 glide plane with b/2 translation"499 num_exti = 16500 glide_abc(tras=1, mir=2, num_exti=num_exti)501 # !---- glide plane a/2 + b/2:502 # ! Hkl_Ref_Conditions(17) = "(h k 0) h+k=2n : xy0 glide plane with a/2 + b/2 translations"503 num_exti = 17504 hkl = gen_hk0(2, 6) # colomn of hkl505 cond = np.asarray((hkl[0] + hkl[1]) % 2, dtype=bool)506 if test_absent(hkl, cond):507 end_action(num_exti)508 # check if "Orthorhombic" .or. "Cubic"509 if (SpaceGroup.no in range(16, 75)) or (SpaceGroup.no > 194):510 # !---- glide plane b/4 + c/4:511 # ! Hkl_Ref_Conditions(10) = "(0 k l) k+l=4n : 0yz glide plane with b/4 +- c/4 translation"512 num_exti = 10513 hkl = gen_hk0(0, 6) # colomn of hkl514 cond = np.asarray((hkl[1] + hkl[2]) % 4, dtype=bool)515 if test_absent(hkl, cond):516 end_action(num_exti)517 # !---- glide plane c/4 + a/4:518 # ! Hkl_Ref_Conditions(14) = "(h 0 l) l+h=4n : x0z glide plane with a/4 +- c/4 translations"519 num_exti = 14520 hkl = gen_hk0(1, 6) # colomn of hkl521 cond = np.asarray((hkl[0] + hkl[2]) % 4, dtype=bool)522 if test_absent(hkl, cond):523 end_action(num_exti)524 # !---- glide plane a/4 + b/4:525 # ! Hkl_Ref_Conditions(18) = "(h k 0) h+k=4n : xy0 glide plane with a/4 +- b/4 translations"526 num_exti = 18527 hkl = gen_hk0(2, 6) # colomn of hkl528 cond = np.asarray((hkl[0] + hkl[1]) % 4, dtype=bool)529 if test_absent(hkl, cond):530 end_action(num_exti)531 # end if ! fin de la condition "if ortho, cubic532 if (SpaceGroup.no in range(143, 195)): # hexagonal cell --> Rombo + Hexagonal groups533 # !---- glide plane with c/2 translation: hexagonal534 # ! Hkl_Ref_Conditions(19) = "( h -h 0 l) l=2n : (11-20) glide plane with c/2 translation (c)"535 num_exti = 19536 hkl = gen_hhl(2, 6)537 hkl[1] *= -1538 cond = np.asarray(hkl[2] % 2, dtype=bool)539 if test_absent(hkl, cond):540 end_action(num_exti)541 # !---- glide plane with c/2 translation: hexagonal542 # ! Hkl_Ref_Conditions(20) = "( 0 k -k l) l=2n : (-2110) glide plane with c/2 translation (c)"543 num_exti = 20544 hkl = gen_hk0(0, 6)545 cond = np.asarray(hkl[2] % 2, dtype=bool)546 if test_absent(hkl, cond):547 end_action(num_exti)548 # !---- glide plane with c/2 translation: hexagonal549 # !Hkl_Ref_Conditions(21) = "( -h 0 h l) l=2n : (1-210) glide plane with c/2 translation (c)"550 num_exti = 21551 hkl = gen_hk0(1, 6)552 cond = np.asarray(hkl[2] % 2, dtype=bool)553 if test_absent(hkl, cond):554 end_action(num_exti)555 # !---- glide plane with c/2 translation: hexagonal556 # ! Hkl_Ref_Conditions(22) = "( h h -2h l) l=2n : (1-100) glide plane with c/2 translation (c)"557 num_exti = 22558 hkl = gen_hhl(2, 6)559 cond = np.asarray(hkl[2] % 2, dtype=bool)560 if test_absent(hkl, cond):561 end_action(num_exti)562 # !---- glide plane with c/2 translation: hexagonal563 # ! Hkl_Ref_Conditions(23) = "(-2h h h l) l=2n : (01-10) glide plane with c/2 translation (c)"564 num_exti = 23565 hkl = gen_hhl(2, 6)566 hkl[0] *= -2567 cond = np.asarray(hkl[2] % 2, dtype=bool)568 if test_absent(hkl, cond):569 end_action(num_exti)570 # !---- glide plane with c/2 translation: hexagonal571 # ! Hkl_Ref_Conditions(24) = "( h -2h h l) l=2n : (-1010) glide plane with c/2 translation (c)"572 num_exti = 24573 hkl = gen_hhl(2, 6)574 hkl[1] *= -2575 cond = np.asarray(hkl[2] % 2, dtype=bool)576 if test_absent(hkl, cond):577 end_action(num_exti)578 # !25: glide plane with c/2 translation: rhomboedral579 # ! Hkl_Ref_Conditions(25) = "( h h l) l=2n : (1-10) glide plane with c/2 translation (c,n)"580 num_exti = 25581 hkl = gen_hhl(2, 6)582 cond = np.asarray(hkl[2] % 2, dtype=bool)583 if test_absent(hkl, cond):584 end_action(num_exti)585 # !---- glide plane with c/2 translation: rhomboedral586 # ! Hkl_Ref_Conditions(26) = "( h k k) h=2n : (01-1) glide plane with a/2 translation (a,n)"587 num_exti = 26588 hkl = gen_hhl(0, 6)589 cond = np.asarray(hkl[0] % 2, dtype=bool)590 if test_absent(hkl, cond):591 end_action(num_exti)592 # !27: glide plane with c/2 translation: rhomboedral593 # ! Hkl_Ref_Conditions(27) = "( h k h) k=2n : (-101) glide plane with b/2 translation (b,n)"594 num_exti = 27595 hkl = gen_hhl(1, 6)596 cond = np.asarray(hkl[1] % 2, dtype=bool)597 if test_absent(hkl, cond):598 end_action(num_exti)599 # check if "Tetragonal" .or. "Cubic"600 if (SpaceGroup.no in range(75, 143)) or (SpaceGroup.no > 195):601 # !---- glide plane with c/2 translation: tetragonal + cubic602 # ! Hkl_Ref_Conditions(28) = "( h h l) l=2n : (1-10) glide plane with c/2 translation (c,n)"603 num_exti = 28604 hkl = gen_hhl(2, 6)605 cond = np.asarray(hkl[2] % 2, dtype=bool)606 if test_absent(hkl, cond):607 end_action(num_exti)608 # !---- glide plane with a/4 +- b/4 +- c/4 translation: tetragonal + cubic609 # ! Hkl_Ref_Conditions(29) = "( h h l) 2h+l=4n : (1-10) glide plane with a/4 +- b/4 +- c/4 translation (d)"610 num_exti = 29611 hkl = gen_hhl(2, 6)612 cond = np.asarray((2 * hkl[0] + hkl[2]) % 4, dtype=bool)613 if test_absent(hkl, cond):614 end_action(num_exti)615 # !30: glide plane with c/2 translation: tetragonal + cubic616 # ! Hkl_Ref_Conditions(30) = "( h -h l) l=2n : (110) glide plane with c/2 translation (c,n)"617 num_exti = 30618 hkl = gen_hhl(2, 6)619 hkl[1] *= -1620 cond = np.asarray(hkl[2] % 4, dtype=bool)621 if test_absent(hkl, cond):622 end_action(num_exti)623 # ! 31: glide plane with a/4 +- b/4 +- c/4 translation: tetragonal + cubic624 # ! Hkl_Ref_Conditions(31) = "( h -h l) 2h+l=4n : (110) glide plane with a/4 +- b/4 +- c/4 translation (d)"625 num_exti = 31626 hkl = gen_hhl(2, 6)627 hkl[1] *= -1628 cond = np.asarray((2 * hkl[0] + hkl[2]) % 4, dtype=bool)629 if test_absent(hkl, cond):630 end_action(num_exti)631 # check if "Cubic"632 if (SpaceGroup.no > 195):633 # !---- glide plane with a/2 translation: tetragonal + cubic634 # ! Hkl_Ref_Conditions(32) = "( h k k) h=2n : (01-1) glide plane with a/2 translation (a,n)"635 num_exti = 32636 hkl = gen_hhl(0, 6)637 cond = np.asarray(hkl[0] % 2, dtype=bool)638 if test_absent(hkl, cond):639 end_action(num_exti)640 # !---- glide plane with +-a/4 +- b/4 +- c/4 translation: tetragonal + cubic641 # ! Hkl_Ref_Conditions(33) = "( h k k) 2k+h=4n : (01-1) glide plane with +-a/4 + b/4 +- c/4 translation (d)"642 num_exti = 33643 hkl = gen_hhl(0, 6)644 cond = np.asarray((2 * hkl[1] + hkl[0]) % 4, dtype=bool)645 if test_absent(hkl, cond):646 end_action(num_exti)647 # !34: glide plane with a/2 translation: tetragonal + cubic648 # ! Hkl_Ref_Conditions(34) = "( h k -k) h=2n : (011) glide plane with a/2 translation (a,n)"649 num_exti = 34650 hkl = gen_hhl(0, 6)651 hkl[2] *= -1652 cond = np.asarray(hkl[0] % 2, dtype=bool)653 if test_absent(hkl, cond):654 end_action(num_exti)655 # ! 35: glide plane with a/4 +- b/4 +- c/4 translation: tetragonal + cubic656 # ! Hkl_Ref_Conditions(351) = "( h k -k) 2k+h=4n : (011) glide plane with +-a/4 + b/4 +- c/4 translation (d)"657 num_exti = 35658 hkl = gen_hhl(0, 6)659 hkl[2] *= -1660 cond = np.asarray((2 * hkl[1] + hkl[0]) % 4, dtype=bool)661 if test_absent(hkl, cond):662 end_action(num_exti)663 # !36: glide plane with b/2 translation: tetragonal + cubic664 # ! Hkl_Ref_Conditions(36) = "( h k h) k=2n : (-101) glide plane with b/2 translation (b,n)"665 num_exti = 36666 hkl = gen_hhl(1, 6)667 cond = np.asarray(hkl[1] % 2, dtype=bool)668 if test_absent(hkl, cond):669 end_action(num_exti)670 # !37: glide plane with +-a/4 +- b/4 +- c/4 translation: tetragonal + cubic671 # ! Hkl_Ref_Conditions(33) = "( h k h) 2h+k=4n : (-101) glide plane with +-a/4 + b/4 +- c/4 translation (d)"672 num_exti = 37673 hkl = gen_hhl(1, 6)674 cond = np.asarray((2 * hkl[0] + hkl[1]) % 4, dtype=bool)675 if test_absent(hkl, cond):676 end_action(num_exti)677 # !38: glide plane with b/2 translation: tetragonal + cubic678 # ! Hkl_Ref_Conditions(38) = "( -h k h) k=2n : (101) glide plane with b/2 translation (b,n)"679 num_exti = 38680 hkl = gen_hhl(1, 6)681 hkl[0] *= -1682 cond = np.asarray(hkl[1] % 2, dtype=bool)683 # ! 39: glide plane with a/4 +- b/4 +- c/4 translation: tetragonal + cubic684 # ! Hkl_Ref_Conditions(39) = "( -h k h) 2h+k=4n : (101) glide plane with +-a/4 + b/4 +- c/4 translation (d)"685 num_exti = 39686 hkl = gen_hhl(1, 6)687 hkl[0] *= -1688 cond = np.asarray((2 * hkl[0] + hkl[1]) % 4, dtype=bool)689 if test_absent(hkl, cond):690 end_action(num_exti)691 # end if ! fin de la condition "if cubic692 if not zonal_condition:693 if Iunit:694 print(" =====>>> no zonal reflection condition")...

Full Screen

Full Screen

test_features.py

Source:test_features.py Github

copy

Full Screen

...112class TestDefaultValues(unittest.TestCase, AbstractFeatureTest):113 114 check = staticmethod(features.check_funcdefaultvalues)115 116 def test_absent(self):117 src = """118 def f(x):119 pass120 """121 self.assertFeatureAbsent(src)122 123 def test_present(self):124 src = """125 def f(x=1):126 pass127 """128 self.assertHasFeature(src)129class TestNonExplicitMembers(unittest.TestCase, AbstractFeatureTest):130 131 check = staticmethod(features.check_nonexplicitmembers)132 133 def test_absent(self):134 src = """135 class C(object):136 __pydron_members__ = locals()137 """138 self.assertFeatureAbsent(src)139 140 def test_present_no_member(self):141 src = """142 class C(object):143 pass144 """145 self.assertHasFeature(src)146 def test_present_member(self):147 src = """148 class C(object):149 x = 1150 """151 self.assertHasFeature(src)152class TestLocals(unittest.TestCase, AbstractFeatureTest):153 154 check = staticmethod(features.check_locals)155 156 def test_absent(self):157 src = """158 x = f(1)159 """160 self.assertFeatureAbsent(src)161 162 def test_present(self):163 src = """164 x = locals()165 """166 self.assertHasFeature(src)167class TestDecorator(unittest.TestCase, AbstractFeatureTest):168 169 check = staticmethod(features.check_decorator)170 171 def test_class_absent(self):172 src = """173 class C(object):174 pass175 """176 self.assertFeatureAbsent(src)177 178 def test_class_present(self):179 src = """180 @f181 class C(object):182 pass183 """184 self.assertHasFeature(src)185 186 def test_function_absent(self):187 src = """188 def f():189 pass190 """191 self.assertFeatureAbsent(src)192 193 def test_function_present(self):194 src = """195 @f196 def f():197 pass198 """199 self.assertHasFeature(src)200 201class TestComplexExpr(unittest.TestCase, AbstractFeatureTest):202 203 check = staticmethod(features.check_complexexpr)204 205 def test_absent_num(self):206 src = """207 x = f(1)208 """209 self.assertFeatureAbsent(src)210 211 def test_absent_str(self):212 src = """213 x = f("str")214 """215 self.assertFeatureAbsent(src)216 217 def test_absent_Name(self):218 src = """219 x = f(y)220 """221 self.assertFeatureAbsent(src)222 223 def test_present(self):224 src = """225 x = 1 + 2 * 3226 """227 self.assertHasFeature(src)228 229 def test_default(self):230 src = """231 def f(x=1+2):232 pass233 """234 self.assertHasFeature(src)235class TestMultitarget(unittest.TestCase, AbstractFeatureTest):236 237 check = staticmethod(features.check_multitarget)238 239 def test_absent(self):240 src = """241 x = 1242 """243 self.assertFeatureAbsent(src)244 245 def test_present(self):246 src = """247 x = y = 1248 """249 self.assertHasFeature(src)250 251class TestClosureFunc(unittest.TestCase, AbstractFeatureTest):252 253 check = staticmethod(features.check_closure_func)254 255 def test_absent(self):256 src = """257 def outer():258 x = 1259 def inner():260 x = 1261 """262 self.assertFeatureAbsent(src)263 264 def test_present(self):265 src = """266 def outer():267 x = 1268 def inner():269 print x270 """271 self.assertHasFeature(src)272 273 274 def test_shared_in_class(self):275 src = """276 class outer():277 x = 1278 def inner():279 print x280 """281 self.assertFeatureAbsent(src)282 283 def test_shared_outside_class(self):284 src = """285 def outer():286 x = 1287 class c():288 def inner():289 print x290 """291 self.assertHasFeature(src)292 293 def test_free_in_class(self):294 src = """295 def outer():296 x = 1297 class inner():298 print x299 """300 self.assertFeatureAbsent(src)301 302 303 304class TestClosureClass(unittest.TestCase, AbstractFeatureTest):305 306 check = staticmethod(features.check_closure_class)307 308 def test_absent(self):309 src = """310 def outer():311 x = 1312 def inner():313 x = 1314 """315 self.assertFeatureAbsent(src)316 317 def test_free_in_class(self):318 src = """319 def outer():320 x = 1321 class inner():322 print x...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run green automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful