Migrating from diffpy.srfit.structure
diffpy.cmistructure holds the code that used to live in
diffpy.srfit.structure. The behavior is the same, but the names follow
the Python style: camelCase methods are now snake_case, and abbreviated
attribute and argument names are spelled out.
diffpy.srfit 3.5.0 warns when you use an old method or attribute and names
its replacement. Renamed function arguments can’t be warned about, so check
the Renamed arguments table if your script passes arguments by keyword.
Update your imports
Replace diffpy.srfit.structure with diffpy.cmistructure. The module
names are unchanged:
# Before
from diffpy.srfit.structure import constrainAsSpaceGroup
from diffpy.srfit.structure.objcrystparset import ObjCrystCrystalParSet
# After
from diffpy.cmistructure import constrain_as_space_group
from diffpy.cmistructure.objcrystparset import ObjCrystCrystalParSet
constrain_as_space_group accepts a generator
constrain_as_space_group now also accepts a generator, such as a
PDFGenerator, in place of its .phase. Both of these calls work:
constrain_as_space_group(generator.phase, "Fm-3m")
constrain_as_space_group(generator, "Fm-3m")
Anything that is neither a structure parameter set nor an object with one as
its .phase raises a TypeError.
What has not changed
Class names, such as
DiffpyStructureParSetandObjCrystCrystalParSet.The space group containers
.sgpars,.latpars,.xyzparsand.adppars. They also name Parameters in fit results, for examplesgpars.latpars.a.The
constrainadpsandperiodickeyword arguments.
Renamed functions and methods
diffpy.srfit.structure |
diffpy.cmistructure |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Renamed attributes
Class |
diffpy.srfit.structure |
diffpy.cmistructure |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
Bond length, bond angle and dihedral angle Parameters |
|
|
|
|
|
|
|
|
|
|
|
Renamed arguments
These only matter if you pass the argument by keyword. Positional calls keep working, because no argument has moved.
Function or class |
diffpy.srfit.structure |
diffpy.cmistructure |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|