Skip to content

Commit

Permalink
Merge pull request #66 from ni1o1/0.4.16
Browse files Browse the repository at this point in the history
0.4.16
  • Loading branch information
ni1o1 committed Nov 16, 2022
2 parents 4546c0f + 32a4a93 commit 959334c
Show file tree
Hide file tree
Showing 29 changed files with 522 additions and 627 deletions.
3 changes: 2 additions & 1 deletion docs/source/CoordinatesConverter.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ Coordinates and Distances


.. autosummary::

:toctree: api/

gcj02tobd09
gcj02towgs84
wgs84togcj02
Expand Down
121 changes: 121 additions & 0 deletions docs/source/activity.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
.. currentmodule:: transbigdata

******************************
Activity
******************************

Constructor
-----------
.. autosummary::
:toctree: api/

plot_activity
entropy
entropy_rate
ellipse_params
ellipse_plot


Activity plot
----------------------------------------------------

.. autofunction:: plot_activity

Entropy
----------------------------------------------------

.. autofunction:: entropy

.. autofunction:: entropy_rate


Confidence ellipse
----------------------------------------------------

.. autofunction:: ellipse_params


.. autofunction:: ellipse_plot


用法
================================================

::

import pandas as pd
import transbigdata as tbd
import numpy as np
#生成测试用数据
data = np.random.uniform(1,10,(100,2))
data[:,1:] = 0.5*data[:,0:1]+np.random.uniform(-2,2,(100,1))
data = pd.DataFrame(data,columns = ['x','y'])
#绘制数据分布
import matplotlib.pyplot as plt
plt.figure(1,(5,5))
#绘制数据点
plt.scatter(data['x'],data['y'],s = 0.5)
#绘制坐标轴
plt.plot([-10,10],[0,0],c = 'k')
plt.plot([0,0],[-10,10],c = 'k')
plt.xlim(-15,15)
plt.ylim(-15,15)
plt.show()



.. image:: gisprocess/output_1_0.png

输入数据与xy坐标所在列名,置信度,估计椭圆参数
分别代表[中心点坐标,短轴,长轴,角度,面积,扁率

::

ellip_params = tbd.ellipse_params(data,confidence=95,col = ['x','y'])
ellip_params


.. parsed-literal::
[array([5.78928146, 2.88466235]),
4.6981983145616875,
14.04315715927693,
-58.15524535916836,
51.8186366184246,
0.6654457212665993]
再用tbd.ellipse_plot绘制置信椭圆

::

#绘制数据分布
import matplotlib.pyplot as plt
plt.figure(1,(5,5))
ax = plt.subplot(111)
#绘制数据点
plt.scatter(data['x'],data['y'],s = 0.5)
#获取置信椭圆参数并绘制椭圆
#99%置信椭圆
ellip_params = tbd.ellipse_params(data,confidence=99,col = ['x','y'])
tbd.ellipse_plot(ellip_params,ax,fill = False,edgecolor = 'r',linewidth = 1)
#95%置信椭圆
ellip_params = tbd.ellipse_params(data,confidence=95,col = ['x','y'])
tbd.ellipse_plot(ellip_params,ax,fill = False,edgecolor = 'b',linewidth = 1)
#90%置信椭圆
ellip_params = tbd.ellipse_params(data,confidence=90,col = ['x','y'])
tbd.ellipse_plot(ellip_params,ax,fill = False,edgecolor = 'k',linewidth = 1)
#绘制坐标轴
plt.plot([-10,10],[0,0],c = 'k')
plt.plot([0,0],[-10,10],c = 'k')
plt.xlim(-15,15)
plt.ylim(-15,15)
plt.show()



.. image:: gisprocess/output_3_0.png



3 changes: 2 additions & 1 deletion docs/source/bikedata.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
Bike-sharing data processing
******************************
.. autosummary::

:toctree: api/

bikedata_to_od

.. autofunction:: bikedata_to_od
3 changes: 2 additions & 1 deletion docs/source/busgps.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
Bus GPS data processing
******************************
.. autosummary::

:toctree: api/

busgps_arriveinfo
busgps_onewaytime

Expand Down
5 changes: 3 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@
import sys
import os

#sys.path.insert(0, os.path.abspath("../../src"))

project = 'TransBigData'
copyright = '2022, Qing Yu'
author = 'Qing Yu'

# The full version, including alpha/beta/rc tags
release = '0.4.15'
version = '0.4.15'
release = '0.4.16'
version = '0.4.16'
html_logo = "_static/logo-wordmark-light.png"
html_favicon = '_static/logo2.ico'
# -- General configuration ---------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,8 @@
"source": [
"#Plot the activity of the user, different color represent different location\n",
"uid = 'fcc3a9e9df361667e00ee5c16cb08922'\n",
"tbd.mobile_plot_activity(stay[stay['user_id']==uid],figsize = (20, 5))"
"stay['group'] = stay['LONCOL'].astype(str)+','+stay['LATCOL'].astype(str)\n",
"tbd.plot_activity(stay[stay['user_id']==uid],figsize = (20, 5))"
]
}
],
Expand Down
3 changes: 2 additions & 1 deletion docs/source/getbusdata.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Data Acquisition
******************************

.. autosummary::

:toctree: api/

getbusdata
getadmin
get_isochrone_amap
Expand Down
96 changes: 3 additions & 93 deletions docs/source/gisprocess.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ GIS处理


.. autosummary::

:toctree: api/

ckdnearest
ckdnearest_point
ckdnearest_line
splitline_with_length
merge_polygon
polyon_exterior
ellipse_params
ellipse_plot



近邻匹配
Expand Down Expand Up @@ -436,93 +436,3 @@ Polygon processing

.. autofunction:: polyon_exterior


confidence ellipse
----------------------------------------------------

.. autofunction:: ellipse_params


.. autofunction:: ellipse_plot

用法
================================================

::

import pandas as pd
import transbigdata as tbd
import numpy as np
#生成测试用数据
data = np.random.uniform(1,10,(100,2))
data[:,1:] = 0.5*data[:,0:1]+np.random.uniform(-2,2,(100,1))
data = pd.DataFrame(data,columns = ['x','y'])
#绘制数据分布
import matplotlib.pyplot as plt
plt.figure(1,(5,5))
#绘制数据点
plt.scatter(data['x'],data['y'],s = 0.5)
#绘制坐标轴
plt.plot([-10,10],[0,0],c = 'k')
plt.plot([0,0],[-10,10],c = 'k')
plt.xlim(-15,15)
plt.ylim(-15,15)
plt.show()



.. image:: gisprocess/output_1_0.png

输入数据与xy坐标所在列名,置信度,估计椭圆参数
分别代表[中心点坐标,短轴,长轴,角度,面积,扁率

::

ellip_params = tbd.ellipse_params(data,confidence=95,col = ['x','y'])
ellip_params


.. parsed-literal::
[array([5.78928146, 2.88466235]),
4.6981983145616875,
14.04315715927693,
-58.15524535916836,
51.8186366184246,
0.6654457212665993]
再用tbd.ellipse_plot绘制置信椭圆

::

#绘制数据分布
import matplotlib.pyplot as plt
plt.figure(1,(5,5))
ax = plt.subplot(111)
#绘制数据点
plt.scatter(data['x'],data['y'],s = 0.5)
#获取置信椭圆参数并绘制椭圆
#99%置信椭圆
ellip_params = tbd.ellipse_params(data,confidence=99,col = ['x','y'])
tbd.ellipse_plot(ellip_params,ax,fill = False,edgecolor = 'r',linewidth = 1)
#95%置信椭圆
ellip_params = tbd.ellipse_params(data,confidence=95,col = ['x','y'])
tbd.ellipse_plot(ellip_params,ax,fill = False,edgecolor = 'b',linewidth = 1)
#90%置信椭圆
ellip_params = tbd.ellipse_params(data,confidence=90,col = ['x','y'])
tbd.ellipse_plot(ellip_params,ax,fill = False,edgecolor = 'k',linewidth = 1)
#绘制坐标轴
plt.plot([-10,10],[0,0],c = 'k')
plt.plot([0,0],[-10,10],c = 'k')
plt.xlim(-15,15)
plt.ylim(-15,15)
plt.show()



.. image:: gisprocess/output_3_0.png



3 changes: 2 additions & 1 deletion docs/source/grids.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ Data Gridding
***************

.. autosummary::

:toctree: api/

area_to_grid
area_to_params
GPS_to_grid
Expand Down
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ General Methods
gisprocess.rst
plot_map.rst
CoordinatesConverter.rst
activity.rst
utils.rst

Methods for specific data
Expand Down
3 changes: 2 additions & 1 deletion docs/source/metroline.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ Bus and subway network topology modeling
-------------

.. autosummary::

:toctree: api/

metro_network
get_shortest_path
get_k_shortest_paths
Expand Down
6 changes: 3 additions & 3 deletions docs/source/mobile.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ Mobilephone data processing
******************************

.. autosummary::

:toctree: api/

mobile_stay_move
mobile_stay_dutation
mobile_identify_home
mobile_identify_work
mobile_plot_activity


.. autofunction:: mobile_stay_move

Expand All @@ -21,7 +22,6 @@ Mobilephone data processing

.. autofunction:: mobile_identify_work

.. autofunction:: mobile_plot_activity



3 changes: 2 additions & 1 deletion docs/source/odprocess.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ Data Aggregating
******************

.. autosummary::

:toctree: api/

dataagg
odagg_grid
odagg_shape
Expand Down
3 changes: 2 additions & 1 deletion docs/source/plot_map.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ Load the basemap


.. autosummary::

:toctree: api/

plot_map
plotscale

Expand Down
3 changes: 2 additions & 1 deletion docs/source/preprocess.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
******************************

.. autosummary::

:toctree: api/

clean_same
clean_drift
clean_outofbounds
Expand Down
3 changes: 2 additions & 1 deletion docs/source/quality.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@


.. autosummary::

:toctree: api/

data_summary
sample_duration

Expand Down
Loading

0 comments on commit 959334c

Please sign in to comment.