Skip to content

Commit 09938ac

Browse files
Alison WuAlison Wu
authored andcommitted
Revert "renamed functions and files to PEP8"
This reverts commit 3c9d517.
1 parent 8ecba3f commit 09938ac

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import numpy
1717

1818

19-
def load_data(filename, minrows=10, headers=False, hdel="=", hignore=None, **kwargs):
19+
def loadData(filename, minrows=10, headers=False, hdel="=", hignore=None, **kwargs):
2020
"""Find and load data from a text file.
2121
2222
The data block is identified as the first matrix block of at least minrows rows and constant number of columns.
@@ -54,7 +54,7 @@ def load_data(filename, minrows=10, headers=False, hdel="=", hignore=None, **kwa
5454
set delimiter to ','.
5555
unpack: bool
5656
Return data as a sequence of columns that allows tuple unpacking such as x, y =
57-
load_data(FILENAME, unpack=True). Note transposing the loaded array as load_data(FILENAME).T has the same
57+
loadData(FILENAME, unpack=True). Note transposing the loaded array as loadData(FILENAME).T has the same
5858
effect.
5959
usecols:
6060
Zero-based index of columns to be loaded, by default use all detected columns. The reading skips
@@ -226,7 +226,7 @@ def readfp(self, fp, append=False):
226226
227227
File details include:
228228
* File name.
229-
* All data blocks findable by load_data.
229+
* All data blocks findable by loadData.
230230
* Headers (if present) for each data block. (Generally the headers contain column name information).
231231
"""
232232
self._reset()

src/diffpy/utils/scattering_objects/diffraction_objects.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
)
1818

1919

20-
class DiffractionObject:
20+
class Diffraction_object:
2121
def __init__(self, name="", wavelength=None):
2222
self.name = name
2323
self.wavelength = wavelength
@@ -29,7 +29,7 @@ def __init__(self, name="", wavelength=None):
2929
self.metadata = {}
3030

3131
def __eq__(self, other):
32-
if not isinstance(other, DiffractionObject):
32+
if not isinstance(other, Diffraction_object):
3333
return NotImplemented
3434
self_attributes = [key for key in self.__dict__ if not key.startswith("_")]
3535
other_attributes = [key for key in other.__dict__ if not key.startswith("_")]
@@ -59,8 +59,8 @@ def __add__(self, other):
5959
if isinstance(other, int) or isinstance(other, float) or isinstance(other, np.ndarray):
6060
summed.on_tth[1] = self.on_tth[1] + other
6161
summed.on_q[1] = self.on_q[1] + other
62-
elif not isinstance(other, DiffractionObject):
63-
raise TypeError("I only know how to sum two DiffractionObject objects")
62+
elif not isinstance(other, Diffraction_object):
63+
raise TypeError("I only know how to sum two Diffraction_object objects")
6464
elif self.on_tth[0].all() != other.on_tth[0].all():
6565
raise RuntimeError(x_grid_emsg)
6666
else:
@@ -73,7 +73,7 @@ def __radd__(self, other):
7373
if isinstance(other, int) or isinstance(other, float) or isinstance(other, np.ndarray):
7474
summed.on_tth[1] = self.on_tth[1] + other
7575
summed.on_q[1] = self.on_q[1] + other
76-
elif not isinstance(other, DiffractionObject):
76+
elif not isinstance(other, Diffraction_object):
7777
raise TypeError("I only know how to sum two Scattering_object objects")
7878
elif self.on_tth[0].all() != other.on_tth[0].all():
7979
raise RuntimeError(x_grid_emsg)
@@ -87,7 +87,7 @@ def __sub__(self, other):
8787
if isinstance(other, int) or isinstance(other, float) or isinstance(other, np.ndarray):
8888
subtracted.on_tth[1] = self.on_tth[1] - other
8989
subtracted.on_q[1] = self.on_q[1] - other
90-
elif not isinstance(other, DiffractionObject):
90+
elif not isinstance(other, Diffraction_object):
9191
raise TypeError("I only know how to subtract two Scattering_object objects")
9292
elif self.on_tth[0].all() != other.on_tth[0].all():
9393
raise RuntimeError(x_grid_emsg)
@@ -101,7 +101,7 @@ def __rsub__(self, other):
101101
if isinstance(other, int) or isinstance(other, float) or isinstance(other, np.ndarray):
102102
subtracted.on_tth[1] = other - self.on_tth[1]
103103
subtracted.on_q[1] = other - self.on_q[1]
104-
elif not isinstance(other, DiffractionObject):
104+
elif not isinstance(other, Diffraction_object):
105105
raise TypeError("I only know how to subtract two Scattering_object objects")
106106
elif self.on_tth[0].all() != other.on_tth[0].all():
107107
raise RuntimeError(x_grid_emsg)
@@ -115,7 +115,7 @@ def __mul__(self, other):
115115
if isinstance(other, int) or isinstance(other, float) or isinstance(other, np.ndarray):
116116
multiplied.on_tth[1] = other * self.on_tth[1]
117117
multiplied.on_q[1] = other * self.on_q[1]
118-
elif not isinstance(other, DiffractionObject):
118+
elif not isinstance(other, Diffraction_object):
119119
raise TypeError("I only know how to multiply two Scattering_object objects")
120120
elif self.on_tth[0].all() != other.on_tth[0].all():
121121
raise RuntimeError(x_grid_emsg)
@@ -141,7 +141,7 @@ def __truediv__(self, other):
141141
if isinstance(other, int) or isinstance(other, float) or isinstance(other, np.ndarray):
142142
divided.on_tth[1] = other / self.on_tth[1]
143143
divided.on_q[1] = other / self.on_q[1]
144-
elif not isinstance(other, DiffractionObject):
144+
elif not isinstance(other, Diffraction_object):
145145
raise TypeError("I only know how to multiply two Scattering_object objects")
146146
elif self.on_tth[0].all() != other.on_tth[0].all():
147147
raise RuntimeError(x_grid_emsg)
@@ -389,7 +389,7 @@ def scale_to(self, target_diff_object, xtype=None, xvalue=None):
389389
390390
Parameters
391391
----------
392-
target_diff_object: DiffractionObject
392+
target_diff_object: Diffraction_object
393393
the diffractoin object you want to scale the current one on to
394394
xtype: string, optional. Default is Q
395395
the xtype, from {XQUANTITIES}, that you will specify a point from to scale to
@@ -400,7 +400,7 @@ def scale_to(self, target_diff_object, xtype=None, xvalue=None):
400400
401401
Returns
402402
-------
403-
the rescaled DiffractionObject as a new object
403+
the rescaled Diffraction_object as a new object
404404
405405
"""
406406
scaled = deepcopy(self)
@@ -454,7 +454,7 @@ def dump(self, filepath, xtype=None):
454454

455455
with open(filepath, "w") as f:
456456
f.write(
457-
f"[DiffractionObject]\nname = {self.name}\nwavelength = {self.wavelength}\n"
457+
f"[Diffraction_object]\nname = {self.name}\nwavelength = {self.wavelength}\n"
458458
f"scat_quantity = {self.scat_quantity}\n"
459459
)
460460
for key, value in self.metadata.items():

0 commit comments

Comments
 (0)