Skip to content

Commit 05a7aa7

Browse files
committed
Merge branch 'lowercase-structure-import'
* use lowercase import for diffpy.structure * require diffpy.structure 3.0 or later Close #40.
2 parents 8e02a6f + fdf78bf commit 05a7aa7

11 files changed

Lines changed: 25 additions & 25 deletions

File tree

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ that are used by PDFgui and its components.
2929
* matplotlib - Python 2D plotting library
3030
* diffpy.pdffit2 - computational engine for PDFgui,
3131
https://github.com/diffpy/diffpy.pdffit2
32-
* diffpy.Structure - simple storage and manipulation of atomic
33-
structures, https://github.com/diffpy/diffpy.Structure
32+
* diffpy.structure - simple storage and manipulation of atomic
33+
structures, https://github.com/diffpy/diffpy.structure
3434
* diffpy.utils - shared helper utilities for wx GUI,
3535
https://github.com/diffpy/diffpy.utils
3636

conda-recipe/meta.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ requirements:
3939
- wxpython 4.*
4040
- menuinst [win]
4141
- diffpy.pdffit2
42-
- diffpy.structure
42+
- diffpy.structure >=3
4343
- diffpy.utils
4444

4545
test:

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def dirglob(d, *patterns):
113113
# manual and tutorial files should not be zipped
114114
zip_safe = False,
115115
install_requires = [
116-
'diffpy.structure',
116+
'diffpy.structure>=3',
117117
'diffpy.pdffit2',
118118
'diffpy.utils',
119119
],

src/diffpy/pdfgui/control/fitstructure.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from diffpy.pdfgui.control.constraint import Constraint
2525
from diffpy.pdfgui.control.parameter import Parameter
2626
from diffpy.pdfgui.control.controlerrors import ControlTypeError, ControlValueError
27-
from diffpy.Structure import Atom
27+
from diffpy.structure import Atom
2828

2929
class FitStructure(PDFStructure):
3030
"""FitStructure holds initial and refined structure and related fit
@@ -42,7 +42,7 @@ class FitStructure(PDFStructure):
4242
Use setSelectedPairs() and getSelectedPairs() methods
4343
to access its value.
4444
custom_spacegroup -- instance of SpaceGroup which has no equivalent
45-
in diffpy.Structure.SpaceGroups module. This can happen
45+
in diffpy.structure.spacegroups module. This can happen
4646
after reading from a CIF file. When equivalent space
4747
group exists, custom_spacegroup is None.
4848
@@ -366,7 +366,7 @@ def isSpaceGroupPossible(self, spacegroup):
366366
367367
Return bool.
368368
"""
369-
from diffpy.Structure.SymmetryUtilities import isSpaceGroupLatPar
369+
from diffpy.structure.symmetryutilities import isSpaceGroupLatPar
370370
return isSpaceGroupLatPar(spacegroup, *self.initial.lattice.abcABG())
371371

372372

@@ -376,7 +376,7 @@ def getSpaceGroupList(self):
376376
with custom_spacegroup.
377377
"""
378378
if not FitStructure.sorted_standard_space_groups:
379-
import diffpy.Structure.SpaceGroups as SG
379+
import diffpy.structure.spacegroups as SG
380380
existing_names = {}
381381
unique_named_list = []
382382
for sg in SG.SpaceGroupList:
@@ -400,7 +400,7 @@ def getSpaceGroup(self, sgname):
400400
Raise ValueError if sgname cannot be found or when it is not present
401401
in getSpaceGroupList().
402402
"""
403-
import diffpy.Structure.SpaceGroups as SG
403+
import diffpy.structure.spacegroups as SG
404404
# this should match the "CIF data" sgname
405405
sgmatch = [sg for sg in self.getSpaceGroupList()
406406
if sg.short_name == sgname]
@@ -420,11 +420,11 @@ def expandAsymmetricUnit(self, spacegroup, indices, sgoffset=[0,0,0]):
420420
of the occupancy("occ". Constraints of unaffected atoms are adjusted
421421
for new positions self.initial.
422422
423-
spacegroup -- instance of Structure.SpaceGroup
423+
spacegroup -- instance of SpaceGroup from diffpy.structure
424424
indices -- list of integer indices of atoms to be expanded
425425
sgoffset -- optional offset of space group origin [0,0,0]
426426
"""
427-
from diffpy.Structure.SymmetryUtilities import ExpandAsymmetricUnit
427+
from diffpy.structure.symmetryutilities import ExpandAsymmetricUnit
428428
acd = self._popAtomConstraints()
429429
# get unique, reverse sorted indices
430430
ruindices = dict.fromkeys(indices).keys()
@@ -470,15 +470,15 @@ def applySymmetryConstraints(self, spacegroup, indices, posflag, Uijflag,
470470
erased. New parameter indices start at fist decade after the last
471471
used parameter.
472472
473-
spacegroup -- instance of Structure.SpaceGroup
473+
spacegroup -- instance of SpaceGroup from diffpy.structure
474474
indices -- list of integer indices of atoms to be expanded
475475
posflag -- required bool flag for constraining positions
476476
Uijflag -- required bool flag for Uij constrainment
477477
sgoffset -- optional offset of space group origin [0,0,0]
478478
"""
479479
if not posflag and not Uijflag: return
480480
# need to do something
481-
from diffpy.Structure.SymmetryUtilities import SymmetryConstraints
481+
from diffpy.structure.symmetryutilities import SymmetryConstraints
482482
# get unique sorted indices
483483
tobeconstrained = dict.fromkeys(indices)
484484
uindices = tobeconstrained.keys()

src/diffpy/pdfgui/control/pdfstructure.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import copy
1717
import re
1818

19-
from diffpy.Structure import PDFFitStructure
19+
from diffpy.structure import PDFFitStructure
2020
from diffpy.pdfgui.control.pdfcomponent import PDFComponent
2121
from diffpy.pdfgui.control.controlerrors import \
2222
ControlKeyError, ControlFileError
@@ -48,7 +48,7 @@ def read(self, filename, format='auto'):
4848
Return instance of StructureParser used to load the data.
4949
See Structure.read() for more info.
5050
"""
51-
from diffpy.Structure import StructureFormatError
51+
from diffpy.structure import StructureFormatError
5252
try:
5353
p = PDFFitStructure.read(self, filename, format)
5454
except StructureFormatError, err:

src/diffpy/pdfgui/control/structureviewer.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class StructureViewer(object):
5151
quoting. Instances of '%s' in the string are replaced with
5252
temporary structure file. By default '%s'
5353
fileformat -- structure format that can be loaded by the viewer.
54-
Must be one of output formats supported by diffpy.Structure
54+
Must be one of output formats supported by diffpy.structure
5555
package. By default 'pdb'.
5656
_tmpdir -- Temporary directory for structure files opened by the viewer.
5757
tmpdir is None before the first call to plot. The directory
@@ -71,7 +71,7 @@ def __init__(self, executable=None, argstr=None, fileformat=None):
7171
argstr -- argument string for the viewer program, it can use
7272
shell quoting. Instances of '%s' are replaced with
7373
temporary structure file.
74-
fileformat -- structure format supported by diffpy.Structure package.
74+
fileformat -- structure format supported by diffpy.structure package.
7575
"""
7676
# declare instance data
7777
self.executable = ''
@@ -119,15 +119,15 @@ def setConfig(self, cfg):
119119
def getFileFormats():
120120
"""Return list of valid values for the fileformat attribute.
121121
"""
122-
from diffpy.Structure.Parsers import outputFormats
122+
from diffpy.structure.parsers import outputFormats
123123
return outputFormats()
124124
getFileFormats = staticmethod(getFileFormats)
125125

126126

127127
def plot(self, stru):
128128
"""Launch new structure viewer and open a temporary copy of stru.
129129
130-
stru -- instance of Structure class from diffpy.Structure
130+
stru -- instance of Structure class from diffpy.structure
131131
132132
No return value.
133133
Raise ControlConfigError if structure viewer could not be launched.
@@ -203,7 +203,7 @@ def _writeTemporaryStructure(self, stru):
203203
Return full path to the temporary file.
204204
"""
205205
# get extension preferred by fileformat
206-
from diffpy.Structure.Parsers import parser_index
206+
from diffpy.structure.parsers import parser_index
207207
ffext = parser_index[self.fileformat]['file_extension']
208208
d = self._createTemporaryDirectory()
209209
# Use a simple file name to avoid naming errors. It is common to put

src/diffpy/pdfgui/gui/phaseconfigurepanel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
import wx
2020
import wx.grid
21-
from diffpy.Structure import Atom
21+
from diffpy.structure import Atom
2222
from diffpy.pdffit2 import is_element
2323
from diffpy.pdfgui.gui.insertrowsdialog import InsertRowsDialog
2424
from diffpy.pdfgui.gui.pdfpanel import PDFPanel

src/diffpy/pdfgui/gui/sgstructuredialog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def updateWidgets(self):
163163
self.offset[i] = val
164164

165165
# find how many new atoms would be generated
166-
from diffpy.Structure.SymmetryUtilities import ExpandAsymmetricUnit
166+
from diffpy.structure.symmetryutilities import ExpandAsymmetricUnit
167167
corepos = [ self.structure[i].xyz for i in self.indices ]
168168
symposeps = self.structure.symposeps
169169
eau = ExpandAsymmetricUnit(self.spacegroup, corepos,

src/diffpy/pdfgui/tests/TestFitStructure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def test_changeParameterIndex(self):
151151
def test_insertAtoms(self):
152152
"""check FitStructure.insertAtoms()
153153
"""
154-
from diffpy.Structure import Atom
154+
from diffpy.structure import Atom
155155
stru = self.stru
156156
stru.read(datafile('Ni.stru'), format='pdffit')
157157
cns = Constraint('@1')

src/diffpy/pdfgui/tests/TestPDFStructure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def test_setvar(self):
9292
def test_getvar(self):
9393
"""check PDFStructure.getvar()
9494
"""
95-
from diffpy.Structure import Atom
95+
from diffpy.structure import Atom
9696
stru = self.stru
9797
abcABG = (3.0, 4.0, 5.0, 81, 82, 83)
9898
stru.lattice.setLatPar(*abcABG)

0 commit comments

Comments
 (0)