In [1]:
from numpy import seterr
from mkl import set_num_threads
from uuid import uuid4
from lpde.geometry import WidthOf, Window, PointAt, BoundingBox, Mapper, Grid
from lpde.estimators import ParallelEstimator
from lpde.estimators.datatypes import Degree
from lpde.producers import MockParams
from lpde.producers.distributions import gaussian
from lpde.visualizers import Visualize
In [2]:
%matplotlib qt5
_ = seterr(over='ignore')
set_num_threads(1)
In [3]:
legendre_width = WidthOf(1.8)
center = PointAt(51.375, 35.675)
window = Window(0.55, 0.35)
bounds = BoundingBox(center, window)
mapper = Mapper(bounds, legendre_width)
degree = Degree(20, 20)
params = MockParams(100, 1000, gaussian)
demand = ParallelEstimator(degree, mapper, params)
In [4]:
demand.controller.start(16, 1.0)
In [5]:
demand.controller.alive
Out[5]:
In [6]:
demand.controller.open
Out[6]:
In [9]:
demand.controller.qsize
Out[9]:
In [10]:
demand.controller.stop()
In [ ]:
point = PointAt(51.4, 35.7)
demand.at(point)
In [ ]:
visulization = Visualize(demand)
animation = visulization.show(cartopy=True, zoom=11)
In [ ]:
demand.grid = Grid(50, 150)
visulization = Visualize(demand)
animation = visulization.show(cartopy=True)
In [ ]:
import matplotlib.pyplot as plt
demand.grid = Grid(50, 50)
fig, ax = plt.subplots(figsize=(5.5, 5),)
ax.quiver(*demand.grid, *demand.gradient_on_grid, demand.on_grid, angles='xy', pivot='middle')
fig.tight_layout()
In [ ]:
demand.gradient_at(PointAt(51.4, 35.7))
In [ ]: