RunningTrainsPlot
为研究人员与工程技术人员提供的可扩展、可交互的铁路可视化工具。
注意: 本项目之前名为"RailwayTrainsVisualization",现已更名为"RunningTrainsPlot"以提供更简洁的名称。如果您之前使用的是旧版本,请使用新名称重新安装。
功能特点
- 列流图 (Column Flow Chart):铁路线路流量可视化
- 速度曲线 (Speed Curve):列车速度-距离/时间曲线可视化
- 循环运行图 (Cyclic Diagram):列车循环运行图可视化
- 股道占用图 (Track Occupation):列车股道占用可视化
- 客流OD图 (Passenger Flow OD Chart):站点间客流可视化
- 工具函数:数据加载、预处理和可视化工具
安装与更新
初次安装
pip install RunningTrainsPlot
更新到最新版本
pip install --upgrade RunningTrainsPlot
注意:只有在发布新版本后才需要使用--upgrade选项更新。可以通过
from RunningTrainsPlot import __version__; print(__version__)检查当前版本。
验证安装
安装完成后可运行以下简单测试验证功能:
import pandas as pd
import matplotlib.pyplot as plt
from datetime import datetime, timedelta
# 检查版本
from RunningTrainsPlot import __version__
print(f"当前版本: {__version__}")
# 导入所有模块
from RunningTrainsPlot import passenger_flow, column_flow, speed_curve
from RunningTrainsPlot import cyclic_diagram, track_occupation
# 测试股道占用图
base_time = datetime(2023, 1, 1, 8, 0)
data = pd.DataFrame({
'train_id': ['G201', 'D101', 'K105'],
'track': ['1股道', '2股道', '3股道'],
'arrival_time': [
base_time,
base_time + timedelta(hours=1),
base_time + timedelta(hours=2)
],
'departure_time': [
base_time + timedelta(hours=0.5),
base_time + timedelta(hours=2),
base_time + timedelta(hours=3)
]
})
# 创建股道占用图
fig, ax = track_occupation.plot_track_occupation(
data,
title='股道占用图测试',
figsize=(10, 6)
)
plt.show()
使用指南
列流图
from RunningTrainsPlot import column_flow
# 加载数据
stations, flows = column_flow.load_flow_data("stations.csv", "flows.csv")
# 绘制图表
column_flow.plot_column_flow(stations, flows)
速度曲线
from RunningTrainsPlot import speed_curve
# 加载数据
data = speed_curve.load_speed_data("speed_data.csv")
# 绘制速度-距离曲线
speed_curve.plot_speed_curve(data, x_col='distance', y_col='speed')
# 绘制速度-时间曲线
speed_curve.plot_speed_curve(data, x_col='time', y_col='speed')
# 同时绘制两种曲线
speed_curve.plot_speed_distance_time(data)
循环运行图
from RunningTrainsPlot import cyclic_diagram
# 加载数据
data = cyclic_diagram.load_data("cycle_data.csv")
# 绘制图表
cyclic_diagram.plot_cyclic_diagram(data)
股道占用图
from RunningTrainsPlot import track_occupation
# 加载数据
data = track_occupation.load_track_data("track_data.csv")
# 绘制股道占用图
track_occupation.plot_track_occupation(data)
客流OD图表
from RunningTrainsPlot import passenger_flow
# 加载数据
data = passenger_flow.load_data("passenger_data.csv")
# 绘制图表
passenger_flow.plot_passenger_flow(data)
数据工具
from RunningTrainsPlot import utils
# 加载数据
data = utils.load_data("data.csv")
# 预处理数据
processed_data = utils.preprocess_data(data)
版本历史
- 1.0.0 - 初始版本,从RailwayTrainsVisualization更名而来
- 1.0.1 - 新增原生循环运行图(cyclic_diagram)实现,不再依赖外部包
作者
- ZeyuShen sc22zs2@leeds.ac.uk
许可证
MIT
Metadata
Release files for RunningTrainsPlot 1.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| runningtrainsplot-1.0.7.tar.gz | 15.2 kB | Without provenance | Details for runningtrainsplot-1.0.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| runningtrainsplot-1.0.7-py3-none-any.whl | Python 3 | none | any | Details for runningtrainsplot-1.0.7-py3-none-any.whl |
Total release size: 33.8 kB
Release files / runningtrainsplot-1.0.7.tar.gz
| Download URL | runningtrainsplot-1.0.7.tar.gz |
|---|---|
| Size | 15.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1190b8eda1faef998cc3167952282399c4b9053fbb7853311d975251038df328
|
|
BLAKE2b-256 checksum How to use checksums |
02ed23cb262726e3a7b4a7d52a02491d74197c0e49461282bed82bd13f3bc317
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.1
|
Release files / runningtrainsplot-1.0.7-py3-none-any.whl
| Download URL | runningtrainsplot-1.0.7-py3-none-any.whl |
|---|---|
| Size | 18.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8fd71c7c1c83e98cf45abdc42be1545afb6bf6801bf1af37b957611e0c978d10
|
|
BLAKE2b-256 checksum How to use checksums |
7a1ab57577114c1a1ec5835482f97bbf16bdeb42395fa8bad726645859ab7a34
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.1
|
Security for RunningTrainsPlot 1.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.