Skip to content

Commit

Permalink
Resolving ruff code style errors (#57)
Browse files Browse the repository at this point in the history
* fix markdown linter errors

* spelling fixes

* ruff linting for fetch_od.py

* lint the osm_parser.py script

* lint graphtool.py

* lint optimization.py

* lint network_clean.py

* lint load_osm.py

* lint fetch_pois.py

* lint core.py

* have ruff skip __init__.py

* lint calculate_od_raw.py

* finish linting calculate_od_raw.py

* lint tutorials/step 1

* fix ogr import

* add osgeo requirement to support ogr import

* change to support import ogr

* add boltons to req dependencies

* add geopy to req dependencies
  • Loading branch information
elbeejay authored Feb 20, 2024
1 parent 7c81d50 commit b0763ce
Show file tree
Hide file tree
Showing 11 changed files with 203 additions and 162 deletions.
6 changes: 3 additions & 3 deletions Tutorials/Step 1 - Extract From OSM.ipynb

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ dependencies = [
"rtree>=0.9.3",
"scipy",
"shapely",
"boltons",
"geopy"
]

[project.optional-dependencies]
Expand All @@ -55,3 +57,6 @@ ignore-words-list = "gost,nd,ans,chck,lenth"

[tool.ruff.pydocstyle]
convention = "numpy"

[tool.ruff]
exclude = ["__init__.py"]
11 changes: 7 additions & 4 deletions src/GOSTnets/calculate_od_raw.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,18 @@ def calculate_gravity(

od_df = pd.DataFrame(od)

for dist_decay in decayVals:
decayFunction = lambda x: np.exp(-1 * dist_decay * x)
def decayFunction(x, decay):
return np.exp(-1 * decay * x)

summedVals = np.sum(decayFunction(od_df) * dWeight, axis=1) * oWeight
for dist_decay in decayVals:
summedVals = (
np.sum(decayFunction(od_df, dist_decay) * dWeight, axis=1) * oWeight
)

allRes.append(summedVals)

res = pd.DataFrame(allRes).transpose()
res.columns = columns = ["d_%s" % d for d in decayVals]
res.columns = ["d_%s" % d for d in decayVals]

return res

Expand Down
Loading

0 comments on commit b0763ce

Please sign in to comment.