-
Notifications
You must be signed in to change notification settings - Fork 0
Sourcery refactored master branch #19
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
base: master
Are you sure you want to change the base?
Changes from all commits
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 |
|---|---|---|
|
|
@@ -170,29 +170,26 @@ def plot_contour(self): | |
| self.ax3.set_ylabel('Energy Transfer (eV)') | ||
| # Setting up the RIXS-Map with optional contour-plot | ||
| if self.cont_t: | ||
| if self.cont_n != 0: | ||
| self.cont = self.ax3.contour(self.x, self.y, self.amp, self.cont_n, cmap=plt.get_cmap(self.style)) | ||
| else: | ||
| if self.cont_n == 0: | ||
| self.cont = self.ax3.contour(self.x, self.y, self.amp, cmap=plt.get_cmap(self.style)) | ||
| else: | ||
| self.cont = self.ax3.contour(self.x, self.y, self.amp, self.cont_n, cmap=plt.get_cmap(self.style)) | ||
| self.cont.set_norm( | ||
| norm.MyNormalize(vmin=self.amp.min(), vmax=self.amp.max(), stretch=self.stretch, clip=True)) | ||
| else: | ||
| extent = (min(self.x), max(self.x), min(self.y), max(self.y)) | ||
| if self.cont_n != 0: | ||
| self.cont = self.ax3.contour(self.x, self.y, self.amp, self.cont_n, colors='w', aspect='auto', | ||
| linewidths=0.75, origin='lower') | ||
| if self.cont_n == 0: | ||
| self.im = self.ax3.imshow(self.amp, extent=extent, cmap=plt.get_cmap(self.style), aspect='auto', | ||
| interpolation='bilinear', origin='lower') | ||
| self.cont.set_norm( | ||
| norm.MyNormalize(vmin=self.amp.min(), vmax=self.amp.max(), stretch=self.stretch, clip=True)) | ||
| self.im.set_norm( | ||
| norm.MyNormalize(vmin=self.amp.min(), vmax=self.amp.max(), stretch=self.stretch, clip=True)) | ||
| else: | ||
| self.cont = self.ax3.contour(self.x, self.y, self.amp, self.cont_n, colors='w', aspect='auto', | ||
| linewidths=0.75, origin='lower') | ||
| self.im = self.ax3.imshow(self.amp, extent=extent, cmap=plt.get_cmap(self.style), aspect='auto', | ||
| interpolation='bilinear', origin='lower') | ||
| self.im.set_norm( | ||
| self.cont.set_norm( | ||
| norm.MyNormalize(vmin=self.amp.min(), vmax=self.amp.max(), stretch=self.stretch, clip=True)) | ||
|
|
||
| self.im.set_norm( | ||
| norm.MyNormalize(vmin=self.amp.min(), vmax=self.amp.max(), stretch=self.stretch, clip=True)) | ||
| # catch error if dividing by zero for normalization | ||
| # But not working | ||
| try: | ||
|
|
@@ -292,7 +289,7 @@ def zoompick(self, event): | |
| np.savetxt(self.pathway + newpath + '/XAS_Cut_at_' + label + '.txt', CUT_XAS.T, delimiter='\t', | ||
| newline='\n', header='En\tnorm.Int\tInt', fmt="%.4f") | ||
| os.chdir('..') | ||
| elif event.inaxes == self.ax2 and event.button == 1: | ||
| elif event.button == 1: | ||
|
Comment on lines
-295
to
+292
Author
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. Function
|
||
| xpos = int(np.argmin(np.abs(event.xdata - self.x))) | ||
| if self.aver_x == 0: | ||
| int_xes = self.amp[:, xpos] | ||
|
|
@@ -327,7 +324,7 @@ def onpick(self, event): | |
| """ | ||
| if event.inaxes != self.ax3: | ||
| return | ||
| elif event.inaxes == self.ax3: | ||
| else: | ||
|
Comment on lines
-330
to
+327
Author
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. Function
|
||
| if event.button == 1: | ||
| xpos = int(np.argmin(np.abs(event.xdata - self.x))) | ||
| if self.aver_x == 0: | ||
|
|
@@ -391,11 +388,7 @@ def norm_XAS(data): | |
| """ | ||
| Normalization of the XAS-Spectra according to the maxima of the all RIXS-intensities | ||
| """ | ||
| if np.max(data) != 0: | ||
| norm = data / np.max(data) | ||
| else: | ||
| norm = data | ||
| return norm | ||
| return data / np.max(data) if np.max(data) != 0 else data | ||
|
Comment on lines
-394
to
+391
Author
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. Function
|
||
|
|
||
| def norm_XES(self, data, mode): | ||
| """ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,29 +47,19 @@ def __init__(self, stretch='Linear', exponent=5, vmid=None, vmin=None, vmax=None | |
| if stretch == 'Power' and np.equal(self.exponent, None): | ||
| raise Exception("For stretch=='Power', an exponent should be specified") | ||
|
|
||
| if np.equal(vmid, None): | ||
| if stretch == 'Log': | ||
| if vmin > 0: | ||
| self.midpoint = vmax / vmin | ||
| elif vmin <= 0: | ||
| if stretch == 'Log': | ||
| if np.equal(vmid, None): | ||
| if vmin <= 0: | ||
| vmin = 0.00001 | ||
| self.midpoint = vmax / vmin | ||
| else: | ||
| raise Exception("When using a Log stretch, if vmin < 0, then vmid has to be specified") | ||
| elif stretch == 'Arcsinh' or stretch == 'Arccosh': | ||
| self.midpoint = -1. / 30. | ||
| self.midpoint = vmax / vmin | ||
| else: | ||
| self.midpoint = None | ||
| else: | ||
| if stretch == 'Log': | ||
| if vmin < vmid: | ||
| raise Exception("When using a Log stretch, vmin should be larger than vmid") | ||
| self.midpoint = (vmax - vmid) / (vmin - vmid) | ||
| elif stretch == 'Arcsinh' or stretch == 'Arccosh': | ||
| self.midpoint = (vmid - vmin) / (vmax - vmin) | ||
|
|
||
| else: | ||
| self.midpoint = None | ||
| elif stretch in ['Arcsinh', 'Arccosh']: | ||
| self.midpoint = -1. / 30. | ||
| else: | ||
| self.midpoint = None | ||
|
Comment on lines
-50
to
+62
Author
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. Function
|
||
|
|
||
| def __call__(self, value, clip=None): | ||
|
|
||
|
|
||
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.
Function
RIXS.plot_contourrefactored with the following changes:hoist-statement-from-if)