Skip to content
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

Sourcery refactored master branch #28

Merged
merged 1 commit into from
Oct 27, 2023
Merged

Sourcery refactored master branch #28

merged 1 commit into from
Oct 27, 2023

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Oct 8, 2023

Branch master refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the master branch, then run:

git fetch origin sourcery/master
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from LemurPwned October 8, 2023 09:24
ext.define_macros = [
("VERSION_INFO",
'"{}"'.format(self.distribution.get_version()))
]
ext.define_macros = [("VERSION_INFO", f'"{self.distribution.get_version()}"')]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function BuildExt.build_extensions refactored with the following changes:

if effective:
Keff = self.Ku - (0.5 * mu0) * (self.Ms**2)
else:
Keff = self.Ku
Keff = self.Ku - (0.5 * mu0) * (self.Ms**2) if effective else self.Ku
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function DomainWallDynamics.get_unrelaxed_domain_width refactored with the following changes:

sum_ = 0
for x_ in x:
sum_ += x_**2
sum_ = sum(x_**2 for x_ in x)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function fast_norm refactored with the following changes:

all_symbols.append(sym.Symbol(r"\theta_" + indx_i))
all_symbols.append(sym.Symbol(r"\phi_" + indx_i))
all_symbols.extend(
(sym.Symbol(r"\theta_" + indx_i), sym.Symbol(r"\phi_" + indx_i))
)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function general_hessian_functional refactored with the following changes:

Comment on lines +78 to -88
s1 = sym.Symbol(r"\theta_" + indx_i)
s2 = sym.Symbol(r"\phi_" + indx_j)
expr = sym.diff(energy_functional_expr, s1, s2)
if i == j:
s1 = sym.Symbol(r"\theta_" + indx_i)
s2 = sym.Symbol(r"\phi_" + indx_j)
expr = sym.diff(energy_functional_expr, s1, s2)
hessian[2 * i + 1][2 * j] = expr + sym.I * z
hessian[2 * i][2 * j + 1] = expr - sym.I * z
else:
s1 = sym.Symbol(r"\theta_" + indx_i)
s2 = sym.Symbol(r"\phi_" + indx_j)
expr = sym.diff(energy_functional_expr, s1, s2)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function get_hessian_from_energy_expr refactored with the following changes:

y = lfilter(b, a, data, zi=None)
return y
return lfilter(b, a, data, zi=None)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Filters.butter_bandpass_filter refactored with the following changes:

Comment on lines -56 to +55
y = lfilter(b, a, data, zi=None)
return y
return lfilter(b, a, data, zi=None)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Filters.butter_lowpass_filter refactored with the following changes:

Comment on lines -66 to +64
if axis:
detrended = (arr.T - medians).T
else:
detrended = arr - medians
return detrended
return (arr.T - medians).T if axis else arr - medians
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Filters.detrend_axis refactored with the following changes:

axes = [host] + [host.twinx() for i in range(ys.shape[1] - 1)]
axes = [host] + [host.twinx() for _ in range(ys.shape[1] - 1)]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function create_coordinates_plot refactored with the following changes:

Comment on lines -280 to +281
if not (angle is None):
if angle is not None:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function create_stack refactored with the following changes:

  • Simplify logical expression using De Morgan identities (de-morgan)

R = Rp + 0.5 * (Rap - Rp) * np.sum(m[0] * m[1], axis=0)
return R
return Rp + 0.5 * (Rap - Rp) * np.sum(m[0] * m[1], axis=0)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function calculate_magnetoresistance refactored with the following changes:

if sol.success:
return sol.x[0]
return None
return sol.x[0] if sol.success else None
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function RootFinder.find_root refactored with the following changes:

@@ -85,7 +85,6 @@ def __init__(self,
else:
raise ValueError(f"Unknown loss type: {loss_type}")

infeat = 2998 * 80
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function PhysicsModel.__init__ refactored with the following changes:

Comment on lines -165 to +164
opt = torch.optim.Adam(self.parameters(), lr=self.hparams.lr)
return opt
return torch.optim.Adam(self.parameters(), lr=self.hparams.lr)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function PhysicsModel.configure_optimizers refactored with the following changes:

@LemurPwned LemurPwned merged commit fdd7614 into master Oct 27, 2023
@LemurPwned LemurPwned deleted the sourcery/master branch December 27, 2023 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant