import yappi

from apd.aggregation.analysis import interactable_plot_multiple_charts, Config, clean_temperature_fluctuations, get_data_by_deployment
from apd.aggregation.utils import jupyter_page_file, profile_with_yappi, YappiPackageFilter


async def filter_and_clean_temperature_fluctuations(datapoints):
    filtered = (item async for item in datapoints
                if item.sensor_name == "Temperature")
    cleaned = clean_temperature_fluctuations(filtered)
    async for item in cleaned:
        yield item


filter_in_python = Config(
    clean=filter_and_clean_temperature_fluctuations,
    title="Ambient temperature",
    ylabel="Degrees C",
    get_data=get_data_by_deployment,
)

with profile_with_yappi():
    plot = interactable_plot_multiple_charts(configs=[filter_in_python])
    plot()

yappi.get_func_stats().print_all()
import tracemalloc

from apd.aggregation.analysis import interactable_plot_multiple_charts


tracemalloc.start()
plot = interactable_plot_multiple_charts()()
snapshot = tracemalloc.take_snapshot()
tracemalloc.stop()
for line in snapshot.statistics("lineno", cumulative=True):
    print(line)

Esempio n. 3
0
import yappi
from apd.aggregation.analysis import interactable_plot_multiple_charts, Config
from apd.aggregation.analysis import convert_temperature_system, clean_temperature_fluctuations
from apd.aggregation.analysis import get_one_sensor_by_deployment

filter_in_db = Config(
    clean=convert_temperature_system(clean_temperature_fluctuations, "degF"),
    title="Ambient temperature",
    ylabel="Degrees F",
    get_data=get_one_sensor_by_deployment("Temperature"),
)
display(interactable_plot_multiple_charts(configs=[filter_in_db])())