@@ -175,7 +175,7 @@ def random_permutations_iterator(initial_permutation, n_permutations):
175
175
# 1. Check the algorithms defined for this coordination geometry and get the explicit permutations
176
176
original_n_explicit_perms = []
177
177
original_n_explicit_optimized_perms = []
178
- for ialgo , algo in enumerate (cg .algorithms ):
178
+ for idx , algo in enumerate (cg .algorithms ):
179
179
algo ._permutations = algo .explicit_permutations
180
180
algo .minimum_number_of_points = 4
181
181
if algo .algorithm_type == "EXPLICIT_PERMUTATIONS" :
@@ -185,7 +185,7 @@ def random_permutations_iterator(initial_permutation, n_permutations):
185
185
else :
186
186
eop = str (len (algo .explicit_optimized_permutations ))
187
187
print (
188
- f"For ialgo { ialgo ,:d } , plane_points are "
188
+ f"For { idx = } , plane_points are "
189
189
f"[{ ', ' .join (map (str , algo .plane_points ))} ], "
190
190
f"side_0 is [{ ', ' .join (map (str , algo .point_groups [0 ]))} ] and "
191
191
f"side_1 is [{ ', ' .join (map (str , algo .point_groups [1 ]))} ]."
@@ -194,7 +194,7 @@ def random_permutations_iterator(initial_permutation, n_permutations):
194
194
original_n_explicit_optimized_perms .append (eop )
195
195
print (
196
196
f" For this algorithm, there are { eop } optimized permutations and "
197
- f"{ len (algo .explicit_permutations ):d } explicit permutations"
197
+ f"{ len (algo .explicit_permutations )} explicit permutations"
198
198
)
199
199
if algo .other_plane_points is None :
200
200
input ("Multiplicity and other plane points is not defined for this algorithm !" )
@@ -204,7 +204,7 @@ def random_permutations_iterator(initial_permutation, n_permutations):
204
204
ordered_plane = algo .ordered_plane , ordered_point_groups = algo .ordered_point_groups
205
205
)
206
206
algo ._permutations = permutations
207
- print (f"Safe permutations found ({ len (permutations ):d } )" )
207
+ print (f"Safe permutations found ({ len (permutations )} )" )
208
208
209
209
# Definition of the facets
210
210
all_planes_point_indices = [algo .plane_points ]
@@ -213,9 +213,9 @@ def random_permutations_iterator(initial_permutation, n_permutations):
213
213
214
214
# Loop on the facets
215
215
explicit_permutations_per_plane = []
216
- for iplane , plane_point_indices in enumerate (all_planes_point_indices ):
216
+ for idx_plane , plane_point_indices in enumerate (all_planes_point_indices ):
217
217
prt1 (
218
- string = f"In plane { iplane :d } ({ '-' .join (str (pp ) for pp in plane_point_indices )} )" ,
218
+ string = f"In plane { idx_plane } ({ '-' .join (str (pp ) for pp in plane_point_indices )} )" ,
219
219
printing_volume = printing_volume ,
220
220
)
221
221
@@ -268,7 +268,7 @@ def random_permutations_iterator(initial_permutation, n_permutations):
268
268
algo .explicit_permutations = [list (perm ) for perm in list (explicit_permutations_per_plane [0 ])]
269
269
algo .explicit_permutations .sort ()
270
270
algo .explicit_permutations = np .array (algo .explicit_permutations )
271
- print (f"Explicit permutations found ({ len (algo .explicit_permutations ):d } )" )
271
+ print (f"Explicit permutations found ({ len (algo .explicit_permutations )} )" )
272
272
print (algo .explicit_permutations )
273
273
print ()
274
274
# Setup the permutations for the next optimization
@@ -291,10 +291,10 @@ def random_permutations_iterator(initial_permutation, n_permutations):
291
291
perms_used_algos : list [dict ] = [{} for _ in cg .algorithms ]
292
292
293
293
# Loop on algorithms
294
- for ialgo , algo in enumerate (cg .algorithms ):
294
+ for idx , algo in enumerate (cg .algorithms ):
295
295
perms_used : dict [tuple , int ] = {}
296
296
print (
297
- f"In ialgo { ialgo :d } (plane_points : "
297
+ f"In { idx = } (plane_points : "
298
298
f"[{ ', ' .join (map (str , algo .plane_points ))} ], "
299
299
f"side_0 : [{ ', ' .join (map (str , algo .point_groups [0 ]))} ] and "
300
300
f"side_1 : [{ ', ' .join (map (str , algo .point_groups [1 ]))} ])"
@@ -334,12 +334,12 @@ def random_permutations_iterator(initial_permutation, n_permutations):
334
334
raise ValueError ("Permutation setup not allowed ..." )
335
335
336
336
# Loop on permutations
337
- iperm = 1
337
+ idx_perm = 1
338
338
t0 = time .process_time ()
339
339
time_left : float | str = "Unknown"
340
340
for indices_perm in perms_iterator :
341
341
prt1 (
342
- string = f"Perm # { iperm :d } /{ n_permutations :d } : "
342
+ string = f"Perm # { idx_perm } /{ n_permutations } : "
343
343
f"{ '-' .join (map (str , indices_perm ))} "
344
344
f"(est. rem. time : { time_left } sec)" ,
345
345
printing_volume = printing_volume ,
@@ -353,9 +353,9 @@ def random_permutations_iterator(initial_permutation, n_permutations):
353
353
354
354
# Loop on the facets
355
355
separation_permutations = []
356
- for iplane , plane_point_indices in enumerate (all_planes_point_indices ):
356
+ for idx_plane , plane_point_indices in enumerate (all_planes_point_indices ):
357
357
prt2 (
358
- string = f"In plane { iplane :d } ({ '-' .join (str (pp ) for pp in plane_point_indices )} )" ,
358
+ string = f"In plane { idx_plane } ({ '-' .join (str (pp ) for pp in plane_point_indices )} )" ,
359
359
printing_volume = printing_volume ,
360
360
)
361
361
@@ -399,28 +399,28 @@ def random_permutations_iterator(initial_permutation, n_permutations):
399
399
else :
400
400
perms_used [some_perm ] = 1
401
401
tcurrent = time .process_time ()
402
- time_left = (n_permutations - iperm ) * (tcurrent - t0 ) / iperm # type: ignore
402
+ time_left = (n_permutations - idx_perm ) * (tcurrent - t0 ) / idx_perm # type: ignore
403
403
time_left = f"{ time_left :.1f} "
404
- iperm += 1
404
+ idx_perm += 1
405
405
print (
406
- f"Optimized permutations { len (perms_used ):d } /{ len (algo .permutations ):d } "
407
- f"(old : { original_n_explicit_optimized_perms [ialgo ]} /{ original_n_explicit_perms [ialgo ]} ) : "
406
+ f"Optimized permutations { len (perms_used )} /{ len (algo .permutations )} "
407
+ f"(old : { original_n_explicit_optimized_perms [idx ]} /{ original_n_explicit_perms [idx ]} ) : "
408
408
)
409
409
for perm , number in perms_used .items ():
410
- print (f" - permutation { '-' .join (map (str , perm ))} : { number :d } " )
410
+ print (f" - permutation { '-' .join (map (str , perm ))} : { number } " )
411
411
print (
412
- f"For { ialgo = } (plane_points : [{ ', ' .join (map (str , algo .plane_points ))} ], "
412
+ f"For { idx = } (plane_points : [{ ', ' .join (map (str , algo .plane_points ))} ], "
413
413
f"side_0 : [{ ', ' .join (map (str , algo .point_groups [0 ]))} ] and "
414
414
f"side_1 : [{ ', ' .join (map (str , algo .point_groups [1 ]))} ]),\n "
415
415
f"Optimized perturbations { len (perms_used )} /{ len (algo .permutations )} (old : "
416
- f"{ original_n_explicit_optimized_perms [ialgo ]} /{ original_n_explicit_perms [ialgo ]} ) are :"
416
+ f"{ original_n_explicit_optimized_perms [idx ]} /{ original_n_explicit_perms [idx ]} ) are :"
417
417
)
418
- # print(f"Optimized permutations ({len(perms_used):d }/{len(algo.permutations):d }) : ")
418
+ # print(f"Optimized permutations ({len(perms_used)}/{len(algo.permutations)}) : ")
419
419
explicit_optimized_permutations = [list (perm ) for perm in perms_used ]
420
420
explicit_optimized_permutations .sort ()
421
421
print (explicit_optimized_permutations )
422
422
print ()
423
- test = input (f'Set optimized permutations for algorithm { ialgo :d } ? ("y" to confirm)' )
423
+ test = input (f'Set optimized permutations for algorithm { idx } ? ("y" to confirm)' )
424
424
if test == "y" :
425
425
algo .explicit_optimized_permutations = np .array (explicit_optimized_permutations )
426
426
0 commit comments