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

Some suggestions #101

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

mkamyab
Copy link

@mkamyab mkamyab commented Feb 16, 2022

While going over the code I edited some part of the code and thought it would be useful to share it with you.
I'm adding comments throughout the code to explain reasons for the suggestions.

.gitignore Show resolved Hide resolved
{
Copy link
Author

Choose a reason for hiding this comment

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

It is easier to read through if it is formatted properly in JSON form.

Comment on lines +1 to -9
import os

import numpy as np
from numpy import sin, cos, tan, pi, sqrt
from numpy.core.defchararray import index
import yaml
import os

from collections import OrderedDict
# import imp
from numpy import sin, cos, tan, pi, sqrt

# import welleng.error
Copy link
Author

Choose a reason for hiding this comment

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

  • Sorted the imports
  • Removed from numpy.core.defchararray import index since it wasn't used in the file.

mag_defaults={
'b_total': 50_000.,
'dip': 70.,
'declination': 0.,
},
mag_defaults=None,
Copy link
Author

Choose a reason for hiding this comment

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

Initialization of function arguments to mutable objects is not recommended in python. Check "Using mutable objects as default argument values in python" of this page.

@@ -444,8 +448,10 @@ def _get_azi_mag_and_true_deg(self):
def _get_radius(self, radius=None):
if radius is None:
self.radius = np.full_like(self.md.astype(float), 0.3048)

Copy link
Author

@mkamyab mkamyab Feb 16, 2022

Choose a reason for hiding this comment

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

It is advisable to put an extra line after the if clause.

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