-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Moved resample out of parsers to its own sub-package #158
Changes from 4 commits
0d6b1b8
6a121cc
79a2f1e
87a5b6d
2c364fc
f45ba82
5f285e0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
**Added:** | ||
|
||
* <news item> | ||
|
||
**Changed:** | ||
|
||
* Moved resampler out of parsers, new path is diffpy.utils.resample | ||
|
||
**Deprecated:** | ||
|
||
* <news item> | ||
|
||
**Removed:** | ||
|
||
* <news item> | ||
|
||
**Fixed:** | ||
|
||
* <news item> | ||
|
||
**Security:** | ||
|
||
* <news item> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
) | ||
|
||
|
||
class Diffraction_object: | ||
class diffraction_object: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Although this wasn't discussed before, could we try There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, not camel case which is not the PEP8 standard, but Classes always begin with capital letters. Please everyone read the PEP8 standards.... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems it's got two interpretations: while PEP8 says,
but yeah I guess There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
yeah I will add this to our gitlab so that we can say, "did you read that section" or "refer to here.." |
||
def __init__(self, name="", wavelength=None): | ||
self.name = name | ||
self.wavelength = wavelength | ||
|
@@ -29,7 +29,7 @@ def __init__(self, name="", wavelength=None): | |
self.metadata = {} | ||
|
||
def __eq__(self, other): | ||
if not isinstance(other, Diffraction_object): | ||
if not isinstance(other, diffraction_object): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also - if it's camelcased, then it improves readability in lines like here |
||
return NotImplemented | ||
self_attributes = [key for key in self.__dict__ if not key.startswith("_")] | ||
other_attributes = [key for key in other.__dict__ if not key.startswith("_")] | ||
|
@@ -59,7 +59,7 @@ def __add__(self, other): | |
if isinstance(other, int) or isinstance(other, float) or isinstance(other, np.ndarray): | ||
summed.on_tth[1] = self.on_tth[1] + other | ||
summed.on_q[1] = self.on_q[1] + other | ||
elif not isinstance(other, Diffraction_object): | ||
elif not isinstance(other, diffraction_object): | ||
raise TypeError("I only know how to sum two Diffraction_object objects") | ||
elif self.on_tth[0].all() != other.on_tth[0].all(): | ||
raise RuntimeError(x_grid_emsg) | ||
|
@@ -73,7 +73,7 @@ def __radd__(self, other): | |
if isinstance(other, int) or isinstance(other, float) or isinstance(other, np.ndarray): | ||
summed.on_tth[1] = self.on_tth[1] + other | ||
summed.on_q[1] = self.on_q[1] + other | ||
elif not isinstance(other, Diffraction_object): | ||
elif not isinstance(other, diffraction_object): | ||
raise TypeError("I only know how to sum two Scattering_object objects") | ||
elif self.on_tth[0].all() != other.on_tth[0].all(): | ||
raise RuntimeError(x_grid_emsg) | ||
|
@@ -87,7 +87,7 @@ def __sub__(self, other): | |
if isinstance(other, int) or isinstance(other, float) or isinstance(other, np.ndarray): | ||
subtracted.on_tth[1] = self.on_tth[1] - other | ||
subtracted.on_q[1] = self.on_q[1] - other | ||
elif not isinstance(other, Diffraction_object): | ||
elif not isinstance(other, diffraction_object): | ||
raise TypeError("I only know how to subtract two Scattering_object objects") | ||
elif self.on_tth[0].all() != other.on_tth[0].all(): | ||
raise RuntimeError(x_grid_emsg) | ||
|
@@ -101,7 +101,7 @@ def __rsub__(self, other): | |
if isinstance(other, int) or isinstance(other, float) or isinstance(other, np.ndarray): | ||
subtracted.on_tth[1] = other - self.on_tth[1] | ||
subtracted.on_q[1] = other - self.on_q[1] | ||
elif not isinstance(other, Diffraction_object): | ||
elif not isinstance(other, diffraction_object): | ||
raise TypeError("I only know how to subtract two Scattering_object objects") | ||
elif self.on_tth[0].all() != other.on_tth[0].all(): | ||
raise RuntimeError(x_grid_emsg) | ||
|
@@ -115,7 +115,7 @@ def __mul__(self, other): | |
if isinstance(other, int) or isinstance(other, float) or isinstance(other, np.ndarray): | ||
multiplied.on_tth[1] = other * self.on_tth[1] | ||
multiplied.on_q[1] = other * self.on_q[1] | ||
elif not isinstance(other, Diffraction_object): | ||
elif not isinstance(other, diffraction_object): | ||
raise TypeError("I only know how to multiply two Scattering_object objects") | ||
elif self.on_tth[0].all() != other.on_tth[0].all(): | ||
raise RuntimeError(x_grid_emsg) | ||
|
@@ -141,7 +141,7 @@ def __truediv__(self, other): | |
if isinstance(other, int) or isinstance(other, float) or isinstance(other, np.ndarray): | ||
divided.on_tth[1] = other / self.on_tth[1] | ||
divided.on_q[1] = other / self.on_q[1] | ||
elif not isinstance(other, Diffraction_object): | ||
elif not isinstance(other, diffraction_object): | ||
raise TypeError("I only know how to multiply two Scattering_object objects") | ||
elif self.on_tth[0].all() != other.on_tth[0].all(): | ||
raise RuntimeError(x_grid_emsg) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alisnwu I think we are using reampler.py?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will update the news file