changes to add to list
This commit is contained in:
@ -26,7 +26,7 @@ class BECAdapter:
|
||||
self.scan_nr = None
|
||||
self.scan_running = False
|
||||
|
||||
self.eaccount = "e20632" #change for each new beamtime
|
||||
self.eaccount = "e20631" #change for each new beamtime
|
||||
|
||||
# To decide what should be plotted
|
||||
self.monitor = monitor
|
||||
@ -134,9 +134,9 @@ class BECAdapter:
|
||||
recon_img_abs, recon_img_phase = self.get_recon_imgs(hf)
|
||||
|
||||
# PLOT
|
||||
print("max(recon_img_abs)", max(max(recon_img_abs)))
|
||||
# print("max(recon_img_abs)", max(max(recon_img_abs)))
|
||||
|
||||
print("max(recon_img_phase)", max(max(recon_img_phase)))
|
||||
# print("max(recon_img_phase)", max(max(recon_img_phase)))
|
||||
print('plotting new image with scan_nr: ', self.latest_reconstructed)
|
||||
xlab = str(self.latest_reconstructed)
|
||||
if self.recon:
|
||||
|
@ -94,7 +94,7 @@ class MainWindow(QMainWindow):
|
||||
rst.server.register_function(self.extend_data)
|
||||
rst.server.register_function(self.set_data)
|
||||
rst.server.register_function(self.new_image)
|
||||
rst.server.register_function(self.plot_images_from_list) # function for CSAXS beamtime
|
||||
rst.server.register_function(self.append_image_to_list) # function for CSAXS beamtime
|
||||
|
||||
self.sig_make_new_plot.connect(self.on_make_new_plot)
|
||||
self.sig_make_new_image.connect(self.on_make_new_image)
|
||||
@ -169,27 +169,11 @@ class MainWindow(QMainWindow):
|
||||
else:
|
||||
self.sig_make_new_image.emit(name, desc)
|
||||
|
||||
def plot_images_from_list(self, image_desc_list):
|
||||
def append_image_to_list(self, img):
|
||||
"""
|
||||
Plot images from list
|
||||
Append image to list
|
||||
"""
|
||||
# images = []
|
||||
# selected_items = []
|
||||
# i =1
|
||||
for img in image_desc_list:
|
||||
print("new image, ", img[0])
|
||||
desc = self.add_new_desc_to_list(img[0], img[1], Desc=ImageDescription) # best solution for now
|
||||
# item = self.lst.get(img[0]) # this is also a neew window
|
||||
# selected_items.append(item)
|
||||
# self.new_image(img[0], img[1])
|
||||
|
||||
# desc = ImageDescription(img[0], **img[1]) #TODO: this pops up in new window, no images
|
||||
# dlistitem = DictListItem(f"Phase: {i}", desc)
|
||||
# images.append(dlistitem)
|
||||
# i+=1
|
||||
|
||||
# self.plot_multiple_images(selected_items)
|
||||
# self.plot_multiple_images(images) # new window
|
||||
desc = self.add_new_desc_to_list(img[0], img[1], Desc=ImageDescription)
|
||||
|
||||
# Signal callbacks
|
||||
|
||||
|
@ -104,11 +104,9 @@ class MDISubMultiImage(MDISubImageBase):
|
||||
|
||||
|
||||
def set_title(self):
|
||||
print("setting title")
|
||||
vbox = self.pw.getView()
|
||||
allchildren = vbox.allChildren()
|
||||
for child in allchildren:
|
||||
if isinstance(child, pg.LabelItem):
|
||||
vbox.removeItem(child)
|
||||
vbox.addItem(pg.LabelItem(self.descriptions[self.slider.value()].xlabel, size='50pt'))
|
||||
print("changed title")
|
@ -3,13 +3,14 @@ from os import listdir
|
||||
from os.path import isfile, join
|
||||
import h5py
|
||||
import numpy as np
|
||||
import argparse
|
||||
|
||||
class plotPhases:
|
||||
def __init__(self, start, end, step=1):
|
||||
self.start = start
|
||||
self.end = end
|
||||
self.step =step
|
||||
self.eaccount = "e20632" # for jeff: 20633
|
||||
self.eaccount = "e20631"
|
||||
self.grum_client = RPCClient("localhost", 8000) # this is outgoing
|
||||
self.image_description_list = []
|
||||
|
||||
@ -25,30 +26,23 @@ class plotPhases:
|
||||
recon_img_phase = self.get_recon_phase(hf)
|
||||
|
||||
xlab = str(scan_nr)
|
||||
self.image_description_list.append([f"{scan_nr} Phase", {'image': recon_img_phase, "xlabel": xlab}])
|
||||
print("appending scan nr: ", scan_nr)
|
||||
self.grum_client.append_image_to_list([f"{scan_nr} Phase", {'image': recon_img_phase, "xlabel": xlab}])
|
||||
# self.image_description_list.append([f"{scan_nr} Phase", {'image': recon_img_phase, "xlabel": xlab}])
|
||||
|
||||
print("calling plot images from list")
|
||||
self.grum_client.plot_images_from_list(self.image_description_list)
|
||||
# print("calling plot images from list")
|
||||
# self.grum_client.append_images_to_list(self.image_description_list)
|
||||
|
||||
def get_recon_phase(self, hf):
|
||||
|
||||
recon = hf.get('reconstruction')
|
||||
recon_object = hf.get('reconstruction/object')
|
||||
# recon_probes = hf.get('reconstruction/probes')
|
||||
|
||||
# recon_probes_1 = recon_probes[0]
|
||||
# recon_probes_2 = recon_probes[1]
|
||||
|
||||
recon_object = np.array(recon_object)
|
||||
# recon_object_abs = np.abs(recon_object)
|
||||
recon_object_angle = np.angle(recon_object)
|
||||
|
||||
# recon_object_abs = np.rot90(recon_object_abs,3)
|
||||
recon_object_angle = np.rot90(recon_object_angle, 3)
|
||||
|
||||
# recon_img_abs = recon_object_abs.tolist()
|
||||
recon_img_angle = recon_object_angle.tolist()
|
||||
# return recon_img_abs, recon_img_angle
|
||||
return recon_img_angle
|
||||
|
||||
def get_recon_file(self, mypath):
|
||||
@ -70,7 +64,16 @@ if __name__ == "__main__":
|
||||
start = 10296
|
||||
end = 10300
|
||||
step = 1
|
||||
print('starts plotting phase for scans: ',start, ' to ', end)
|
||||
|
||||
parser = argparse.ArgumentParser(description="description", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
||||
parser.add_argument("-s", "--startstop", nargs =2, help="set start, end")
|
||||
clargs = parser.parse_args()
|
||||
if clargs:
|
||||
start = int(clargs.startstop[0])
|
||||
end = int(clargs.startstop[1])
|
||||
|
||||
print('starts plotting phase for scans: ',start, ' to ', end)
|
||||
|
||||
pp = plotPhases(start, end)
|
||||
|
||||
pp.plot_all_phases()
|
Reference in New Issue
Block a user