1818"""
1919
2020
21- LABEL_RA = ' r (A)' # r-grid
22- LABEL_GR = ' G (1/A^2)' # PDF G(r)
23- LABEL_RR = ' R (1/A)' # RDF R(r)
21+ LABEL_RA = " r (A)" # r-grid
22+ LABEL_GR = " G (1/A^2)" # PDF G(r)
23+ LABEL_RR = " R (1/A)" # RDF R(r)
2424
2525
2626class Morph (object ):
27- ''' Base class for implementing a morph given a target.
27+ """ Base class for implementing a morph given a target.
2828
2929 Adapted from diffpy.pdfgetx to include two sets of arrays that get passed through.
3030
@@ -79,46 +79,51 @@ class Morph(object):
7979 Tuple of (x_target_out, y_target_out).
8080 xyallout
8181 Tuple of (x_morph_out, y_morph_out, x_target_out, y_target_out).
82- '''
82+ """
8383
8484 # Class variables
8585 # default array types are empty
86- summary = ' identity transformation'
87- xinlabel = 'x'
88- yinlabel = 'y'
89- xoutlabel = 'x'
90- youtlabel = 'y'
86+ summary = " identity transformation"
87+ xinlabel = "x"
88+ yinlabel = "y"
89+ xoutlabel = "x"
90+ youtlabel = "y"
9191 parnames = []
9292
9393 # Properties
9494
9595 xy_morph_in = property (
9696 lambda self : (self .x_morph_in , self .y_morph_in ),
97- doc = ' Return a tuple of morph input arrays' ,
97+ doc = " Return a tuple of morph input arrays" ,
9898 )
9999 xy_morph_out = property (
100100 lambda self : (self .x_morph_out , self .y_morph_out ),
101- doc = ' Return a tuple of morph output arrays' ,
101+ doc = " Return a tuple of morph output arrays" ,
102102 )
103103 xy_target_in = property (
104104 lambda self : (self .x_target_in , self .y_target_in ),
105- doc = ' Return a tuple of target input arrays' ,
105+ doc = " Return a tuple of target input arrays" ,
106106 )
107107 xy_target_out = property (
108108 lambda self : (self .x_target_out , self .y_target_out ),
109- doc = ' Return a tuple of target output arrays' ,
109+ doc = " Return a tuple of target output arrays" ,
110110 )
111111 xyallout = property (
112- lambda self : (self .x_morph_out , self .y_morph_out , self .x_target_out , self .y_target_out ),
113- doc = 'Return a tuple of all output arrays' ,
112+ lambda self : (
113+ self .x_morph_out ,
114+ self .y_morph_out ,
115+ self .x_target_out ,
116+ self .y_target_out ,
117+ ),
118+ doc = "Return a tuple of all output arrays" ,
114119 )
115120
116121 def __init__ (self , config = None ):
117- ''' Create a default Morph instance.
122+ """ Create a default Morph instance.
118123
119124 config: dict
120125 All configuration variables.
121- '''
126+ """
122127 # declare empty attributes
123128 if config is None :
124129 config = {}
@@ -135,7 +140,7 @@ def __init__(self, config=None):
135140 return
136141
137142 def morph (self , x_morph , y_morph , x_target , y_target ):
138- ''' Morph arrays morphed or target.
143+ """ Morph arrays morphed or target.
139144
140145 Identity operation. This method should be overloaded in a derived class.
141146
@@ -150,7 +155,7 @@ def morph(self, x_morph, y_morph, x_target, y_target):
150155 -------
151156 tuple
152157 A tuple of numpy arrays (x_morph_out, y_morph_out, x_target_out, y_target_out)
153- '''
158+ """
154159 self .x_morph_in = x_morph
155160 self .y_morph_in = y_morph
156161 self .x_target_in = x_target
@@ -163,11 +168,11 @@ def morph(self, x_morph, y_morph, x_target, y_target):
163168 return self .xyallout
164169
165170 def __call__ (self , x_morph , y_morph , x_target , y_target ):
166- ''' Alias for morph.'''
171+ """ Alias for morph."""
167172 return self .morph (x_morph , y_morph , x_target , y_target )
168173
169174 def applyConfig (self , config ):
170- ''' Process any configuration data from a dictionary.
175+ """ Process any configuration data from a dictionary.
171176
172177 Parameters
173178 ----------
@@ -177,19 +182,19 @@ def applyConfig(self, config):
177182 Returns
178183 -------
179184 No return value.
180- '''
185+ """
181186 self .config = config
182187 return
183188
184189 def checkConfig (self ):
185- ''' Verify data in self.config. No action by default.
190+ """ Verify data in self.config. No action by default.
186191
187192 To be overridden in a derived class.
188- '''
193+ """
189194 return
190195
191196 def plotInputs (self , xylabels = True ):
192- ''' Plot input arrays using matplotlib.pyplot
197+ """ Plot input arrays using matplotlib.pyplot
193198
194199 Parameters
195200 ----------
@@ -200,7 +205,7 @@ def plotInputs(self, xylabels=True):
200205 -------
201206 list:
202207 A list of matplotlib line objects.
203- '''
208+ """
204209 from matplotlib .pyplot import plot , xlabel , ylabel
205210
206211 rv = plot (self .x_target_in , self .y_target_in , label = "target" )
@@ -211,7 +216,7 @@ def plotInputs(self, xylabels=True):
211216 return rv
212217
213218 def plotOutputs (self , xylabels = True , ** plotargs ):
214- ''' Plot output arrays using matplotlib.pyplot
219+ """ Plot output arrays using matplotlib.pyplot
215220
216221 Parameters
217222 ----------
@@ -224,7 +229,7 @@ def plotOutputs(self, xylabels=True, **plotargs):
224229 -------
225230 list
226231 A list of matplotlib line objects.
227- '''
232+ """
228233 from matplotlib .pyplot import plot , xlabel , ylabel
229234
230235 pargs = dict (plotargs )
@@ -237,7 +242,7 @@ def plotOutputs(self, xylabels=True, **plotargs):
237242 return rv
238243
239244 def __getattr__ (self , name ):
240- ''' Obtain the value from self.config, when normal lookup fails.
245+ """ Obtain the value from self.config, when normal lookup fails.
241246
242247 Parameters
243248 ----------
@@ -252,23 +257,23 @@ def __getattr__(self, name):
252257 ------
253258 AttributeError
254259 Name is not available from self.config.
255- '''
260+ """
256261 if name in self .config :
257262 return self .config [name ]
258263 else :
259- emsg = ' Object has no attribute %r' % name
264+ emsg = " Object has no attribute %r" % name
260265 raise AttributeError (emsg )
261266
262267 def __setattr__ (self , name , val ):
263- ''' Set configuration variables to config.
268+ """ Set configuration variables to config.
264269
265270 Parameters
266271 ----------
267272 name
268273 Name of the attribute.
269274 val
270275 Value of the attribute.
271- '''
276+ """
272277 if name in self .parnames :
273278 self .config [name ] = val
274279 else :
0 commit comments