Skip to content

Br/add more field lines#226

Merged
Didou09 merged 24 commits intodevelfrom
br/add_more_field_lines
Nov 20, 2019
Merged

Br/add more field lines#226
Didou09 merged 24 commits intodevelfrom
br/add_more_field_lines

Conversation

@jmoralesFusion
Copy link
Copy Markdown
Collaborator

It will not pass pep8 sorry I will modify next week

@pep8speaks
Copy link
Copy Markdown

pep8speaks commented Oct 31, 2019

Hello @jmoralesFusion! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 15:5: E265 block comment should start with '# '
Line 16:80: E501 line too long (86 > 79 characters)
Line 17:5: E265 block comment should start with '# '
Line 31:62: E502 the backslash is redundant between brackets
Line 32:13: E128 continuation line under-indented for visual indent
Line 32:80: E501 line too long (80 > 79 characters)
Line 32:80: E502 the backslash is redundant between brackets
Line 39:80: E501 line too long (80 > 79 characters)
Line 59:29: E127 continuation line over-indented for visual indent
Line 63:65: E502 the backslash is redundant between brackets
Line 68:69: E502 the backslash is redundant between brackets
Line 69:55: E502 the backslash is redundant between brackets
Line 72:80: E501 line too long (84 > 79 characters)
Line 73:80: E501 line too long (84 > 79 characters)
Line 79:44: E502 the backslash is redundant between brackets
Line 80:13: E128 continuation line under-indented for visual indent
Line 80:70: E502 the backslash is redundant between brackets
Line 81:13: E128 continuation line under-indented for visual indent
Line 90:5: E265 block comment should start with '# '
Line 93:5: E265 block comment should start with '# '
Line 94:5: E265 block comment should start with '# '
Line 97:5: E265 block comment should start with '# '
Line 98:80: E501 line too long (80 > 79 characters)
Line 101:5: E265 block comment should start with '# '
Line 103:5: E265 block comment should start with '# '
Line 103:80: E501 line too long (81 > 79 characters)
Line 104:5: E265 block comment should start with '# '
Line 104:80: E501 line too long (80 > 79 characters)
Line 105:5: E265 block comment should start with '# '
Line 105:80: E501 line too long (86 > 79 characters)
Line 106:5: E265 block comment should start with '# '
Line 107:5: E265 block comment should start with '# '
Line 108:5: E265 block comment should start with '# '
Line 109:5: E265 block comment should start with '# '
Line 109:80: E501 line too long (88 > 79 characters)
Line 110:5: E265 block comment should start with '# '
Line 112:5: E265 block comment should start with '# '
Line 113:5: E265 block comment should start with '# '
Line 114:5: E265 block comment should start with '# '
Line 115:5: E265 block comment should start with '# '
Line 117:5: E265 block comment should start with '# '
Line 118:5: E265 block comment should start with '# '
Line 119:5: E265 block comment should start with '# '
Line 120:5: E265 block comment should start with '# '
Line 124:71: E502 the backslash is redundant between brackets
Line 125:71: E502 the backslash is redundant between brackets
Line 127:74: E502 the backslash is redundant between brackets
Line 128:74: E502 the backslash is redundant between brackets
Line 136:5: E265 block comment should start with '# '
Line 137:5: E265 block comment should start with '# '
Line 138:5: E265 block comment should start with '# '
Line 139:5: E265 block comment should start with '# '
Line 140:5: E265 block comment should start with '# '
Line 141:5: E265 block comment should start with '# '
Line 143:5: E265 block comment should start with '# '
Line 144:5: E265 block comment should start with '# '
Line 146:5: E265 block comment should start with '# '
Line 147:5: E265 block comment should start with '# '
Line 149:5: E265 block comment should start with '# '
Line 150:5: E265 block comment should start with '# '
Line 152:5: E265 block comment should start with '# '
Line 153:5: E265 block comment should start with '# '
Line 154:5: E265 block comment should start with '# '
Line 155:5: E265 block comment should start with '# '
Line 156:5: E265 block comment should start with '# '
Line 157:80: E501 line too long (83 > 79 characters)
Line 161:56: E502 the backslash is redundant between brackets
Line 162:13: E128 continuation line under-indented for visual indent
Line 162:70: E502 the backslash is redundant between brackets
Line 163:13: E128 continuation line under-indented for visual indent
Line 167:5: E265 block comment should start with '# '
Line 171:80: E501 line too long (81 > 79 characters)
Line 174:71: E502 the backslash is redundant between brackets
Line 175:71: E502 the backslash is redundant between brackets
Line 177:74: E502 the backslash is redundant between brackets
Line 178:74: E502 the backslash is redundant between brackets
Line 185:56: E502 the backslash is redundant between brackets
Line 186:13: E128 continuation line under-indented for visual indent
Line 186:70: E502 the backslash is redundant between brackets
Line 187:13: E128 continuation line under-indented for visual indent
Line 190:5: E265 block comment should start with '# '
Line 193:80: E501 line too long (81 > 79 characters)
Line 197:71: E502 the backslash is redundant between brackets
Line 198:71: E502 the backslash is redundant between brackets
Line 200:74: E502 the backslash is redundant between brackets
Line 201:74: E502 the backslash is redundant between brackets
Line 208:51: E502 the backslash is redundant between brackets
Line 209:13: E128 continuation line under-indented for visual indent
Line 209:70: E502 the backslash is redundant between brackets
Line 210:13: E128 continuation line under-indented for visual indent
Line 214:5: E265 block comment should start with '# '
Line 221:71: E502 the backslash is redundant between brackets
Line 222:71: E502 the backslash is redundant between brackets
Line 224:74: E502 the backslash is redundant between brackets
Line 225:74: E502 the backslash is redundant between brackets
Line 232:80: E501 line too long (100 > 79 characters)
Line 236:5: E265 block comment should start with '# '
Line 237:5: E265 block comment should start with '# '
Line 240:5: E265 block comment should start with '# '
Line 243:5: E265 block comment should start with '# '
Line 246:5: E265 block comment should start with '# '
Line 247:5: E265 block comment should start with '# '
Line 248:5: E265 block comment should start with '# '
Line 249:5: E265 block comment should start with '# '
Line 252:50: E502 the backslash is redundant between brackets
Line 253:13: E128 continuation line under-indented for visual indent
Line 253:70: E502 the backslash is redundant between brackets
Line 254:13: E128 continuation line under-indented for visual indent
Line 258:5: E265 block comment should start with '# '
Line 265:71: E502 the backslash is redundant between brackets
Line 266:71: E502 the backslash is redundant between brackets
Line 268:74: E502 the backslash is redundant between brackets
Line 269:74: E502 the backslash is redundant between brackets
Line 276:49: E502 the backslash is redundant between brackets
Line 277:13: E128 continuation line under-indented for visual indent
Line 277:70: E502 the backslash is redundant between brackets
Line 278:13: E128 continuation line under-indented for visual indent
Line 289:71: E502 the backslash is redundant between brackets
Line 290:71: E502 the backslash is redundant between brackets
Line 292:74: E502 the backslash is redundant between brackets
Line 293:74: E502 the backslash is redundant between brackets

Line 7:61: E502 the backslash is redundant between brackets
Line 14:5: E265 block comment should start with '# '
Line 15:80: E501 line too long (86 > 79 characters)
Line 16:5: E265 block comment should start with '# '
Line 17:5: E265 block comment should start with '# '

Line 17:5: E265 block comment should start with '# '
Line 18:80: E501 line too long (86 > 79 characters)
Line 19:5: E265 block comment should start with '# '
Line 24:5: E265 block comment should start with '# '
Line 25:5: E265 block comment should start with '# '
Line 27:9: E221 multiple spaces before operator
Line 36:11: E221 multiple spaces before operator
Line 37:9: E221 multiple spaces before operator
Line 38:9: E221 multiple spaces before operator
Line 57:29: E127 continuation line over-indented for visual indent
Line 60:80: E501 line too long (84 > 79 characters)
Line 61:80: E501 line too long (84 > 79 characters)
Line 71:44: E502 the backslash is redundant between brackets
Line 72:13: E128 continuation line under-indented for visual indent
Line 72:41: E502 the backslash is redundant between brackets
Line 73:13: E128 continuation line under-indented for visual indent
Line 82:48: E502 the backslash is redundant between brackets
Line 83:18: E128 continuation line under-indented for visual indent
Line 83:46: E502 the backslash is redundant between brackets
Line 84:18: E128 continuation line under-indented for visual indent
Line 92:80: E501 line too long (81 > 79 characters)
Line 93:44: E502 the backslash is redundant between brackets
Line 94:17: E127 continuation line over-indented for visual indent
Line 96:19: E127 continuation line over-indented for visual indent
Line 98:45: E502 the backslash is redundant between brackets
Line 99:18: E128 continuation line under-indented for visual indent
Line 106:66: E502 the backslash is redundant between brackets
Line 107:22: E127 continuation line over-indented for visual indent
Line 109:9: E265 block comment should start with '# '
Line 125:80: E501 line too long (85 > 79 characters)
Line 126:80: E501 line too long (99 > 79 characters)
Line 131:55: E502 the backslash is redundant between brackets
Line 132:62: E502 the backslash is redundant between brackets
Line 134:59: E502 the backslash is redundant between brackets
Line 135:72: E502 the backslash is redundant between brackets
Line 150:9: E221 multiple spaces before operator
Line 151:9: E221 multiple spaces before operator
Line 155:44: E502 the backslash is redundant between brackets
Line 156:13: E128 continuation line under-indented for visual indent
Line 156:41: E502 the backslash is redundant between brackets
Line 157:13: E128 continuation line under-indented for visual indent
Line 166:48: E502 the backslash is redundant between brackets
Line 167:18: E128 continuation line under-indented for visual indent
Line 167:46: E502 the backslash is redundant between brackets
Line 168:18: E128 continuation line under-indented for visual indent
Line 177:36: E502 the backslash is redundant between brackets
Line 178:7: E128 continuation line under-indented for visual indent
Line 178:59: E502 the backslash is redundant between brackets
Line 180:40: E502 the backslash is redundant between brackets
Line 181:7: E128 continuation line under-indented for visual indent
Line 181:69: E502 the backslash is redundant between brackets
Line 187:55: E502 the backslash is redundant between brackets
Line 188:64: E502 the backslash is redundant between brackets
Line 190:59: E502 the backslash is redundant between brackets
Line 191:74: E502 the backslash is redundant between brackets
Line 201:44: E502 the backslash is redundant between brackets
Line 202:13: E128 continuation line under-indented for visual indent
Line 202:70: E502 the backslash is redundant between brackets
Line 203:13: E128 continuation line under-indented for visual indent
Line 208:80: E501 line too long (80 > 79 characters)
Line 213:71: E502 the backslash is redundant between brackets
Line 214:71: E502 the backslash is redundant between brackets
Line 216:74: E502 the backslash is redundant between brackets
Line 217:74: E502 the backslash is redundant between brackets
Line 226:9: E221 multiple spaces before operator
Line 227:9: E221 multiple spaces before operator
Line 231:44: E502 the backslash is redundant between brackets
Line 232:13: E128 continuation line under-indented for visual indent
Line 232:41: E502 the backslash is redundant between brackets
Line 233:13: E128 continuation line under-indented for visual indent
Line 242:48: E502 the backslash is redundant between brackets
Line 243:18: E128 continuation line under-indented for visual indent
Line 243:46: E502 the backslash is redundant between brackets
Line 244:18: E128 continuation line under-indented for visual indent
Line 253:36: E502 the backslash is redundant between brackets
Line 254:7: E128 continuation line under-indented for visual indent
Line 254:56: E502 the backslash is redundant between brackets
Line 256:40: E502 the backslash is redundant between brackets
Line 257:7: E128 continuation line under-indented for visual indent
Line 257:66: E502 the backslash is redundant between brackets
Line 264:55: E502 the backslash is redundant between brackets
Line 265:61: E502 the backslash is redundant between brackets
Line 267:59: E502 the backslash is redundant between brackets
Line 268:71: E502 the backslash is redundant between brackets
Line 276:44: E502 the backslash is redundant between brackets
Line 277:13: E128 continuation line under-indented for visual indent
Line 277:70: E502 the backslash is redundant between brackets
Line 278:13: E128 continuation line under-indented for visual indent
Line 283:80: E501 line too long (80 > 79 characters)
Line 288:71: E502 the backslash is redundant between brackets
Line 289:71: E502 the backslash is redundant between brackets
Line 291:74: E502 the backslash is redundant between brackets
Line 292:74: E502 the backslash is redundant between brackets
Line 301:9: E221 multiple spaces before operator
Line 302:9: E221 multiple spaces before operator
Line 306:44: E502 the backslash is redundant between brackets
Line 307:13: E128 continuation line under-indented for visual indent
Line 307:41: E502 the backslash is redundant between brackets
Line 308:13: E128 continuation line under-indented for visual indent
Line 317:48: E502 the backslash is redundant between brackets
Line 318:18: E128 continuation line under-indented for visual indent
Line 318:46: E502 the backslash is redundant between brackets
Line 319:18: E128 continuation line under-indented for visual indent
Line 328:36: E502 the backslash is redundant between brackets
Line 329:7: E128 continuation line under-indented for visual indent
Line 329:56: E502 the backslash is redundant between brackets
Line 331:40: E502 the backslash is redundant between brackets
Line 332:7: E128 continuation line under-indented for visual indent
Line 332:66: E502 the backslash is redundant between brackets
Line 339:55: E502 the backslash is redundant between brackets
Line 340:61: E502 the backslash is redundant between brackets
Line 342:59: E502 the backslash is redundant between brackets
Line 343:71: E502 the backslash is redundant between brackets
Line 351:44: E502 the backslash is redundant between brackets
Line 352:13: E128 continuation line under-indented for visual indent
Line 352:70: E502 the backslash is redundant between brackets
Line 353:13: E128 continuation line under-indented for visual indent
Line 358:80: E501 line too long (80 > 79 characters)
Line 363:71: E502 the backslash is redundant between brackets
Line 364:71: E502 the backslash is redundant between brackets
Line 366:74: E502 the backslash is redundant between brackets
Line 367:74: E502 the backslash is redundant between brackets
Line 376:9: E221 multiple spaces before operator
Line 377:9: E221 multiple spaces before operator
Line 381:44: E502 the backslash is redundant between brackets
Line 382:13: E128 continuation line under-indented for visual indent
Line 382:41: E502 the backslash is redundant between brackets
Line 383:13: E128 continuation line under-indented for visual indent
Line 392:48: E502 the backslash is redundant between brackets
Line 393:18: E128 continuation line under-indented for visual indent
Line 393:46: E502 the backslash is redundant between brackets
Line 394:18: E128 continuation line under-indented for visual indent
Line 403:36: E502 the backslash is redundant between brackets
Line 404:7: E128 continuation line under-indented for visual indent
Line 404:58: E502 the backslash is redundant between brackets
Line 406:40: E502 the backslash is redundant between brackets
Line 407:7: E128 continuation line under-indented for visual indent
Line 407:68: E502 the backslash is redundant between brackets
Line 414:55: E502 the backslash is redundant between brackets
Line 415:63: E502 the backslash is redundant between brackets
Line 417:59: E502 the backslash is redundant between brackets
Line 418:73: E502 the backslash is redundant between brackets
Line 426:44: E502 the backslash is redundant between brackets
Line 427:13: E128 continuation line under-indented for visual indent
Line 427:70: E502 the backslash is redundant between brackets
Line 428:13: E128 continuation line under-indented for visual indent
Line 433:80: E501 line too long (80 > 79 characters)
Line 438:71: E502 the backslash is redundant between brackets
Line 439:71: E502 the backslash is redundant between brackets
Line 441:74: E502 the backslash is redundant between brackets
Line 442:74: E502 the backslash is redundant between brackets

Comment last updated at 2019-11-20 08:38:52 UTC

@Didou09
Copy link
Copy Markdown
Member

Didou09 commented Nov 4, 2019

Thanks @jmoralesFusion for this PR,
before we validate, can you just take the time to address the PEP8 compliance (we are trying to get tofu gradually uniformized in terms of coding style and conventions). A bit cumbersome the first few times but then we'll all get the good practices :-)

@Didou09
Copy link
Copy Markdown
Member

Didou09 commented Nov 4, 2019

The units tests are all passing for python 3.6, which is sufficient because we'll drop python 2.7 from now, so it's fine

@Didou09 Didou09 self-assigned this Nov 4, 2019
Comment thread tofu/utils.py Outdated
if t is None:
t = np.r_[38]
# Get time in the middle of equilibrium time interval
t = equi.ddata['equilibrium.t']['data'][int(0.5*equi.ddata['equilibrium.t']['data'].size)]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

good idea

Copy link
Copy Markdown
Member

@Didou09 Didou09 left a comment

Choose a reason for hiding this comment

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

See comments, but mostly:

  • Please restore the original system path
  • please just confirm I have properly understood the changes where commented

And then we'll be all set :-)

Comment thread tofu/utils.py
r_init = [equi_r_ext]*nbr_init
phi_init = [ii*2.*np.pi/nbr_init for ii in range(nbr_init)]
z_init = [equi_z_r_ext]*nbr_init
init_plt = [r_init, phi_init, z_init]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

so if I understand correctly, the starting points are all in the equatorial plane at theta=0 (outer R of separatrix) but shifted toroidally (phi), right ?

Comment thread tofu/utils.py
refpt = np.r_[2.4,0.]
dax = config.plot_phithetaproj_dist(refpt)

if init is not None:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

So I understand that this is the user-provided initial points, right ?

Comment thread tofu/mag/test_magFieldLines.py Outdated
import sys

#print('path 1 =', sys.path)
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please make sure any change to the system path is exceptional and temporary
The system path should not be changed without the user knowing, unless it is temporary (i.e.: only in for a limited time inside the file)

=> please restore the original system path as soon as possible after the tests are run

=> Actually, this is not necessary, all unit tests should be placed in tofu/tests/

=> Temporary fix: restore original system path in the file, I validate the PR, then we open a new issue to move all unit tests to the proper repo (we will create a dedicated tofu/tests/tests09_mag/ repo, and get the template from other unit tests

Comment on lines +2 to +3
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
# Also if needed: retab
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

seems like this is specific to your vim config, and not necessary to add ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Agreed, anything specific to a contributor's working environment shall be removed

Comment thread tofu/mag/test_magFieldLines.py Outdated
#import mag
from mag import magFieldLines

doctest.testmod(magFieldLines, verbose=True)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Not sure how @Didou09 sees this, but... I feel like this test should probably be moved to the tests directory?
Whatever the solution chosen, it should take into account that we are going to get rid of nose.
See #232

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As commented in the review, I suggest:

  • Step 1: minimize changes to system path and restore original system path before the end of the tests, I think we can validate the PR from there
  • Step 2: Move the unit tests to a dedicated repo in tofu/tests (create a dedicated issue and PR)
  • Step 3: move from nose to something else (see issue Moving on from nosetests... #232, but we are not there yet)

Comment thread tofuplot.py
parser.add_argument('-t0', '--t0', type=str, required=False,
help='Reference time event setting t = 0', default=_T0)
parser.add_argument('-t', '--t', type=float, required=False,
help='Input time when needed')
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@Didou09 seems like replacing renaming a flag that you used to be used for something else, and adding a new one (type) for the old one (tokamak), can lead to confusion. Could the long flag for the time could be at least --time, or even better --input-time?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Discussed together, name flag -tok (short version) is actually probably better for --tokamak and -t for time is also more intuitive.
So it's fine for me.

The question on the long version (i.e.: --t vs --time) remains, I'm not sure what to think, because updating to --time would also require updating the corresponding keyword argument of the python function.

I suggest : leave it as is (--t) for now, and we'll see later if users mention any issue / ambiguity with that

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

fine by me :)

@codecov-io
Copy link
Copy Markdown

codecov-io commented Nov 4, 2019

Codecov Report

Merging #226 into devel will decrease coverage by 0.2%.
The diff coverage is 0.39%.

Impacted file tree graph

@@            Coverage Diff            @@
##            devel    #226      +/-   ##
=========================================
- Coverage   43.91%   43.7%   -0.21%     
=========================================
  Files          74      75       +1     
  Lines       21523   21624     +101     
=========================================
  Hits         9451    9451              
- Misses      12072   12173     +101
Impacted Files Coverage Δ
tofu/geom/_plot.py 65.09% <0%> (-0.28%) ⬇️
tofu/utils.py 48% <0%> (-0.77%) ⬇️
tofu/mag/equimap.py 0% <0%> (ø) ⬆️
tofu/mag/mag_ripple/__init__.py 0% <0%> (ø) ⬆️
tofu/mag/test_magFieldLines.py 0% <0%> (ø)
tofu/mag/test_ripple.py 0% <0%> (ø) ⬆️
tofu/mag/magFieldLines.py 0% <0%> (ø) ⬆️
tofu/mag/test_equimap.py 0% <0%> (ø) ⬆️
tofu/version.py 100% <100%> (ø) ⬆️
tofu/geom/_core.py 63.46% <33.33%> (ø) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 78c221f...d739927. Read the comment docs.

Comment thread tofuplot.py
parser.add_argument('-t0', '--t0', type=str, required=False,
help='Reference time event setting t = 0', default=_T0)
parser.add_argument('-t', '--t', type=float, required=False,
help='Input time when needed')
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

fine by me :)

@jmoralesFusion
Copy link
Copy Markdown
Collaborator Author

Hello pep8 now ok except for test files but they will be removed for a test folder when test package will be chosen. And for the _core.py file I didn't touch it so pep8speaks bug?
Hope everything is fine for an alpha release.

@Didou09 Didou09 requested a review from lasofivec November 7, 2019 11:42
@Didou09 Didou09 merged commit cb9992f into devel Nov 20, 2019
@Didou09
Copy link
Copy Markdown
Member

Didou09 commented Nov 20, 2019

Fixes in devel Issue #235

@Didou09 Didou09 deleted the br/add_more_field_lines branch November 22, 2019 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants