dylab/test_living_plot.py

58 lines
1.2 KiB
Python
Raw Normal View History

2022-07-30 21:50:53 +02:00
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 11 14:58:18 2021
@author: Nick Sauerwein
"""
import lyse
import numpy as np
from HelperClasses.Plotting import WidgetFakeColorPlot, MainPlotPanel
import cProfile
import pstats
profile = cProfile.Profile()
profile.enable()
fm = lyse.figure_manager
h5_paths = lyse.h5_paths()
if lyse.spinning_top:
# If so, use the filepath of the current shot
h5_path = lyse.path
else:
# If not, get the filepath of the last shot of the lyse DataFrame
h5_path = lyse.h5_paths().iloc[-1]
print(h5_path)
if len(h5_paths):
last_globals = run = lyse.Run(h5_paths.iloc[-1]).get_globals()
if not hasattr(fm, 'ap'):
fm.ap = MainPlotPanel.MainPlotPanel(h5_paths)
# Imaging Methods
imagings = ['absorption_imaging']
cams = {'absorption_imaging': ['Cam_absorption']}
imaging = 'absorption_imaging'
for cam in cams[imaging]:
plot_name = imaging + ' ' + cam
if not plot_name in fm.ap.plots:
ip = WidgetFakeColorPlot.FakeColorPlot(plot_name, ('absorption_imaging', 'absorption_imaging'))
fm.ap.add_plot_dock(plot_name, ip)
fm.ap.update_h5_paths(h5_paths)
fm.ap.refresh(h5_path)
profile.disable()
ps = pstats.Stats(profile)
ps.sort_stats('cumtime')
ps.print_stats(10)