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

🧹 Chore: Why can't tm2py just use Emme's Python environment? #123

Open
3 tasks
DavidOry opened this issue Aug 23, 2023 · 2 comments
Open
3 tasks

🧹 Chore: Why can't tm2py just use Emme's Python environment? #123

DavidOry opened this issue Aug 23, 2023 · 2 comments
Assignees
Labels
chore overhead: doesn't add additional functionality, change performance, or refactor code

Comments

@DavidOry
Copy link
Collaborator

At some point in the development, we decided to create a single Python environment that can accommodate Lasso and tm2py. This has proven problematic, as the two packages need substantively different Python environments.

Because Lasso is only used to create the network, it does not need to have the same Python environment as tm2py. It can be run by itself.

But there are other aspects of tm2py that need newer versions of the Python spatial libraries than are distributed in Emme. What are they and can we accomplish them some other way to just use the version of Python distributed in Emme?

Progress:

  • Sufficiently defined
  • Approach decided
  • Implemented

Once we determine what these functions are, we can use this space to discuss them.

fyi @lmz, @gregerhardt

@DavidOry DavidOry added the chore overhead: doesn't add additional functionality, change performance, or refactor code label Aug 23, 2023
@i-am-sijia
Copy link
Collaborator

Quick comment: transit_network.py uses shapely.

import shapely.geometry as _geom

def bounding_rect(shape):
if shape.bounds:
x_min, y_min, x_max, y_max = shape.bounds
return _geom.Polygon(
[(x_min, y_max), (x_max, y_max), (x_max, y_min), (x_min, y_min)]
)
return _geom.Point()
for fs_index, fs_data in enumerate(faresystems.values()):
stops = set([])
for line in fs_data["LINES"]:
for stop in line.segments(True):
if stop.allow_alightings or stop.allow_boardings:
stops.add(stop.i_node)
fs_data["shape"] = _geom.MultiPoint([(stop.x, stop.y) for stop in stops])
# fs_data["bounding_rect"] = bounding_rect(fs_data["shape"])
fs_data["NUM STOPS"] = len(fs_data["shape"])
fs_data["FS_INDEX"] = fs_index

@DavidOry
Copy link
Collaborator Author

I suggest the next time Emme upgrades Python versions, which should be soon given 3.7's age, we should move tm2py to only use the Emme distribution. It's likely things like this that are more convenient to do with newer libraries, but can still be accomplished with older libraries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore overhead: doesn't add additional functionality, change performance, or refactor code
Projects
None yet
Development

No branches or pull requests

3 participants