Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@santisoler
Copy link
Member

Summary

Remove F811 from list of ignored flake warnings in .flake8. Remove redefinitions of variables.

PR Checklist

  • If this is a work in progress PR, set as a Draft PR
  • Linted my code according to the style guides.
  • Added tests to verify changes to the code.
  • Added necessary documentation to any new functions/classes following the
    expect style.
  • Added relevant method tags (i.e. GRAV, EM, etc.)
  • Marked as ready for review (ff this is was a draft PR), and converted
    to a Pull Request
  • Tagged @simpeg/simpeg-developers when ready for review.

Reference issue

What does this implement/fix?

Additional information

Remove F811 from list of ignored flake warnings in `.flake8`. Remove
redefinitions of variables.
@santisoler
Copy link
Member Author

There are two unfixed warnings that I left because they are not trivial to solve.

The first one is on SimPEG/electromagnetics/time_domain/simulation.py, where getRHSDeriv is redefined:

def getRHSDeriv(self, tInd, src, v, adjoint=False):
C = self.mesh.edge_curl
s_m, s_e = src.eval(self, self.times[tInd])
if adjoint is True:
return self.MfRhoDeriv(s_e, C * v, adjoint)
# assumes no source derivs
return C.T * self.MfRhoDeriv(s_e, v, adjoint)
def getRHSDeriv(self, tInd, src, v, adjoint=False):
return Zero() # assumes no derivs on sources

The second one is on tests/em/tdem/test_TDEM_DerivAdjoint.py, with test_Jvec_adjoint_b_ey. In the first definition, it uses the "ElectricFieldy":

def test_Jvec_adjoint_b_ey(self):
self.JvecVsJtvecTest("ElectricFieldy")

while in the redefinition is uses "CurrentDensity":

def test_Jvec_adjoint_b_ey(self):
self.JvecVsJtvecTest("CurrentDensityy")

@lheagy maybe you could provide some insight here.

@jcapriot
Copy link
Member

jcapriot commented Jun 20, 2023

There are two unfixed warnings that I left because they are not trivial to solve.

The first one is on SimPEG/electromagnetics/time_domain/simulation.py, where getRHSDeriv is redefined:

def getRHSDeriv(self, tInd, src, v, adjoint=False):
C = self.mesh.edge_curl
s_m, s_e = src.eval(self, self.times[tInd])
if adjoint is True:
return self.MfRhoDeriv(s_e, C * v, adjoint)
# assumes no source derivs
return C.T * self.MfRhoDeriv(s_e, v, adjoint)
def getRHSDeriv(self, tInd, src, v, adjoint=False):
return Zero() # assumes no derivs on sources

The second one is on tests/em/tdem/test_TDEM_DerivAdjoint.py, with test_Jvec_adjoint_b_ey. In the first definition, it uses the "ElectricFieldy":

def test_Jvec_adjoint_b_ey(self):
self.JvecVsJtvecTest("ElectricFieldy")

while in the redefinition is uses "CurrentDensity":

def test_Jvec_adjoint_b_ey(self):
self.JvecVsJtvecTest("CurrentDensityy")

@lheagy maybe you could provide some insight here.

I actually think the first one might be the reason that the magnetic field source derivative tests are failing... #1233

as far as the second one, I believe it should be renamed to ..._jy instead of ..._ey

@santisoler
Copy link
Member Author

Thanks @jcapriot! I'm just keeping the record that the first case was fixed in 501aa0f

I've just pushed the change to fix the other one with your suggestion (which actually makes sense).

@codecov
Copy link

codecov bot commented Jun 22, 2023

Codecov Report

Merging #1248 (41f98df) into main (9e08237) will increase coverage by 0.00%.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main    #1248   +/-   ##
=======================================
  Coverage   82.31%   82.31%           
=======================================
  Files         164      164           
  Lines       24965    24961    -4     
=======================================
- Hits        20549    20546    -3     
+ Misses       4416     4415    -1     
Impacted Files Coverage Δ
...lectromagnetics/natural_source/utils/data_utils.py 10.90% <ø> (ø)
SimPEG/fields.py 96.87% <ø> (+0.39%) ⬆️
SimPEG/regularization/__init__.py 95.00% <ø> (-0.13%) ⬇️

@jcapriot jcapriot merged commit 67e2f76 into simpeg:main Jun 23, 2023
@santisoler santisoler deleted the flake8-redefinitions branch June 23, 2023 16:29
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.

2 participants