@@ -476,6 +476,24 @@ def _find_invariants(symops):
476476 "convert_fp_num_to_signed_rational" ,
477477 removal_version ,
478478)
479+ positionFormula_deprecation_msg = build_deprecation_message (
480+ generator_site ,
481+ "positionFormula" ,
482+ "position_formula" ,
483+ removal_version ,
484+ )
485+ UFormula_deprecation_msg = build_deprecation_message (
486+ generator_site ,
487+ "UFormula" ,
488+ "u_formula" ,
489+ removal_version ,
490+ )
491+ eqIndex_deprecation_msg = build_deprecation_message (
492+ generator_site ,
493+ "eqIndex" ,
494+ "eq_index" ,
495+ removal_version ,
496+ )
479497
480498
481499class GeneratorSite (object ):
@@ -759,7 +777,17 @@ def _find_eq_uij(self):
759777 self .eqUij .append (numpy .dot (R , numpy .dot (self .Uij , Rt )))
760778 return
761779
780+ @deprecated (positionFormula_deprecation_msg )
762781 def positionFormula (self , pos , xyzsymbols = ("x" , "y" , "z" )):
782+ """'diffpy.structure.GeneratorSite.positionFormula' is
783+ deprecated and will be removed in version 4.0.0.
784+
785+ Please use 'diffpy.structure.GeneratorSite.position_formula'
786+ instead.
787+ """
788+ return self .position_formula (pos , xyzsymbols )
789+
790+ def position_formula (self , pos , xyzsymbols = ("x" , "y" , "z" )):
763791 """Formula of equivalent position with respect to generator
764792 site.
765793
@@ -811,7 +839,16 @@ def positionFormula(self, pos, xyzsymbols=("x", "y", "z")):
811839 xyzformula = [re .sub ("^[+]1[*]|(?<=[+-])1[*]" , "" , f ).strip () for f in xyzformula ]
812840 return dict (zip (("x" , "y" , "z" ), xyzformula ))
813841
842+ @deprecated (UFormula_deprecation_msg )
814843 def UFormula (self , pos , Usymbols = stdUsymbols ):
844+ """'diffpy.structure.GeneratorSite.UFormula' is deprecated and
845+ will be removed in version 4.0.0.
846+
847+ Please use 'diffpy.structure.GeneratorSite.u_formula' instead.
848+ """
849+ return self .u_formula (pos , Usymbols )
850+
851+ def u_formula (self , pos , Usymbols = stdUsymbols ):
815852 """List of atom displacement formulas with custom parameter
816853 symbols.
817854
@@ -857,7 +894,16 @@ def UFormula(self, pos, Usymbols=stdUsymbols):
857894 Uformula [smbl ] = f
858895 return Uformula
859896
897+ @deprecated (eqIndex_deprecation_msg )
860898 def eqIndex (self , pos ):
899+ """'diffpy.structure.GeneratorSite.eqIndex' is deprecated and
900+ will be removed in version 4.0.0.
901+
902+ Please use 'diffpy.structure.GeneratorSite.eq_index' instead.
903+ """
904+ return self .eq_index (pos )
905+
906+ def eq_index (self , pos ):
861907 """Index of the nearest generator equivalent site.
862908
863909 Parameters
@@ -954,8 +1000,29 @@ def __init__(self, spacegroup, corepos, coreUijs=None, sgoffset=[0, 0, 0], eps=N
9541000# Helper function for SymmetryConstraints class. It may be useful
9551001# elsewhere therefore its name does not start with underscore.
9561002
1003+ pruneFormulaDictionary_deprecation_msg = build_deprecation_message (
1004+ base ,
1005+ "pruneFormulaDictionary" ,
1006+ "prune_formula_dictionary" ,
1007+ removal_version ,
1008+ )
1009+
9571010
1011+ @deprecated (pruneFormulaDictionary_deprecation_msg )
9581012def pruneFormulaDictionary (eqdict ):
1013+ """'diffpy.structure.pruneFormulaDictionary' is deprecated and will
1014+ be removed in version 4.0.0.
1015+
1016+ Please use 'diffpy.structure.prune_formula_dictionary' instead.
1017+ """
1018+ pruned = {}
1019+ for smb , eq in eqdict .items ():
1020+ if not is_constant_formula (eq ):
1021+ pruned [smb ] = eq
1022+ return pruned
1023+
1024+
1025+ def prune_formula_dictionary (eqdict ):
9591026 """Remove constant items from formula dictionary.
9601027
9611028 Parameters
@@ -1097,17 +1164,17 @@ def _findConstraints(self):
10971164 indies = sorted (independent )
10981165 for indidx in indies :
10991166 indpos = self .positions [indidx ]
1100- formula = gen .positionFormula (indpos , gxyzsymbols )
1167+ formula = gen .position_formula (indpos , gxyzsymbols )
11011168 # formula is empty when indidx is independent
11021169 if not formula :
11031170 continue
11041171 # indidx is dependent here
11051172 independent .remove (indidx )
11061173 self .coremap [genidx ].append (indidx )
11071174 self .poseqns [indidx ] = formula
1108- self .Ueqns [indidx ] = gen .UFormula (indpos , gUsymbols )
1175+ self .Ueqns [indidx ] = gen .u_formula (indpos , gUsymbols )
11091176 # make sure positions and Uijs are consistent with spacegroup
1110- eqidx = gen .eqIndex (indpos )
1177+ eqidx = gen .eq_index (indpos )
11111178 dxyz = gen .eqxyz [eqidx ] - indpos
11121179 self .positions [indidx ] += dxyz - dxyz .round ()
11131180 self .Uijs [indidx ] = gen .eqUij [eqidx ]
@@ -1179,7 +1246,7 @@ def positionFormulasPruned(self, xyzsymbols=None):
11791246 list
11801247 List of coordinate formula dictionaries.
11811248 """
1182- rv = [pruneFormulaDictionary (eqns ) for eqns in self .positionFormulas (xyzsymbols )]
1249+ rv = [prune_formula_dictionary (eqns ) for eqns in self .positionFormulas (xyzsymbols )]
11831250 return rv
11841251
11851252 def UparSymbols (self ):
@@ -1248,7 +1315,7 @@ def UFormulasPruned(self, Usymbols=None):
12481315 List of atom displacement formulas in tuples of
12491316 ``(U11, U22, U33, U12, U13, U23)``.
12501317 """
1251- rv = [pruneFormulaDictionary (eqns ) for eqns in self .UFormulas (Usymbols )]
1318+ rv = [prune_formula_dictionary (eqns ) for eqns in self .UFormulas (Usymbols )]
12521319 return rv
12531320
12541321
@@ -1263,9 +1330,9 @@ def UFormulasPruned(self, Usymbols=None):
12631330 site = [0.125 , 0.625 , 0.13 ]
12641331 Uij = [[1 , 2 , 3 ], [2 , 4 , 5 ], [3 , 5 , 6 ]]
12651332 g = GeneratorSite (sg100 , site , Uij = Uij )
1266- fm100 = g .positionFormula (site )
1333+ fm100 = g .position_formula (site )
12671334 print ("g = GeneratorSite(sg100, %r)" % site )
12681335 print ("g.positionFormula(%r) = %s" % (site , fm100 ))
12691336 print ("g.pparameters =" , g .pparameters )
12701337 print ("g.Uparameters =" , g .Uparameters )
1271- print ("g.UFormula(%r) =" % site , g .UFormula (site ))
1338+ print ("g.UFormula(%r) =" % site , g .u_formula (site ))
0 commit comments