Skip to content

Commit 9e86908

Browse files
committed
more cleanup; fix buggy code that is likely not used
1 parent 3807809 commit 9e86908

3 files changed

Lines changed: 19 additions & 18 deletions

File tree

GSASII/GSASIImiscGUI.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import os
2525
import re
2626
import copy
27-
import platform
27+
#import platform
2828
import pickle
2929
import sys
3030
import random as ran
@@ -709,7 +709,7 @@ def ProjFileSave(G2frame):
709709
commit = g2repo.head.commit
710710
Controls['LastSavedUsing'] += f" git {commit.hexsha[:8]}"
711711
else:
712-
gv = getSavedVersionInfo()
712+
gv = GSASIIpath.getSavedVersionInfo()
713713
if gv is not None:
714714
Controls['LastSavedUsing'] += f" static {gv.git_version[:8]}"
715715
except:

GSASII/GSASIIsasd.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ def CylinderVol(R,args):
267267
268268
:param float R: diameter (A)
269269
:param array args: [float L]: length (A)
270-
:returns float:volume (A^3)
270+
:returns float: volume (A^3)
271271
'''
272272
L = args[0]
273273
return np.pi*L*R**2
@@ -278,7 +278,7 @@ def CylinderDVol(L,args):
278278
279279
:param float: L half length (A)
280280
:param array args: [float D]: diameter (A)
281-
:returns float:volume (A^3)
281+
:returns float: volume (A^3)
282282
'''
283283
D = args[0]
284284
return CylinderVol(D/2.,[2.*L,])
@@ -289,7 +289,7 @@ def CylinderARVol(R,args):
289289
290290
:param float: R radius (A)
291291
:param array args: [float AR]: =L/D=L/2R aspect ratio
292-
:returns float:volume
292+
:returns float: volume
293293
'''
294294
AR = args[0]
295295
return CylinderVol(R,[2.*R*AR,])
@@ -310,7 +310,7 @@ def UniRodVol(R,args):
310310
311311
:param float R: diameter (A)
312312
:param array args: [float L]: length (A)
313-
:returns float:volume (A^3)
313+
:returns float: volume (A^3)
314314
'''
315315
L = args[0]
316316
return CylinderVol(R,[L,])
@@ -321,7 +321,7 @@ def UniRodARVol(R,args):
321321
322322
:param float R: diameter (A)
323323
:param array args: [float AR]: =L/D=L/2R aspect ratio
324-
:returns float:volume (A^3)
324+
:returns float: volume (A^3)
325325
'''
326326
AR = args[0]
327327
return CylinderARVol(R,[AR,])
@@ -332,7 +332,7 @@ def UniDiskVol(R,args):
332332
333333
:param float R: diameter (A)
334334
:param array args: [float T]: thickness
335-
:returns float:volume (A^3)
335+
:returns float: volume (A^3)
336336
'''
337337
T = args[0]
338338
return CylinderVol(R,[T,])
@@ -491,7 +491,7 @@ def HardSpheresSF(Q,args):
491491
492492
:param float Q: Q value array (A-1)
493493
:param array args: [float R, float VolFrac]: interparticle distance & volume fraction
494-
:returns numpy array S(Q)
494+
:returns numpy array: S(Q)
495495
'''
496496

497497
R,VolFr = args
@@ -522,7 +522,7 @@ def SquareWellSF(Q,args):
522522
:param array args: [float R, float VolFrac, float depth, float width]:
523523
interparticle distance, volume fraction (<0.08), well depth (e/kT<1.5kT),
524524
well width
525-
:returns: numpy array S(Q)
525+
:returns: numpy array: S(Q)
526526
well depth > 0 attractive & values outside above limits nonphysical cf.
527527
Monte Carlo simulations
528528
'''
@@ -557,7 +557,7 @@ def StickyHardSpheresSF(Q,args):
557557
558558
:param float Q: Q value array (A-1)
559559
:param array args: [float R, float VolFrac]: sphere radius & volume fraction
560-
:returns numpy array S(Q)
560+
:returns numpy array: S(Q)
561561
'''
562562
R,VolFr,epis,sticky = args
563563
eta = VolFr/(1.0-epis)/(1.0-epis)/(1.0-epis)
@@ -606,7 +606,7 @@ def InterPrecipitateSF(Q,args):
606606
607607
:param float Q: Q value array (A-1)
608608
:param array args: [float R, float VolFr]: "radius" & volume fraction
609-
:returns numpy array S(Q)
609+
:returns numpy array: S(Q)
610610
'''
611611
R,VolFr = args
612612
QV2 = Q**2*VolFr**2

GSASII/GSASIIscriptable.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,8 @@ def import_generic(filename, readerlist, fmthint=None, bank=None,
505505
else:
506506
try:
507507
flag = rd.Reader(filename,buffer=rdbuffer, blocknum=block)
508-
except Exception as msg:
508+
#except Exception as msg:
509+
except Exception:
509510
flag = False
510511
if flag:
511512
# Omitting image loading special cases
@@ -593,7 +594,8 @@ def load_pwd_from_reader(reader, instprm, existingnames=[],bank=None):
593594
try:
594595
Iparm1, Iparm2 = reader.pwdparms['Instrument Parameters']
595596
print('Instrument parameters supplied in data file')
596-
except KeyError as err:
597+
#except KeyError as err:
598+
except KeyError:
597599
Iparm1 = None # signal error rather than raise exception inside an exception handler
598600
if Iparm1 is None:
599601
msg = "The data file does not have any instrument params associated with it and none were provided."
@@ -1007,9 +1009,9 @@ def save(self, filename=None):
10071009
commit = g2repo.head.commit
10081010
controls_data['LastSavedUsing'] += f" git {commit.hexsha[:8]} script"
10091011
else:
1010-
gv = getSavedVersionInfo()
1012+
gv = GSASIIpath.getSavedVersionInfo()
10111013
if gv is not None:
1012-
Controls['LastSavedUsing'] += f" static {gv.git_version[:8]}"
1014+
controls_data['LastSavedUsing'] += f" static {gv.git_version[:8]}"
10131015
except:
10141016
pass
10151017
# .gpx name
@@ -5620,7 +5622,6 @@ def setHAPentryValue(self, keylist, newvalue):
56205622
def _getBondRest(self,nam):
56215623
if 'Restraints' not in self.proj.data:
56225624
raise G2ScriptException(f"{nam} error: Restraints entry not in data tree")
5623-
errmsg = ''
56245625
try:
56255626
return self.proj.data['Restraints']['data'][self.name]['Bond']
56265627
except:
@@ -7200,7 +7201,7 @@ def loadPixelMask(self,mask,tag="loaded in G2sc.loadPixelMask"):
72007201
Image = self.image
72017202
else:
72027203
Image = _getCorrImage(Readers['Image'],self.proj,self)
7203-
Controls = self.getControls()
7204+
#Controls = self.getControls()
72047205
if mask.shape != Image.shape:
72057206
raise G2ScriptException(f"loadPixelMask Error: mask shape {mask.shape} must match image {Image.shape}")
72067207
self.getMasks()['SpotMask']['spotMask'] = mask

0 commit comments

Comments
 (0)