@@ -469,6 +469,14 @@ def _find_invariants(symops):
469469
470470# ----------------------------------------------------------------------------
471471
472+ generator_site = "diffpy.symmetryutilities.GeneratorSite"
473+ signedRatStr_deprecation_msg = build_deprecation_message (
474+ generator_site ,
475+ "signedRatStr" ,
476+ "convert_fp_num_to_signed_rational" ,
477+ removal_version ,
478+ )
479+
472480
473481class GeneratorSite (object ):
474482 """Storage of data related to a generator positions.
@@ -593,14 +601,14 @@ def __init__(
593601 self .symops = ops
594602 self .multiplicity = mult
595603 self .invariants = invariants
596- self ._findNullSpace ()
597- self ._findPosParameters ()
598- self ._findUSpace ()
599- self ._findUParameters ()
600- self ._findeqUij ()
604+ self ._find_null_space ()
605+ self ._find_pos_parameters ()
606+ self ._find_u_space ()
607+ self ._find_u_parameters ()
608+ self ._find_eq_uij ()
601609 return
602610
603- def signedRatStr (self , x ):
611+ def convert_fp_num_to_signed_rational (self , x ):
604612 """Convert floating point number to signed rational
605613 representation.
606614
@@ -628,7 +636,16 @@ def signedRatStr(self, x):
628636 # here we have fraction
629637 return "%+.0f/%.0f" % (nom [idx [0 ]], den [idx [0 ]])
630638
631- def _findNullSpace (self ):
639+ @deprecated (signedRatStr_deprecation_msg )
640+ def signedRatStr (self , x ):
641+ """'diffpy.structure.GeneratorSite.signedRatStr' is deprecated
642+ and will be removed in version 4.0.0.
643+
644+ Please use 'diffpy.structure.GeneratorSite.convert_fp_num_to_signed_rational' instead.
645+ """
646+ return self .convert_fp_num_to_signed_rational (x )
647+
648+ def _find_null_space (self ):
632649 """Calculate `self.null_space` from `self.invariants`.
633650
634651 Try to represent `self.null_space` using small integers.
@@ -660,7 +677,7 @@ def _findNullSpace(self):
660677 row [:] = (sgrow * abrow ) / sgrow [idx ] / abrow [idx ]
661678 return
662679
663- def _findPosParameters (self ):
680+ def _find_pos_parameters (self ):
664681 """Find pparameters and their values for expressing
665682 `self.xyz`."""
666683 usedsymbol = {}
@@ -677,7 +694,7 @@ def _findPosParameters(self):
677694 usedsymbol [vname ] = True
678695 return
679696
680- def _findUSpace (self ):
697+ def _find_u_space (self ):
681698 """Find independent U components with respect to invariant
682699 rotations."""
683700 n = len (self .invariants )
@@ -710,7 +727,7 @@ def _findUSpace(self):
710727 self .Uisotropy = len (self .Uspace ) == 1
711728 return
712729
713- def _findUParameters (self ):
730+ def _find_u_parameters (self ):
714731 """Find Uparameters and their values for expressing
715732 `self.Uij`."""
716733 # permute indices as 00 11 22 01 02 12 10 20 21
@@ -726,7 +743,7 @@ def _findUParameters(self):
726743 self .Uparameters .append ((vname , varvalue ))
727744 return
728745
729- def _findeqUij (self ):
746+ def _find_eq_uij (self ):
730747 """Adjust `self.Uij` and `self.eqUij` to be consistent with
731748 spacegroup."""
732749 self .Uij = numpy .zeros ((3 , 3 ), dtype = float )
@@ -782,14 +799,14 @@ def positionFormula(self, pos, xyzsymbols=("x", "y", "z")):
782799 if abs (nvec [i ]) < epsilon :
783800 continue
784801 xyzformula [i ] += "%s*%s " % (
785- self .signedRatStr (nvec [i ]),
802+ self .convert_fp_num_to_signed_rational (nvec [i ]),
786803 name2sym [vname ],
787804 )
788805 # add constant offset teqpos to all formulas
789806 for i in range (3 ):
790807 if xyzformula [i ] and abs (teqpos [i ]) < epsilon :
791808 continue
792- xyzformula [i ] += self .signedRatStr (teqpos [i ])
809+ xyzformula [i ] += self .convert_fp_num_to_signed_rational (teqpos [i ])
793810 # reduce unnecessary +1* and -1*
794811 xyzformula = [re .sub ("^[+]1[*]|(?<=[+-])1[*]" , "" , f ).strip () for f in xyzformula ]
795812 return dict (zip (("x" , "y" , "z" ), xyzformula ))
0 commit comments