index
int64
repo_name
string
branch_name
string
path
string
content
string
import_graph
string
42,215
JTopanotti/turing-machine
refs/heads/master
/backend/turing_machine.py
from backend.tables import * class TuringMachine(object): def __init__(self, tape = "", blank = " ", initial_state = "", final_states = None, transition_table = None): self.__tape = Tape(tape) self.__head_position = 0 self.__blank_symbol = blank self.__current_state = initial_state self.operation_list = [] if transition_table == None: self.__transition_table = {} else: self.__transition_table = transition_table if final_states == None: self.__final_states = set() else: self.__final_states = set(final_states) def get_tape(self): return str(self.__tape) def step(self): current_head_symbol = self.__tape[self.__head_position] current_operation = {} if self.__head_position == self.__tape.length(): self.__tape[self.__head_position] = "B" x = (self.__current_state, current_head_symbol) if x in self.__transition_table: y = self.__transition_table[x] self.__current_state, current_operation["state"] = y[0], y[0] replaced_symbol = y[1] if y[1] == "$": replaced_symbol = current_head_symbol self.__tape[self.__head_position], current_operation["symbol"] = \ replaced_symbol, replaced_symbol if y[2] == "D": self.__head_position += 1 current_operation["position"] = 1 elif y[2] == "E": self.__head_position -= 1 current_operation["position"] = -1 else: current_operation["position"] = 0 self.operation_list.append(current_operation) def final(self): return self.__current_state in self.__final_states class Tape(object): blank = " " def __init__(self, tape = ""): self.__tape = dict((enumerate(tape))) def length(self): return len(self.__tape) def __str__(self): s = "" min_index = min(self.__tape.keys()) max_index = max(self.__tape.keys()) for i in range(min_index, max_index + 1): s += self.__tape[i] s = s.strip('B').replace('B', ' ') return s def __getitem__(self, index): if index in self.__tape: return self.__tape[index] else: return Tape.blank def __setitem__(self, key, value): self.__tape[key] = value if __name__ == "__main__": initial_state = ">" tables = { "division_table": division_table, "equals_table": equals_table } final_states = {"FIM"} t = TuringMachine(">***B**B", initial_state=initial_state, final_states=final_states, transition_table=tables["equals_table"]) print("Input on Tape:\n" + t.get_tape()) while not t.final(): t.step() print("Result of the Turing machine calculation:") print(t.get_tape())
{"/backend/api.py": ["/backend/turing_machine.py"]}
42,216
JTopanotti/turing-machine
refs/heads/master
/backend/api.py
from flask import Flask, request, jsonify from flask_cors import CORS from .turing_machine import TuringMachine from .tables import * app = Flask(__name__) CORS(app) tables = { "division": division_table, "equals": equals_table } @app.route("/test") def hello(): print("API Functioning normally") return "Hello World!" @app.route("/execute") def execute(): operation = request.args.get("operation") input = request.args.get("input").replace(" ", "B") + "B" t = TuringMachine(input, initial_state=">", final_states=["FIM"], transition_table=tables[operation]) while not t.final(): t.step() data = { "input_tape": input, "result_tape": t.get_tape(), "operation_list": t.operation_list } return jsonify(data)
{"/backend/api.py": ["/backend/turing_machine.py"]}
42,227
IanBurwell/PyCV
refs/heads/master
/PyCV/searchHistImgClassification.py
import numpy as np import _pickle import descriptors import cv2 class Search: def __init__(self, index): self.index = index def search(self, searchFeatures): results = {} for k,features in self.index.items(): #replace features with distances d = self.distance(features, searchFeatures) results[k] = d #sort imgs so small distances are towards begginning results = sorted([(v,k) for (k,v) in results.items()]) return results def distance(self, histA, histB): #this super small value stops devide by zero errors eps = 1e-10 # compute the chi-squared distance (wtf) return 0.5 * np.sum([((a - b) ** 2) / (a + b + eps) for (a, b) in zip(histA, histB)]) dataStore = "C:/Users/ian/Desktop/PyCV/PyCV/Resources/data/HistClassData" searchImg = "C:/Users/ian/Desktop/PyCV/PyCV/Resources/pictures/search.jpg" index = _pickle.loads(open(dataStore, "rb").read()) searcher = Search(index) desc = descriptors.RGBHist([8,8,8]) searched = cv2.imread(searchImg) results = searcher.search(desc.describe(searched)) cv2.imshow("Query", searched) resultImg = None for j in range(5): (score, imageKey) = results[j] print(imageKey) path = "C:/Users/ian/Desktop/PyCV/PyCV/Resources/pictures/" + imageKey if resultImg is not None: resultImg = np.concatenate((resultImg, cv2.resize(cv2.imread(path),(300, 168))), axis=1) else: resultImg = cv2.resize(cv2.imread(path),(300, 168)) cv2.imshow("Results", resultImg) cv2.waitKey(0)
{"/PyCV/searchHistImgClassification.py": ["/descriptors.py"], "/OpenCVtesting.py": ["/disp_video.py", "/img_operations.py", "/helpers.py"], "/PyCV/calcHistImgClassification.py": ["/descriptors.py"], "/PyCV/camshift.py": ["/helpers.py"]}
42,228
IanBurwell/PyCV
refs/heads/master
/OpenCVtesting.py
import cv2 import numpy as np from matplotlib import pyplot as plt import disp_video import img_operations as imop import helpers camera = cv2.VideoCapture(0) helpers.set_hd(camera) camera.release() cv2.destroyAllWindows()
{"/PyCV/searchHistImgClassification.py": ["/descriptors.py"], "/OpenCVtesting.py": ["/disp_video.py", "/img_operations.py", "/helpers.py"], "/PyCV/calcHistImgClassification.py": ["/descriptors.py"], "/PyCV/camshift.py": ["/helpers.py"]}
42,229
IanBurwell/PyCV
refs/heads/master
/PyCV/calcHistImgClassification.py
import cv2 import numpy as np import _pickle import glob import descriptors comped_imgs = {} dataStore = "C:/Users/ian/Desktop/PyCV/PyCV/Resources/data/HistClassData" imgs = ["C:/Users/ian/Desktop/PyCV/PyCV/Resources/pictures/Corgi","C:/Users/ian/Desktop/PyCV/PyCV/Resources/pictures/HotAirBalloon"] desc = descriptors.RGBHist([8, 8, 8]) for tset in imgs: for imgPath in glob.glob(tset + "/*.jpg"): imgPath = imgPath.replace('\\','/') key = imgPath[imgPath.rfind("/",0,imgPath.rfind("/"))+1:] image = cv2.imread(imgPath) features = desc.describe(image) comped_imgs[key] = features f = open(dataStore, "wb") f.write(_pickle.dumps(comped_imgs)) f.close()
{"/PyCV/searchHistImgClassification.py": ["/descriptors.py"], "/OpenCVtesting.py": ["/disp_video.py", "/img_operations.py", "/helpers.py"], "/PyCV/calcHistImgClassification.py": ["/descriptors.py"], "/PyCV/camshift.py": ["/helpers.py"]}
42,230
IanBurwell/PyCV
refs/heads/master
/PyCV/camshift.py
import cv2 import numpy as np import helpers camera = cv2.VideoCapture(0) helpers.set_hd(camera) grabbed, frame = camera.read() h, w, c = frame.shape while cv2.waitKey(10) != ord("n"): grabbed, frame = camera.read() if not grabbed: break h, w, c = frame.shape frame = cv2.rectangle(frame,(w/2+100,h/2+100),(w/2-100,h/2-100),(0,255,0),3) frame = cv2.flip(frame,1) cv2.imshow('hist',helpers.hist_curve(frame[h/2-100:h/2+100, w/2-100:w/2+100])) cv2.imshow("img", frame) #setup ROI track_window = (w/2-100,h/2-100,200,200) roi = frame[h/2-100:h/2+100, w/2-100:w/2+100] hsv_roi = cv2.cvtColor(roi, cv2.COLOR_BGR2HSV) #roi_hist = cv2.calcHist([hsv_roi],[0],None,[180],[0,180]) roi_hist = cv2.calcHist([hsv_roi],[0,1],None,[180,256],[0,180,0,256]) cv2.normalize(roi_hist, roi_hist, 0, 240, cv2.NORM_MINMAX) terminationCriteria = (cv2.TERM_CRITERIA_EPS | cv2.TERM_CRITERIA_COUNT, 10, 1) while True: grabbed, frame = camera.read() if not grabbed: break hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV) #backProj = cv2.calcBackProject([hsv], [0], roi_hist, [0, 180], 1) backProj = cv2.calcBackProject([hsv], [0,1 ], roi_hist, [0, 180, 0, 256], 1) r, track_window = cv2.CamShift(backProj, track_window, terminationCriteria) pts = cv2.boxPoints(r) pts = np.int64(pts) cv2.polylines(frame, [pts], True, (0,0,255), 2) frame = cv2.flip(frame,1) cv2.imshow("img", frame) key = cv2.waitKey(1) & 0xFF if key == ord('q'): break camera.release() cv2.destroyAllWindows()
{"/PyCV/searchHistImgClassification.py": ["/descriptors.py"], "/OpenCVtesting.py": ["/disp_video.py", "/img_operations.py", "/helpers.py"], "/PyCV/calcHistImgClassification.py": ["/descriptors.py"], "/PyCV/camshift.py": ["/helpers.py"]}
42,231
IanBurwell/PyCV
refs/heads/master
/descriptors.py
import cv2 import numpy as np #descriptors are nice in classes, because we can set 1 property #like num_bins for all the images that will use said descriptor #defines imgs with 3D RGB Histogram class RGBHist: def __init__(self, num_bins): self.bins = num_bins def describe(self, img, mask=None): #Calc 3D hist and normalize so #a scaled image has roughly same histogram as original hist = cv2.calcHist(img, [0, 1, 2], mask, self.bins, [0,256, 0,256, 0,256]) hist = cv2.normalize(hist) #Makes 1D array out of 3D array so it can be a descriptor return hist.flatten()
{"/PyCV/searchHistImgClassification.py": ["/descriptors.py"], "/OpenCVtesting.py": ["/disp_video.py", "/img_operations.py", "/helpers.py"], "/PyCV/calcHistImgClassification.py": ["/descriptors.py"], "/PyCV/camshift.py": ["/helpers.py"]}
42,232
IanBurwell/PyCV
refs/heads/master
/img_operations.py
import cv2 import numpy as np def single_color(img): img = cv2.cvtColor(img, cv2.COLOR_BGR2HSV) upper_b = np.array([64, 177, 231],np.uint8) lower_b = np.array([37, 33, 114],np.uint8) mask = cv2.inRange(img, lower_b, upper_b) return mask def blur_average(img,size=5): kernel = np.ones((size,size),np.float32)/(size*size) avg = cv2.filter2D(img,-1,kernel) return avg def remove_noise(img, size=9): return cv2.bilateralFilter(img,size,75,75) def test(img): #kernel = np.matrix([[0,1,0], # [1,-4,1], # [0,1,0]]) kernel = np.matrix([[0,0,1,0,0], [0,0,1,0,0], [1,1,-8,1,1], [0,0,1,0,0], [0,0,1,0,0]]) avg = cv2.filter2D(img,-1,kernel) return avg
{"/PyCV/searchHistImgClassification.py": ["/descriptors.py"], "/OpenCVtesting.py": ["/disp_video.py", "/img_operations.py", "/helpers.py"], "/PyCV/calcHistImgClassification.py": ["/descriptors.py"], "/PyCV/camshift.py": ["/helpers.py"]}
42,233
IanBurwell/PyCV
refs/heads/master
/Projects/HistImgClassification.py
import cv2 import numpy as np import cPickle import glob
{"/PyCV/searchHistImgClassification.py": ["/descriptors.py"], "/OpenCVtesting.py": ["/disp_video.py", "/img_operations.py", "/helpers.py"], "/PyCV/calcHistImgClassification.py": ["/descriptors.py"], "/PyCV/camshift.py": ["/helpers.py"]}
42,234
IanBurwell/PyCV
refs/heads/master
/helpers.py
import cv2 import numpy as np def take_pic(camera): retval, img = camera.read() return img def load_colortest(): return cv2.imread('E:\Folders\OpenCV\Resources\colortest.jpg') def save_pic(img): cv2.imwrite('E:\Folders\OpenCV\Resources\img.png',img) def disp_pic(img, resize=False, wait=True): if resize: cv2.imshow('test',cv2.resize(img,(500,500))) else: cv2.imshow('test',img) if wait: cv2.waitKey(0) def set_hd(camera): camera.set(cv2.CAP_PROP_FRAME_WIDTH,1280) camera.set(cv2.CAP_PROP_FRAME_HEIGHT,720) def hist_curve(im): h = np.zeros((300,256,3)) if len(im.shape) == 2: color = [(255,255,255)] elif im.shape[2] == 3: color = [ (255,0,0),(0,255,0),(0,0,255) ] for ch, col in enumerate(color): hist_item = cv2.calcHist([im],[ch],None,[256],[0,256]) cv2.normalize(hist_item,hist_item,0,255,cv2.NORM_MINMAX) hist=np.int32(np.around(hist_item)) pts = np.int32(np.column_stack((np.arange(256).reshape(256,1),hist))) cv2.polylines(h,[pts],False,col) y=np.flipud(h) return y
{"/PyCV/searchHistImgClassification.py": ["/descriptors.py"], "/OpenCVtesting.py": ["/disp_video.py", "/img_operations.py", "/helpers.py"], "/PyCV/calcHistImgClassification.py": ["/descriptors.py"], "/PyCV/camshift.py": ["/helpers.py"]}
42,235
IanBurwell/PyCV
refs/heads/master
/disp_video.py
import cv2 import numpy as np def nothing(x): pass def disp_sliders_hsv(camera): cv2.namedWindow('img') cv2.createTrackbar('HMAX','img',0,179,nothing) cv2.createTrackbar('HMIN','img',0,179,nothing) cv2.createTrackbar('SMAX','img',0,255,nothing) cv2.createTrackbar('SMIN','img',0,255,nothing) cv2.createTrackbar('VMAX','img',0,255,nothing) cv2.createTrackbar('VMIN','img',0,255,nothing) cv2.createTrackbar('SAVE','img',0,1,nothing) cv2.setTrackbarPos('HMAX','img',255) cv2.setTrackbarPos('SMAX','img',255) cv2.setTrackbarPos('VMAX','img',255) while True: retval, img = camera.read() HMax = cv2.getTrackbarPos('HMAX','img') HMin = cv2.getTrackbarPos('HMIN','img') SMax = cv2.getTrackbarPos('SMAX','img') SMin = cv2.getTrackbarPos('SMIN','img') VMax = cv2.getTrackbarPos('VMAX','img') VMin = cv2.getTrackbarPos('VMIN','img') imghsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV) if cv2.getTrackbarPos('SAVE','img') == 0: upper_b = np.array([HMax, SMax, VMax],np.uint8) lower_b = np.array([HMin, SMin, VMin],np.uint8) else: upper_b = np.array([64, 177, 231],np.uint8) lower_b = np.array([37, 33, 114],np.uint8) mask = cv2.inRange(imghsv, lower_b, upper_b) img = cv2.bitwise_and(img, img, mask=mask) key = cv2.waitKey(1) & 0xFF if key == ord('q'): break cv2.imshow('img',img) def disp_custom(img_op_func, camera): while True: retval, img = camera.read() img = img_op_func(img) key = cv2.waitKey(1) & 0xFF if key == ord('q'): break cv2.imshow('img',img) if __name__ == "__main__" : camera = cv2.VideoCapture(0) disp_sliders_hsv(camera) camera.release()
{"/PyCV/searchHistImgClassification.py": ["/descriptors.py"], "/OpenCVtesting.py": ["/disp_video.py", "/img_operations.py", "/helpers.py"], "/PyCV/calcHistImgClassification.py": ["/descriptors.py"], "/PyCV/camshift.py": ["/helpers.py"]}
42,236
freanuperiaa/Simple-Stochastic-Traffic-Model
refs/heads/master
/stochmod.py
import random from datetime import datetime import math #use the instantaneous date as the seed for the #pseudorandom number generation random.seed(datetime.now()) #stochastic model def calc(): time_delay = 0 event = random.random() if(0.0<event<0.06): time_delay = 0 elif(0.6<=event<0.21): time_delay = 10 elif(0.21<=event<0.55): time_delay = 30 elif(0.55<=event<0.99): time_delay = 45 else: time_delay = 10 #remove the comment sign below if you are to add rain constant!! """rain_event = random.random() if(0.0<rain_event < 50): time_delay += 15 """ return time_delay if __name__ == "__main__": print(calc())
{"/montecarlo.py": ["/stochmod.py"], "/simulator.py": ["/stochmod.py"]}
42,237
freanuperiaa/Simple-Stochastic-Traffic-Model
refs/heads/master
/montecarlo.py
from stochmod import calc import numpy as np realizations = int(input('how many simulation runs: ')) results = np.zeros(realizations) #store the results of all the runs no_occur = { 'no_45':0, 'no_30':0, 'no_10':0, 'no_0':0, #add the dict elements below by removing the comments (if rain element is added!) #'no_15':0,'no_25':0,'no_60':0, } for x in range(realizations): event = calc() results[x] = event if (event == 45): no_occur['no_45'] += 1 elif (event == 30): no_occur['no_30'] += 1 elif (event == 10): no_occur['no_10'] += 1 elif (event == 0): no_occur['no_0'] += 1 #add more if options (if rain element is added!) """ elif (event == 15): no_occur['no_15'] += 1 elif (event == 25): no_occur['no_25'] += 1 elif (event == 60): no_occur['no_60'] += 1 """ print(event) #the probabilities of each incidents based on the simulation prob_45 = (no_occur['no_45']/len(results))*100 prob_30 = (no_occur['no_30']/len(results))*100 prob_10 = (no_occur['no_10']/len(results))*100 prob_0 = (no_occur['no_0']/len(results))*100 #prob_15 = (no_occur['no_15']/len(results))*100 #prob_25 = (no_occur['no_25']/len(results))*100 #prob_60 = (no_occur['no_60']/len(results))*100 print(results) print('----------------------------------------------------------------') print('The number of occurences of a 45-minute delay: ',no_occur['no_45']) print('The number of occurences of a 30-minute delay: ',no_occur['no_30']) print('The number of occurences of a 10-minute delay: ',no_occur['no_10']) print('The number of occurences of no delays: ',no_occur['no_0']) #print('The number of occurences of 15-minute delay: ',no_occur['no_15']) #print('The number of occurences of 25-minute delay: ',no_occur['no_25']) #print('The number of occurences of 60-minute delay: ',no_occur['no_60']) print('----------------------------------------------------------------') print('a posteriori probability of a 45-minute delay',prob_45, ' per cent') print('a posteriori probability of a 30-minute delay',prob_30, ' per cent') print('a posteriori probability of a 10-minute delay',prob_10, ' per cent') print('a posteriori probability of no delays',prob_0, ' per cent') #print('a posteriori probability of a 15-minute delay',prob_15, ' per cent') #print('a posteriori probability of a 25-minute delay',prob_25, ' per cent') #print('a posteriori probability of a 60-minute delay',prob_60, ' per cent')
{"/montecarlo.py": ["/stochmod.py"], "/simulator.py": ["/stochmod.py"]}
42,238
freanuperiaa/Simple-Stochastic-Traffic-Model
refs/heads/master
/simulator.py
from stochmod import calc import numpy as np import matplotlib.pyplot as plt from matplotlib import style def simulate(realizations,pointOfItrs): #this is basically a copy on the monte carlo simulation! results = np.zeros(realizations) #store the results of all the runs no_occur = { 'no_45':0, 'no_30':0, 'no_10':0, 'no_0':0, } for x in range(realizations): event = calc() results[x] = event if (event == 45): no_occur['no_45'] += 1 elif (event == 30): no_occur['no_30'] += 1 elif (event == 10): no_occur['no_10'] += 1 elif (event == 0): no_occur['no_0'] += 1 #the probabilities of each incidents based on the simulation prob_45 = (no_occur['no_45']/len(results))*100 prob_30 = (no_occur['no_30']/len(results))*100 prob_10 = (no_occur['no_10']/len(results))*100 prob_0 = (no_occur['no_0']/len(results))*100 if pointOfItrs==45 : return prob_45 elif pointOfItrs==35 : return prob_30 elif pointOfItrs==15 : return prob_10 elif pointOfItrs==5 : return prob_0 ###################################################################### ###################################################################### def main(): start = int(input('start :')) end = int(input('end: ')) inv = int(input('intervals:')) print('take note of the ff:') print('\n45 minutes has 45 per cent of chance\n30 minutes has 35 per cent of chance') print('10 minutes has 15 per cent of chance\n0 minutes has 5 per cent of chance') print('^these are all a priori probabilities\n') pointOfItrs = int(input(' which a priori probability to track: ')) #variables to be observed! runs = list(np.arange(start,end,inv)) resultOfRuns = [] #actual simulation for x in runs: resultOfRuns.append(simulate(x,pointOfItrs)) print(resultOfRuns) print(runs) #graphing part! style.use('seaborn-whitegrid') fig = plt.figure() plt.plot(runs,resultOfRuns) plt.axhline(y = pointOfItrs, color = 'r', linestyle='-') plt.xlabel('no. of simulations') plt.ylabel('a posteriori probability') plt.show() if __name__ == '__main__': main()
{"/montecarlo.py": ["/stochmod.py"], "/simulator.py": ["/stochmod.py"]}
42,239
themsoum7/csgo-positioning-gcp
refs/heads/master
/server/economy_to_plot.py
import pandas as pd import os import matplotlib.pyplot as plt def csvs_to_dfs(list_of_csv): current_df = [] for csv in list_of_csv: df = pd.read_csv(csv, index_col = 0) current_df.append(df) return current_df def plot_t_economy(dataframe, csv_name): # ax = plt.gca() # dataframe.plot(kind='line', x='round', y='t_buy_level', ax=ax) dataframe.set_index('round')['t_buy_level'].plot() plt.xlabel("Round", labelpad=10) plt.ylabel("Buy Level", labelpad=15) plt.title("T economy level by rounds", y=1.02, fontsize=22) plt.xticks(dataframe['round'].unique(), rotation=90) plt.yticks([0, 1, 2, 3, 4, 5]) plt.savefig('./static/t_economy_plot/{}_t_economy.jpg'.format(csv_name)) plt.close() def plot_ct_economy(dataframe, csv_name): # ax = plt.gca() # dataframe.plot(kind='line', x='round', y='ct_buy_level', ax=ax) dataframe.set_index('round')['ct_buy_level'].plot() plt.xlabel("Round", labelpad=10) plt.ylabel("Buy Level", labelpad=15) plt.title("CT economy level by rounds", y=1.02, fontsize=22) plt.xticks(dataframe['round'].unique(), rotation=90) plt.yticks([0, 1, 2, 3, 4, 5]) plt.savefig('./static/ct_economy_plot/{}_ct_economy.jpg'.format(csv_name)) plt.close() def economy_images(): current_csv = [] current_csv_name = [] for file in os.listdir("../csv"): if file.endswith(".csv"): current_csv.append(os.path.join("../csv/", file)) current_csv_name.append(os.path.splitext(file)[0]) df = csvs_to_dfs(current_csv) plot_t_economy(df[0], current_csv_name[0]) plot_ct_economy(df[0], current_csv_name[0])
{"/server/server.py": ["/server/get_coordinates.py", "/server/split_demos_to_images.py", "/server/economy_to_plot.py"]}
42,240
themsoum7/csgo-positioning-gcp
refs/heads/master
/server/server.py
from flask import Flask, flash, request, redirect, url_for, render_template from flask import send_from_directory from server.get_coordinates import * from werkzeug.utils import secure_filename from server.split_demos_to_images import * from server.economy_to_plot import * import re UPLOAD_FOLDER = '../uploads' ALLOWED_EXTENSIONS = {'dem'} app = Flask(__name__) app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER app.config['MAX_CONTENT_LENGTH'] = 524288000 def allowed_file(filename): return '.' in filename and filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS @app.route('/', methods=['GET', 'POST']) def upload_file(): if request.method == 'POST': # check if the post request has the file part if 'file' not in request.files: flash('No file part') return redirect(request.url) file = request.files['file'] # if user does not select file, browser also # submit an empty part without filename if file.filename == '': flash('No selected file') return redirect(request.url) if file and allowed_file(file.filename): for demo in os.listdir('../uploads'): os.remove('../uploads/' + demo) for csv in os.listdir('../csv'): os.remove('../csv/' + csv) for image in os.listdir('./static/images_by_rounds'): if image.endswith(".jpg"): os.remove('./static/images_by_rounds/' + image) for img in os.listdir('./static/image_ct_side'): os.remove('./static/image_ct_side/' + img) for img in os.listdir('./static/image_t_side'): os.remove('./static/image_t_side/' + img) for img in os.listdir('./static/image_team_one'): os.remove('./static/image_team_one/' + img) for img in os.listdir('./static/image_team_two'): os.remove('./static/image_team_two/' + img) for img in os.listdir('./static/ct_economy_plot'): os.remove('./static/ct_economy_plot/' + img) for img in os.listdir('./static/t_economy_plot'): os.remove('./static/t_economy_plot/' + img) filename = secure_filename(file.filename) file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename)) # file.save(os.path.join(app.config['UPLOAD_FOLDER'], 'demo.dem')) # checking if can demo be read # data = open('./uploads/' + filename, 'rb').read() # print('data: ', data[0]) #return redirect(url_for('uploaded_file', filename=filename)) return redirect('demo_by_rounds') return render_template('upload.html') @app.route('/uploads/<filename>') def uploaded_file(filename): return send_from_directory(app.config['UPLOAD_FOLDER'], filename) @app.route('/demo_by_rounds') def demo_dropdown(): def sort_nicely(l): convert = lambda text: int(text) if text.isdigit() else text alphanum_key = lambda key: [convert(c) for c in re.split('([0-9]+)', key)] l.sort(key = alphanum_key) return l get_coordinates() res_images() economy_images() round_numbers = return_rnd_numbers() images_names = [] for file in os.listdir("./static/images_by_rounds"): if file.endswith(".jpg"): images_names.append(file) # images_names = os.listdir("./images_by_rounds") sorted_names = sort_nicely(images_names) return render_template('demo_viewer.html', round_nums = round_numbers, images = sorted_names) @app.route('/demo_ct_side') def demo_ct_side(): image_name = "./static/image_ct_side/" + os.listdir("./static/image_ct_side")[0] return render_template('demo_ct_side.html', image = image_name) @app.route('/demo_t_side') def demo_t_side(): image_name = "./static/image_t_side/" + os.listdir("./static/image_t_side")[0] return render_template('demo_t_side.html', image = image_name) @app.route('/demo_team_one') def demo_team_one(): image_name = "./static/image_team_one/" + os.listdir("./static/image_team_one")[0] return render_template('demo_team_one.html', image = image_name) @app.route('/demo_team_two') def demo_team_two(): image_name = "./static/image_team_two/" + os.listdir("./static/image_team_two")[0] return render_template('demo_team_two.html', image = image_name) @app.route('/demo_by_roundss') def demo_by_roundss(): def sort_nicely(l): convert = lambda text: int(text) if text.isdigit() else text alphanum_key = lambda key: [convert(c) for c in re.split('([0-9]+)', key)] l.sort(key = alphanum_key) return l round_numbers = return_rnd_numbers() images_names = [] for file in os.listdir("./static/images_by_rounds"): if file.endswith(".jpg"): images_names.append(file) # images_names = os.listdir("./images_by_rounds") sorted_names = sort_nicely(images_names) return render_template('demo_by_roundss.html', round_nums = round_numbers, images = sorted_names) @app.route('/ct_economy') def ct_economy(): image_name = "./static/ct_economy_plot/" + os.listdir("./static/ct_economy_plot")[0] return render_template('ct_economy_plot.html', image = image_name) @app.route('/t_economy') def t_economy(): image_name = "./static/t_economy_plot/" + os.listdir("./static/t_economy_plot")[0] return render_template('t_economy_plot.html', image = image_name) if __name__ == "__main__": app.run(host="0.0.0.0", port=8000)
{"/server/server.py": ["/server/get_coordinates.py", "/server/split_demos_to_images.py", "/server/economy_to_plot.py"]}
42,241
themsoum7/csgo-positioning-gcp
refs/heads/master
/server/split_demos_to_images.py
#!/usr/bin/env python # coding: utf-8 import pandas as pd import os import matplotlib.pyplot as plt from matplotlib.patches import ConnectionPatch def csvs_to_dfs(list_of_csv): current_df = [] for csv in list_of_csv: df = pd.read_csv(csv, index_col = 0) current_df.append(df) return current_df im = plt.imread('../maps/de_dust2.png') # def plot_image(dataframe, idx, list_of_csv): # fig, ax = plt.subplots(figsize = (20, 20)) # # ax.scatter(dataframe.att_map_x, dataframe.att_map_y, alpha = 1, c = 'b') # ax.scatter(dataframe.vic_map_x, dataframe.vic_map_y, alpha = 1, c = 'r') # # ax.imshow(im) # # plt.savefig('./images/{}.jpg'.format(list_of_csv[idx])) # # # # # def plot_image_with_lines(dataframe, idx, list_of_csv): # fig, ax = plt.subplots(figsize = (20, 20)) # # ax.scatter(dataframe.att_map_x, dataframe.att_map_y, alpha = 1, c = 'b') # ax.scatter(dataframe.vic_map_x, dataframe.vic_map_y, alpha = 1, c = 'r') # # for j in range(len(dataframe)): # xyA = dataframe.att_map_x[j], dataframe.att_map_y[j] # xyB = dataframe.vic_map_x[j], dataframe.vic_map_y[j] # # con = ConnectionPatch(xyA, xyB, coordsA = "data", coordsB = "data", # arrowstyle="-", shrinkA=5, shrinkB=5, # mutation_scale=20, fc="w") # ax.add_artist(con) # # ax.imshow(im) # # plt.savefig('./images_by_sides/{}.jpg'.format(list_of_csv[idx])) # def plot_image_by_rounds(dataframe, csv_name): last_idx = 0 for j in range(dataframe['round'].nunique()): fig, ax = plt.subplots(figsize = (20, 20)) current_demo_round = dataframe.loc[dataframe['round'] == j + 1] plt.title("Round outcome: " + current_demo_round.winner_team.to_list()[0], fontsize = 30) ax.scatter(current_demo_round.att_map_x, current_demo_round.att_map_y, alpha = 1, c = 'b', s = 19**2, edgecolors='black') ax.scatter(current_demo_round.vic_map_x, current_demo_round.vic_map_y, alpha = 1, c = 'r', s = 19**2, edgecolors='black') for i in range(len(current_demo_round)): xy_a = current_demo_round.att_map_x[i + last_idx], current_demo_round.att_map_y[i + last_idx] xy_b = current_demo_round.vic_map_x[i + last_idx], current_demo_round.vic_map_y[i + last_idx] con = ConnectionPatch(xy_a, xy_b, coordsA = "data", coordsB = "data", arrowstyle="-|>", shrinkA=5, shrinkB=5, mutation_scale=20, fc="w") ax.add_artist(con) last_idx += len(current_demo_round) ax.imshow(im) plt.savefig('./static/images_by_rounds/{}_round_{}.jpg'.format(csv_name, j + 1)) plt.close() def return_round_num(dataframe): return dataframe['round'].unique().tolist() # def plot_image_by_sides(list_of_dfs, winner_side): # # plot images by sides NOT TEAMS # for i in range(len(list_of_dfs)): # fig, ax = plt.subplots(figsize = (20, 20)) # # demo_by_side = list_of_dfs[i].loc[list_of_dfs[i]['winner_team'] == winner_side] # # ax.scatter(demo_by_side.att_map_x, demo_by_side.att_map_y, alpha = 1, c = 'b') # ax.scatter(demo_by_side.vic_map_x, demo_by_side.vic_map_y, alpha = 1, c = 'r') # # ax.imshow(im) def plot_ct_side(dataframe, ct_side, csv_name): # plot images by sides NOT TEAMS fig, ax = plt.subplots(figsize = (20, 20)) demo_by_side = dataframe.loc[dataframe['winner_team'] == ct_side] plt.title('Demo plot for CT side for both teams', fontsize = 30) ax.scatter(demo_by_side.att_map_x, demo_by_side.att_map_y, alpha = 1, c = 'b', s = 15**2, edgecolors='black') ax.scatter(demo_by_side.vic_map_x, demo_by_side.vic_map_y, alpha = 1, c = 'r', s = 15**2, edgecolors='black') for j in range(len(demo_by_side)): xyA = demo_by_side.att_map_x.to_list()[j], demo_by_side.att_map_y.to_list()[j] xyB = demo_by_side.vic_map_x.to_list()[j], demo_by_side.vic_map_y.to_list()[j] con = ConnectionPatch(xyA, xyB, coordsA = "data", coordsB = "data", arrowstyle="-|>", shrinkA=5, shrinkB=5, mutation_scale=20, fc="w") ax.add_artist(con) ax.imshow(im) plt.savefig('./static/image_ct_side/{}_ct_side.jpg'.format(csv_name)) plt.close() def plot_t_side(dataframe, t_side, csv_name): # plot images by sides NOT TEAMS fig, ax = plt.subplots(figsize = (20, 20)) demo_by_side = dataframe.loc[dataframe['winner_team'] == t_side] plt.title('Demo plot for T side for both teams', fontsize = 30) ax.scatter(demo_by_side.att_map_x, demo_by_side.att_map_y, alpha = 1, c = 'b', s = 15**2, edgecolors='black') ax.scatter(demo_by_side.vic_map_x, demo_by_side.vic_map_y, alpha = 1, c = 'r', s = 15**2, edgecolors='black') for j in range(len(demo_by_side)): xyA = demo_by_side.att_map_x.to_list()[j], demo_by_side.att_map_y.to_list()[j] xyB = demo_by_side.vic_map_x.to_list()[j], demo_by_side.vic_map_y.to_list()[j] con = ConnectionPatch(xyA, xyB, coordsA = "data", coordsB = "data", arrowstyle="-|>", shrinkA=5, shrinkB=5, mutation_scale=20, fc="w") ax.add_artist(con) ax.imshow(im) plt.savefig('./static/image_t_side/{}_t_side.jpg'.format(csv_name)) plt.close() def plot_image_by_team_one(dataframe, tm_one, csv_name): fig, ax = plt.subplots(figsize = (20, 20)) demo_by_team_num = dataframe.loc[dataframe['team_num'] == tm_one] plt.title('Demo plot for Team 1', fontsize = 30) ax.scatter(demo_by_team_num.att_map_x, demo_by_team_num.att_map_y, alpha = 1, c = 'b', s = 15**2, edgecolors='black') ax.scatter(demo_by_team_num.vic_map_x, demo_by_team_num.vic_map_y, alpha = 1, c = 'r', s = 15**2, edgecolors='black') for j in range(len(demo_by_team_num)): xyA = demo_by_team_num.att_map_x.to_list()[j], demo_by_team_num.att_map_y.to_list()[j] xyB = demo_by_team_num.vic_map_x.to_list()[j], demo_by_team_num.vic_map_y.to_list()[j] con = ConnectionPatch(xyA, xyB, coordsA = "data", coordsB = "data", arrowstyle="-|>", shrinkA=5, shrinkB=5, mutation_scale=20, fc="w") ax.add_artist(con) ax.imshow(im) plt.savefig('./static/image_team_one/{}_team_one.jpg'.format(csv_name)) plt.close() def plot_image_by_team_two(dataframe, tm_two, csv_name): fig, ax = plt.subplots(figsize = (20, 20)) demo_by_team_num = dataframe.loc[dataframe['team_num'] == tm_two] plt.title('Demo plot for Team 2', fontsize = 30) ax.scatter(demo_by_team_num.att_map_x, demo_by_team_num.att_map_y, alpha = 1, c = 'b', s = 15**2, edgecolors='black') ax.scatter(demo_by_team_num.vic_map_x, demo_by_team_num.vic_map_y, alpha = 1, c = 'r', s = 15**2, edgecolors='black') for j in range(len(demo_by_team_num)): xyA = demo_by_team_num.att_map_x.to_list()[j], demo_by_team_num.att_map_y.to_list()[j] xyB = demo_by_team_num.vic_map_x.to_list()[j], demo_by_team_num.vic_map_y.to_list()[j] con = ConnectionPatch(xyA, xyB, coordsA = "data", coordsB = "data", arrowstyle="-|>", shrinkA=5, shrinkB=5, mutation_scale=20, fc="w") ax.add_artist(con) ax.imshow(im) plt.savefig('./static/image_team_two/{}_team_two.jpg'.format(csv_name)) plt.close() # # # # # def plot_image_by_teams(list_of_dfs, tm_num): # for i in range(len(list_of_dfs)): # fig, ax = plt.subplots(figsize = (20, 20)) # # demo_by_team_num = list_of_dfs[i].loc[list_of_dfs[i]['team_num'] == tm_num] # # ax.scatter(demo_by_team_num.att_map_x, demo_by_team_num.att_map_y, alpha = 1, c = 'b') # ax.scatter(demo_by_team_num.vic_map_x, demo_by_team_num.vic_map_y, alpha = 1, c = 'r') # # ax.imshow(im) # # # # # def plot_image_all_matches(list_of_dfs): # fig, ax = plt.subplots(figsize = (20, 20)) # coff = 1 # # for i in range(len(list_of_dfs)): # ax.scatter(list_of_dfs[i].att_map_x, list_of_dfs[i].att_map_y, alpha = coff, c = 'b') # ax.scatter(list_of_dfs[i].vic_map_x, list_of_dfs[i].vic_map_y, alpha = coff, c = 'r') # rnd = 1/len(list_of_dfs) # coff -= rnd # # ax.imshow(im) def return_rnd_numbers(): current_csv = [] for file in os.listdir("../csv"): if file.endswith(".csv"): current_csv.append(os.path.join("../csv/", file)) df = csvs_to_dfs(current_csv) round_number = return_round_num(df[0]) return round_number def res_images(): current_csv = [] current_csv_name = [] for file in os.listdir("../csv"): if file.endswith(".csv"): current_csv.append(os.path.join("../csv/", file)) current_csv_name.append(os.path.splitext(file)[0]) df = csvs_to_dfs(current_csv) cts_win = 'CTs win' ts_win = 'Ts win' team_one = 'Team 1' team_two = 'Team 2' plot_image_by_rounds(df[0], current_csv_name[0]) # plot_image(df, i, list_of_clear_csv) # plot_image_with_lines(df, i, list_of_clear_csv) # plot_image_all_matches(dfs) plot_ct_side(df[0], cts_win, current_csv_name[0]) plot_t_side(df[0], ts_win, current_csv_name[0]) plot_image_by_team_one(df[0], team_one, current_csv_name[0]) plot_image_by_team_two(df[0], team_two, current_csv_name[0]) # plot_image_by_sides(df[0], ts_win) # plot_image_by_teams(dfs, team_one) # plot_image_by_teams(dfs, team_two)
{"/server/server.py": ["/server/get_coordinates.py", "/server/split_demos_to_images.py", "/server/economy_to_plot.py"]}
42,242
themsoum7/csgo-positioning-gcp
refs/heads/master
/server/get_coordinates.py
from demoparser.demofile import DemoFile import pandas as pd import os def get_coordinates(): def m_start(event, msg): result.append("Match start") def r_start(event, msg): for idx, key in enumerate(event['event'].keys): if key.name == 'objective': objective = msg.keys[idx].val_string result.append([objective]) def r_end(event, msg): for idx, key in enumerate(event['event'].keys): if key.name == 'winner': winner = msg.keys[idx].val_byte elif key.name == 'reason': reason = msg.keys[idx].val_byte elif key.name == 'legacy': legacy = msg.keys[idx].val_byte elif key.name == 'message': message = msg.keys[idx].val_string elif key.name == 'player_count': player_count = msg.keys[idx].val_short result.append([message]) def death(event, msg): for idx, key in enumerate(event['event'].keys): if key.name == 'attacker': user_id = msg.keys[idx].val_short attacker = d.entities.get_by_user_id(user_id) elif key.name == 'userid': user_id = msg.keys[idx].val_short victim = d.entities.get_by_user_id(user_id) elif key.name == 'weapon': weapon = msg.keys[idx].val_string elif key.name == 'headshot': headshot = msg.keys[idx].val_bool if attacker and victim: result.append([attacker.position, victim.position]) def remove_warmup(res_list): match_start_idx = len(res_list) - 1 - res_list[::-1].index("Match start") new_res_list = res_list[match_start_idx:] return new_res_list def create_final_res(res_lst): new_result = remove_warmup(res_lst) res_with_round_num = define_round_num(new_result) res_no_trash = remove_trash(res_with_round_num) return res_no_trash def define_round_num(new_res_list): counter = 1 for i in range(len(new_res_list)): if new_res_list[i] in ct_round_end_msgs: new_res_list[i] = [{"Round msg": new_res_list[i][0], "round num": counter, "winner team": "CTs win"}] counter += 1 elif new_res_list[i] in t_round_end_msgs: new_res_list[i] = [{"Round msg": new_res_list[i][0], "round num": counter, "winner team": "Ts win"}] counter += 1 return new_res_list def remove_trash(new_res_list): for el in new_res_list: if el == "Match start" or el == ['BOMB TARGET']: new_res_list.pop(new_res_list.index(el)) return new_res_list def create_lists(new_res_list, att_list, vic_list, r_list, wnr_list, tms_list, cts_lvl_list, ts_lvl_list): round_counter = 1 kill_counter = 0 kills_counter = [] final_winner_list = [] final_team_list = [] idx = 0 rnd_cntr = 1 team_one = "" team_two = "" cts_final_lvls = [] ts_final_lvls = [] for el in new_res_list: if len(el) == 1: round_counter += 1 kills_counter.append(kill_counter) kill_counter = 0 wnr_list.append(el[0].get("winner team", "")) cts_lvl_list.append(el[0].get("ct buy level", "")) ts_lvl_list.append(el[0].get("t buy level", "")) else: att_list.append(el[0]) vic_list.append(el[1]) r_list.append(round_counter) kill_counter += 1 for el in wnr_list: if rnd_cntr == 1: team_one = el if rnd_cntr == 15: team_two = team_one team_one = "" if rnd_cntr < 15: if el == team_one: tms_list.append("Team 1") else: tms_list.append("Team 2") else: if el == team_two: tms_list.append("Team 2") else: tms_list.append("Team 1") rnd_cntr += 1 for el in kills_counter: for i in range(el): final_team_list.append(tms_list[idx]) final_winner_list.append(wnr_list[idx]) cts_final_lvls.append(cts_lvl_list[idx]) ts_final_lvls.append(ts_lvl_list[idx]) idx += 1 return att_list, vic_list, r_list, final_winner_list, final_team_list, cts_final_lvls, ts_final_lvls def split_x_y_z(att_or_vic_list, att_or_vic_x, att_or_vic_y, att_or_vic_z): for el in att_or_vic_list: att_or_vic_x.append(el['x']) att_or_vic_y.append(el['y']) att_or_vic_z.append(el['z']) return att_or_vic_x, att_or_vic_y, att_or_vic_z def create_df_from_res(att_x, att_y, att_z, vic_x, vic_y, vic_z, rnds, wnrs, tms): data_frame = pd.DataFrame({'attacker_x': att_x, 'attacker_y': att_y, 'attacker_z': att_z, 'victim_x': vic_x, 'victim_y': vic_y, 'victim_z': vic_z, 'round': rnds, 'wnr_team': wnrs, 'team_num': tms }) return data_frame # points for old dust 2: StartX = -2486; StartY = -1150; EndX = 2127; EndY = 3455; ResX = 1024; ResY = 1024; def pointx_to_resolutionx(xinput, startX = -2486, endX = 2127, resX = 1024): sizeX = endX - startX if startX < 0: xinput += startX * (-1.0) else: xinput += startX xoutput = float((xinput / abs(sizeX)) * resX) return xoutput def pointy_to_resolutiony(yinput, startY = -1150, endY = 3455, resY = 1024): sizeY = endY - startY if startY < 0: yinput += startY * (-1.0) else: yinput += startY youtput = float((yinput / abs(sizeY)) * resY) return resY - youtput - 10 # def convert_data(dataframe, list_of_dfs, rnds, wnrs, tms): # new_df = pd.DataFrame() # # Convert the data to radar positions # new_df['att_map_x'] = dataframe['attacker_x'].apply(pointx_to_resolutionx) # new_df['att_map_y'] = dataframe['attacker_y'].apply(pointy_to_resolutiony) # new_df['vic_map_x'] = dataframe['victim_x'].apply(pointx_to_resolutionx) # new_df['vic_map_y'] = dataframe['victim_y'].apply(pointy_to_resolutiony) # new_df['round'] = rnds # new_df['winner_team'] = wnrs # new_df['team_num'] = tms # list_of_dfs.append(new_df) # # return list_of_dfs def convert_data(dataframe, actual_df, rnds, wnrs, tms, cts_lvls, t_lvls): new_df = pd.DataFrame() # Convert the data to radar positions new_df['att_map_x'] = dataframe['attacker_x'].apply(pointx_to_resolutionx) new_df['att_map_y'] = dataframe['attacker_y'].apply(pointy_to_resolutiony) new_df['vic_map_x'] = dataframe['victim_x'].apply(pointx_to_resolutionx) new_df['vic_map_y'] = dataframe['victim_y'].apply(pointy_to_resolutiony) new_df['round'] = rnds new_df['winner_team'] = wnrs new_df['team_num'] = tms new_df['t_buy_level'] = t_lvls new_df['ct_buy_level'] = cts_lvls actual_df.append(new_df) return actual_df # def df_to_csv(list_of_demos, list_of_dfs): # for i in range(len(list_of_demos)): # for j in range(len(list_of_dfs)): # if i == j: # list_of_dfs[j].to_csv('../csv/{}.csv'.format(list_of_demos[i])) def df_to_csv(actual_df, actual_clear_df): actual_df[0].to_csv('../csv/{}.csv'.format(actual_clear_df[0])) def economy(dataframe, res_list): t_buy_level = 0 ct_buy_level = 0 counter = 1 win_streak = 0 prev_winner = '' for i in range(len(res_list)): if len(res_list[i]) == 1: rnd_winner = res_list[i][0].get("winner team") if counter == 1 or counter == 16: win_streak = 0 if rnd_winner: win_streak += 1 ct_buy_level = 1 t_buy_level = 1 if counter == 2 or counter == 17: if rnd_winner == "CTs win": if rnd_winner == prev_winner: win_streak += 1 ct_buy_level = 2.5 t_buy_level = 1.5 else: win_streak = 1 ct_buy_level = 1.5 t_buy_level = 2.5 else: if rnd_winner == prev_winner: win_streak += 1 ct_buy_level = 1.5 t_buy_level = 2.5 else: win_streak = 1 ct_buy_level = 2.5 t_buy_level = 1.5 if counter == 3 or counter == 18: if rnd_winner == "Ts win": if rnd_winner == prev_winner: win_streak += 1 ct_buy_level = 1.5 t_buy_level = 2.7 else: win_streak = 1 ct_buy_level = 2.7 t_buy_level = 1.5 else: if rnd_winner == prev_winner: win_streak += 1 ct_buy_level = 2.7 t_buy_level = 1.5 else: win_streak = 1 ct_buy_level = 1.5 t_buy_level = 2.7 if 3 < counter <= 15 or 18 < counter <= 30: if rnd_winner == "CTs win": if rnd_winner != prev_winner: win_streak = 1 # ct_buy_level += 0.2 t_buy_level -= 0.5 else: if win_streak > 4 and t_buy_level == 2.5: t_buy_level = 3 elif win_streak > 4 and t_buy_level == 3: t_buy_level = 2.5 else: win_streak += 1 if win_streak >= 4: ct_buy_level += 0.7 t_buy_level = 2.5 else: if win_streak > 1 and ct_buy_level < 3: t_buy_level += 0.5 else: ct_buy_level += 0.4 t_buy_level -= 0.5 if t_buy_level < 1: t_buy_level = 1 if ct_buy_level > 5: ct_buy_level = 5 if t_buy_level > 5: t_buy_level = 5 elif rnd_winner == "Ts win": if rnd_winner != prev_winner: win_streak = 1 ct_buy_level -= 0.8 # t_buy_level += 0.5 else: if win_streak > 4 and ct_buy_level == 2.5: ct_buy_level = 3 elif win_streak > 4 and ct_buy_level == 3: ct_buy_level = 2.5 else: win_streak += 1 if win_streak >= 4: ct_buy_level = 2.5 t_buy_level += 0.7 else: if win_streak > 1 and t_buy_level < 3: ct_buy_level += 0.5 else: ct_buy_level -= 0.4 t_buy_level += 0.4 if ct_buy_level < 1: ct_buy_level = 1 if ct_buy_level > 5: ct_buy_level = 5 if t_buy_level > 5: t_buy_level = 5 res_list[i][0]["t buy level"] = round(t_buy_level, 1) res_list[i][0]["ct buy level"] = round(ct_buy_level, 1) res_list[i] = [res_list[i][0]] # res_list[0][i] = [res_list[0][i][0], {"t buy level": round(t_buy_level, 1), "ct buy level": round(ct_buy_level, 1)}] prev_winner = rnd_winner counter += 1 return res_list def all_processes(res): final_res = create_final_res(res) new_final_res = economy(current_df, final_res) attackers_list, victims_list, rounds_list, winner_list, teams_list, ct_lvls, t_lvls = create_lists(final_res, attackers, victims, rounds, winners, teams, ct_final_lvls, t_final_lvls) attackers_x, attackers_y, attackers_z = split_x_y_z(attackers, attacker_x, attacker_y, attacker_z) vitctims_x, victims_y, victims_z = split_x_y_z(victims, victim_x, victim_y, victim_z) df = create_df_from_res(attacker_x, attacker_y, attacker_z, victim_x, victim_y, victim_z, rounds_list, winner_list, teams_list) all_demos_result.append(new_final_res) new_dff = convert_data(df, current_df, rounds_list, winner_list, teams_list, ct_lvls, t_lvls) df_to_csv(current_df, clear_demos_list) return all_demos_result all_demos_result = [] current_df = [] ct_round_end_msgs = [['#SFUI_Notice_Bomb_Defused'], ['#SFUI_Notice_CTs_Win'], ['#SFUI_Notice_Target_Saved']] t_round_end_msgs = [['#SFUI_Notice_Terrorists_Win'], ['#SFUI_Notice_Target_Bombed']] demos_list = [] clear_demos_list = [] for file in os.listdir("../uploads"): if file.endswith(".dem"): demos_list.append(os.path.join("../uploads/", file)) clear_demos_list.append(os.path.splitext(file)[0]) for demo in demos_list: result = [] attackers, victims, rounds, attacker_x, attacker_y, attacker_z, victim_x, victim_y, victim_z, winners, teams, ct_final_lvls, t_final_lvls = [], [], [], [], [], [], [], [], [], [], [], [], [] data = open(demo, 'rb').read() d = DemoFile(data) d.add_callback('round_announce_match_start', m_start) d.add_callback('round_start', r_start) d.add_callback('player_death', death) d.add_callback('round_end', r_end) d.parse() data_res = all_processes(result) return data_res
{"/server/server.py": ["/server/get_coordinates.py", "/server/split_demos_to_images.py", "/server/economy_to_plot.py"]}
42,293
yinwil27/Test
refs/heads/main
/Truck.py
import CSVReader import HashMap '''' loop through RolodexAddressOnly start from Hub call getDistance function for each element n RolodexAddressonly find distance assign minimum distance minDistance find address for minDistance and deliver repeat this for all addresses if address is not in current truck, skip ''' Truck1 = [] # for Truck1 in CSVReader.RolodexAddressOnly: print("Package1's distance is: " + str(CSVReader.getDistance('4001 South 700 East', '195 W Oakland Ave'))) print("Package13's distance is: " + str(CSVReader.getDistance('4001 South 700 East', '2010 W 500 S'))) print("Package14's distance is: " + str(CSVReader.getDistance('4001 South 700 East', '4300 S 1300 E'))) print("Package15's distance is: " + str(CSVReader.getDistance('4001 South 700 East', '4580 S 2300 E'))) print("Package16's distance is: " + str(CSVReader.getDistance('4001 South 700 East', '4580 S 2300 E'))) print("Package17's distance is: " + str(CSVReader.getDistance('4001 South 700 East', '3148 S 1100 W'))) print("Package19's distance is: " + str(CSVReader.getDistance('4001 South 700 East', '177 W Price Ave'))) print("Package30's distance is: " + str(CSVReader.getDistance('4001 South 700 East', '300 State St'))) print("Package31's distance is: " + str(CSVReader.getDistance('4001 South 700 East', '3365 S 900 W'))) print("Package34's distance is: " + str(CSVReader.getDistance('4001 South 700 East', '4580 S 2300 E'))) print("Package37's distance is: " + str(CSVReader.getDistance('4001 South 700 East', '410 S State St'))) print("Package40's distance is: " + str(CSVReader.getDistance('4001 South 700 East', '380 W 2880 S'))) Truck1.append(CSVReader.getDistance('4001 South 700 East', '195 W Oakland Ave')) Truck1.append(CSVReader.getDistance('4001 South 700 East', '2010 W 500 S')) Truck1.append(CSVReader.getDistance('4001 South 700 East', '4300 S 1300 E')) Truck1.append(CSVReader.getDistance('4001 South 700 East', '4580 S 2300 E')) Truck1.append(CSVReader.getDistance('4001 South 700 East', '4580 S 2300 E')) Truck1.append(CSVReader.getDistance('4001 South 700 East', '3148 S 1100 W')) Truck1.append(CSVReader.getDistance('4001 South 700 East', '300 State St')) Truck1.append(CSVReader.getDistance('4001 South 700 East', '3365 S 900 W')) Truck1.append(CSVReader.getDistance('4001 South 700 East', '4580 S 2300 E')) Truck1.append(CSVReader.getDistance('4001 South 700 East', '410 S State St')) Truck1.append(CSVReader.getDistance('4001 South 700 East', '380 W 2880 S')) Truck1.append(CSVReader.getDistance('4001 South 700 East', '177 W Price Ave')) print(min(Truck1)) minDistance = min(Truck1) '''print(CSVReader.getDistance(print(getDistance('4001 South 700 East', '1060 Dalton Ave S'))))''' class Truck: def __init__(self): self.package_list = [] self.size = 6 self.Location = '4001 South 700 East' self.LeaveTime = 480 self.CurrentTime = 480 def deliveryminutes(mph): return CSVReader.getDistance('4001 South 700 East', '1060 Dalton Ave S') / mph def currentminutes(mph): return (CSVReader.getDistance('4001 South 700 East', '1060 Dalton Ave S') / mph) + Truck.CurrentTime # Package ID def deliver(self, packageID, h): package_list = h.get('5') ''' Get Address for the package object pacckage_list is the package object #find distance from the trucks location to the package's object address #convert that distance to time ''' return print("package :" + CSVReader.PackageID + "was delivered at") h = HashMap.HashMap() CSVReader.HashMaker(h) truckAmazon = Truck() print(truckAmazon.deliver(5, h))
{"/Truck.py": ["/CSVReader.py"], "/main.py": ["/CSVReader.py"]}
42,294
yinwil27/Test
refs/heads/main
/main.py
import csv import CSVReader import HashMap FirstTime = CSVReader.Ride1[2] o = min(str(FirstTime)) def dropOff1(packageCount): while packageCount > 0: print("dropoff") print(o) as_list = list(FirstTime) as_list.pop[o] packageCount - 1 print(dropOff1(12)) ''' SecondTime = CSVReader.Ride2 p = min(str(SecondTime)) for p in SecondTime: print("Ride2") print(p) ThirdTime = CSVReader.Ride3 q = min(str(ThirdTime)) for q in ThirdTime: print("Ride3") print(q) '' h.add("1", "195 W Oakland Ave Salt Lake City UT 84115") h.add('2', '2530 S 500 E Salt Lake City UT 84106') h.add('3', '233 Canyon Rd Salt Lake City UT 84103') h.add('4', '380 W 2880 S Salt Lake City UT 84115') h.add('5', '410 S State St Salt Lake City UT 84111') h.add('6', '3060 Lester St West Valley City UT 84119') h.add('7', '1330 2100 S Salt Lake City UT 84106') h.add('8', '300 State St Salt Lake City UT 84103') h.add('9', '410 S State St Salt Lake City UT 84111') h.add('10', '600 E 900 South Salt Lake City UT 84105') h.add('11', '2600 Taylorsville Blvd Salt Lake City UT 84118') h.add('12', '3575 W Valley Central Station bus Loop West Valley City UT 84119') h.add('13', '2010 W 500 S Salt Lake City UT 84104') h.add('14', '4300 S 1300 E Millcreek UT 84117') h.add('15', '4580 S 2300 E Holladay UT 84117') h.add('16', '4580 S 2300 E Holladay UT 84117') h.add('17', '3148 S 1100 W Salt Lake City UT 84119') h.add('18', '1488 4800 S Salt Lake City UT 84123') h.add('19', '177 W Price Ave Salt Lake City UT 84115') h.add('20', '3595 Main St Salt Lake City UT 84115') h.add('21', '3595 Main St Salt Lake City UT 84115') h.add('22', '6351 South 900 East Murray UT 84121') h.add('23', '5100 South 2700 West Salt Lake City UT 84118') h.add('24', '5025 State St Murray UT 84107') h.add('25', '5383 South 900 East #104 Salt Lake City UT 84117') h.add('26', '5383 South 900 East #104 Salt Lake City UT 84117') h.add('27', '1060 Dalton Ave S Salt Lake City UT 84104') h.add('28', '2835 Main St Salt Lake City UT 84115') h.add('29', '1330 2100 S Salt Lake City UT 84106') h.add('30', '300 State St Salt Lake City UT 84103') h.add('31', '3365 S 900 W Salt Lake City UT 84119') h.add('32', '3365 S 900 W Salt Lake City UT 84119') h.add('33', '2530 S 500 E Salt Lake City UT 84106') h.add('34', '4580 S 2300 E Holladay UT 84117') h.add('35', '1060 Dalton Ave S Salt Lake City UT 84104') h.add('36', '2300 Parkway Blvd West Valley City UT 84119') h.add('37', '410 S State St Salt Lake City UT 84111') h.add('38', '410 S State St Salt Lake City UT 84111') h.add('39', '2010 W 500 S Salt Lake City UT 84104') h.add('40', '380 W 2880 S Salt Lake City UT 84115') h.print() # create an algorithm that checks everything for the shortest distance from current location. recount, go again, # shortest distance, count, go again Using holistic approach Ride1 = [h.get('1'), h.get('13'), h.get('14'), h.get('15'), h.get('16'), h.get('17'), h.get('19'), h.get('30'), h.get('31'), h.get('34'), h.get('37'), h.get('40')] # 8 am Ride2 = [h.get('3'), h.get('6'), h.get('18'), h.get('25'), h.get('36'), h.get('38'), h.get('32'), h.get('33'), h.get('35'), h.get('39')] # 9:06 am Ride3 = [h.get('2'), h.get('4'), h.get('5'), h.get('7'), h.get('8'), h.get('9'), h.get('10'), h.get('11'), h.get('21'), h.get('22'), h.get('23'), h.get('24'), h.get('26'), h.get('27'), h.get('28')] # 1021am print("Truck1") print(Ride1) print("Truck2") print(Ride2) print("Truck1, 2nd Ride") print(Ride3) '''
{"/Truck.py": ["/CSVReader.py"], "/main.py": ["/CSVReader.py"]}
42,295
yinwil27/Test
refs/heads/main
/CSVReader.py
import csv import HashMap GPSMatrix = [] # Read in csv file that is the mapping of distances between locations with open('DistanceNumbers.csv') as csvfile: readCSV2 = csv.reader(csvfile, delimiter=',') readCSV2 = list(readCSV2) for row in readCSV2: GPS = [row[0], row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20], row[21], row[22], row[23], row[24], row[25], row[26]] GPSMatrix.append(row) print("GPS Numbers") print(GPSMatrix) ''' for row in readCSV: print("row") print(row) print(row[0]) print(row[0], row[1],row[2]) package = [row[1],row[2],row[3],row[4],row[5],row[6], row[7] ,row[8]] h.add(row[0], package) #PackageID.append(PackageID) #Address.append(Address)''' # Read in csv file that is the names of all possible delivery locations Rolodex = [] RolodexAddressOnly = [] with open('DistanceApart.csv') as csv_name_file: readCSV3 = csv.reader(csv_name_file, delimiter=',') readCSV3 = list(readCSV3) for row in readCSV3: Book = [row[0], row[1], row[2]] Rolodex.append(row) RolodexAddressOnly.append(row[2]) print("GPS NAMES") print(Rolodex) print(RolodexAddressOnly) PackageID = [] Address = [] h = HashMap.HashMap() with open('WGUPS Package File.csv') as csvfile: readCSV = csv.reader(csvfile, delimiter=',') for row in readCSV: (' print("row")\n' ' print(row)\n' ' print(row[0])\n' ' print(row[0], row[1],row[2])\n') package = [row[0], row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8]] h.add(row[0], package) PackageID.append(row[0]) Address.append(package) print(PackageID) print(Address) # Holistic Approach to loading packages onto truck # create an algorithm that checks everything for the shortest distance from current location. recount, go again, # shortest distance, count, go again Using holistic approach Ride1 = [(h.get('1'), Rolodex[5][1], GPSMatrix[5][0]), (h.get('13'), Rolodex[6][1], GPSMatrix[6][0]), (h.get('14'), Rolodex[20][1], GPSMatrix[20][0]), (h.get('15'), Rolodex[21][1], GPSMatrix[21][0]), (h.get('16'), Rolodex[21][1], GPSMatrix[21][0]), (h.get('17'), Rolodex[14][1], GPSMatrix[14][0]), (h.get('19'), Rolodex[4][1], GPSMatrix[4][0]), (h.get('30'), Rolodex[12][1], GPSMatrix[12][0]), (h.get('31'), Rolodex[15][1], GPSMatrix[15][0]), (h.get('34'), Rolodex[21][1], GPSMatrix[21][0]), (h.get('37'), Rolodex[19][1], GPSMatrix[19][0]), (h.get('40'), Rolodex[18][1], GPSMatrix[18][0])] # 8 am Ride2 = [h.get('3'), h.get('6'), h.get('18'), h.get('25'), h.get('36'), h.get('38'), h.get('32'), h.get('33'), h.get('35'), h.get('39')] # 9:06 am Ride3 = [h.get('2'), h.get('4'), h.get('5'), h.get('7'), h.get('8'), h.get('9'), h.get('10'), h.get('11'), h.get('21'), h.get('22'), h.get('23'), h.get('24'), h.get('26'), h.get('27'), h.get('28')] # 1021am print("Truck1") print(Ride1) print("Truck2") print(Ride2) print("Truck1, 2nd Ride") print(Ride3) # Print GPS Matrix for row in GPSMatrix: print(row) for i in range(27): for j in range(27): print(GPSMatrix[i][j]) # '4001 South 700 East', '1060 Dalton Ave S', def getDistance(fromAddress, toAddress): return GPSMatrix[RolodexAddressOnly.index(toAddress)][RolodexAddressOnly.index(fromAddress)] print("Get Distance Results") print(getDistance('4001 South 700 East', '1060 Dalton Ave S'))
{"/Truck.py": ["/CSVReader.py"], "/main.py": ["/CSVReader.py"]}
42,297
jean-mi-e/calc-mge-wxPython
refs/heads/master
/frame/txtvaclass.py
#!/usr/bin/env python3 # coding: utf-8 import wx class Classtxtva(wx.Panel): """Classe du tk.Entry Taux de la TVA""" def __init__(self, parent): wx.Panel.__init__(self, parent) self.lab_txtva = wx.StaticText(self, -1, "Taux de T.V.A.") self.listTaux = ["20 %", "10 %", "5,50 %", "2,10 %", "0 %", "Inconnu"] self.txtva = wx.ComboBox(self, -1, value=self.listTaux[0], choices=self.listTaux, style=wx.CB_READONLY | wx.CB_DROPDOWN) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.lab_txtva) sizer.Add(self.txtva, wx.ALIGN_LEFT) sizer.Add(-1, 10) self.SetSizer(sizer) #sizer = wx.GridBagSizer() #sizer.Add(self.combo, (210, 25), (1, 1), wx.EXPAND) def val_get(self): """Méthode permettant de vérifier si l'entrée est numérique et de retourner un float""" if self.txtva.GetStringSelection() == self.listTaux[5]: txselec = self.listTaux[5] else: txselec = self.txtva.GetStringSelection() txselec = txselec[:-2] if txselec == '5,50': txselec = 5.5 elif txselec == '2,10': txselec = 2.1 txselec = float(txselec) return txselec def lab_get(self): """Méthode retournant le contenu du Label de la classe""" return wx.Control.GetLabel(self.lab_txtva) def delete(self): """Méthode effaçant le contenu de l'Entry de la classe""" return self.txtva.SetSelection(self.listTaux[0]) def insert(self, arg): """Méthode permettant de définir le taux de TVA dans l'OptionMenu""" val_arg = {float(20): '0', float(10): '1', 5.5: '2', 2.1: '3', float(0): '4', "Inconnu": 5} if arg in val_arg.keys(): arg = val_arg[arg] return self.txtva.SetValue(self.listTaux[int(arg)]) else: res = wx.MessageDialog(self, "Vous avez du faire une erreur de saisie \n" f"Le Taux de TVA {arg:.2f}% n'existe pas.", "ERREUR", style=wx.OK | wx.ICON_ERROR | wx.CENTRE, pos=wx.DefaultPosition) res = res.ShowModal() return self.txtva.SetValue(arg) def raz(self): self.txtva.SetValue(self.listTaux[0])
{"/frame/interface.py": ["/frame/pattcclass.py", "/frame/txtvaclass.py"], "/calc.py": ["/frame/interface.py"]}
42,298
jean-mi-e/calc-mge-wxPython
refs/heads/master
/frame/interface.py
#!/usr/bin/env python3 # coding: utf-8 import wx import frame.fonctionscalculs as fc import frame.mttmgeclass as mttmge import frame.mtttvaclass as mtttva import frame.pahtclass as paht import frame.pattcclass as pattc import frame.pvttcclass as pvttc import frame.txmgeclass as txmge import frame.txtvaclass as txtva class Interface(wx.Frame): """Notre fenêtre principale qui hérite de Frame Les éléments principaux sont stockés comme attributs de cette fenêtre Les widgets sont créés par une méthode de classe lors de l'initialisation""" def __init__(self, parent, id): wx.Frame.__init__(self, parent, id, 'Calculatrice de marge', size=(365, 375), style=wx.DEFAULT_FRAME_STYLE & ~ (wx.RESIZE_BORDER | wx.MAXIMIZE_BOX)) icone = wx.Icon("./calcul.ico", wx.BITMAP_TYPE_ICO) self.SetIcon(icone) self.CentreOnScreen() self._initui() def _initui(self): self.panel = wx.Panel(self) # Instanciation des widgets à partir des différentes classes self.list_inst_wid = [paht.Classpaht(self.panel), txtva.Classtxtva(self.panel), mtttva.Classmtttva(self.panel), pattc.Classpattc(self.panel), pvttc.Classpvttc(self.panel), txmge.Classtxmge(self.panel), mttmge.Classmttmge(self.panel)] self.listwidgets = [] for wid in self.list_inst_wid: self.listwidgets.append(wid) # Création des boutons de l'interface button_quit = wx.Button(self.panel, label="Quitter", size=(140, 40)) self.Bind(wx.EVT_BUTTON, self._closebutton, button_quit) button_raz = wx.Button(self.panel, label="Remise à zéro", size=(140, 40)) self.Bind(wx.EVT_BUTTON, self._raz, button_raz) button_calcul = wx.Button(self.panel, label="Calcul", size=(140, 40)) self.Bind(wx.EVT_BUTTON, self._cliquer, button_calcul) # Création du sizer principal qui contiendra tous les autres sizer = wx.BoxSizer(wx.VERTICAL) # Mise en place des différents sizer et de leur contenu sizer1 = wx.BoxSizer(wx.HORIZONTAL) sizer1.AddSpacer(30) sizer1.Add(self.listwidgets[0], flag=wx.TOP, border=15) sizer1.AddSpacer(60) sizer1.Add(self.listwidgets[1], flag=wx.TOP, border=15) sizer2 = wx.BoxSizer(wx.HORIZONTAL) sizer2.AddSpacer(30) sizer2.Add(self.listwidgets[2]) sizer2.AddSpacer(60) sizer2.Add(self.listwidgets[3]) sizer3 = wx.BoxSizer(wx.HORIZONTAL) sizer3.AddSpacer(30) sizer3.Add(self.listwidgets[4]) sizer3.AddSpacer(60) sizer3.Add(self.listwidgets[5]) sizer4 = wx.BoxSizer(wx.HORIZONTAL) sizer4.AddSpacer(110) sizer4.Add(self.listwidgets[6]) sizer5 = wx.BoxSizer(wx.VERTICAL) sizer5.AddSpacer(10) sizer6 = wx.BoxSizer(wx.HORIZONTAL) sizer6.AddSpacer(100) sizer6.Add(button_calcul) sizer7 = wx.BoxSizer(wx.VERTICAL) sizer7.AddSpacer(10) sizer8 = wx.BoxSizer(wx.HORIZONTAL) sizer8.Add(button_quit, flag=wx.LEFT, border=25) sizer8.Add(button_raz, flag=wx.LEFT, border=20) list_sizer = [sizer1, sizer2, sizer3, sizer4, sizer5, sizer6, sizer7, sizer8] for elt in list_sizer: sizer.Add(elt) self.panel.SetSizer(sizer) # Gestion des évènements saisie clavier self.Bind(wx.EVT_CHAR_HOOK, self._onchar) # Création de listes des libellés et entry instanciés self.list_labels = [self.listwidgets[0].lab_get(), self.listwidgets[1].lab_get(), self.listwidgets[2].lab_get(), self.listwidgets[3].lab_get(), self.listwidgets[4].lab_get(), self.listwidgets[5].lab_get(), self.listwidgets[6].lab_get()] self.list_entry = [self.listwidgets[0], self.listwidgets[2], self.listwidgets[3], self.listwidgets[4], self.listwidgets[5], self.listwidgets[6]] def _cliquer(self, event): """Méthode détaillant les étapes principales du calcul. On lance les contrôles et calculs pour trouver les résultats souhaités.""" # Controle du nombre de données renseignées if self._ctrl_nb_data(): res = wx.MessageDialog(self, "Vous devez renseigner au minimum 3 données \n" "pour avoir un maximum de résultats", "ERREUR", style=wx.OK | wx.ICON_WARNING | wx.CENTRE, pos=wx.DefaultPosition) res.ShowModal() self.list_var = self._recup_val() # On crée une liste des calculs à réaliser self.list_calculs = [fc.calc_paht(*self.list_var), fc.calc_txtva(*self.list_var), fc.calc_mtttva(*self.list_var), fc.calc_pattc(*self.list_var), fc.calc_pvttc(*self.list_var), fc.calc_txmge(*self.list_var), fc.calc_mttmge(*self.list_var)] # On crée une liste vide pour insérer les résultats self.list_resultats = [] # On effectue les calculs et on les places dans la liste de résultats for calc in self.list_calculs: self.list_resultats.append(calc) # Contrôles de cohérence if self.list_resultats[1] == 'Inconnu' or self.list_resultats[1] == float(0): control = round(self.list_resultats[4] - self.list_resultats[0], 2) else: control = round(self.list_resultats[4] / (1 + (self.list_resultats[1] / 100)) - self.list_resultats[0], 2) if control != self.list_resultats[6]: res = wx.MessageDialog(self, "Les données saisies contiennent une anomalie et/ou " "ne suffisent pas à calculer un résultat juste.", "ERREUR", style=wx.OK | wx.ICON_ERROR | wx.CENTRE, pos=wx.DefaultPosition) res.ShowModal() # mise à jour des Entry idx = 0 for elt in self.list_entry: elt.delete() if idx == 1: # On saute le résultat txtva car il fonctionne différement des autres (OptionMenu pas Entry) idx = 2 elt.insert(self.list_resultats[idx]) idx += 1 self.listwidgets[1].insert(self.list_resultats[1]) # Mise en state='disabled' les widgets pour figer les résultats for elt in self.list_entry: elt.state('disabled') def _recup_val(self): """Affectation des valeurs saisies dans les entry à une liste.""" list_val = [] for elt in self.listwidgets: list_val.append(elt.val_get()) return list_val def _ctrl_nb_data(self): """Méthode vérifiant qu'au moins 3 données ont été renseignées pour les calculs""" idx = 0 list_control = list(self._recup_val()) del list_control[1] for elt in list_control: if str(elt) != '0.0' and str(elt) != '': idx += 1 if self.listwidgets[1].val_get() != 'Inconnu': idx += 1 if idx < 3: return True else: return False def _raz(self, event): """Méthode remettant tous les Widgets de saisie en mode initial""" for elt in self.list_entry: elt.state('normal') elt.delete() elt.insert(0.0) self.listwidgets[1].raz() def _onchar(self, event): """Méthode permettant de récupérer le code des touches clavier qui sont utilisées. Si la touche Escape est utilisée on ferme l'application Si la touche Entrée est utilisée on lance les calculs.""" keycode = event.GetKeyCode() if keycode == wx.WXK_ESCAPE: self.Close(True) elif keycode == wx.WXK_RETURN or keycode == wx.WXK_NUMPAD_ENTER: self._cliquer(event) else: event.Skip() def _closebutton(self, event): self.Close(True) if __name__ == "__main__": app = wx.App() frame = Interface(parent=None, id=-1) frame.Show() app.MainLoop()
{"/frame/interface.py": ["/frame/pattcclass.py", "/frame/txtvaclass.py"], "/calc.py": ["/frame/interface.py"]}
42,299
jean-mi-e/calc-mge-wxPython
refs/heads/master
/calc.py
#!/usr/bin/env python3 # coding: utf-8 import frame.interface as itf import wx def main(): app = wx.App() frame = itf.Interface(parent=None, id=-1) frame.Show() app.MainLoop() if __name__ == "__main__": main()
{"/frame/interface.py": ["/frame/pattcclass.py", "/frame/txtvaclass.py"], "/calc.py": ["/frame/interface.py"]}
42,300
jean-mi-e/calc-mge-wxPython
refs/heads/master
/frame/pattcclass.py
#!/usr/bin/env python3 # coding: utf-8 import wx class Classpattc(wx.Panel): """Classe du wx.TextCtrl Prix d'achat HT""" def __init__(self, parent): wx.Panel.__init__(self, parent) self.lab_pattc = wx.StaticText(self, label="Prix d'achat T.T.C.") self.pattc = wx.TextCtrl(self, value="0.00") sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.lab_pattc, flag=wx.EXPAND) sizer.Add(self.pattc, proportion=1) sizer.Add(-1, 10) self.SetSizer(sizer) #sizer = wx.GridBagSizer() #sizer.Add(self.pattc, (210, 75), (1, 1), wx.EXPAND) def val_get(self): """Méthode permettant de vérifier si l'entrée est numérique et de retourner un float""" try: float(self.pattc.GetValue()) except ValueError: res = wx.MessageDialog(self, "Le PA T.T.C. n'est pas un nombre", "ERREUR", style=wx.OK | wx.ICON_ERROR | wx.CENTRE, pos=wx.DefaultPosition) res.ShowModal() if self.pattc.GetValue() == '': self.pattc.SetValue(float(0)) return float(self.pattc.GetValue()) def lab_get(self): """Méthode retournant le contenu du Label de la classe""" return wx.Control.GetLabel(self.lab_pattc) def delete(self): """Méthode effaçant le contenu de l'Entry de la classe""" return self.pattc.SetValue('0') def insert(self, arg): """Méthode permettant de redéfinir le contenu du TextEntry""" return self.pattc.SetValue(str(arg)) def state(self, arg): """Méthode permettant de définir l'état de l'Entry Normal -> saisie autorisée Disabled -> saisie bloquée""" try: assert arg == 'normal' or arg == 'disabled' except TypeError: pass if arg == 'normal': self.pattc.SetEditable(True) elif arg == 'disabled': self.pattc.SetEditable(False)
{"/frame/interface.py": ["/frame/pattcclass.py", "/frame/txtvaclass.py"], "/calc.py": ["/frame/interface.py"]}
42,302
jaybaker/gaeutils
refs/heads/master
/gaeutils/__init__.py
import os import time from google.appengine.api import taskqueue, app_identity from google.appengine.ext import ndb __all__ = ['App', 'safe_enqueue', 'QueryExec', 'urlsafe', 'fanout', 'Stack', 'FutStack'] class _App(object): """ Encapsulates some basic identifying features often used. """ def __init__(self): self.setup() def setup(self): """ Needed for environments like test if the env is not set yet. """ try: self.id = app_identity.get_application_id() except: # call to get_application_id fails in unitest env for some reason self.id = os.getenv('APPLICATION_ID') version_info = os.getenv('CURRENT_VERSION_ID', '').split('.') self.version = version_info[0] if len(version_info) > 0 else '' self.deploy_time = int(version_info[1]) if len(version_info) > 1 else 0 self.dev = os.getenv('SERVER_SOFTWARE', '').startswith('Dev') def __str__(self): return 'App: id=%s ver=%s deployed=%s dev=%s' % (self.id, self.version, self.deploy_time, self.dev) App = _App() def safe_enqueue(url, max_retry_timeout=2000, **kwargs): """ Utility to enqueue a task. """ timeout_ms = 100 while timeout_ms < max_retry_timeout or max_retry_timeout == 0: try: taskqueue.add(url=url, **kwargs) break except taskqueue.TransientError: # try again # max timeout of 0 is signal to not retry if max_retry_timeout == 0: break time.sleep(timeout_ms/1000) timeout_ms *= 2 except (taskqueue.TombstonedTaskError, taskqueue.TaskAlreadyExistsError): break # already queued def urlsafe(key_repr): """ Converts an ndb.Key to urlsafe representation while allowing a string to just pass through. This is useful as one often wants to support a function that obligingly accepts either a Key or what is already the urlsafe encoded version. Usage: key = ndb.Key(urlsafe=urlsafe(key_info)) """ if isinstance(key_repr, basestring): return key_repr else: return key_repr.urlsafe() class Stack(object): """ A base stack implementation. """ def __init__(self): self.stack = [] def push(self, item): """ Supports chaining push calls. """ self.stack.append(item) return self def pop(self): return self.stack.pop() def __enter__(self): return self def __exit__(self, type, value, traceback): assert len(self) == 0 def __len__(self): return len(self.stack) class FutStack(Stack): """ For pushing futures. get_result() is called on pop. """ def pop(self): future = super(FutStack, self).pop() return future.get_result() class PageFuture(object): """ A specific proxy for the future returned from fetch_page_async. Frequently, just the page results are needed. """ def __init__(self, future): self.future = future def get_result(self): items, next_curs, more = self.future.get_result() return items class QueryExec(object): def __init__(self, query, batch_size=300): self.query = query self.batch_size = batch_size def get_by_page_async(self, **kwargs): more, next_curs = True, None while more: future = self.query.fetch_page_async(self.batch_size, start_cursor=next_curs, **kwargs) yield PageFuture(future) page, next_curs, more = future.get_result() def get_by_page(self, **kwargs): """ Generator yielding one page at a time """ for page_fut in self.get_by_page_async(**kwargs): items = page_fut.get_result() yield items @ndb.tasklet def get_all_async(self, **kwargs): items = [] more, next_curs = True, None while more: page, next_curs, more = yield self.query.fetch_page_async(self.batch_size, start_cursor=next_curs, **kwargs) items.extend(page) raise ndb.Return(items) def get_all(self, **kwargs): """ Common operation to get all of something. kwargs passed to fetch. """ items = [] for page in self.get_by_page(**kwargs): items.extend(page) return items def __iter__(self): """ Return the generator as an iterator. """ return self.get_by_page()
{"/test/test_memcache_hook.py": ["/gaeutils/__init__.py"], "/gaeutils/caching.py": ["/gaeutils/__init__.py"], "/test/test_query_exec.py": ["/gaeutils/__init__.py"], "/gaeutils/fanout/__init__.py": ["/gaeutils/fanout/models.py"], "/test/tests.py": ["/gaeutils/__init__.py"], "/test/test_lock.py": ["/gaeutils/__init__.py"], "/test/test_counters.py": ["/gaeutils/__init__.py", "/gaeutils/counters.py"], "/test/test_models.py": ["/gaeutils/__init__.py"], "/gaeutils/locks.py": ["/gaeutils/__init__.py"], "/test/test_fanout.py": ["/gaeutils/__init__.py"], "/gaeutils/fanout/models.py": ["/gaeutils/__init__.py"]}
42,303
jaybaker/gaeutils
refs/heads/master
/test/test_memcache_hook.py
import tests from google.appengine.api import memcache class TestMemcacheNoHook(tests.TestBase): """ A baseline. A few simple memcache tests to compare with the same tests with the hook in place. """ def setUp(self): super(TestMemcacheNoHook, self).setUp() memcache.set('foo', 'bar') def testSet(self): pass def testSetGet(self): self.assertEqual(memcache.get('foo'), 'bar') class TestMemcacheHook(tests.TestBase): def setUp(self): super(TestMemcacheHook, self).setUp() from gaeutils import caching caching.memcache_hook(use_cache=False) memcache.set('foo', 'bar') def testSet(self): pass def testSetGet(self): self.assertTrue(memcache.get('foo') is None) def testAdd(self): # Just checking that other verb in the api memcache.add('foobar', 'bar') self.assertTrue(memcache.get('foobar') is None) def testNamespace(self): memcache.set('foobar', 'bar', namespace='xyz') self.assertTrue(memcache.get('foobar', namespace='xyz') is None)
{"/test/test_memcache_hook.py": ["/gaeutils/__init__.py"], "/gaeutils/caching.py": ["/gaeutils/__init__.py"], "/test/test_query_exec.py": ["/gaeutils/__init__.py"], "/gaeutils/fanout/__init__.py": ["/gaeutils/fanout/models.py"], "/test/tests.py": ["/gaeutils/__init__.py"], "/test/test_lock.py": ["/gaeutils/__init__.py"], "/test/test_counters.py": ["/gaeutils/__init__.py", "/gaeutils/counters.py"], "/test/test_models.py": ["/gaeutils/__init__.py"], "/gaeutils/locks.py": ["/gaeutils/__init__.py"], "/test/test_fanout.py": ["/gaeutils/__init__.py"], "/gaeutils/fanout/models.py": ["/gaeutils/__init__.py"]}
42,304
jaybaker/gaeutils
refs/heads/master
/gaeutils/caching.py
from google.appengine.api import apiproxy_stub_map, memcache, modules from google.appengine.ext import ndb import logging import gaeutils class cachestate(ndb.Model): """ Use db to synchronize cache state. """ cleartime = ndb.IntegerProperty(default=0) @classmethod @ndb.transactional def get(cls): key = ndb.Key(cls, modules.get_current_module_name()) inst = key.get() if not inst: inst = cls(key=key) inst.put() return inst def flushcache(): # conditionally flush memcache if this is loaded # due to module deployment _cachestate = cachestate.get() if _cachestate.cleartime != gaeutils.App.deploy_time: logging.debug('flushing cache. last cleared %i and curr deploy time %i' % ( _cachestate.cleartime, gaeutils.App.deploy_time)) def txn(): _cachestate.cleartime = gaeutils.App.deploy_time _cachestate.put() if memcache.flush_all(): ndb.transaction(txn) flushcache() def memcache_hook(use_cache=True): """ To turn on this memcache hook, place an import early in the import cycle of your app, e.g. import gaeutils gaeutils.caching.memcache_hook() """ def hook(service, call, request, response): """ Use app version to namespace all calls to memcache. This is something like flushing memcache each time you deploy to GAE. It also supports globally turning caching off for development purposes. """ ns = None NS_SEP = '#@' # looks for a Set operation # checks config and also safety checks not in prod if call in ('Set',) and not use_cache and gaeutils.App.dev: # get around cache by prepending to namespace on Set ns = 'zz' + str(gaeutils.App.deploy_time) # augment namespace if callable(getattr(request, 'set_name_space', None)): namespace = request.name_space() if ns: namespace = namespace + NS_SEP + ns if namespace else ns request.set_name_space(namespace) apiproxy_stub_map.apiproxy.GetPreCallHooks().Append('memcache_ver_namespace', hook, 'memcache')
{"/test/test_memcache_hook.py": ["/gaeutils/__init__.py"], "/gaeutils/caching.py": ["/gaeutils/__init__.py"], "/test/test_query_exec.py": ["/gaeutils/__init__.py"], "/gaeutils/fanout/__init__.py": ["/gaeutils/fanout/models.py"], "/test/tests.py": ["/gaeutils/__init__.py"], "/test/test_lock.py": ["/gaeutils/__init__.py"], "/test/test_counters.py": ["/gaeutils/__init__.py", "/gaeutils/counters.py"], "/test/test_models.py": ["/gaeutils/__init__.py"], "/gaeutils/locks.py": ["/gaeutils/__init__.py"], "/test/test_fanout.py": ["/gaeutils/__init__.py"], "/gaeutils/fanout/models.py": ["/gaeutils/__init__.py"]}
42,305
jaybaker/gaeutils
refs/heads/master
/gaeutils/models.py
from google.appengine.ext import ndb class NoCache(ndb.Model): """ No cache mixin. Uses ndb cache policy. """ _use_cache = False _use_memcache = False class FauxFuture(object): """ Stand in when not really querying """ def __init__(self, data=None): self.data = data def get_result(self): return self.data def __repr__(self): return self.__class__.__name__
{"/test/test_memcache_hook.py": ["/gaeutils/__init__.py"], "/gaeutils/caching.py": ["/gaeutils/__init__.py"], "/test/test_query_exec.py": ["/gaeutils/__init__.py"], "/gaeutils/fanout/__init__.py": ["/gaeutils/fanout/models.py"], "/test/tests.py": ["/gaeutils/__init__.py"], "/test/test_lock.py": ["/gaeutils/__init__.py"], "/test/test_counters.py": ["/gaeutils/__init__.py", "/gaeutils/counters.py"], "/test/test_models.py": ["/gaeutils/__init__.py"], "/gaeutils/locks.py": ["/gaeutils/__init__.py"], "/test/test_fanout.py": ["/gaeutils/__init__.py"], "/gaeutils/fanout/models.py": ["/gaeutils/__init__.py"]}
42,306
jaybaker/gaeutils
refs/heads/master
/test/test_query_exec.py
from google.appengine.ext import ndb import tests import gaeutils class EmptyModel(ndb.Model): pass class TestQueryExec(tests.TestBase): def setUp(self): super(TestQueryExec, self).setUp() ndb.put_multi([tests.TestModel(number=i) for i in xrange(0, 30)]) self.query = tests.TestModel.query() def testGetByPage(self): self.assertEqual(len(self.query.fetch()), 30) # normal operation query_exec = gaeutils.QueryExec(self.query, batch_size=10) num_pages = 0 for page in query_exec.get_by_page(): self.assertEqual(len(page), 10) num_pages += 1 self.assertEqual(3, num_pages) def testGetByPageEmpty(self): query = EmptyModel.query() self.assertEqual(len(query.fetch()), 0) # no results query_exec = gaeutils.QueryExec(query, batch_size=10) num_pages = 0 for page in query_exec.get_by_page(): self.assertEqual(len(page), 0) num_pages += 1 self.assertEqual(1, num_pages) def testGetAll(self): query_exec = gaeutils.QueryExec(self.query, batch_size=10) self.assertEqual(len(query_exec.get_all()), len(self.query.fetch())) def testIter(self): """ As an iterator """ num_pages = 0 for page in gaeutils.QueryExec(self.query, batch_size=10): num_pages += 1 self.assertEqual(3, num_pages)
{"/test/test_memcache_hook.py": ["/gaeutils/__init__.py"], "/gaeutils/caching.py": ["/gaeutils/__init__.py"], "/test/test_query_exec.py": ["/gaeutils/__init__.py"], "/gaeutils/fanout/__init__.py": ["/gaeutils/fanout/models.py"], "/test/tests.py": ["/gaeutils/__init__.py"], "/test/test_lock.py": ["/gaeutils/__init__.py"], "/test/test_counters.py": ["/gaeutils/__init__.py", "/gaeutils/counters.py"], "/test/test_models.py": ["/gaeutils/__init__.py"], "/gaeutils/locks.py": ["/gaeutils/__init__.py"], "/test/test_fanout.py": ["/gaeutils/__init__.py"], "/gaeutils/fanout/models.py": ["/gaeutils/__init__.py"]}
42,307
jaybaker/gaeutils
refs/heads/master
/setup.py
from distutils.core import setup setup( name = 'gaeutils', packages = ['gaeutils', 'gaeutils.fanout'], version = '0.1', description = 'Simple set of GAE utilities', author = 'Jay Baker', author_email = 'jbaker.work@gmail.com', url = 'https://github.com/jaybaker/gaeutils', download_url = 'https://github.com/jaybaker/gaeutils/tarball/0.1', keywords = ['google', 'app engine', 'gae'], classifiers = [], )
{"/test/test_memcache_hook.py": ["/gaeutils/__init__.py"], "/gaeutils/caching.py": ["/gaeutils/__init__.py"], "/test/test_query_exec.py": ["/gaeutils/__init__.py"], "/gaeutils/fanout/__init__.py": ["/gaeutils/fanout/models.py"], "/test/tests.py": ["/gaeutils/__init__.py"], "/test/test_lock.py": ["/gaeutils/__init__.py"], "/test/test_counters.py": ["/gaeutils/__init__.py", "/gaeutils/counters.py"], "/test/test_models.py": ["/gaeutils/__init__.py"], "/gaeutils/locks.py": ["/gaeutils/__init__.py"], "/test/test_fanout.py": ["/gaeutils/__init__.py"], "/gaeutils/fanout/models.py": ["/gaeutils/__init__.py"]}
42,308
jaybaker/gaeutils
refs/heads/master
/gaeutils/fanout/__init__.py
from .models import Subscription
{"/test/test_memcache_hook.py": ["/gaeutils/__init__.py"], "/gaeutils/caching.py": ["/gaeutils/__init__.py"], "/test/test_query_exec.py": ["/gaeutils/__init__.py"], "/gaeutils/fanout/__init__.py": ["/gaeutils/fanout/models.py"], "/test/tests.py": ["/gaeutils/__init__.py"], "/test/test_lock.py": ["/gaeutils/__init__.py"], "/test/test_counters.py": ["/gaeutils/__init__.py", "/gaeutils/counters.py"], "/test/test_models.py": ["/gaeutils/__init__.py"], "/gaeutils/locks.py": ["/gaeutils/__init__.py"], "/test/test_fanout.py": ["/gaeutils/__init__.py"], "/gaeutils/fanout/models.py": ["/gaeutils/__init__.py"]}
42,309
jaybaker/gaeutils
refs/heads/master
/test/tests.py
import unittest from google.appengine.ext import ndb from google.appengine.ext import testbed from google.appengine.datastore import datastore_stub_util import gaeutils class TestModel(ndb.Model): """A model class used for testing.""" number = ndb.IntegerProperty(default=42) text = ndb.StringProperty() class TestBase(unittest.TestCase): def setUp(self): self.testbed = testbed.Testbed() self.testbed.activate() self.policy = datastore_stub_util.PseudoRandomHRConsistencyPolicy(probability=1) self.testbed.init_datastore_v3_stub(consistency_policy=self.policy) self.testbed.init_memcache_stub() self.testbed.init_app_identity_stub() #self.testbed.init_taskqueue_stub(root_path=os.path.join('.')) self.testbed.init_taskqueue_stub() gaeutils.App.setup() # needed in test env def tearDown(self): self.testbed.deactivate() class TestTest(TestBase): def testInsertEntity(self): """ Test the test cases. """ TestModel().put() self.assertEqual(1, len(TestModel.query().fetch(2)))
{"/test/test_memcache_hook.py": ["/gaeutils/__init__.py"], "/gaeutils/caching.py": ["/gaeutils/__init__.py"], "/test/test_query_exec.py": ["/gaeutils/__init__.py"], "/gaeutils/fanout/__init__.py": ["/gaeutils/fanout/models.py"], "/test/tests.py": ["/gaeutils/__init__.py"], "/test/test_lock.py": ["/gaeutils/__init__.py"], "/test/test_counters.py": ["/gaeutils/__init__.py", "/gaeutils/counters.py"], "/test/test_models.py": ["/gaeutils/__init__.py"], "/gaeutils/locks.py": ["/gaeutils/__init__.py"], "/test/test_fanout.py": ["/gaeutils/__init__.py"], "/gaeutils/fanout/models.py": ["/gaeutils/__init__.py"]}
42,310
jaybaker/gaeutils
refs/heads/master
/test/test_lock.py
from google.appengine.ext import ndb import tests import gaeutils from gaeutils import locks from gaeutils import models class MyModel(models.NoCache): val = ndb.IntegerProperty(default=0) class TestLock(tests.TestBase): def setUp(self): super(TestLock, self).setUp() def test_inc(self): lock = locks.Lock.incr('mylock') self.assertEqual(lock.ver, 1) lock = locks.Lock.incr('mylock') self.assertEqual(lock.ver, 2) # arbitrary amount lock = locks.Lock.incr('mylock', amount=5) self.assertEqual(lock.ver, 2+5) # negative works lock = locks.Lock.incr('mylock', amount=-1) self.assertEqual(lock.ver, 2+5-1) def test_xaction(self): ent = MyModel() ent.put() def work(fail=False): ver = locks.Lock.get('mylock').ver entity = ent.key.get() entity.val += 2 entity.put() locks.Lock.incr('mylock') if fail: raise Exception('operation failed') ndb.transaction(work, xg=True) ent = ent.key.get() lock = locks.Lock.get('mylock') self.assertEqual(ent.val, 2) self.assertEqual(lock.ver, 1) try: ndb.transaction(lambda: work(fail=True), xg=True) except: pass ent = ent.key.get() lock = locks.Lock.get('mylock') self.assertEqual(ent.val, 2) # same as after success self.assertEqual(lock.ver, 1) # unchanged def test_demonstrate_pattern(self): """ This just demonstrates typical usage """ # setup, pretend this was done before for i in range(0, 5): ent = MyModel(val=i) ent.put() ## pattern starts here ## # check the ver of particular lock before starting work verstart = locks.Lock.get('mylock').ver # now pretend like some other process changed the ver # after you started working locks.Lock.incr('mylock') item = MyModel.query(MyModel.val == 3).get() def work(): item.val = 100 item.put() vercheck = locks.Lock.get('mylock').ver if vercheck != verstart: # stop right here; don't process those items # try it again later, or raise an exception, or ... raise ndb.Rollback('versioning or sequence issue') ndb.transaction(work, retries=0, xg=True) ## pattern stops here ## # this just checks that the xaction was rolled back for item in MyModel.query(): # this is true because that work operation # never committed self.assertTrue(item.val < 100)
{"/test/test_memcache_hook.py": ["/gaeutils/__init__.py"], "/gaeutils/caching.py": ["/gaeutils/__init__.py"], "/test/test_query_exec.py": ["/gaeutils/__init__.py"], "/gaeutils/fanout/__init__.py": ["/gaeutils/fanout/models.py"], "/test/tests.py": ["/gaeutils/__init__.py"], "/test/test_lock.py": ["/gaeutils/__init__.py"], "/test/test_counters.py": ["/gaeutils/__init__.py", "/gaeutils/counters.py"], "/test/test_models.py": ["/gaeutils/__init__.py"], "/gaeutils/locks.py": ["/gaeutils/__init__.py"], "/test/test_fanout.py": ["/gaeutils/__init__.py"], "/gaeutils/fanout/models.py": ["/gaeutils/__init__.py"]}
42,311
jaybaker/gaeutils
refs/heads/master
/test/test_counters.py
from google.appengine.ext import ndb import tests import gaeutils from gaeutils import counters from gaeutils.counters import Counter class TestCounters(tests.TestBase): def setUp(self): super(TestCounters, self).setUp() def test_increment(self): """Happy path """ counters.increment('testcounter') self.assertEqual(counters.get_count('testcounter'), 1) counters.increment('testcounter', delta=5) self.assertEqual(counters.get_count('testcounter'), 6) def test_read_before_write(self): self.assertEqual(counters.get_count('neverbeenseen'), 0) def test_shard(self): """Tests internal counter structure. """ name = 'testcounter' shards = ndb.get_multi(counters.ShardConfig.all_keys(name)) counters.increment(name) config = counters.ShardConfig.get_by_id(name) self.assertTrue(config is not None) shards = ndb.get_multi(counters.ShardConfig.all_keys(name)) self.assertTrue(len(shards) > 1) # this will be gt 1 but all but 1 are None shards = filter(None, shards) self.assertEqual(len(shards), 1) # there should be only 1 shard since only one increment def test_many_increment(self): name = 'testcounter' for i in range(0, 100): counters.increment(name) self.assertEqual(counters.get_count(name), 100) class TestSimpleCounter(tests.TestBase): def test_incr_none_existing(self): Counter.increment(name='foo') self.assertEqual(1, len(Counter.query().fetch())) counter = Counter.get_or_create(name='foo') self.assertEqual(1, counter.count) def test_increment_existing(self): Counter.increment(name='foo') Counter.increment(name='foo') self.assertEqual(1, len(Counter.query().fetch())) counter = Counter.get_or_create(name='foo') self.assertEqual(2, counter.count) def test_domain(self): # this one does NOT belong to a domain Counter.increment(name='foo') Counter.increment(name='foo', domain='zzz') Counter.increment(name='foo', domain='zzz') # this one is in the same domain as previous counter Counter.increment(name='bar', domain='zzz') counter1 = Counter.get_or_create(name='foo') counter2 = Counter.get_or_create(name='foo', domain='zzz') self.assertNotEqual(counter1.count, counter2.count) counters = Counter.query(Counter.domain == 'zzz').fetch() self.assertEqual(2, len(counters))
{"/test/test_memcache_hook.py": ["/gaeutils/__init__.py"], "/gaeutils/caching.py": ["/gaeutils/__init__.py"], "/test/test_query_exec.py": ["/gaeutils/__init__.py"], "/gaeutils/fanout/__init__.py": ["/gaeutils/fanout/models.py"], "/test/tests.py": ["/gaeutils/__init__.py"], "/test/test_lock.py": ["/gaeutils/__init__.py"], "/test/test_counters.py": ["/gaeutils/__init__.py", "/gaeutils/counters.py"], "/test/test_models.py": ["/gaeutils/__init__.py"], "/gaeutils/locks.py": ["/gaeutils/__init__.py"], "/test/test_fanout.py": ["/gaeutils/__init__.py"], "/gaeutils/fanout/models.py": ["/gaeutils/__init__.py"]}
42,312
jaybaker/gaeutils
refs/heads/master
/test/test_models.py
import tests from google.appengine.ext import ndb from google.appengine.api import memcache from gaeutils import models from gaeutils import Stack, FutStack class NoCacheModel(tests.TestModel, models.NoCache): pass class TestNDBCache(tests.TestBase): def setUp(self): super(TestNDBCache, self).setUp() ctx = ndb.get_context() self.ndb_cache_pre = ctx._memcache_prefix self.cache_me_key = ndb.Key(tests.TestModel, 'cached') self.cache_me = tests.TestModel(key=self.cache_me_key) self.cache_me.put() self.no_cache_me_key = ndb.Key(NoCacheModel, 'not_cached') self.no_cache_me = NoCacheModel(key=self.no_cache_me_key) self.no_cache_me.put() def mkey(self, key): return self.ndb_cache_pre + key.urlsafe() @ndb.toplevel def testNDBMemcache(self): # prime ndb cache entity = self.cache_me_key.get() entity = self.no_cache_me_key.get() # test that canonical ndb memcache is working ctx = ndb.get_context() self.assertTrue(ctx._use_memcache(self.cache_me_key)) self.assertTrue(memcache.get(self.mkey(self.cache_me_key)) is not None) # the model with no cache should not be in memcache self.assertTrue(memcache.get(self.mkey(self.no_cache_me_key)) is None) class StackTest(tests.TestBase): def test_simple_case(self): s = Stack().push('a').push('b') self.assertEqual('b', s.pop()) self.assertEqual('a', s.pop()) def test_with_context(self): # no error with Stack() as s: s.push('a').push('b') s.pop() s.pop() # forgot to pop something try: with Stack() as s: s.push('a').push('b') s.pop() self.fail() except AssertionError: pass def test_future_stack(self): s = FutStack() s.push(models.FauxFuture(data='a')) s.push(models.FauxFuture(data='b')) self.assertEqual('b', s.pop()) self.assertEqual('a', s.pop())
{"/test/test_memcache_hook.py": ["/gaeutils/__init__.py"], "/gaeutils/caching.py": ["/gaeutils/__init__.py"], "/test/test_query_exec.py": ["/gaeutils/__init__.py"], "/gaeutils/fanout/__init__.py": ["/gaeutils/fanout/models.py"], "/test/tests.py": ["/gaeutils/__init__.py"], "/test/test_lock.py": ["/gaeutils/__init__.py"], "/test/test_counters.py": ["/gaeutils/__init__.py", "/gaeutils/counters.py"], "/test/test_models.py": ["/gaeutils/__init__.py"], "/gaeutils/locks.py": ["/gaeutils/__init__.py"], "/test/test_fanout.py": ["/gaeutils/__init__.py"], "/gaeutils/fanout/models.py": ["/gaeutils/__init__.py"]}
42,313
jaybaker/gaeutils
refs/heads/master
/gaeutils/locks.py
from google.appengine.ext import ndb from gaeutils import models class Semaphore(models.NoCache): """ A small datastore entity as a semaphore. Its mere presence is a signal. """ name = ndb.StringProperty(required=True) @classmethod @ndb.transactional def get(cls, name): key = ndb.Key(cls, name) # read by key, eventual consistency does not come into play semaphore = key.get() if not semaphore: semaphore = cls(key=key, name=name) semaphore.put() return semaphore class Lock(Semaphore): """ Uses a small datastore entity as a lock. A lock is referenced by name, there is a single entity per name. It has a version, or sequence, number that can be used to order operations or semantically suggest that the group of controlled data is at a particular version. Typical usage pattern: 1. Get lock to check version number 2. Do some work 3. Check lock ver number again If it is the same as before, all good. If it is different, something changed when you didn't expect it; rollback, schedule later, drop it, etc. see tests for example usage """ ver = ndb.IntegerProperty(default=0) @staticmethod @ndb.transactional def incr(name, amount=1): # will propogate a transaction # pays the price of double put very first time created # but these are typically used frequently and that is better # than duplicated code, or a 'create' switch lock = Lock.get(name) lock.ver += amount lock.put() return lock
{"/test/test_memcache_hook.py": ["/gaeutils/__init__.py"], "/gaeutils/caching.py": ["/gaeutils/__init__.py"], "/test/test_query_exec.py": ["/gaeutils/__init__.py"], "/gaeutils/fanout/__init__.py": ["/gaeutils/fanout/models.py"], "/test/tests.py": ["/gaeutils/__init__.py"], "/test/test_lock.py": ["/gaeutils/__init__.py"], "/test/test_counters.py": ["/gaeutils/__init__.py", "/gaeutils/counters.py"], "/test/test_models.py": ["/gaeutils/__init__.py"], "/gaeutils/locks.py": ["/gaeutils/__init__.py"], "/test/test_fanout.py": ["/gaeutils/__init__.py"], "/gaeutils/fanout/models.py": ["/gaeutils/__init__.py"]}
42,314
jaybaker/gaeutils
refs/heads/master
/test/test_fanout.py
from google.appengine.ext import ndb import tests import gaeutils from gaeutils import fanout class SubscriptionTest(fanout.Subscription): match = ndb.StringProperty() class Subscriber(ndb.Model): name = ndb.StringProperty() class TestFanout(tests.TestBase): def setUp(self): super(TestFanout, self).setUp() self.sub = SubscriptionTest(match='abc') self.sub.put() self.subscriber1 = Subscriber(name='fred') self.subscriber2 = Subscriber(name='alice') self.subscriber1.put() self.subscriber2.put() def more_subscribers(self, n=10): for i in xrange(0, n): subscriber = Subscriber(name=str(i)) subscriber.put() self.subscribers = Subscriber.query().fetch() def testSubcribe(self): self.sub.subscribe(self.subscriber1) shards = self.sub.shards() self.assertEqual(1, len(shards)) self.assertTrue(self.subscriber1.key in shards[0].subscribers) def testUnsubscribe(self): # unsubscribe w/ no subscription self.subscriber3 = Subscriber(name='alice') self.subscriber3.put() self.sub.unsubscribe(self.subscriber3) # no error # regular unsubscribe self.sub.subscribe(self.subscriber1) self.assertEqual(1, len(self.sub.shards(ref=self.subscriber1.key))) self.sub.unsubscribe(self.subscriber1) self.assertEqual(0, len(self.sub.shards(ref=self.subscriber1.key))) def testSubscribeIdempotent(self): self.sub.subscribe(self.subscriber1) self.sub.subscribe(self.subscriber1) shards = self.sub.shards() self.assertEqual(1, len(shards)) self.assertEqual(1, shards[0].subscriber_count) def testSubscriberShardLimit(self): _subscriber_size, _shard_num = 4, 3 self.more_subscribers(n=40) for subscriber in self.subscribers: self.sub.subscribe(subscriber, shard_size=_subscriber_size, shard_child_limit=_shard_num) shards = self.sub.shards() self.assertTrue(len(shards) > 1) for shard in shards: self.assertTrue(shard.subscriber_count <= _subscriber_size) self.assertTrue(shard.shard_child_count <= _shard_num) def testDoWork(self): self.more_subscribers(n=20) for subscriber in self.subscribers: self.sub.subscribe(subscriber) self.sub.do_work('/worker/test', queue_name='default') def testDoWorkShard(self): # this emulates the webhook at shard_url self.more_subscribers(n=20) for subscriber in self.subscribers: self.sub.subscribe(subscriber) shards = self.sub.shards() shards[0].do_work('/worker/test', '/worker/accept_subscribers', queue_name='default')
{"/test/test_memcache_hook.py": ["/gaeutils/__init__.py"], "/gaeutils/caching.py": ["/gaeutils/__init__.py"], "/test/test_query_exec.py": ["/gaeutils/__init__.py"], "/gaeutils/fanout/__init__.py": ["/gaeutils/fanout/models.py"], "/test/tests.py": ["/gaeutils/__init__.py"], "/test/test_lock.py": ["/gaeutils/__init__.py"], "/test/test_counters.py": ["/gaeutils/__init__.py", "/gaeutils/counters.py"], "/test/test_models.py": ["/gaeutils/__init__.py"], "/gaeutils/locks.py": ["/gaeutils/__init__.py"], "/test/test_fanout.py": ["/gaeutils/__init__.py"], "/gaeutils/fanout/models.py": ["/gaeutils/__init__.py"]}
42,315
jaybaker/gaeutils
refs/heads/master
/gaeutils/blob.py
from google.appengine.ext.webapp import blobstore_handlers import safe_enqueue class UploadHandler(blobstore_handlers.BlobstoreUploadHandler): """ Normal front-end requests to GAE have a relatively low timeout. This is fine for most requests. Sometimes uploading a file like a spreadsheet or a big image might hit this timeout. GAE has a built-in blob upload handler at /_ah/upload that is not subject to this timeout. This handler uses the GAE provided blobstore_handlers built off webapp(2) for convenience. Also note that some frameworks, e.g. Django, may throw away header information needed to fetch the blob_key. The way this works is you have a form with a file upload in it. Use **generate_url** to generate a url that is good for one upload. That will go to /_ah/upload and then redirect here. In the form, include a hidden field, 'next' that is a url to redirect to afterwards. Also optionally include fields in the form prefixed with '_task_', these will be sent as params to a task. After the upload, the blob is created, an optional task has kicked off, and the browser is redirected back to your view of choice. """ def post(self): ''' This post happens after the built-in /_ah/upload that is part of app engine. next is a post param directing the final http redirect. If there are post params prefixed with '_task_', these are used to construct a task that is kicked off. Specifically, _task_url spcifies the url of the task. ''' get_param = lambda param, default=None: self.request.POST.get(param, default) upload_files = self.get_uploads('file') # 'file' is file upload field in the form blob_info = upload_files[0] filename = get_param('file').__dict__['filename'] # cgi.FieldStorage # check if a task needs to be created if get_param('_task_url'): params = dict(filename=filename, blob_key=blob_info.blob_key) for param in self.request.arguments(): if param.startswith('_task_'): params[param] = get_param(param) safe_enqueue(get_param('_task_url'), params) # redirect to desired view self.redirect(get_param('next'))
{"/test/test_memcache_hook.py": ["/gaeutils/__init__.py"], "/gaeutils/caching.py": ["/gaeutils/__init__.py"], "/test/test_query_exec.py": ["/gaeutils/__init__.py"], "/gaeutils/fanout/__init__.py": ["/gaeutils/fanout/models.py"], "/test/tests.py": ["/gaeutils/__init__.py"], "/test/test_lock.py": ["/gaeutils/__init__.py"], "/test/test_counters.py": ["/gaeutils/__init__.py", "/gaeutils/counters.py"], "/test/test_models.py": ["/gaeutils/__init__.py"], "/gaeutils/locks.py": ["/gaeutils/__init__.py"], "/test/test_fanout.py": ["/gaeutils/__init__.py"], "/gaeutils/fanout/models.py": ["/gaeutils/__init__.py"]}
42,316
jaybaker/gaeutils
refs/heads/master
/gaeutils/fanout/models.py
import uuid import base64 from google.appengine.api import taskqueue from google.appengine.ext import ndb from google.appengine.ext import deferred from gaeutils import safe_enqueue _SHARD_SIZE = 100 # subscribers per shard; this is like batch size _SHARD_CHILDREN_LIMIT = 3 # limit children of shard class Shard(ndb.Model): """ Container for list of subscribers and linked to other shards through parent relationship. Parent of root shard is the subscription. """ subscribers = ndb.KeyProperty(repeated=True) subscriber_count = ndb.ComputedProperty(lambda self: len(self.subscribers)) # the key is not to have too many shards linked to any given shard shard_child_count = ndb.IntegerProperty(default=0) # this doesn't need to be very accurate depth = ndb.IntegerProperty(default=0) def _pre_put_hook(self): # depth as zero offset self.depth = len(self.key.pairs()) - 2 @property def children(self): # get first level of children query = Shard.query(ancestor = self.key) query = query.filter(Shard.depth == self.depth + 1) return query.fetch(keys_only=True) @property def subscription(self): # subscription is the top parent return ndb.Key(pairs=[ self.key.pairs()[0] ]) def do_work(self, shard_url, work_url, params=None, **kwargs): """ Task params are passed as params, additional kwargs passed to taskqueue api. params needs to have job_id in it which the parent task should have received. """ params = params or {} # job_id gets passed along params.update(shard_url=shard_url, work_url=work_url, subscription=self.subscription.urlsafe()) # kick off children for child in self.children: params.update(dict(shard=child.urlsafe())) safe_enqueue(shard_url, params=params, name='%s-%s' % (params['job_id'], child.id()), **kwargs) # now do work in another task params['subscriber_keys'] = [key.urlsafe() for key in self.subscribers] safe_enqueue(work_url, params=params, **kwargs) @ndb.transactional def add_subscriber(self, ref): self.subscribers = list(set(self.subscribers + [ref])) self.put() @classmethod @ndb.transactional def find_shard(cls, subscription, shard_size=_SHARD_SIZE, shard_child_limit=_SHARD_CHILDREN_LIMIT): """ Finds a shard that will accept a subscriber if availale. Else if adds a new shard using a breadth first approach. Each eschelon of shards will be dispatched to work by the parent shard. That is why it is undesirable for the eschelon to grow too large. If the eschelon is full, the new shard is added on a new eschelon. """ if not isinstance(subscription, ndb.Key): subscription = subscription.key def incr_shard_count(_shard): # not doing this in a trasaction because the shard count doesn't need # to be accurate; just so it is 0 or some number close to actual child count _shard.shard_child_count += 1 _shard.put() base_query = cls.query(ancestor = subscription) # get one that has room shard = base_query.filter(cls.subscriber_count < shard_size).get() if shard is None: # creating new shard # some shard that has room for children parent_query = base_query.filter(cls.shard_child_count < shard_child_limit) # this ordering is what accomplishes breadth first; fullest shard at lowest depth parent_shard = parent_query.order(-cls.shard_child_count).order(cls.depth).get() if parent_shard is not None: # there is a shard to serve as parent shard = Shard(parent=parent_shard.key) incr_shard_count(parent_shard) else: # this will very often be the sole shard with a parent of the subscription # but can this result in an explosion of shards at depth=0? shard = Shard(parent=subscription) shard.put() return shard class Subscription(ndb.Model): """ The subscription model is a little different here from the traditional one that might use one subscription instance / entity per subscriber. In the fanout model, a Subscription is matched, then all subscribers are 'notified' of this through fanout. """ @ndb.transactional def subscribe(self, ref, shard_size=_SHARD_SIZE, shard_child_limit=_SHARD_CHILDREN_LIMIT): """ Add a subscriber. """ if not isinstance(ref, ndb.Key): ref = ref.key existing = self.shards(ref=ref, limit=1) if existing is None: shard = Shard.find_shard(self, shard_size=shard_size, shard_child_limit=shard_child_limit) shard.add_subscriber(ref) @ndb.transactional def unsubscribe(self, ref): """ Remove a subscriber. """ if not isinstance(ref, ndb.Key): ref = ref.key existing = self.shards(ref=ref) if len(existing) > 0: for shard in existing: shard.subscribers = [sub for sub in shard.subscribers if sub != ref] shard.put() @ndb.transactional def shards(self, ref=None, limit=500): """ Get all shards for this subscription. If ref is supplied, look for it. """ query = Shard.query(ancestor = self.key) if ref is not None: query = query.filter(Shard.subscribers == ref) return query.get() if limit == 1 else query.fetch(limit) def do_work(self, shard_url, params=None, job_id=None, **kwargs): """ Task params are passed as params, additional kwargs passed to taskqueue api. """ # job_id prevents fork bomb on fanout; passed to shards job_id = job_id or base64.b32encode(uuid.uuid4().bytes).strip('=').lower() # first tier of shards shards = Shard.query(ancestor = self.key).filter(Shard.depth == 0).fetch(keys_only=True) params = params or {} params.update(dict(shard_url=shard_url, subscription=self.key.urlsafe()), job_id=job_id) for shard in shards: params.update(dict(shard=shard.urlsafe())) safe_enqueue(shard_url, params=params, name='%s-%s' % (job_id, shard.id()), **kwargs)
{"/test/test_memcache_hook.py": ["/gaeutils/__init__.py"], "/gaeutils/caching.py": ["/gaeutils/__init__.py"], "/test/test_query_exec.py": ["/gaeutils/__init__.py"], "/gaeutils/fanout/__init__.py": ["/gaeutils/fanout/models.py"], "/test/tests.py": ["/gaeutils/__init__.py"], "/test/test_lock.py": ["/gaeutils/__init__.py"], "/test/test_counters.py": ["/gaeutils/__init__.py", "/gaeutils/counters.py"], "/test/test_models.py": ["/gaeutils/__init__.py"], "/gaeutils/locks.py": ["/gaeutils/__init__.py"], "/test/test_fanout.py": ["/gaeutils/__init__.py"], "/gaeutils/fanout/models.py": ["/gaeutils/__init__.py"]}
42,317
jaybaker/gaeutils
refs/heads/master
/gaeutils/counters.py
import hashlib import random from google.appengine.api import memcache from google.appengine.ext import ndb DEFAULT_NUM_SHARDS = 10 MAX_NUM_SHARDS = 30 SHARD_KEY_TEMPLATE = 'shard-{}-{:d}' CACHE_COUNT_KEY = '_counters-{}' CACHE_LIFE = 60*5 class ShardConfig(ndb.Model): """Tracks the number of shards for each named counter.""" num_shards = ndb.IntegerProperty(default=DEFAULT_NUM_SHARDS) @classmethod def all_keys(cls, name): """Returns all possible keys for the counter name given the config.""" config = cls.get_or_insert(name) shard_keys = [CounterShard.gen_key(name, x) for x in range(config.num_shards)] return shard_keys class CounterShard(ndb.Model): """Shards for each named counter.""" count = ndb.IntegerProperty(default=0) @classmethod def gen_key(cls, name, index): return ndb.Key(CounterShard, SHARD_KEY_TEMPLATE.format(name, index)) @classmethod def gen_random_key(cls, name, num_shards): index = random.randint(0, num_shards - 1) return cls.gen_key(name, index) def get_count(name, use_cache=True, cache_life=CACHE_LIFE): """Retrieve the value for a given sharded counter.""" cache_key = CACHE_COUNT_KEY.format(name) total = memcache.get(cache_key) if use_cache else None if total is None: total = 0 all_keys = ShardConfig.all_keys(name) for counter in ndb.get_multi(all_keys): if counter is not None: total += counter.count if use_cache: memcache.add(cache_key, total, cache_life) return total def increment(name, delta=1): """Increment the value for a given sharded counter.""" config = ShardConfig.get_or_insert(name) _increment(name, config.num_shards, delta=delta) @ndb.transactional def _increment(name, num_shards, delta=1): """Transactional helper to increment the value for a given sharded counter.""" key = CounterShard.gen_random_key(name, num_shards) counter = key.get() if counter is None: counter = CounterShard(key=key) counter.count += delta counter.put() # Memcache increment does nothing if the name is not a key in memcache memcache.incr(CACHE_COUNT_KEY.format(name), delta=delta) @ndb.transactional def increase_shards(name, num_shards): """Increase the number of shards for a given sharded counter. Will never decrease the number of shards. """ config = ShardConfig.get_or_insert(name) if config.num_shards < num_shards and num_shards <= MAX_NUM_SHARDS: config.num_shards = num_shards config.put() class Counter(ndb.Model): """ A simple counter. A specific counter may have a name, which you bake into the key. Counters may also be grouped by domain which allows for a query to get them as a group. """ count = ndb.IntegerProperty(default=0) name = ndb.StringProperty() domain = ndb.StringProperty() @ndb.transactional def _increment(self, delta=1): self.count += delta self.put() @classmethod def gen_key(cls, name, domain=None): _key = hashlib.sha224(name.lower() + (domain or '').lower()) return ndb.Key(cls, _key.hexdigest()) @classmethod @ndb.transactional def get(cls, name, domain=None): key = cls.gen_key(name, domain=domain) return key.get() @classmethod @ndb.transactional def get_or_create(cls, name, domain=None): counter = cls.get(name=name, domain=domain) if counter is None: counter = cls(key=cls.gen_key(name=name, domain=domain), name=name) if domain is not None: counter.domain = domain counter.put() return counter @classmethod @ndb.transactional def increment(cls, name, domain=None, delta=1): counter = cls.get_or_create(name, domain=domain) counter.count += delta counter.put() @classmethod @ndb.transactional def set(cls, name, domain=None, value=0): counter = cls.get_or_create(name, domain=domain) counter.count = value counter.put()
{"/test/test_memcache_hook.py": ["/gaeutils/__init__.py"], "/gaeutils/caching.py": ["/gaeutils/__init__.py"], "/test/test_query_exec.py": ["/gaeutils/__init__.py"], "/gaeutils/fanout/__init__.py": ["/gaeutils/fanout/models.py"], "/test/tests.py": ["/gaeutils/__init__.py"], "/test/test_lock.py": ["/gaeutils/__init__.py"], "/test/test_counters.py": ["/gaeutils/__init__.py", "/gaeutils/counters.py"], "/test/test_models.py": ["/gaeutils/__init__.py"], "/gaeutils/locks.py": ["/gaeutils/__init__.py"], "/test/test_fanout.py": ["/gaeutils/__init__.py"], "/gaeutils/fanout/models.py": ["/gaeutils/__init__.py"]}
42,318
deapplegate/astronomr
refs/heads/master
/astronomr/__init__.py
from flask import Flask from flask.ext.sqlalchemy import SQLAlchemy from flask.ext.creole import Creole ############# ### Set up app app = Flask('astronomr', instance_relative_config=True) #look for things in the instance direcotry app.config.from_object('astronomr.default_config') app.config.from_pyfile('astronomr.cfg', silent = True) #overrides db = SQLAlchemy(app) creole = Creole(app) #last but not least from astronomr import views, model, forms
{"/astronomr/views.py": ["/astronomr/__init__.py"], "/astronomr/model.py": ["/astronomr/__init__.py"], "/init_db.py": ["/astronomr/__init__.py"]}
42,319
deapplegate/astronomr
refs/heads/master
/astronomr/forms.py
from flask.ext.wtf import Form from wtforms import StringField, DateTimeField, TextAreaField, validators from wtforms.validators import DataRequired ### class LoggedObservationForm(Form): title = StringField('Title', validators=[DataRequired()]) timestamp = DateTimeField('Date & TIme', validators=[DataRequired()]) objects = StringField('Objects', validators=[DataRequired()]) description = TextAreaField('Description') ### class EditObjectForm(Form): name = StringField('Name', validators=[DataRequired()]) text = TextAreaField('Notes') ###
{"/astronomr/views.py": ["/astronomr/__init__.py"], "/astronomr/model.py": ["/astronomr/__init__.py"], "/init_db.py": ["/astronomr/__init__.py"]}
42,320
deapplegate/astronomr
refs/heads/master
/astronomr/default_config.py
DEBUG = True SECRET_KEY= 'messier 40 is a myth' USERNAME = 'admin' PASSWORD = 'default' WTF_CSRF_ENABLED=True #relative to instance folder SQLALCHEMY_DATABASE_URI = 'sqlite:///astronomr.db'
{"/astronomr/views.py": ["/astronomr/__init__.py"], "/astronomr/model.py": ["/astronomr/__init__.py"], "/init_db.py": ["/astronomr/__init__.py"]}
42,321
deapplegate/astronomr
refs/heads/master
/astronomr/views.py
import sqlite3 from flask import request, session, g, redirect, url_for, \ abort, render_template, flash from contextlib import closing from astronomr import app, db, model, forms ########### ### Views @app.route('/object/<int:object_id>') def show_object(object_id): theobject = model.Object.query.get(object_id) if theobject is None: abort(404) observations = theobject.logged_observations.order_by(model.LoggedObservation.id.desc())[:10] return render_template('show_object.html', theobject = theobject, observations = observations) ### @app.route('/object/<int:object_id>/edit', methods=['GET','POST']) def edit_object(object_id): if not session.get('logged_in'): abort(401) theobject = model.Object.query.get(object_id) if theobject is None: abort(404) edit_object_form = forms.EditObjectForm(obj = theobject) if edit_object_form.validate_on_submit(): theobject.name = edit_object_form.name.data theobject.text = edit_object_form.text.data db.session.add(theobject) db.session.commit() flash('%s successfully updated' % theobject.name) return redirect(url_for('show_object', object_id = object_id)) return render_template('edit_object.html', theobject = theobject, edit_object_form = edit_object_form) ### def get_newest_obs(nobs): observations = model.LoggedObservation.query.order_by(model.LoggedObservation.id.desc())[:nobs] return observations ### @app.route('/') @app.route('/add', methods=['GET', 'POST']) def show_observations(): new_obs_interface = do_add_observation() newest_obs = get_newest_obs(10) return render_template('show_entries.html', new_obs_interface = new_obs_interface, observations=newest_obs) ### def do_add_observation(): if not session.get('logged_in'): return '' new_obs_form = forms.LoggedObservationForm() if new_obs_form.validate_on_submit(): new_obs = model.LoggedObservation(title = new_obs_form.title.data, timestamp = new_obs_form.timestamp.data, description = new_obs_form.description.data) db.session.add(new_obs) object_names = new_obs_form.objects.data.split(',') for object_name in object_names: theobject = model.Object.query.filter_by(name = object_name).first() if theobject is None: theobject = model.Object(name=object_name, text='') new_obs.objects.append(theobject) db.session.add(theobject) db.session.commit() flash('New entry was successfully posted') new_obs_form = forms.LoggedObservationForm(formdata = None) return render_template('add_observation.html', new_obs_form = new_obs_form) ### @app.route('/login', methods=['GET', 'POST']) def login(): error = None if request.method == 'POST': if request.form['username'] != app.config['USERNAME']: error = 'Invalid username' elif request.form['password'] != app.config['PASSWORD']: error = 'Invalid password' else: session['logged_in'] = True flash('You were logged in') return redirect(url_for('show_observations')) return render_template('login.html', error=error) ### @app.route('/logout') def logout(): session.pop('logged_in', None) flash('You were logged out') return redirect(url_for('show_observations'))
{"/astronomr/views.py": ["/astronomr/__init__.py"], "/astronomr/model.py": ["/astronomr/__init__.py"], "/init_db.py": ["/astronomr/__init__.py"]}
42,322
deapplegate/astronomr
refs/heads/master
/astronomr/model.py
from astronomr import db ##### objects_observed = db.Table('objects_observed', db.Column('logged_observation_id', db.Integer, db.ForeignKey('logged_observation.id')), db.Column('object_id', db.Integer, db.ForeignKey('object.id'))) #### class LoggedObservation(db.Model): id = db.Column(db.Integer, primary_key = True) title = db.Column(db.String(80)) timestamp = db.Column(db.DateTime) description = db.Column(db.Text) objects = db.relationship('Object', secondary=objects_observed, backref=db.backref('logged_observations', lazy='dynamic')) def __repr__(self): return '<LoggedObservation %r: %r>' % (self.id, self.title) ##### class Object(db.Model): id = db.Column(db.Integer, primary_key = True) name = db.Column(db.String(80), unique=True) text = db.Column(db.Text) #backref: logged_observations (dynamic) def __repr__(self): return '<Object %r: %r>' % (self.id, self.name)
{"/astronomr/views.py": ["/astronomr/__init__.py"], "/astronomr/model.py": ["/astronomr/__init__.py"], "/init_db.py": ["/astronomr/__init__.py"]}
42,323
deapplegate/astronomr
refs/heads/master
/init_db.py
from astronomr import app, db import os.path db.create_all()
{"/astronomr/views.py": ["/astronomr/__init__.py"], "/astronomr/model.py": ["/astronomr/__init__.py"], "/init_db.py": ["/astronomr/__init__.py"]}
42,327
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/plotting.py
from py_particle_processor_qt.gui.plot_settings import Ui_PlotSettingsWindow from py_particle_processor_qt.gui.default_plot_settings import Ui_DefaultPlotSettingsWindow from PyQt5 import QtGui, QtWidgets, QtCore import pyqtgraph as pg import numpy as np __author__ = "Philip Weigel, Daniel Winklehner" __doc__ = """Plotting objects and associated GUI objects used in the PyParticleProcessor.""" class PlotObject(object): def __init__(self, parent, graphics_view): self._parent = parent # Parent object, which should be a PlotManager self._is_shown = False # A flag raised by showing the plot self._is_3d = False # A flag that determines if the object is a 3D Plot self._enabled = True # A flag indicating the plot is enabled self._graphics_view = graphics_view # The plot's graphics view object to plot to self._plot_settings = {} # The plot settings for this object self._datasets = [] # Datasets being shown in the plot def add_dataset(self, dataset): self._datasets.append(dataset) # Add the dataset to the list of datasets return 0 def clear(self): if self._is_3d: # Check if it's a 3D plot self._graphics_view.items = [] # Clear the items list self._graphics_view.update() # Update the graphics view else: for data_item in self._graphics_view.listDataItems(): # Loop through each data item self._graphics_view.removeItem(data_item) # Remove the data item from the graphics view return 0 def is_shown(self): return self._is_shown # Returns the shown flag def datasets(self): return self._datasets # Return the list of datasets being shown def remove_dataset(self, dataset): if dataset in self._datasets: # If the dataset is in the list... del self._datasets[self._datasets.index(dataset)] # Delete it from the list def set_plot_settings(self, plot_settings): self._plot_settings = plot_settings # Set the instance settings to the supplied plot settings if "is_3d" in plot_settings.keys(): # If this settings is found, check the value if plot_settings["is_3d"] == 2: # 2 --> True self._is_3d = True else: self._is_3d = False else: self._is_3d = False def get_plot_settings(self, translated=False): """ Gets the plot settings used in propertieswindow. Translated means using "x", "y", ... instead of 0, 1, 2, ... :param translated: :return: """ if translated is False: return self._plot_settings # Return raw plot settings else: t_plot_settings = {} # Create a new dictionary for the translated plot settings en_val = [False, None, True] # Values for the "enable" settings combo_val = ["x", "y", "z", "r", "px", "py", "pz", "pr"] # Values for the combo boxes for k, v in self._plot_settings.items(): # Get the key and value of each setting if "_en" in k or "is" in k: # If it's an enable setting... t_plot_settings[k] = en_val[v] elif "step" in k: # If it's the step... t_plot_settings[k] = v elif v is None: # If the value is set to None... t_plot_settings[k] = None else: # Else, it's a combo box setting t_plot_settings[k] = combo_val[v] return t_plot_settings def show(self): self._is_shown = False t_plot_settings = self.get_plot_settings(translated=True) # Get the translated settings # Set the displayed axes to what the combo box settings were (param_c will be None for a 2D plot) axes = t_plot_settings["param_a"], t_plot_settings["param_b"], t_plot_settings["param_c"] enabled = t_plot_settings["param_en"] step = t_plot_settings["step"] # Get the step from the settings # Check if the plot object is a 3D plot if self._is_3d: if enabled: # Note: since the get_color is set to random, you won't be able to distinguish different datasets for dataset in self._datasets: # Loop through each dataset # Only do a 3D display for data with more than one step and it's enabled if dataset.get_nsteps() > 1 and self._enabled: _grid = False # Loop through each particle if dataset.get_npart() > 1: for particle_id in range(dataset.get_npart()): # Get the particle data and color for plotting particle, _c = dataset.get_particle(particle_id, get_color="random") # Make an array of the values and transpose it (needed for plotting) pts = np.array([particle.get(axes[0]), particle.get(axes[1]), particle.get(axes[2])]).T # Create a line item of all the points corresponding to this particle plt = pg.opengl.GLLinePlotItem(pos=pts, color=pg.glColor(_c), width=1., antialias=True) # Add the line object to the graphics view self._graphics_view.addItem(plt) else: # Source: https://stackoverflow.com/questions/4296249/how-do-i-convert-a-hex-triplet-to-an-rgb-tuple-and-back _NUMERALS = '0123456789abcdefABCDEF' _HEXDEC = {v: int(v, 16) for v in (x + y for x in _NUMERALS for y in _NUMERALS)} def rgb(triplet): return [_HEXDEC[triplet[0:2]] / 255.0, _HEXDEC[triplet[2:4]] / 255.0, _HEXDEC[triplet[4:6]] / 255.0, 255.0 / 255.0] if dataset.get_nsteps() > 1 and dataset.get_npart() == 1: _x, _y, _z = [], [], [] for step_i in range(step): dataset.set_step_view(step_i) _x.append(float(dataset.get(axes[0]))) _y.append(float(dataset.get(axes[1]))) _z.append(float(dataset.get(axes[2]))) pts = np.array([_x, _y, _z]).T dataset_color = dataset.color() line_color = rgb(dataset_color[1:]) plot_curve = pg.opengl.GLLinePlotItem(pos=pts, color=line_color, width=1., antialias=True) self._graphics_view.addItem(plot_curve) self._graphics_view.repaint() if _grid: # If the grid is enabled for this plot # TODO: Make the grid size dynamic -PW # TODO: The maximum and minimum values might be useful to get during import -PW gx = pg.opengl.GLGridItem() gx.rotate(90, 0, 1, 0) gx.translate(0.0, 0.0, 0.0) gx.setSize(x=0.2, y=0.2, z=0.2) gx.setSpacing(x=0.01, y=0.01, z=0.01) gy = pg.opengl.GLGridItem() gy.rotate(90, 1, 0, 0) gy.translate(0.0, 0.0, 0.0) gy.setSize(x=0.2, y=0.2, z=0.2) gy.setSpacing(x=0.01, y=0.01, z=0.01) gz = pg.opengl.GLGridItem() gz.translate(0.0, 0.0, 0.0) gz.setSize(x=0.2, y=0.2, z=1.0) gz.setSpacing(x=0.01, y=0.01, z=0.01) # Add the three grids to the graphics view self._graphics_view.addItem(gx) self._graphics_view.addItem(gy) self._graphics_view.addItem(gz) # Set the "camera" distance self._graphics_view.opts["distance"] = 3e-1 # Seems to be a good value for now self._is_shown = True else: # If it's not a 3D plot, it's a 2D plot... if enabled: for dataset in self._datasets: # Loop through each dataset if dataset.get_nsteps() > 1 and dataset.get_npart() == 1: _x, _y = [], [] for step_i in range(step): dataset.set_step_view(step_i) _x.append(float(dataset.get(axes[0]))) _y.append(float(dataset.get(axes[1]))) plot_curve = pg.PlotDataItem(x=np.array(_x), y=np.array(_y), pen=pg.mkPen(dataset.color()), brush='b', size=1.0, pxMode=True) plot_start = pg.ScatterPlotItem(x=np.array([_x[0]]), y=np.array([_y[0]]), pen=pg.mkPen(color=(0.0, 255.0, 0.0)), symbol="o", brush='b', size=3.0, pxMode=True) plot_end = pg.ScatterPlotItem(x=np.array([_x[-1]]), y=np.array([_y[-1]]), pen=pg.mkPen(color=(255.0, 0.0, 0.0)), symbol="o", brush='b', size=3.0, pxMode=True) self._graphics_view.addItem(plot_curve) self._graphics_view.addItem(plot_start) self._graphics_view.addItem(plot_end) if axes[0] == "x" and axes[1] == "y": self._graphics_view.setAspectLocked(lock=True, ratio=1) if dataset.orbit() is not None: xc, yc, r = dataset.orbit() theta = np.linspace(0, 2*np.pi, 180) xo = r * np.cos(theta) + xc yo = r * np.sin(theta) + yc orbit_curve = pg.PlotDataItem(x=xo, y=yo, pen=pg.mkPen(color=dataset.color(), style=QtCore.Qt.DashLine), brush='b', size=1.0, pxMode=True) orbit_center = pg.ScatterPlotItem(x=np.array([xc]), y=np.array([yc]), pen=pg.mkPen(color=dataset.color()), symbol="s", brush='b', size=3.0, pxMode=True) self._graphics_view.addItem(orbit_curve) self._graphics_view.addItem(orbit_center) else: self._graphics_view.setAspectLocked(lock=False) self._graphics_view.showGrid(True, True, 0.5) self._graphics_view.repaint() else: dataset.set_step_view(step) # Set the step for the current dataset # Create a scatter plot item using the values and color from the dataset scatter = pg.ScatterPlotItem(x=dataset.get(axes[0]), y=dataset.get(axes[1]), pen=pg.mkPen(dataset.color()), brush='b', size=1.0, pxMode=True) # Add the scatter plot item to the graphics view self._graphics_view.addItem(scatter) # Create a title for the graph, which is just the axis labels for now title = axes[0].upper() + "-" + axes[1].upper() self._graphics_view.setTitle(title) # Set the title of the graphics view self._graphics_view.repaint() # Repaint the view self._is_shown = True # Set the shown flag return 0 class PlotManager(object): def __init__(self, parent, debug=False): self._parent = parent self._tabs = parent.tabs() # Tab Widget from the parent self._gvs = [] # A list of the graphics views self._plot_objects = [] # A list of the plot objects self._debug = debug # Debug flag self._screen_size = parent.screen_size() # Get the screen size from the parent self._plot_settings_gui = None # Used to store the GUI object so it stays in memory while running self._current_plot = None # Which plot is currently showing (None should be default plots) self._default_plots = [None, None, None, None] # A list of the default plot objects self._default_plot_settings = {} # The plot settings for the default plots self._initialize_default_plots() # Initialization of the default plots def _initialize_default_plots(self): default_gv = self._parent.get_default_graphics_views() # Get the default graphics views self._default_plots = [PlotObject(self, gv) for gv in default_gv] # Make the plot objects return 0 @staticmethod def add_to_plot(dataset, plot_object): if dataset not in plot_object.datasets(): # Only add to the plot object if it isn't already in it plot_object.add_dataset(dataset) else: print("This dataset is already in the PlotObject!") return 0 def add_to_current_plot(self, dataset): current_index = self._tabs.currentIndex() if current_index == 0: # Catch the condition that the default plots are shown self.add_to_default(dataset) else: plot_object = self._plot_objects[current_index - 1] self.add_to_plot(dataset=dataset, plot_object=plot_object) return 0 def add_to_default(self, dataset): for plot_object in self._default_plots: # Add the dataset to all of the default plot objects plot_object.add_dataset(dataset) return 0 def apply_default_plot_settings(self, plot_settings, redraw=False): # TODO: Better way to do this -PW self._default_plot_settings = plot_settings # Store the plot settings as the default plot settings prefix_list = ["tl", "tr", "bl", "3d"] # Create a list of prefixes for idx, plot_object in enumerate(self._default_plots): # Enumerate through the default plot objects new_plot_settings = {"step": plot_settings["step"]} # Add the step parameter for key, val in plot_settings.items(): # Scan through all of the default plot settings if prefix_list[idx] in key: # If the key has the prefix for this plot object... new_key = "param_"+key.split("_")[1] # Create a new key that will be used by the plot object new_plot_settings[new_key] = val # Store the value in that new key new_plot_settings["param_c"] = None # Unused parameter for the 2D plots (needed for 3D) if idx == 3: # The third (last) index corresponds to the 3D plot, and by default it's x, y, z new_plot_settings["param_a"] = 0 # 0 --> "x" new_plot_settings["param_b"] = 1 # 1 --> "y" new_plot_settings["param_c"] = 2 # 2 --> "z" new_plot_settings["is_3d"] = 2 # 2 --> True plot_object.set_plot_settings(new_plot_settings) # Apply the plot settings for the current object if redraw: # Redraw the plot if the flag is set self.redraw_plot() return 0 def default_plot_settings(self, redraw=False): # Create the default plot settings GUI, store it in memory, and run it self._plot_settings_gui = PlotSettings(self, redraw=redraw, default=True, debug=self._debug) self._plot_settings_gui.run() return 0 def get_default_plot_settings(self): return self._default_plot_settings # Returns the default plot settings (untranslated) def get_plot_object(self, tab_index): if tab_index == 0: # In the case of the default plots tab return self._default_plots # It returns the list of all the objects else: return [self._plot_objects[tab_index - 1]] # Return it in a list def has_default_plot_settings(self): # Returns True if the settings for the default plots have been set previously for plot_object in self._default_plots: if len(plot_object.get_plot_settings()) > 0: return True return False def modify_plot(self): if self._tabs.currentIndex() == 0: self.default_plot_settings(redraw=True) else: self.plot_settings(new_plot=False) return 0 def new_plot(self): self.new_tab() # Create a new tab for the new plot plot_object = PlotObject(parent=self, graphics_view=self._gvs[-1]) # Create a plot object for the new gv self._plot_objects.append(plot_object) # Add this new plot object to the list of plot objects self.plot_settings(new_plot=True) # Open the plot settings for this plot return 0 def new_tab(self): # Create a new widget that will be the new tab local_tab = QtWidgets.QWidget(parent=self._tabs, flags=self._tabs.windowFlags()) gl = QtWidgets.QGridLayout(local_tab) # Create a grid layout gl.setContentsMargins(0, 0, 0, 0) gl.setSpacing(6) self._gvs.append(pg.PlotWidget(local_tab)) # Add the PlotWidget to the list of graphics views gl.addWidget(self._gvs[-1]) # Add the grid layout to the newest graphics view # Add the new widget to the tabs widget, and give it a name self._tabs.addTab(local_tab, "Tab {}".format(self._tabs.count() + 1)) return 0 def plot_settings(self, new_plot=False): if new_plot is False: current_index = self._tabs.currentIndex() # The current index of the tab widget plot_object = self._plot_objects[current_index - 1] # Find the plot object corresponding to that tab index self._plot_settings_gui = PlotSettings(self, plot_object, debug=self._debug) else: plot_object = self._plot_objects[-1] self._plot_settings_gui = PlotSettings(self, plot_object, new_plot=True, debug=self._debug) self._plot_settings_gui.run() # Run the GUI return 0 def redraw_default_plots(self): # Clear, then show each plot object in the default plot object list for plot_object in self._default_plots: plot_object.clear() plot_object.show() return 0 def redraw_plot(self): current_index = self._tabs.currentIndex() # Get the current index of the tab widget if current_index == 0: # If it's zero, it's the first tab/default plots self.redraw_default_plots() else: plot_object = self._plot_objects[current_index - 1] # If not, get the plot object and redraw plot_object.clear() plot_object.show() return 0 def remove_dataset(self, dataset): for plot_object in self._plot_objects: # Remove the dataset from each plot object plot_object.remove_dataset(dataset) # Note: the method checks to see if the set is in the object for default_plot_object in self._default_plots: # Remove the dataset from each default plot object default_plot_object.remove_dataset(dataset) return 0 def remove_plot(self): current_index = self._tabs.currentIndex() if current_index == 0: print("You cannot remove the default plots!") return 1 else: self._tabs.setCurrentIndex(current_index - 1) # This should always exist -PW self._tabs.removeTab(current_index) del self._plot_objects[current_index - 1] del self._gvs[current_index - 1] return 0 def screen_size(self): return self._screen_size # Return the size of the screen def set_tab(self, index): if index == "last": self._tabs.setCurrentIndex(self._tabs.count() - 1) elif index == "first": self._tabs.setCurrentIndex(0) else: self._tabs.setCurrentIndex(index) return 0 class PlotSettings(object): def __init__(self, parent, plot_object=None, redraw=False, default=False, new_plot=False, debug=False): self._parent = parent self._plot_object = plot_object self._debug = debug # Debug flag self._redraw = redraw # Redraw flag self._default = default # Default flag self._new_plot = new_plot # New Plot flag combo_val = ["x", "y", "z", "r", "px", "py", "pz", "pr"] # --- Initialize the GUI --- # if self._default: self._settings = parent.get_default_plot_settings() # Get the (possibly) previously set settings self._plotSettingsWindow = QtGui.QMainWindow() self._plotSettingsWindowGUI = Ui_DefaultPlotSettingsWindow() self._plotSettingsWindowGUI.setupUi(self._plotSettingsWindow) for _ in range(self._plotSettingsWindowGUI.tl_combo_a.count()): self._plotSettingsWindowGUI.tl_combo_a.removeItem(0) self._plotSettingsWindowGUI.tl_combo_b.removeItem(0) self._plotSettingsWindowGUI.tr_combo_a.removeItem(0) self._plotSettingsWindowGUI.tr_combo_b.removeItem(0) self._plotSettingsWindowGUI.bl_combo_a.removeItem(0) self._plotSettingsWindowGUI.bl_combo_b.removeItem(0) for item in combo_val: self._plotSettingsWindowGUI.tl_combo_a.addItem(item.upper()) self._plotSettingsWindowGUI.tl_combo_b.addItem(item.upper()) self._plotSettingsWindowGUI.tr_combo_a.addItem(item.upper()) self._plotSettingsWindowGUI.tr_combo_b.addItem(item.upper()) self._plotSettingsWindowGUI.bl_combo_a.addItem(item.upper()) self._plotSettingsWindowGUI.bl_combo_b.addItem(item.upper()) self._plotSettingsWindowGUI.tl_combo_a.setCurrentIndex(combo_val.index("x")) self._plotSettingsWindowGUI.tl_combo_b.setCurrentIndex(combo_val.index("y")) self._plotSettingsWindowGUI.tr_combo_a.setCurrentIndex(combo_val.index("x")) self._plotSettingsWindowGUI.tr_combo_b.setCurrentIndex(combo_val.index("px")) self._plotSettingsWindowGUI.bl_combo_a.setCurrentIndex(combo_val.index("y")) self._plotSettingsWindowGUI.bl_combo_b.setCurrentIndex(combo_val.index("py")) else: self._settings = plot_object.get_plot_settings() # Get the (possibly) previously set settings of the object self._plotSettingsWindow = QtGui.QMainWindow() self._plotSettingsWindowGUI = Ui_PlotSettingsWindow() self._plotSettingsWindowGUI.setupUi(self._plotSettingsWindow) for _ in range(self._plotSettingsWindowGUI.param_combo_a.count()): self._plotSettingsWindowGUI.param_combo_a.removeItem(0) self._plotSettingsWindowGUI.param_combo_b.removeItem(0) self._plotSettingsWindowGUI.param_combo_c.removeItem(0) for item in combo_val: self._plotSettingsWindowGUI.param_combo_a.addItem(item.upper()) self._plotSettingsWindowGUI.param_combo_b.addItem(item.upper()) self._plotSettingsWindowGUI.param_combo_c.addItem(item.upper()) self._plotSettingsWindowGUI.param_combo_a.setCurrentIndex(combo_val.index("x")) self._plotSettingsWindowGUI.param_combo_b.setCurrentIndex(combo_val.index("y")) self._plotSettingsWindowGUI.param_combo_c.setCurrentIndex(combo_val.index("z")) if len(self._settings) > 0: # If there are settings, then populate the GUI self.populate() else: # If not, then apply the ones from the UI file self.apply_settings() # --- Connections --- # self._plotSettingsWindowGUI.apply_button.clicked.connect(self.callback_apply) self._plotSettingsWindowGUI.cancel_button.clicked.connect(self.callback_cancel) self._plotSettingsWindowGUI.redraw_button.clicked.connect(self.callback_redraw) self._plotSettingsWindowGUI.main_label.setText("Plot Settings") def apply_settings(self): # Step: self._settings["step"] = self._plotSettingsWindowGUI.step_input.value() # 3D Plot: self._settings["3d_en"] = self._plotSettingsWindowGUI.three_d_enabled.checkState() if self._default and isinstance(self._plotSettingsWindowGUI, Ui_DefaultPlotSettingsWindow): # Top Left: self._settings["tl_en"] = self._plotSettingsWindowGUI.tl_enabled.checkState() self._settings["tl_a"] = self._plotSettingsWindowGUI.tl_combo_a.currentIndex() self._settings["tl_b"] = self._plotSettingsWindowGUI.tl_combo_b.currentIndex() # Top Right: self._settings["tr_en"] = self._plotSettingsWindowGUI.tr_enabled.checkState() self._settings["tr_a"] = self._plotSettingsWindowGUI.tr_combo_a.currentIndex() self._settings["tr_b"] = self._plotSettingsWindowGUI.tr_combo_b.currentIndex() # Bottom Left: self._settings["bl_en"] = self._plotSettingsWindowGUI.bl_enabled.checkState() self._settings["bl_a"] = self._plotSettingsWindowGUI.bl_combo_a.currentIndex() self._settings["bl_b"] = self._plotSettingsWindowGUI.bl_combo_b.currentIndex() # Redraw: # self._settings["redraw_en"] = self._plotSettingsWindowGUI.redraw_enabled.checkState() elif isinstance(self._plotSettingsWindowGUI, Ui_PlotSettingsWindow): # Parameters: self._settings["param_a"] = self._plotSettingsWindowGUI.param_combo_a.currentIndex() self._settings["param_b"] = self._plotSettingsWindowGUI.param_combo_b.currentIndex() self._settings["param_c"] = self._plotSettingsWindowGUI.param_combo_c.currentIndex() self._settings["param_en"] = self._plotSettingsWindowGUI.param_enabled.checkState() def callback_apply(self): # Apply the settings in the GUI, then apply them to the plot object self.apply_settings() if self._default: self._parent.apply_default_plot_settings(self.get_settings(), redraw=self._redraw) else: self._plot_object.set_plot_settings(plot_settings=self.get_settings()) self._plotSettingsWindow.close() # Close the GUI if self._new_plot is True: self._parent.set_tab("last") self._parent.redraw_plot() # Redraw the plot return 0 def callback_cancel(self): self._plotSettingsWindow.close() # Close the window return 0 def callback_redraw(self): self.apply_settings() # Apply the settings to the GUI if self._default: self._parent.apply_default_plot_settings(self.get_settings()) self._parent.redraw_default_plots() else: self._plot_object.apply_plot_settings(plot_settings=self.get_settings()) self._parent.redraw_plot() # Redraw the plot def get_settings(self): return self._settings # Return the plot settings def populate(self): # Step: self._plotSettingsWindowGUI.step_input.setValue(self._settings["step"]) # 3D Plot: self._plotSettingsWindowGUI.three_d_enabled.setCheckState(self._settings["3d_en"]) if self._default and isinstance(self._plotSettingsWindowGUI, Ui_DefaultPlotSettingsWindow): # Top Left: self._plotSettingsWindowGUI.tl_enabled.setCheckState(self._settings["tl_en"]) self._plotSettingsWindowGUI.tl_combo_a.setCurrentIndex(self._settings["tl_a"]) self._plotSettingsWindowGUI.tl_combo_b.setCurrentIndex(self._settings["tl_b"]) # Top Right: self._plotSettingsWindowGUI.tr_enabled.setCheckState(self._settings["tr_en"]) self._plotSettingsWindowGUI.tr_combo_a.setCurrentIndex(self._settings["tr_a"]) self._plotSettingsWindowGUI.tr_combo_b.setCurrentIndex(self._settings["tr_b"]) # Bottom Left: self._plotSettingsWindowGUI.bl_enabled.setCheckState(self._settings["bl_en"]) self._plotSettingsWindowGUI.bl_combo_a.setCurrentIndex(self._settings["bl_a"]) self._plotSettingsWindowGUI.bl_combo_b.setCurrentIndex(self._settings["bl_b"]) # Redraw: # self._plotSettingsWindowGUI.redraw_enabled.setCheckState(self._settings["redraw_en"]) elif isinstance(self._plotSettingsWindowGUI, Ui_PlotSettingsWindow): # Parameters: self._plotSettingsWindowGUI.param_combo_a.setCurrentIndex(self._settings["param_a"]) self._plotSettingsWindowGUI.param_combo_b.setCurrentIndex(self._settings["param_b"]) self._plotSettingsWindowGUI.param_combo_c.setCurrentIndex(self._settings["param_c"]) self._plotSettingsWindowGUI.param_enabled.setCheckState(self._settings["param_en"]) def run(self): # --- Calculate the positions to center the window --- # screen_size = self._parent.screen_size() _x = 0.5 * (screen_size.width() - self._plotSettingsWindow.width()) _y = 0.5 * (screen_size.height() - self._plotSettingsWindow.height()) # --- Show the GUI --- # self._plotSettingsWindow.show() self._plotSettingsWindow.move(_x, _y)
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,328
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'collimOPALgui.ui' # # Created by: PyQt5 UI code generator 5.6 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_CollimOPAL(object): def setupUi(self, CollimOPAL): CollimOPAL.setObjectName("CollimOPAL") CollimOPAL.resize(421, 340) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(CollimOPAL.sizePolicy().hasHeightForWidth()) CollimOPAL.setSizePolicy(sizePolicy) CollimOPAL.setAutoFillBackground(False) self.centralwidget = QtWidgets.QWidget(CollimOPAL) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.centralwidget.sizePolicy().hasHeightForWidth()) self.centralwidget.setSizePolicy(sizePolicy) self.centralwidget.setObjectName("centralwidget") self.verticalLayoutWidget = QtWidgets.QWidget(self.centralwidget) self.verticalLayoutWidget.setGeometry(QtCore.QRect(10, 3, 401, 358)) self.verticalLayoutWidget.setObjectName("verticalLayoutWidget") self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.verticalLayoutWidget) self.verticalLayout_3.setSizeConstraint(QtWidgets.QLayout.SetMinimumSize) self.verticalLayout_3.setContentsMargins(0, 0, 0, 0) self.verticalLayout_3.setSpacing(0) self.verticalLayout_3.setObjectName("verticalLayout_3") self.label = QtWidgets.QLabel(self.verticalLayoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth()) self.label.setSizePolicy(sizePolicy) self.label.setMaximumSize(QtCore.QSize(16777215, 200)) self.label.setObjectName("label") self.verticalLayout_3.addWidget(self.label) self.gridLayout = QtWidgets.QGridLayout() self.gridLayout.setObjectName("gridLayout") self.label_7 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_7.setObjectName("label_7") self.gridLayout.addWidget(self.label_7, 6, 0, 1, 1, QtCore.Qt.AlignHCenter) self.gap = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.gap.setObjectName("gap") self.gridLayout.addWidget(self.gap, 4, 1, 1, 1, QtCore.Qt.AlignHCenter) self.label_6 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_6.setObjectName("label_6") self.gridLayout.addWidget(self.label_6, 4, 0, 1, 1, QtCore.Qt.AlignHCenter) self.step = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.step.setObjectName("step") self.gridLayout.addWidget(self.step, 2, 1, 1, 1, QtCore.Qt.AlignHCenter) self.w = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.w.setObjectName("w") self.gridLayout.addWidget(self.w, 6, 1, 1, 1, QtCore.Qt.AlignHCenter) self.hl = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.hl.setObjectName("hl") self.gridLayout.addWidget(self.hl, 5, 1, 1, 1, QtCore.Qt.AlignHCenter) self.label_8 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_8.setObjectName("label_8") self.gridLayout.addWidget(self.label_8, 5, 0, 1, 1, QtCore.Qt.AlignHCenter) self.label_2 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_2.setObjectName("label_2") self.gridLayout.addWidget(self.label_2, 2, 0, 1, 1, QtCore.Qt.AlignHCenter) self.num = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.num.setObjectName("num") self.gridLayout.addWidget(self.num, 0, 1, 1, 1, QtCore.Qt.AlignHCenter) self.label_3 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_3.setObjectName("label_3") self.gridLayout.addWidget(self.label_3, 0, 0, 1, 1, QtCore.Qt.AlignHCenter) self.label_4 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_4.setObjectName("label_4") self.gridLayout.addWidget(self.label_4, 1, 0, 1, 1, QtCore.Qt.AlignHCenter) self.nseg = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.nseg.setObjectName("nseg") self.gridLayout.addWidget(self.nseg, 1, 1, 1, 1, QtCore.Qt.AlignHCenter) self.verticalLayout_3.addLayout(self.gridLayout) self.textBrowser = QtWidgets.QTextBrowser(self.verticalLayoutWidget) self.textBrowser.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents) self.textBrowser.setObjectName("textBrowser") self.verticalLayout_3.addWidget(self.textBrowser) self.buttonBox = QtWidgets.QDialogButtonBox(self.verticalLayoutWidget) self.buttonBox.setLayoutDirection(QtCore.Qt.LeftToRight) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Close|QtWidgets.QDialogButtonBox.Ok) self.buttonBox.setCenterButtons(False) self.buttonBox.setObjectName("buttonBox") self.verticalLayout_3.addWidget(self.buttonBox, 0, QtCore.Qt.AlignRight) spacerItem = QtWidgets.QSpacerItem(20, 10, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.verticalLayout_3.addItem(spacerItem) CollimOPAL.setCentralWidget(self.centralwidget) self.retranslateUi(CollimOPAL) QtCore.QMetaObject.connectSlotsByName(CollimOPAL) def retranslateUi(self, CollimOPAL): _translate = QtCore.QCoreApplication.translate CollimOPAL.setWindowTitle(_translate("CollimOPAL", "Generating Collimator")) self.label.setText(_translate("CollimOPAL", "<html><head/><body><p>Generate collimator code for OPAL-cycl.</p><p>The collimator will be perpendicular to the average momentum at the given step.</p></body></html>")) self.label_7.setText(_translate("CollimOPAL", "Collimator Width (mm):")) self.label_6.setText(_translate("CollimOPAL", "Gap Half-width (mm):")) self.label_8.setText(_translate("CollimOPAL", "Collimator Half-length (mm):")) self.label_2.setText(_translate("CollimOPAL", "Step Number:")) self.label_3.setText(_translate("CollimOPAL", "Label Number:")) self.label_4.setText(_translate("CollimOPAL", "Number of Segments:")) self.textBrowser.setHtml(_translate("CollimOPAL", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n" "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p, li { white-space: pre-wrap; }\n" "</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8pt; font-weight:400; font-style:normal;\">\n" "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p></body></html>"))
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,329
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/test/__main__.py
from py_particle_processor_qt.py_particle_processor_qt import PyParticleProcessor ppp = PyParticleProcessor(debug=True) ppp.run()
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,330
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py
from ..abstract_tool import AbstractTool from .orbittoolgui import Ui_OrbitToolGUI from PyQt5 import QtGui class OrbitTool(AbstractTool): def __init__(self, parent): super(OrbitTool, self).__init__(parent) self._name = "Orbit Tool" self._parent = parent # --- Initialize the GUI --- # self._orbitToolWindow = QtGui.QMainWindow() self._orbitToolGUI = Ui_OrbitToolGUI() self._orbitToolGUI.setupUi(self._orbitToolWindow) self._orbitToolGUI.apply_button.clicked.connect(self.callback_apply) self._orbitToolGUI.cancel_button.clicked.connect(self.callback_cancel) self._has_gui = True self._need_selection = True self._min_selections = 1 self._max_selections = None self._redraw_on_exit = True self.values = [None, None, None] # --- Required Functions --- # def run(self): # --- Calculate the positions to center the window --- # screen_size = self._parent.screen_size() _x = 0.5 * (screen_size.width() - self._orbitToolWindow.width()) _y = 0.5 * (screen_size.height() - self._orbitToolWindow.height()) # --- Show the GUI --- # self._orbitToolWindow.show() self._orbitToolWindow.move(_x, _y) # --- GUI-related Functions --- # def open_gui(self): self.run() def close_gui(self): self._orbitToolWindow.close() def callback_apply(self): if self.apply() == 0: self._redraw() self.close_gui() def callback_cancel(self): self.close_gui() # --- Tool-related Functions --- # def check_step_numbers(self): step_texts = [self._orbitToolGUI.step_1, self._orbitToolGUI.step_2, self._orbitToolGUI.step_3] self.values = [None, None, None] for i, step in enumerate(step_texts): s_txt = step.text() if len(s_txt) == 0: step.setStyleSheet("color: #000000") try: if "." in s_txt: step.setStyleSheet("color: #FF0000") else: self.values[i] = int(s_txt) # Try to convert the input to an int step.setStyleSheet("color: #000000") except ValueError: # Set the text color to red step.setStyleSheet("color: #FF0000") def apply(self): self.check_step_numbers() if None in self.values: return 1 for dataset in self._selections: dataset.xy_orbit(self.values, center=self._orbitToolGUI.center_orbit.isChecked()) return 0
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,331
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/tools/abstract_tool.py
from abc import ABC, abstractmethod # TODO: WIP class AbstractTool(ABC): def __init__(self, parent): self._name = None self._parent = parent self._has_gui = False self._need_selection = False self._min_selections = 1 self._max_selections = 1 self._selections = None self._redraw_on_exit = False self._plot_manager = None def _redraw(self): self._plot_manager.redraw_plot() def check_requirements(self): if len(self._selections) == 0 and self._need_selection: return 1 if self._min_selections is not None: if len(self._selections) < self._min_selections: return 1 if self._max_selections is not None: if len(self._selections) > self._max_selections: return 1 return 0 def name(self): return self._name def redraw_on_exit(self): return self._redraw_on_exit @abstractmethod def run(self): pass def set_plot_manager(self, plot_manager): self._plot_manager = plot_manager def set_selections(self, selections): self._selections = selections
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,332
DanielWinklehner/py_particle_processor
refs/heads/master
/examples/gui_example.py
from py_particle_processor_qt.py_particle_processor_qt import PyParticleProcessor ppp = PyParticleProcessor(debug=False) ppp.run()
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,333
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py
from py_particle_processor_qt.drivers.TraceWinDriver.TraceWinDriver import *
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,334
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'orbittoolgui.ui' # # Created by: PyQt5 UI code generator 5.5.1 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_OrbitToolGUI(object): def setupUi(self, OrbitToolGUI): OrbitToolGUI.setObjectName("OrbitToolGUI") OrbitToolGUI.resize(323, 183) self.centralwidget = QtWidgets.QWidget(OrbitToolGUI) self.centralwidget.setObjectName("centralwidget") self.verticalLayoutWidget = QtWidgets.QWidget(self.centralwidget) self.verticalLayoutWidget.setGeometry(QtCore.QRect(0, 0, 321, 183)) self.verticalLayoutWidget.setObjectName("verticalLayoutWidget") self.verticalLayout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget) self.verticalLayout.setObjectName("verticalLayout") self.label = QtWidgets.QLabel(self.verticalLayoutWidget) self.label.setObjectName("label") self.verticalLayout.addWidget(self.label, 0, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter) self.gridLayout = QtWidgets.QGridLayout() self.gridLayout.setObjectName("gridLayout") self.step_1_label = QtWidgets.QLabel(self.verticalLayoutWidget) self.step_1_label.setObjectName("step_1_label") self.gridLayout.addWidget(self.step_1_label, 0, 0, 1, 1) self.step_2_label = QtWidgets.QLabel(self.verticalLayoutWidget) self.step_2_label.setObjectName("step_2_label") self.gridLayout.addWidget(self.step_2_label, 1, 0, 1, 1) self.step_2 = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.step_2.setText("") self.step_2.setObjectName("step_2") self.gridLayout.addWidget(self.step_2, 1, 1, 1, 1) self.step_3_label = QtWidgets.QLabel(self.verticalLayoutWidget) self.step_3_label.setObjectName("step_3_label") self.gridLayout.addWidget(self.step_3_label, 2, 0, 1, 1) self.step_3 = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.step_3.setText("") self.step_3.setObjectName("step_3") self.gridLayout.addWidget(self.step_3, 2, 1, 1, 1) self.step_1 = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.step_1.setText("") self.step_1.setObjectName("step_1") self.gridLayout.addWidget(self.step_1, 0, 1, 1, 1) self.center_orbit = QtWidgets.QCheckBox(self.verticalLayoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.center_orbit.sizePolicy().hasHeightForWidth()) self.center_orbit.setSizePolicy(sizePolicy) self.center_orbit.setObjectName("center_orbit") self.gridLayout.addWidget(self.center_orbit, 3, 1, 1, 1) self.verticalLayout.addLayout(self.gridLayout) self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.cancel_button = QtWidgets.QPushButton(self.verticalLayoutWidget) self.cancel_button.setObjectName("cancel_button") self.horizontalLayout.addWidget(self.cancel_button) self.apply_button = QtWidgets.QPushButton(self.verticalLayoutWidget) self.apply_button.setDefault(True) self.apply_button.setObjectName("apply_button") self.horizontalLayout.addWidget(self.apply_button) self.verticalLayout.addLayout(self.horizontalLayout) OrbitToolGUI.setCentralWidget(self.centralwidget) self.retranslateUi(OrbitToolGUI) QtCore.QMetaObject.connectSlotsByName(OrbitToolGUI) def retranslateUi(self, OrbitToolGUI): _translate = QtCore.QCoreApplication.translate OrbitToolGUI.setWindowTitle(_translate("OrbitToolGUI", "Orbit Tool")) self.label.setText(_translate("OrbitToolGUI", "Orbit Tool")) self.step_1_label.setText(_translate("OrbitToolGUI", "First Step:")) self.step_2_label.setText(_translate("OrbitToolGUI", "Second Step:")) self.step_2.setPlaceholderText(_translate("OrbitToolGUI", "1")) self.step_3_label.setText(_translate("OrbitToolGUI", "Third Step:")) self.step_3.setPlaceholderText(_translate("OrbitToolGUI", "2")) self.step_1.setPlaceholderText(_translate("OrbitToolGUI", "0")) self.center_orbit.setText(_translate("OrbitToolGUI", "Center Orbit (for R and PR)")) self.cancel_button.setText(_translate("OrbitToolGUI", "Cancel")) self.apply_button.setText(_translate("OrbitToolGUI", "Apply"))
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,335
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor/drivers/OPALDriver/__init__.py
from OPALDriver import *
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,336
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py
from ..arraywrapper import ArrayWrapper from ..abstractdriver import AbstractDriver from dans_pymodules import IonSpecies import numpy as np import h5py class OPALDriver(AbstractDriver): def __init__(self, debug=False): super(OPALDriver, self).__init__() self._debug = debug self._program_name = "OPAL" def get_program_name(self): return self._program_name def import_data(self, filename, species): if self._debug: print("Importing data from program: {}".format(self._program_name)) if h5py.is_hdf5(filename): if self._debug: print("Opening h5 file..."), _datasource = h5py.File(filename, "r+") if self._debug: print("Done!") if "OPAL_version" in _datasource.attrs.keys(): data = {"datasource": _datasource} if self._debug: print("Loading dataset from h5 file in OPAL format.") data["steps"] = len(_datasource.keys())-1 if self._debug: print("Found {} steps in the file.".format(data["steps"])) _data = _datasource.get("Step#0") # for _key in _data.keys(): # print(_key) # # for _key in _data.attrs.keys(): # print(_key) # TODO: OPAL apparently doesn't save the charge per particle, but per macroparticle without frequency, # TODO: we have no way of telling what the species is! Add manual input. And maybe fix OPAL... -DW try: species.calculate_from_energy_mev(_data.attrs["ENERGY"]) except Exception: pass data["ion"] = species data["mass"] = species.a() data["charge"] = species.q() data["current"] = None # TODO: Get actual current! -DW data["particles"] = len(_data.get("x")[()]) return data elif ".dat" in filename: if self._debug: print("Opening OPAL .dat file...") data = {} with open(filename, "rb") as infile: data["particles"] = int(infile.readline().rstrip().lstrip()) data["steps"] = 1 _distribution = [] mydtype = [('x', float), ('xp', float), ('y', float), ('yp', float), ('z', float), ('zp', float)] for line in infile.readlines(): values = line.strip().split() _distribution.append(tuple(values)) _distribution = np.array(_distribution, dtype=mydtype) distribution = {'x': ArrayWrapper(_distribution['x']), 'px': ArrayWrapper(_distribution['xp']), 'y': ArrayWrapper(_distribution['y']), 'py': ArrayWrapper(_distribution['yp']), 'z': ArrayWrapper(_distribution['z']), 'pz': ArrayWrapper(_distribution['zp'])} # For a single timestep, we just define a Step#0 entry in a dictionary (supports .get()) data["datasource"] = {"Step#0": distribution} # TODO: OPAL apparently doesn't save the charge per particle, but per macroparticle without frequency, # TODO: we have no way of telling what the species is! Add manual input. And maybe fix OPAL... -DW data["current"] = 0.0 return data return None def export_data(self, dataset, filename): datasource = dataset.get_datasource() nsteps = dataset.get_nsteps() npart = dataset.get_npart() if ".h5" in filename: if self._debug: print("Exporting data for program: {}...".format(self._program_name)) outfile = h5py.File(filename, "w") # The file dialog will make sure they want to overwrite -PW m = [dataset.get_ion().mass_mev() for _ in range(npart)] q = [dataset.get_ion().q() for _ in range(npart)] id_list = [i for i in range(npart)] for step in range(nsteps): step_str = "Step#{}".format(step) step_grp = outfile.create_group(step_str) for key in ["x", "y", "z", "px", "py", "pz"]: step_grp.create_dataset(key, data=datasource[step_str][key]) step_grp.create_dataset("id", data=id_list) step_grp.create_dataset("mass", data=m) step_grp.create_dataset("q", data=q) step_grp.attrs.__setitem__("ENERGY", dataset.get_ion().energy_mev()) outfile.attrs.__setitem__("OPAL_version", b"OPAL 1.9.0") outfile.close() if self._debug: print("Export successful!") return 0 elif ".dat" in filename: if self._debug: print("Exporting data for program: {}...".format(self._program_name)) if nsteps > 1: print("The .dat format only supports one step! Using the selected step...") step = dataset.get_current_step() else: step = 0 # The file dialog will make sure they want to overwrite -PW with open(filename, "w") as outfile: data = datasource["Step#{}".format(step)] outfile.write(str(npart) + "\n") for particle in range(npart): outfile.write(str(data["x"][particle]) + " " + str(data["px"][particle]) + " " + str(data["y"][particle]) + " " + str(data["py"][particle]) + " " + str(data["z"][particle]) + " " + str(data["pz"][particle]) + "\n") if self._debug: print("Export successful!") return 0 else: print("Something went wrong when exporting to: {}".format(self._program_name)) return 1
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,337
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/gui/generate_twiss.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'generate_twiss.ui' # # Created by: PyQt5 UI code generator 5.6 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Generate_Twiss(object): def setupUi(self, Generate_Twiss): Generate_Twiss.setObjectName("Generate_Twiss") Generate_Twiss.resize(452, 700) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(Generate_Twiss.sizePolicy().hasHeightForWidth()) Generate_Twiss.setSizePolicy(sizePolicy) self.centralwidget = QtWidgets.QWidget(Generate_Twiss) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.centralwidget.sizePolicy().hasHeightForWidth()) self.centralwidget.setSizePolicy(sizePolicy) self.centralwidget.setObjectName("centralwidget") self.verticalLayoutWidget = QtWidgets.QWidget(self.centralwidget) self.verticalLayoutWidget.setGeometry(QtCore.QRect(10, 10, 431, 663)) self.verticalLayoutWidget.setObjectName("verticalLayoutWidget") self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.verticalLayoutWidget) self.verticalLayout_3.setContentsMargins(0, 0, 0, 0) self.verticalLayout_3.setSpacing(0) self.verticalLayout_3.setObjectName("verticalLayout_3") self.label = QtWidgets.QLabel(self.verticalLayoutWidget) self.label.setMaximumSize(QtCore.QSize(500, 25)) self.label.setObjectName("label") self.verticalLayout_3.addWidget(self.label) self.gridLayout = QtWidgets.QGridLayout() self.gridLayout.setSizeConstraint(QtWidgets.QLayout.SetMaximumSize) self.gridLayout.setObjectName("gridLayout") self.bl_label_7 = QtWidgets.QLabel(self.verticalLayoutWidget) self.bl_label_7.setObjectName("bl_label_7") self.gridLayout.addWidget(self.bl_label_7, 1, 1, 1, 1, QtCore.Qt.AlignRight) self.length = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.length.setObjectName("length") self.gridLayout.addWidget(self.length, 5, 2, 1, 1, QtCore.Qt.AlignHCenter) self.tl_label = QtWidgets.QLabel(self.verticalLayoutWidget) self.tl_label.setObjectName("tl_label") self.gridLayout.addWidget(self.tl_label, 0, 1, 1, 1, QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) self.label_2 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_2.setObjectName("label_2") self.gridLayout.addWidget(self.label_2, 7, 1, 1, 1, QtCore.Qt.AlignLeft) self.ze = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.ze.setEnabled(False) self.ze.setObjectName("ze") self.gridLayout.addWidget(self.ze, 7, 2, 1, 1, QtCore.Qt.AlignHCenter) self.zpa = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.zpa.setEnabled(False) self.zpa.setObjectName("zpa") self.gridLayout.addWidget(self.zpa, 1, 2, 1, 1, QtCore.Qt.AlignHCenter) self.tr_label = QtWidgets.QLabel(self.verticalLayoutWidget) self.tr_label.setObjectName("tr_label") self.gridLayout.addWidget(self.tr_label, 3, 1, 1, 1, QtCore.Qt.AlignLeft) self.bl_label = QtWidgets.QLabel(self.verticalLayoutWidget) self.bl_label.setObjectName("bl_label") self.gridLayout.addWidget(self.bl_label, 5, 1, 1, 1, QtCore.Qt.AlignLeft) self.label_3 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_3.setObjectName("label_3") self.gridLayout.addWidget(self.label_3, 8, 1, 1, 1, QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) self.zpos = QtWidgets.QComboBox(self.verticalLayoutWidget) self.zpos.setMinimumSize(QtCore.QSize(142, 0)) self.zpos.setMaximumSize(QtCore.QSize(176, 16777215)) self.zpos.setObjectName("zpos") self.zpos.addItem("") self.zpos.addItem("") self.zpos.addItem("") self.zpos.addItem("") self.zpos.addItem("") self.zpos.addItem("") self.gridLayout.addWidget(self.zpos, 0, 2, 1, 1, QtCore.Qt.AlignHCenter) self.zmom = QtWidgets.QComboBox(self.verticalLayoutWidget) self.zmom.setEnabled(True) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.zmom.sizePolicy().hasHeightForWidth()) self.zmom.setSizePolicy(sizePolicy) self.zmom.setMinimumSize(QtCore.QSize(142, 0)) self.zmom.setMaximumSize(QtCore.QSize(176, 16777215)) self.zmom.setObjectName("zmom") self.zmom.addItem("") self.zmom.addItem("") self.zmom.addItem("") self.zmom.addItem("") self.gridLayout.addWidget(self.zmom, 3, 2, 1, 1, QtCore.Qt.AlignHCenter) self.bl_label_8 = QtWidgets.QLabel(self.verticalLayoutWidget) self.bl_label_8.setObjectName("bl_label_8") self.gridLayout.addWidget(self.bl_label_8, 2, 1, 1, 1, QtCore.Qt.AlignRight) self.zpb = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.zpb.setEnabled(False) self.zpb.setObjectName("zpb") self.gridLayout.addWidget(self.zpb, 2, 2, 1, 1, QtCore.Qt.AlignHCenter) spacerItem = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.gridLayout.addItem(spacerItem, 2, 0, 1, 1) self.gridLayout_3 = QtWidgets.QGridLayout() self.gridLayout_3.setObjectName("gridLayout_3") self.label_8 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_8.setObjectName("label_8") self.gridLayout_3.addWidget(self.label_8, 0, 0, 1, 1, QtCore.Qt.AlignHCenter) self.label_9 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_9.setObjectName("label_9") self.gridLayout_3.addWidget(self.label_9, 1, 0, 1, 1, QtCore.Qt.AlignHCenter) self.zpstddev = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.zpstddev.setEnabled(False) self.zpstddev.setMinimumSize(QtCore.QSize(100, 0)) self.zpstddev.setMaximumSize(QtCore.QSize(134, 134)) self.zpstddev.setObjectName("zpstddev") self.gridLayout_3.addWidget(self.zpstddev, 0, 1, 1, 1, QtCore.Qt.AlignRight) self.zmstddev = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.zmstddev.setEnabled(False) self.zmstddev.setMinimumSize(QtCore.QSize(100, 0)) self.zmstddev.setMaximumSize(QtCore.QSize(134, 16777215)) self.zmstddev.setObjectName("zmstddev") self.gridLayout_3.addWidget(self.zmstddev, 1, 1, 1, 1, QtCore.Qt.AlignRight) self.gridLayout.addLayout(self.gridLayout_3, 8, 2, 1, 1) self.verticalLayout_3.addLayout(self.gridLayout) spacerItem1 = QtWidgets.QSpacerItem(20, 5, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.verticalLayout_3.addItem(spacerItem1) self.label_4 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_4.setMaximumSize(QtCore.QSize(16777215, 25)) self.label_4.setObjectName("label_4") self.verticalLayout_3.addWidget(self.label_4) self.verticalLayout_2 = QtWidgets.QVBoxLayout() self.verticalLayout_2.setObjectName("verticalLayout_2") self.xydist = QtWidgets.QComboBox(self.verticalLayoutWidget) self.xydist.setMinimumSize(QtCore.QSize(142, 0)) self.xydist.setMaximumSize(QtCore.QSize(176, 16777215)) self.xydist.setObjectName("xydist") self.xydist.addItem("") self.xydist.addItem("") self.xydist.addItem("") self.xydist.addItem("") self.verticalLayout_2.addWidget(self.xydist, 0, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter) self.gridLayout_2 = QtWidgets.QGridLayout() self.gridLayout_2.setSizeConstraint(QtWidgets.QLayout.SetMinimumSize) self.gridLayout_2.setObjectName("gridLayout_2") self.tr_label_2 = QtWidgets.QLabel(self.verticalLayoutWidget) self.tr_label_2.setObjectName("tr_label_2") self.gridLayout_2.addWidget(self.tr_label_2, 5, 1, 1, 1, QtCore.Qt.AlignLeft) self.tl_label_2 = QtWidgets.QLabel(self.verticalLayoutWidget) self.tl_label_2.setObjectName("tl_label_2") self.gridLayout_2.addWidget(self.tl_label_2, 0, 1, 1, 1, QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) self.bl_label_3 = QtWidgets.QLabel(self.verticalLayoutWidget) self.bl_label_3.setObjectName("bl_label_3") self.gridLayout_2.addWidget(self.bl_label_3, 7, 1, 1, 1, QtCore.Qt.AlignRight) self.label_5 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_5.setObjectName("label_5") self.gridLayout_2.addWidget(self.label_5, 8, 1, 1, 1, QtCore.Qt.AlignRight) self.ya = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.ya.setEnabled(True) self.ya.setObjectName("ya") self.gridLayout_2.addWidget(self.ya, 6, 2, 1, 1, QtCore.Qt.AlignHCenter) self.bl_label_4 = QtWidgets.QLabel(self.verticalLayoutWidget) self.bl_label_4.setObjectName("bl_label_4") self.gridLayout_2.addWidget(self.bl_label_4, 6, 1, 1, 1, QtCore.Qt.AlignRight) self.label_6 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_6.setObjectName("label_6") self.gridLayout_2.addWidget(self.label_6, 9, 1, 1, 1, QtCore.Qt.AlignRight|QtCore.Qt.AlignVCenter) self.xe = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.xe.setEnabled(True) self.xe.setObjectName("xe") self.gridLayout_2.addWidget(self.xe, 3, 2, 1, 1, QtCore.Qt.AlignHCenter) self.bl_label_5 = QtWidgets.QLabel(self.verticalLayoutWidget) self.bl_label_5.setObjectName("bl_label_5") self.gridLayout_2.addWidget(self.bl_label_5, 1, 1, 1, 1, QtCore.Qt.AlignRight) self.label_7 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_7.setObjectName("label_7") self.gridLayout_2.addWidget(self.label_7, 3, 1, 1, 1, QtCore.Qt.AlignRight) self.xa = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.xa.setEnabled(True) self.xa.setObjectName("xa") self.gridLayout_2.addWidget(self.xa, 1, 2, 1, 1, QtCore.Qt.AlignHCenter) self.xb = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.xb.setEnabled(True) self.xb.setObjectName("xb") self.gridLayout_2.addWidget(self.xb, 2, 2, 1, 1, QtCore.Qt.AlignHCenter) self.bl_label_6 = QtWidgets.QLabel(self.verticalLayoutWidget) self.bl_label_6.setObjectName("bl_label_6") self.gridLayout_2.addWidget(self.bl_label_6, 2, 1, 1, 1, QtCore.Qt.AlignRight) self.yb = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.yb.setObjectName("yb") self.gridLayout_2.addWidget(self.yb, 7, 2, 1, 1, QtCore.Qt.AlignHCenter) spacerItem2 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.gridLayout_2.addItem(spacerItem2, 6, 0, 2, 1) self.ye = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.ye.setObjectName("ye") self.gridLayout_2.addWidget(self.ye, 8, 2, 1, 1, QtCore.Qt.AlignHCenter) self.label_12 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_12.setObjectName("label_12") self.gridLayout_2.addWidget(self.label_12, 4, 1, 1, 1, QtCore.Qt.AlignRight) self.gridLayout_4 = QtWidgets.QGridLayout() self.gridLayout_4.setObjectName("gridLayout_4") self.label_11 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_11.setObjectName("label_11") self.gridLayout_4.addWidget(self.label_11, 0, 0, 1, 1, QtCore.Qt.AlignHCenter) self.label_13 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_13.setObjectName("label_13") self.gridLayout_4.addWidget(self.label_13, 1, 0, 1, 1, QtCore.Qt.AlignHCenter) self.xstddev = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.xstddev.setEnabled(False) self.xstddev.setMinimumSize(QtCore.QSize(100, 0)) self.xstddev.setMaximumSize(QtCore.QSize(134, 16777215)) self.xstddev.setObjectName("xstddev") self.gridLayout_4.addWidget(self.xstddev, 0, 1, 1, 1, QtCore.Qt.AlignRight) self.xpstddev = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.xpstddev.setEnabled(False) self.xpstddev.setMinimumSize(QtCore.QSize(100, 0)) self.xpstddev.setMaximumSize(QtCore.QSize(134, 16777215)) self.xpstddev.setObjectName("xpstddev") self.gridLayout_4.addWidget(self.xpstddev, 1, 1, 1, 1, QtCore.Qt.AlignRight) self.gridLayout_2.addLayout(self.gridLayout_4, 4, 2, 1, 1) self.gridLayout_5 = QtWidgets.QGridLayout() self.gridLayout_5.setObjectName("gridLayout_5") self.label_14 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_14.setObjectName("label_14") self.gridLayout_5.addWidget(self.label_14, 0, 0, 1, 1, QtCore.Qt.AlignHCenter) self.label_15 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_15.setObjectName("label_15") self.gridLayout_5.addWidget(self.label_15, 1, 0, 1, 1, QtCore.Qt.AlignHCenter) self.ystddev = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.ystddev.setEnabled(False) self.ystddev.setMinimumSize(QtCore.QSize(100, 0)) self.ystddev.setMaximumSize(QtCore.QSize(134, 16777215)) self.ystddev.setObjectName("ystddev") self.gridLayout_5.addWidget(self.ystddev, 0, 1, 1, 1, QtCore.Qt.AlignRight) self.ypstddev = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.ypstddev.setEnabled(False) self.ypstddev.setMinimumSize(QtCore.QSize(100, 0)) self.ypstddev.setMaximumSize(QtCore.QSize(134, 16777215)) self.ypstddev.setObjectName("ypstddev") self.gridLayout_5.addWidget(self.ypstddev, 1, 1, 1, 1, QtCore.Qt.AlignRight) self.gridLayout_2.addLayout(self.gridLayout_5, 9, 2, 1, 1) self.checkBox = QtWidgets.QCheckBox(self.verticalLayoutWidget) self.checkBox.setObjectName("checkBox") self.gridLayout_2.addWidget(self.checkBox, 5, 2, 1, 1, QtCore.Qt.AlignHCenter) self.verticalLayout_2.addLayout(self.gridLayout_2) self.verticalLayout_3.addLayout(self.verticalLayout_2) self.buttonBox = QtWidgets.QDialogButtonBox(self.verticalLayoutWidget) self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) self.buttonBox.setObjectName("buttonBox") self.verticalLayout_3.addWidget(self.buttonBox) Generate_Twiss.setCentralWidget(self.centralwidget) self.retranslateUi(Generate_Twiss) QtCore.QMetaObject.connectSlotsByName(Generate_Twiss) def retranslateUi(self, Generate_Twiss): _translate = QtCore.QCoreApplication.translate Generate_Twiss.setWindowTitle(_translate("Generate_Twiss", "Generate Distribution: Enter Parameters")) self.label.setText(_translate("Generate_Twiss", "Longitudinal Distribution")) self.bl_label_7.setText(_translate("Generate_Twiss", "Alpha:")) self.tl_label.setText(_translate("Generate_Twiss", "Position:")) self.label_2.setText(_translate("Generate_Twiss", "Normalized Emittance (pi-mm-mrad):")) self.tr_label.setText(_translate("Generate_Twiss", "Momentum:")) self.bl_label.setText(_translate("Generate_Twiss", "Length (mm):")) self.label_3.setText(_translate("Generate_Twiss", "Standard Deviation:")) self.zpos.setItemText(0, _translate("Generate_Twiss", "Constant")) self.zpos.setItemText(1, _translate("Generate_Twiss", "Uniform along length")) self.zpos.setItemText(2, _translate("Generate_Twiss", "Uniform on ellipse")) self.zpos.setItemText(3, _translate("Generate_Twiss", "Gaussian on ellipse")) self.zpos.setItemText(4, _translate("Generate_Twiss", "Waterbag")) self.zpos.setItemText(5, _translate("Generate_Twiss", "Parabolic")) self.zmom.setItemText(0, _translate("Generate_Twiss", "Constant")) self.zmom.setItemText(1, _translate("Generate_Twiss", "Uniform along length")) self.zmom.setItemText(2, _translate("Generate_Twiss", "Uniform on ellipse")) self.zmom.setItemText(3, _translate("Generate_Twiss", "Gaussian on ellipse")) self.bl_label_8.setText(_translate("Generate_Twiss", "Beta (mm/mrad):")) self.label_8.setText(_translate("Generate_Twiss", "Position (mm):")) self.label_9.setText(_translate("Generate_Twiss", "Momentum (mrad):")) self.label_4.setText(_translate("Generate_Twiss", "Transverse Distribution")) self.xydist.setItemText(0, _translate("Generate_Twiss", "Uniform")) self.xydist.setItemText(1, _translate("Generate_Twiss", "Gaussian")) self.xydist.setItemText(2, _translate("Generate_Twiss", "Waterbag")) self.xydist.setItemText(3, _translate("Generate_Twiss", "Parabolic")) self.tr_label_2.setText(_translate("Generate_Twiss", "Y Phase Space Ellipse:")) self.tl_label_2.setText(_translate("Generate_Twiss", "X Phase Space Ellipse:")) self.bl_label_3.setText(_translate("Generate_Twiss", "Beta (mm/mrad):")) self.label_5.setText(_translate("Generate_Twiss", "Normalized Emittance (pi-mm-mrad):")) self.bl_label_4.setText(_translate("Generate_Twiss", "Alpha:")) self.label_6.setText(_translate("Generate_Twiss", "Standard Deviation:")) self.bl_label_5.setText(_translate("Generate_Twiss", "Alpha:")) self.label_7.setText(_translate("Generate_Twiss", "Normalized Emittance (pi-mm-mrad):")) self.bl_label_6.setText(_translate("Generate_Twiss", "Beta (mm/mrad):")) self.label_12.setText(_translate("Generate_Twiss", "Standard Deviation:")) self.label_11.setText(_translate("Generate_Twiss", "Radius (mm):")) self.label_13.setText(_translate("Generate_Twiss", "Angle (mrad):")) self.label_14.setText(_translate("Generate_Twiss", "Radius (mm):")) self.label_15.setText(_translate("Generate_Twiss", "Angle (mrad):")) self.checkBox.setText(_translate("Generate_Twiss", "Symmetric?"))
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,338
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'animateXY.ui' # # Created by: PyQt5 UI code generator 5.6 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Animate(object): def setupUi(self, Animate): Animate.setObjectName("Animate") Animate.resize(421, 202) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(Animate.sizePolicy().hasHeightForWidth()) Animate.setSizePolicy(sizePolicy) self.centralwidget = QtWidgets.QWidget(Animate) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.centralwidget.sizePolicy().hasHeightForWidth()) self.centralwidget.setSizePolicy(sizePolicy) self.centralwidget.setObjectName("centralwidget") self.verticalLayoutWidget = QtWidgets.QWidget(self.centralwidget) self.verticalLayoutWidget.setGeometry(QtCore.QRect(10, 10, 401, 181)) self.verticalLayoutWidget.setObjectName("verticalLayoutWidget") self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.verticalLayoutWidget) self.verticalLayout_3.setSizeConstraint(QtWidgets.QLayout.SetMinimumSize) self.verticalLayout_3.setContentsMargins(0, 0, 0, 0) self.verticalLayout_3.setSpacing(0) self.verticalLayout_3.setObjectName("verticalLayout_3") self.label = QtWidgets.QLabel(self.verticalLayoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth()) self.label.setSizePolicy(sizePolicy) self.label.setMaximumSize(QtCore.QSize(16777215, 200)) self.label.setObjectName("label") self.verticalLayout_3.addWidget(self.label) self.gridLayout = QtWidgets.QGridLayout() self.gridLayout.setObjectName("gridLayout") self.lim = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.lim.setObjectName("lim") self.gridLayout.addWidget(self.lim, 6, 1, 1, 1, QtCore.Qt.AlignHCenter) self.label_3 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_3.setObjectName("label_3") self.gridLayout.addWidget(self.label_3, 6, 0, 1, 1, QtCore.Qt.AlignHCenter) self.label_2 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_2.setMaximumSize(QtCore.QSize(16777215, 100)) self.label_2.setObjectName("label_2") self.gridLayout.addWidget(self.label_2, 1, 0, 1, 1, QtCore.Qt.AlignHCenter) self.verticalLayout = QtWidgets.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") self.radioButton = QtWidgets.QRadioButton(self.verticalLayoutWidget) self.radioButton.setObjectName("radioButton") self.verticalLayout.addWidget(self.radioButton) self.radioButton_2 = QtWidgets.QRadioButton(self.verticalLayoutWidget) self.radioButton_2.setObjectName("radioButton_2") self.verticalLayout.addWidget(self.radioButton_2) self.gridLayout.addLayout(self.verticalLayout, 1, 1, 1, 1) self.label_4 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_4.setObjectName("label_4") self.gridLayout.addWidget(self.label_4, 7, 0, 1, 1, QtCore.Qt.AlignHCenter) self.fps = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.fps.setObjectName("fps") self.gridLayout.addWidget(self.fps, 7, 1, 1, 1, QtCore.Qt.AlignHCenter) self.verticalLayout_3.addLayout(self.gridLayout) spacerItem = QtWidgets.QSpacerItem(20, 10, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.verticalLayout_3.addItem(spacerItem) self.buttonBox = QtWidgets.QDialogButtonBox(self.verticalLayoutWidget) self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) self.buttonBox.setObjectName("buttonBox") self.verticalLayout_3.addWidget(self.buttonBox) Animate.setCentralWidget(self.centralwidget) self.retranslateUi(Animate) QtCore.QMetaObject.connectSlotsByName(Animate) def retranslateUi(self, Animate): _translate = QtCore.QCoreApplication.translate Animate.setWindowTitle(_translate("Animate", "Choosing Animation")) self.label.setText(_translate("Animate", "<html><head/><body><p>Please enter your animation parameters.</p></body></html>")) self.label_3.setText(_translate("Animate", "Axes Limit (maximum x or y value, mm):")) self.label_2.setText(_translate("Animate", "Reference Frame:")) self.radioButton.setText(_translate("Animate", "Local")) self.radioButton_2.setText(_translate("Animate", "Global")) self.label_4.setText(_translate("Animate", "FPS:"))
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,339
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/drivers/abstractdriver.py
from abc import ABC, abstractmethod import os # TODO: WIP -PW class AbstractDriver(ABC): def __init__(self): self._program_name = None self._debug = None def get_program_name(self): return self._program_name @abstractmethod def import_data(self, *args, **kwargs): pass @abstractmethod def export_data(self, *args, **kwargs): pass # Source: http://fa.bianp.net/blog/2013/ # different-ways-to-get-memory-consumption-or-lessons-learned-from-memory_profiler/ @staticmethod def _memory_usage_ps(): import subprocess out = subprocess.Popen(['ps', 'v', '-p', str(os.getpid())], stdout=subprocess.PIPE).communicate()[0].split("\n") vsz_index = out[0].split().index("RSS") mem = float(out[1].split()[vsz_index]) / 1024.0 return mem # Source: https://stackoverflow.com/questions/2104080/how-to-check-file-size-in-python @staticmethod def _get_file_size(filename): return os.stat(filename).st_size def check_memory(self, filename): current_usage = self._memory_usage_ps() file_size = self._get_file_size(filename) if current_usage + file_size > 5e8: # 500 MB self.convert_to_h5() else: return 0 def convert_to_h5(self): pass def get_species(self): pass
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,340
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py
from ..arraywrapper import ArrayWrapper from ..abstractdriver import AbstractDriver from dans_pymodules import IonSpecies, clight import numpy as np class COMSOLDriver(AbstractDriver): def __init__(self, debug=False): super(COMSOLDriver, self).__init__() # TODO: Currently using: (TIME [s], X [m], Y [m], Z [m], VX [m/s], VY [m/s], VZ [m/s], E [MeV]) self._debug = debug self._program_name = "COMSOL" def get_program_name(self): return self._program_name def import_data(self, filename, species): # TODO: There is a lot of looping going on, the fewer instructions the better. -PW if self._debug: print("Importing data from program: {}".format(self._program_name)) try: datasource = {} data = {} with open(filename, 'rb') as infile: _n = 7 # Length of the n-tuples to unpack from the values list key_list = ["x", "y", "z", "px", "py", "pz", "E"] # Things we want to save firstline = infile.readline() lines = infile.readlines() raw_values = [float(item) for item in firstline.strip().split()] nsteps = int((len(raw_values) - 1) / _n) # Number of steps npart = len(lines) + 1 # Fill in the values for the first line now _id = int(raw_values.pop(0)) for step in range(nsteps): step_str = "Step#{}".format(step) datasource[step_str] = {} for key in key_list: datasource[step_str][key] = ArrayWrapper(np.zeros(npart)) values = raw_values[(step * _n):(_n + step * _n)] gamma = values[6] / species.mass_mev() + 1.0 beta = np.sqrt(1.0 - np.power(gamma, -2.0)) v_tot = np.sqrt(values[3] ** 2.0 + values[4] ** 2.0 + values[5] ** 2.0) values[0:3] = [r for r in values[0:3]] values[3:6] = [beta * gamma * v / v_tot for v in values[3:6]] # Convert velocity to momentum for idx, key in enumerate(key_list): datasource[step_str][key][_id - 1] = values[idx] # Now for every other line for line in lines: raw_values = [float(item) for item in line.strip().split()] # Data straight from the text file _id = int(raw_values.pop(0)) # Particle ID number for step in range(nsteps): step_str = "Step#{}".format(step) values = raw_values[(step * _n):(_n + step * _n)] gamma = values[6] / species.mass_mev() + 1.0 beta = np.sqrt(1.0 - gamma ** (-2.0)) v_tot = np.sqrt(values[3] ** 2.0 + values[4] ** 2.0 + values[5] ** 2.0) values[0:3] = [r for r in values[0:3]] values[3:6] = [beta * gamma * v / v_tot for v in values[3:6]] # Convert velocity to momentum for idx, key in enumerate(key_list): datasource[step_str][key][_id - 1] = values[idx] species.calculate_from_energy_mev(datasource["Step#0"]["E"][0]) data["datasource"] = datasource data["ion"] = species data["mass"] = species.a() data["charge"] = species.q() data["steps"] = len(datasource.keys()) data["current"] = None data["particles"] = len(datasource["Step#0"]["x"]) if self._debug: print("Found {} steps in the file.".format(data["steps"])) print("Found {} particles in the file.".format(data["particles"])) return data except Exception as e: print("Exception happened during particle loading with {} " "ImportExportDriver: {}".format(self._program_name, e)) return None def export_data(self, dataset, filename): if self._debug: print("Exporting data for program: {}".format(self._program_name)) datasource = dataset.get_datasource() ion = dataset.get_ion() nsteps = dataset.get_nsteps() npart = dataset.get_npart() with open(filename + ".txt", "w") as outfile: for i in range(npart): outstring = "{} ".format(i) for step in range(nsteps): _px = datasource.get("Step#{}".format(step)).get("px")[i] _py = datasource.get("Step#{}".format(step)).get("py")[i] _pz = datasource.get("Step#{}".format(step)).get("pz")[i] _vx, _vy, _vz = (clight * _px / np.sqrt(_px ** 2.0 + 1.0), clight * _py / np.sqrt(_py ** 2.0 + 1.0), clight * _pz / np.sqrt(_pz ** 2.0 + 1.0)) outstring += "{} {} {} {} {} {} {} ".format(datasource.get("Step#{}".format(step)).get("x")[i], datasource.get("Step#{}".format(step)).get("y")[i], datasource.get("Step#{}".format(step)).get("z")[i], _vx, _vy, _vz, ion.energy_mev()) outfile.write(outstring + "\n")
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,341
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py
from py_particle_processor_qt.drivers.IBSimuDriver.IBSimuDriver import *
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,342
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/tools/TranslateTool/__init__.py
from py_particle_processor_qt.tools.TranslateTool.TranslateTool import *
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,343
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor/drivers/TraceWinDriver/TraceWinDriver.py
# import h5py from dans_pymodules import IonSpecies import numpy as np class ArrayWrapper(object): def __init__(self, array_like): self._array = np.array(array_like) @property def value(self): return self._array class TraceWinDriver(object): def __init__(self, debug=False): self._debug = debug self._program_name = "TraceWin" def get_program_name(self): return self._program_name def import_data(self, filename): if self._debug: print("Importing data from program: {}".format(self._program_name)) try: with open(filename, 'rb') as infile: header1 = infile.readline() if self._debug: print(header1) data = {} npart, mass, energy, frequency, current, charge = \ [float(item) for item in infile.readline().strip().split()] header2 = infile.readline() if self._debug: print(header2) data["nsteps"] = 1 data["ion"] = IonSpecies('H2_1+', energy) # TODO: Actual ion species! -DW data["current"] = current # (A) data["npart"] = 0 _distribution = [] mydtype = [('x', float), ('xp', float), ('y', float), ('yp', float), ('z', float), ('zp', float), ('ph', float), ('t', float), ('e', float), ('l', float)] for line in infile.readlines(): values = line.strip().split() if values[-1] == "0": data["npart"] += 1 _distribution.append(tuple(values)) _distribution = np.array(_distribution, dtype=mydtype) gamma = _distribution['e'] / data['ion'].mass_mev() + 1.0 beta = np.sqrt(1.0 - gamma**(-2.0)) distribution = {'x': ArrayWrapper(_distribution['x'] * 0.001), 'px': ArrayWrapper(gamma * beta * np.sin(_distribution['xp'] * 0.001)), 'y': ArrayWrapper(_distribution['y'] * 0.001), 'py': ArrayWrapper(gamma * beta * np.sin(_distribution['yp'] * 0.001)), 'z': ArrayWrapper(_distribution['z'] * 0.001)} distribution['pz'] = ArrayWrapper(np.sqrt(beta**2.0 * gamma**2.0 - distribution['px'].value**2.0 - distribution['py'].value**2.0 )) # For a single timestep, we just define a Step#0 entry in a dictionary (supports .get()) data["datasource"] = {"Step#0": distribution} return data except Exception as e: print("Exception happened during particle loading with {} " "ImportExportDriver: {}".format(self._program_name, e)) return None def export_data(self, data): if self._debug: print("Exporting data for program: {}".format(self._program_name)) print("Export not yet implemented :(") return data
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,344
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py
from ..abstract_tool import AbstractTool from .translatetoolgui import Ui_TranslateToolGUI from PyQt5 import QtGui class TranslateTool(AbstractTool): def __init__(self, parent): super(TranslateTool, self).__init__(parent) self._name = "Translate Tool" self._parent = parent # --- Initialize the GUI --- # self._translateToolWindow = QtGui.QMainWindow() self._translateToolGUI = Ui_TranslateToolGUI() self._translateToolGUI.setupUi(self._translateToolWindow) self._translateToolGUI.apply_button.clicked.connect(self.callback_apply) self._translateToolGUI.cancel_button.clicked.connect(self.callback_cancel) self._translateToolGUI.x_trans.textChanged.connect(self.check_inputs) self._translateToolGUI.y_trans.textChanged.connect(self.check_inputs) self._translateToolGUI.z_trans.textChanged.connect(self.check_inputs) self._has_gui = True self._need_selection = True self._min_selections = 1 self._max_selections = None self._redraw_on_exit = True self._invalid_input = False # --- Required Functions --- # def run(self): # --- Calculate the positions to center the window --- # screen_size = self._parent.screen_size() _x = 0.5 * (screen_size.width() - self._translateToolWindow.width()) _y = 0.5 * (screen_size.height() - self._translateToolWindow.height()) # --- Show the GUI --- # self._translateToolWindow.show() self._translateToolWindow.move(_x, _y) # --- GUI-related Functions --- # def open_gui(self): self.run() def close_gui(self): self._translateToolWindow.close() def callback_apply(self): if self.apply() == 0: self._redraw() self.close_gui() def callback_cancel(self): self.close_gui() # --- Tool-related Functions --- # def check_inputs(self): inputs = [self._translateToolGUI.x_trans, self._translateToolGUI.y_trans, self._translateToolGUI.z_trans] self._invalid_input = False for input_item in inputs: translate_txt = input_item.text() if len(translate_txt) == 0: input_item.setStyleSheet("color: #000000") self._invalid_input = True try: float(translate_txt) # Try to convert the input to a float input_item.setStyleSheet("color: #000000") except ValueError: # Set the text color to red input_item.setStyleSheet("color: #FF0000") self._invalid_input = True return 0 def apply(self): dx, dy, dz = (self._translateToolGUI.x_trans.text(), self._translateToolGUI.y_trans.text(), self._translateToolGUI.z_trans.text()) self.check_inputs() if self._invalid_input: return 1 # Let's do this on a text basis instead of inferring from the indices translations = [float(item) for item in [dx, dy, dz]] for dataset in self._selections: datasource = dataset.get_datasource() nsteps, npart = dataset.get_nsteps(), dataset.get_npart() for step in range(nsteps): for part in range(npart): for i, direction in enumerate(["x", "y", "z"]): datasource["Step#{}".format(step)][direction][part] += translations[i] return 0
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,345
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py
from py_particle_processor_qt.drivers.FreeCADDriver.FreeCADDriver import *
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,346
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py
from ..abstract_tool import AbstractTool from .animateXYgui import Ui_Animate import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation from matplotlib.ticker import LinearLocator from PyQt5.QtWidgets import QFileDialog, QMainWindow # Note: This tool requires ffmpeg installation!!! class AnimateXY(AbstractTool): def __init__(self, parent): super(AnimateXY, self).__init__(parent) self._name = "Animate X-Y" self._parent = parent self._filename = "" self._settings = {} # --- Initialize the GUI --- # self._animateWindow = QMainWindow() self._animateGUI = Ui_Animate() self._animateGUI.setupUi(self._animateWindow) self._animateGUI.buttonBox.accepted.connect(self.callback_apply) self._animateGUI.buttonBox.rejected.connect(self._animateWindow.close) self._has_gui = True self._need_selection = True self._min_selections = 1 self._max_selections = 3 self._redraw_on_exit = False def apply_settings(self): self._settings["local"] = self._animateGUI.radioButton.isChecked() self._settings["global"] = self._animateGUI.radioButton_2.isChecked() self._settings["lim"] = float(self._animateGUI.lim.text()) self._settings["fps"] = int(self._animateGUI.fps.text()) @staticmethod def get_bunch_in_local_frame(datasource, step): x = np.array(datasource["Step#{}".format(step)]["x"]) y = np.array(datasource["Step#{}".format(step)]["y"]) x_mean = np.mean(x) y_mean = np.mean(y) px_mean = np.mean(np.array(datasource["Step#{}".format(step)]["px"])) py_mean = np.mean(np.array(datasource["Step#{}".format(step)]["py"])) theta = np.arccos(py_mean / np.sqrt(np.square(px_mean) + np.square(py_mean))) if px_mean < 0: theta = -theta # Center the beam x -= x_mean y -= y_mean # Rotate the beam and return temp_x = x temp_y = y return temp_x * np.cos(theta) - temp_y * np.sin(theta), temp_x * np.sin(theta) + temp_y * np.cos(theta) def callback_apply(self): self.apply_settings() self._animateWindow.close() self.run_animation() def run_animation(self): self._parent.send_status("Setting up animation...") plt.rc('font', **{'family': 'serif', 'serif': ['Computer Modern']}) plt.rc('text', usetex=True) plt.rc('grid', linestyle=':') animate_all = [] for dataset in self._selections: # dataset = self._selections[0] datasource = dataset.get_datasource() nsteps = dataset.get_nsteps() # TODO: Total hack, but I want to tag certain particles RIGHT NOW -DW # tag_step = 568 # tag_y_lim = 5.0 * 1.0e-3 # m # _x, _y = self.get_bunch_in_local_frame(datasource, tag_step) # tag_idx = np.where(_y >= tag_y_lim) # pids = np.array(datasource["Step#{}".format(tag_step)]["id"][tag_idx]) animate = {} for step in range(nsteps): animate["Step#{}".format(step)] = {"x": np.array(datasource["Step#{}".format(step)]["x"]), "y": np.array(datasource["Step#{}".format(step)]["y"]), "id": np.array(datasource["Step#{}".format(step)]["id"])} if self._settings["local"]: animate["Step#{}".format(step)]["x"], animate["Step#{}".format(step)]["y"] = \ self.get_bunch_in_local_frame(datasource, step) animate_all.append(animate) n_ds = len(animate_all) # Handle animations # fig = plt.figure() fig, ax = plt.subplots(1, n_ds) if n_ds == 1: ax = [ax] lines = [] j = 0 for _ax in ax: _ax.set_xlim(-self._settings["lim"], self._settings["lim"]) _ax.set_ylim(-self._settings["lim"], self._settings["lim"]) # ax = plt.axes(xlim=(-self._settings["lim"], self._settings["lim"]), # ylim=(-self._settings["lim"], self._settings["lim"])) line1, = _ax.plot([], [], 'ko', ms=0.1, alpha=0.8) # line2, = ax.plot([], [], 'ko', ms=0.1, alpha=0.8, color='red') # Tagging lines.append(line1) # plt.grid() _ax.grid() _ax.set_aspect('equal') if self._settings["local"]: _ax.set_xlabel("Horizontal (mm)") _ax.set_ylabel("Longitudinal (mm)") else: _ax.set_xlabel("X (mm)") _ax.set_ylabel("Y (mm)") _ax.set_title(r"{}: Step \#0".format(self._selections[j].get_name())) _ax.get_xaxis().set_major_locator(LinearLocator(numticks=13)) _ax.get_yaxis().set_major_locator(LinearLocator(numticks=13)) plt.tight_layout() j += 1 def init(): for _line in lines: _line.set_data([], []) # line2.set_data([], []) return lines, # line2, def update(i): k = 0 for _animate, _line in zip(animate_all, lines): # tags = np.isin(animate["Step#{}".format(i)]["id"], pids) tags = np.zeros(len(_animate["Step#{}".format(i)]["x"]), dtype=bool) # Regular Data x = 1000.0 * _animate["Step#{}".format(i)]["x"][np.invert(tags.astype(bool))] y = 1000.0 * _animate["Step#{}".format(i)]["y"][np.invert(tags.astype(bool))] # Tagged Data xt = 1000.0 * _animate["Step#{}".format(i)]["x"][tags.astype(bool)] yt = 1000.0 * _animate["Step#{}".format(i)]["y"][tags.astype(bool)] _line.set_data(x, y) # line2.set_data(xt, yt) ax[k].set_title(r"{}: Step \#{}".format(self._selections[k].get_name(), i)) k += 1 completed = int(100*(i/(nsteps-1))) self._parent.send_status("Animation progress: {}% complete".format(completed)) # return line1, line2, ax return lines, ax ani = animation.FuncAnimation(fig, update, frames=nsteps, init_func=init, repeat=False) # Save animation writer1 = animation.writers['ffmpeg'] writer2 = writer1(fps=self._settings["fps"], bitrate=1800) ani.save(self._filename[0]+".mp4", writer=writer2) ani._stop() self._parent.send_status("Animation saved successfully!") def run(self): # --- Calculate the positions to center the window --- # screen_size = self._parent.screen_size() _x = 0.5 * (screen_size.width() - self._animateWindow.width()) _y = 0.5 * (screen_size.height() - self._animateWindow.height()) # --- Show the GUI --- # self._animateWindow.show() self._animateWindow.move(_x, _y) def open_gui(self): options = QFileDialog.Options() options |= QFileDialog.DontUseNativeDialog self._filename = QFileDialog.getSaveFileName(caption="Saving animation...", options=options, filter="Video (*.mp4)") self.run()
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,347
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/gui/main_window.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'gui/main_window.ui' # # Created by: PyQt5 UI code generator 5.5.1 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(994, 654) MainWindow.setStyleSheet("background-color: rgb(65, 65, 65);\n" "alternate-background-color: rgb(130, 130, 130);\n" "color: rgb(255, 255, 255);") self.centralWidget = QtWidgets.QWidget(MainWindow) self.centralWidget.setObjectName("centralWidget") self.gridLayout = QtWidgets.QGridLayout(self.centralWidget) self.gridLayout.setContentsMargins(11, 2, 11, 11) self.gridLayout.setSpacing(6) self.gridLayout.setObjectName("gridLayout") self.splitter_2 = QtWidgets.QSplitter(self.centralWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.splitter_2.sizePolicy().hasHeightForWidth()) self.splitter_2.setSizePolicy(sizePolicy) self.splitter_2.setOrientation(QtCore.Qt.Horizontal) self.splitter_2.setObjectName("splitter_2") self.splitter = QtWidgets.QSplitter(self.splitter_2) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.splitter.sizePolicy().hasHeightForWidth()) self.splitter.setSizePolicy(sizePolicy) self.splitter.setLayoutDirection(QtCore.Qt.LeftToRight) self.splitter.setFrameShape(QtWidgets.QFrame.Box) self.splitter.setFrameShadow(QtWidgets.QFrame.Plain) self.splitter.setLineWidth(0) self.splitter.setOrientation(QtCore.Qt.Vertical) self.splitter.setHandleWidth(6) self.splitter.setObjectName("splitter") self.layoutWidget = QtWidgets.QWidget(self.splitter) self.layoutWidget.setObjectName("layoutWidget") self.verticalLayout = QtWidgets.QVBoxLayout(self.layoutWidget) self.verticalLayout.setSizeConstraint(QtWidgets.QLayout.SetMaximumSize) self.verticalLayout.setContentsMargins(11, 11, 11, 11) self.verticalLayout.setSpacing(0) self.verticalLayout.setObjectName("verticalLayout") self.datasets_label = QtWidgets.QLabel(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.datasets_label.sizePolicy().hasHeightForWidth()) self.datasets_label.setSizePolicy(sizePolicy) self.datasets_label.setObjectName("datasets_label") self.verticalLayout.addWidget(self.datasets_label, 0, QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) spacerItem = QtWidgets.QSpacerItem(20, 2, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.verticalLayout.addItem(spacerItem) self.treeWidget = QtWidgets.QTreeWidget(self.layoutWidget) self.treeWidget.setFocusPolicy(QtCore.Qt.NoFocus) self.treeWidget.setAlternatingRowColors(False) self.treeWidget.setSelectionMode(QtWidgets.QAbstractItemView.NoSelection) self.treeWidget.setTextElideMode(QtCore.Qt.ElideRight) self.treeWidget.setObjectName("treeWidget") self.treeWidget.header().setVisible(True) self.treeWidget.header().setCascadingSectionResizes(False) self.treeWidget.header().setDefaultSectionSize(80) self.treeWidget.header().setMinimumSectionSize(1) self.treeWidget.header().setStretchLastSection(True) self.verticalLayout.addWidget(self.treeWidget) self.layoutWidget1 = QtWidgets.QWidget(self.splitter) self.layoutWidget1.setObjectName("layoutWidget1") self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.layoutWidget1) self.verticalLayout_2.setSizeConstraint(QtWidgets.QLayout.SetMaximumSize) self.verticalLayout_2.setContentsMargins(11, 11, 11, 11) self.verticalLayout_2.setSpacing(0) self.verticalLayout_2.setObjectName("verticalLayout_2") self.horizontalLayout_3 = QtWidgets.QHBoxLayout() self.horizontalLayout_3.setContentsMargins(11, 11, 11, 11) self.horizontalLayout_3.setSpacing(6) self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.properties_label = QtWidgets.QLabel(self.layoutWidget1) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.properties_label.sizePolicy().hasHeightForWidth()) self.properties_label.setSizePolicy(sizePolicy) self.properties_label.setObjectName("properties_label") self.horizontalLayout_3.addWidget(self.properties_label) spacerItem1 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_3.addItem(spacerItem1) self.properties_combo = QtWidgets.QComboBox(self.layoutWidget1) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.properties_combo.sizePolicy().hasHeightForWidth()) self.properties_combo.setSizePolicy(sizePolicy) self.properties_combo.setObjectName("properties_combo") self.horizontalLayout_3.addWidget(self.properties_combo) self.verticalLayout_2.addLayout(self.horizontalLayout_3) spacerItem2 = QtWidgets.QSpacerItem(20, 2, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.verticalLayout_2.addItem(spacerItem2) self.properties_table = QtWidgets.QTableWidget(self.layoutWidget1) self.properties_table.setRowCount(1) self.properties_table.setColumnCount(2) self.properties_table.setObjectName("properties_table") self.properties_table.horizontalHeader().setStretchLastSection(True) self.properties_table.verticalHeader().setVisible(False) self.properties_table.verticalHeader().setStretchLastSection(False) self.verticalLayout_2.addWidget(self.properties_table) self.tabWidget = QtWidgets.QTabWidget(self.splitter_2) self.tabWidget.setObjectName("tabWidget") self.tab = QtWidgets.QWidget() self.tab.setStyleSheet("background-color: rgb(0, 0, 0);") self.tab.setObjectName("tab") self.gridLayout_4 = QtWidgets.QGridLayout(self.tab) self.gridLayout_4.setContentsMargins(11, 11, 11, 11) self.gridLayout_4.setSpacing(6) self.gridLayout_4.setObjectName("gridLayout_4") self.gridLayout_3 = QtWidgets.QGridLayout() self.gridLayout_3.setContentsMargins(0, 0, 0, 0) self.gridLayout_3.setSpacing(7) self.gridLayout_3.setObjectName("gridLayout_3") self.graphicsView_1 = PlotWidget(self.tab) self.graphicsView_1.setObjectName("graphicsView_1") self.gridLayout_3.addWidget(self.graphicsView_1, 0, 0, 1, 1) self.graphicsView_2 = PlotWidget(self.tab) self.graphicsView_2.setObjectName("graphicsView_2") self.gridLayout_3.addWidget(self.graphicsView_2, 0, 1, 1, 1) self.graphicsView_3 = PlotWidget(self.tab) self.graphicsView_3.setObjectName("graphicsView_3") self.gridLayout_3.addWidget(self.graphicsView_3, 1, 0, 1, 1) self.graphicsView_4 = GLViewWidget(self.tab) self.graphicsView_4.setObjectName("graphicsView_4") self.gridLayout_3.addWidget(self.graphicsView_4, 1, 1, 1, 1) self.gridLayout_4.addLayout(self.gridLayout_3, 0, 0, 1, 1) self.tabWidget.addTab(self.tab, "") self.gridLayout.addWidget(self.splitter_2, 0, 0, 1, 1) MainWindow.setCentralWidget(self.centralWidget) self.mainToolBar = QtWidgets.QToolBar(MainWindow) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.mainToolBar.sizePolicy().hasHeightForWidth()) self.mainToolBar.setSizePolicy(sizePolicy) self.mainToolBar.setIconSize(QtCore.QSize(16, 16)) self.mainToolBar.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon) self.mainToolBar.setObjectName("mainToolBar") MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.mainToolBar) self.statusBar = QtWidgets.QStatusBar(MainWindow) self.statusBar.setObjectName("statusBar") MainWindow.setStatusBar(self.statusBar) self.menuBar = QtWidgets.QMenuBar(MainWindow) self.menuBar.setGeometry(QtCore.QRect(0, 0, 994, 25)) self.menuBar.setDefaultUp(True) self.menuBar.setNativeMenuBar(True) self.menuBar.setObjectName("menuBar") self.menu_File = QtWidgets.QMenu(self.menuBar) self.menu_File.setFocusPolicy(QtCore.Qt.NoFocus) self.menu_File.setObjectName("menu_File") self.menuHelp = QtWidgets.QMenu(self.menuBar) self.menuHelp.setObjectName("menuHelp") self.menuTools = QtWidgets.QMenu(self.menuBar) self.menuTools.setObjectName("menuTools") self.menuPlot = QtWidgets.QMenu(self.menuBar) self.menuPlot.setObjectName("menuPlot") MainWindow.setMenuBar(self.menuBar) self.actionImport_New = QtWidgets.QAction(MainWindow) icon = QtGui.QIcon.fromTheme("document-new") self.actionImport_New.setIcon(icon) self.actionImport_New.setMenuRole(QtWidgets.QAction.TextHeuristicRole) self.actionImport_New.setPriority(QtWidgets.QAction.NormalPriority) self.actionImport_New.setObjectName("actionImport_New") self.actionImport_Add = QtWidgets.QAction(MainWindow) icon = QtGui.QIcon.fromTheme("add") self.actionImport_Add.setIcon(icon) self.actionImport_Add.setObjectName("actionImport_Add") self.actionExport_For = QtWidgets.QAction(MainWindow) icon = QtGui.QIcon.fromTheme("go-right") self.actionExport_For.setIcon(icon) self.actionExport_For.setObjectName("actionExport_For") self.actionQuit = QtWidgets.QAction(MainWindow) icon = QtGui.QIcon.fromTheme("exit") self.actionQuit.setIcon(icon) self.actionQuit.setObjectName("actionQuit") self.actionAbout = QtWidgets.QAction(MainWindow) self.actionAbout.setObjectName("actionAbout") self.actionRemove = QtWidgets.QAction(MainWindow) icon = QtGui.QIcon.fromTheme("remove") self.actionRemove.setIcon(icon) self.actionRemove.setObjectName("actionRemove") self.actionAnalyze = QtWidgets.QAction(MainWindow) icon = QtGui.QIcon.fromTheme("applications-accessories") self.actionAnalyze.setIcon(icon) self.actionAnalyze.setObjectName("actionAnalyze") self.actionNew_Plot = QtWidgets.QAction(MainWindow) self.actionNew_Plot.setObjectName("actionNew_Plot") self.actionModify_Plot = QtWidgets.QAction(MainWindow) self.actionModify_Plot.setObjectName("actionModify_Plot") self.actionRemove_Plot = QtWidgets.QAction(MainWindow) self.actionRemove_Plot.setObjectName("actionRemove_Plot") self.actionRedraw = QtWidgets.QAction(MainWindow) self.actionRedraw.setObjectName("actionRedraw") self.actionGenerate = QtWidgets.QAction(MainWindow) icon = QtGui.QIcon.fromTheme("emblem-photos") self.actionGenerate.setIcon(icon) self.actionGenerate.setObjectName("actionGenerate") self.mainToolBar.addAction(self.actionImport_New) self.mainToolBar.addAction(self.actionImport_Add) self.mainToolBar.addAction(self.actionRemove) self.mainToolBar.addAction(self.actionGenerate) self.mainToolBar.addAction(self.actionAnalyze) self.mainToolBar.addAction(self.actionExport_For) self.mainToolBar.addAction(self.actionQuit) self.menu_File.addAction(self.actionImport_New) self.menu_File.addAction(self.actionImport_Add) self.menu_File.addAction(self.actionRemove) self.menu_File.addAction(self.actionExport_For) self.menu_File.addSeparator() self.menu_File.addAction(self.actionQuit) self.menuHelp.addAction(self.actionAbout) self.menuPlot.addAction(self.actionRedraw) self.menuPlot.addSeparator() self.menuPlot.addAction(self.actionNew_Plot) self.menuPlot.addAction(self.actionModify_Plot) self.menuPlot.addAction(self.actionRemove_Plot) self.menuBar.addAction(self.menu_File.menuAction()) self.menuBar.addAction(self.menuPlot.menuAction()) self.menuBar.addAction(self.menuTools.menuAction()) self.menuBar.addAction(self.menuHelp.menuAction()) self.retranslateUi(MainWindow) self.tabWidget.setCurrentIndex(0) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "PyParticleProcessor")) self.datasets_label.setText(_translate("MainWindow", "Datasets")) self.treeWidget.headerItem().setText(0, _translate("MainWindow", "Selected")) self.treeWidget.headerItem().setText(1, _translate("MainWindow", "ID")) self.treeWidget.headerItem().setText(2, _translate("MainWindow", "Name")) self.properties_label.setText(_translate("MainWindow", "Properties:")) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("MainWindow", "Default Plots")) self.menu_File.setTitle(_translate("MainWindow", "File")) self.menuHelp.setTitle(_translate("MainWindow", "Help")) self.menuTools.setTitle(_translate("MainWindow", "Tools")) self.menuPlot.setTitle(_translate("MainWindow", "Plot")) self.actionImport_New.setText(_translate("MainWindow", "Import New...")) self.actionImport_New.setIconText(_translate("MainWindow", "New...")) self.actionImport_New.setToolTip(_translate("MainWindow", "New...")) self.actionImport_Add.setText(_translate("MainWindow", "Import Add...")) self.actionImport_Add.setIconText(_translate("MainWindow", "Add...")) self.actionImport_Add.setToolTip(_translate("MainWindow", "Add...")) self.actionExport_For.setText(_translate("MainWindow", "Export...")) self.actionExport_For.setIconText(_translate("MainWindow", "Export...")) self.actionExport_For.setToolTip(_translate("MainWindow", "Export...")) self.actionQuit.setText(_translate("MainWindow", "Quit")) self.actionAbout.setText(_translate("MainWindow", "About")) self.actionRemove.setText(_translate("MainWindow", "Remove")) self.actionRemove.setToolTip(_translate("MainWindow", "Remove")) self.actionAnalyze.setText(_translate("MainWindow", "Analyze")) self.actionAnalyze.setToolTip(_translate("MainWindow", "Analyze")) self.actionNew_Plot.setText(_translate("MainWindow", "New Plot...")) self.actionModify_Plot.setText(_translate("MainWindow", "Modify Current Plot...")) self.actionRemove_Plot.setText(_translate("MainWindow", "Remove Current Plot")) self.actionRedraw.setText(_translate("MainWindow", "Redraw")) self.actionGenerate.setText(_translate("MainWindow", "Generate...")) self.actionGenerate.setIconText(_translate("MainWindow", "Generate...")) self.actionGenerate.setToolTip(_translate("MainWindow", "Generate distribution")) from pyqtgraph import PlotWidget from pyqtgraph.opengl import GLViewWidget
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,348
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/dataset.py
# from dans_pymodules import IonSpecies # import h5py from dans_pymodules import * from scipy import constants as const from py_particle_processor_qt.drivers import * __author__ = "Daniel Winklehner, Philip Weigel" __doc__ = """A container that holds a single dataset with multiple time steps and multiple particles per time step. If the data is too large for memory, it is automatically transferred into a h5 file on disk to be operated on. """ # Initialize some global constants amu = const.value("atomic mass constant energy equivalent in MeV") echarge = const.value("elementary charge") clight = const.value("speed of light in vacuum") colors = MyColors() class ImportExportDriver(object): """ A thin wrapper around the drivers for importing and exporting particle data """ def __init__(self, driver_name=None, debug=False): self._driver_name = driver_name self._driver = None self._debug = debug self.load_driver() def load_driver(self): self._driver = driver_mapping[self._driver_name]['driver'](debug=self._debug) def get_driver_name(self): return self._driver_name def import_data(self, filename, species): return self._driver.import_data(filename, species=species) def export_data(self, dataset, filename): return self._driver.export_data(dataset=dataset, filename=filename) class Dataset(object): def __init__(self, indices, species, data=None, debug=False): self._draw = False self._selected = False self._datasource = data self._filename = None self._driver = None self._species = species self._debug = debug self._data = None self._color = (0.0, 0.0, 0.0) self._indices = indices self._orbit = None self._center_orbit = False self._properties = {"name": None, "ion": species, "multispecies": None, "current": None, "mass": None, "energy": None, "steps": 0, "curstep": None, "charge": None, "particles": None} self._native_properties = {} # This will only be true if the data was supplied via a generator # Temporary flags for development - PW if self._datasource is not None: self._is_generated = True else: self._is_generated = False def close(self): """ Close the dataset's source and return :return: """ if self._datasource is not None: try: self._datasource.close() except Exception as e: if self._debug: print("Exception occurred during closing of datafile: {}".format(e)) return 1 return 0 def color(self): return self._color def assign_color(self, i): self._color = colors[i] def export_to_file(self, filename, driver): if driver is not None: new_ied = ImportExportDriver(driver_name=driver, debug=self._debug) new_ied.export_data(dataset=self, filename=filename) elif driver is None: return 1 def get_property(self, key): return self._properties[key] def xy_orbit(self, triplet, center=False): # Uses a triplet of step numbers to find the center of an orbit self._center_orbit = center # Source: https://math.stackexchange.com/questions/213658/get-the-equation-of-a-circle-when-given-3-points _x, _y = [], [] for step in triplet: self.set_step_view(step) _x.append(float(self.get("x"))) _y.append(float(self.get("y"))) matrix = np.matrix([[_x[0] ** 2.0 + _y[0] ** 2.0, _x[0], _y[0], 1], [_x[1] ** 2.0 + _y[1] ** 2.0, _x[1], _y[1], 1], [_x[2] ** 2.0 + _y[2] ** 2.0, _x[2], _y[2], 1]]) m11 = np.linalg.det(np.delete(matrix, 0, 1)) m12 = np.linalg.det(np.delete(matrix, 1, 1)) m13 = np.linalg.det(np.delete(matrix, 2, 1)) m14 = np.linalg.det(np.delete(matrix, 3, 1)) xc = 0.5 * m12 / m11 yc = -0.5 * m13 / m11 r = np.sqrt(xc ** 2.0 + yc ** 2.0 + m14 / m11) self._orbit = (xc, yc, r) if self._debug: print(self._orbit) return 0 def orbit(self): return self._orbit def set_property(self, key, value): self._properties[key] = value return 0 def is_native_property(self, key): try: return self._native_properties[key] == self._properties[key] except KeyError: return False def properties(self): return self._properties def get_selected(self): return self._selected def set_selected(self, selected): self._selected = selected def get(self, key): """ Returns the values for the currently set step and given key ("id", "x", "y", "z", "r", "px", "py", "pz") :return: """ if key not in ["id", "x", "y", "z", "r", "px", "py", "pz", "pr"]: if self._debug: print("get(key): Key was not one of 'id', 'x', 'y', 'z', 'r', 'px', 'py', 'pz', 'pr'") return 1 if self._data is None: if self._debug: print("get(key): No data loaded yet!") return 1 if key is "r": data_x = self._data.get("x")[()] data_y = self._data.get("y")[()] if self._orbit is not None and self._center_orbit is True: data = np.sqrt((data_x - self._orbit[0]) ** 2.0 + (data_y - self._orbit[1]) ** 2.0) else: data = np.sqrt(data_x ** 2.0 + data_y ** 2.0) return data elif key is "pr": data_px = self._data.get("px")[()] data_py = self._data.get("py")[()] p = np.sqrt(data_px ** 2.0 + data_py ** 2.0) data_x = self._data.get("x")[()] data_y = self._data.get("y")[()] if self._orbit is not None and self._center_orbit is True: r = np.sqrt((data_x - self._orbit[0]) ** 2.0 + (data_y - self._orbit[1]) ** 2.0) else: r = np.sqrt(data_x ** 2.0 + data_y ** 2.0) factor = (data_px * data_x + data_py * data_y)/(abs(p) * abs(r)) data = p * factor return data else: data = self._data.get(key) return data[()] def get_particle(self, particle_id, get_color=False): particle = {"x": [], "y": [], "z": []} max_step = self.get_nsteps() color = None for step in range(max_step): self.set_step_view(step) for key in ["x", "y", "z"]: dat = self._data.get(key)[()][particle_id] if np.isnan(dat) or dat == 0.0: # TODO: A better way to figure out when a particle terminates if get_color == "step": factor = float(step) / float(max_step) color = ((1 - factor) * 255.0, factor * 255.0, 0.0) elif get_color == "random": color = colors[particle_id] return particle, color else: particle[key].append(dat) if get_color == "step": color = (0.0, 255.0, 0.0) elif get_color == "random": color = colors[particle_id] return particle, color # noinspection PyUnresolvedReferences def get_a(self): if isinstance(self._properties, IonSpecies): return self._properties["ion"].a() else: return None def get_current_step(self): return self._properties["curstep"] def get_datasource(self): return self._datasource def get_driver(self): return self._driver def get_filename(self): return self._filename def get_i(self): return self._properties["current"] def get_ion(self): return self._properties["ion"] def get_npart(self): return self._properties["particles"] def get_nsteps(self): return self._properties["steps"] def get_name(self): return self._properties["name"] # noinspection PyUnresolvedReferences def get_q(self): if isinstance(self._properties, IonSpecies): return self._properties["ion"].q() else: return None def indices(self): return self._indices def load_from_file(self, filename, name, driver=None): """ Load a dataset from file. If the file is h5 already, don't load into memory. Users can write their own drivers but they have to be compliant with the internal structure of datasets. :param filename: :param driver: :param name: dataset label :return: """ self._driver = driver self._filename = filename if driver is not None: new_ied = ImportExportDriver(driver_name=driver, debug=self._debug) _data = new_ied.import_data(self._filename, species=self._species) # if self._debug: # print("_data is {}".format(_data)) if _data is not None: self._datasource = _data["datasource"] for k in _data.keys(): self._properties[k] = _data[k] self._native_properties[k] = _data[k] # if isinstance(self._properties["ion"], IonSpecies): # self._properties["name"] = self._properties["ion"].name() # self._native_properties["name"] = self._properties["ion"].name() self._properties["name"] = name # self._native_properties["name"] = name self.set_step_view(0) # self.set_step_view(self._nsteps - 1) # print(self._datasource) return 0 return 1 def set_indices(self, parent_index, index): self._indices = (parent_index, index) # def set_name(self, name): # self._properties["name"] = name # self._native_properties["name"] = name def set_step_view(self, step): if step > self._properties["steps"]: if self._debug: print("set_step_view: Requested step {} exceeded max steps of {}!".format(step, self._properties["steps"])) return 1 self._properties["curstep"] = step self._data = self._datasource.get("Step#{}".format(step)) return 0
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,349
DanielWinklehner/py_particle_processor
refs/heads/master
/setup.py
from setuptools import setup, find_packages setup(name='py_particle_processor', version='0.1.3', description='a GUI application to generate or load and export particle data for beam physics', url='https://github.com/DanielWinklehner/py_particle_processor', author='Daniel Winklehner, Philip Weigel, Maria Yampolskaya', author_email='winklehn@mit.edu', license='MIT', packages=find_packages(), package_data={'': ['mainwindow.py', 'propertieswindow.py']}, include_package_data=True, zip_safe=False)
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,350
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/tools/OrbitTool/__init__.py
from py_particle_processor_qt.tools.OrbitTool.OrbitTool import *
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,351
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/generator.py
import numpy as np from PyQt5.QtWidgets import QMainWindow from py_particle_processor_qt.gui.generate_main import Ui_Generate_Main from py_particle_processor_qt.gui.generate_error import Ui_Generate_Error from py_particle_processor_qt.gui.generate_envelope import Ui_Generate_Envelope from py_particle_processor_qt.gui.generate_twiss import Ui_Generate_Twiss from dans_pymodules import IonSpecies from py_particle_processor_qt.drivers.TraceWinDriver import * class GenerateDistribution(object): """ A generator for creating various particle distributions. """ def __init__(self, numpart, species, energy, z_pos="Zero", z_mom="Zero", rz=0.0, ez=0.0, dev=[1.0, 1.0]): if isinstance(numpart, str): numpart = int(numpart) if isinstance(energy, str): energy = float(energy) if isinstance(rz, str): rz = float(rz) if ez == "": ez = 0.0 elif isinstance(ez, str): ez = float(ez) stddev = [0, 0] if dev[0] == "": stddev[0] = 1.0 else: stddev[0] = float(dev[0]) if dev[1] == "": stddev[1] = 1.0 else: stddev[1] = float(dev[1]) self._numpart = numpart # number of particles self._species = IonSpecies(species, energy) # instance of IonSpecies self._data = None # A variable to store the data dictionary rzp = self._species.v_m_per_s() * 1e-03 # Should this be 1e-03 (original) or 1e03? # Calculate longitudinal position distribution z = np.zeros(self._numpart) if z_pos == "Constant": # Constant z-position z = np.full(self._numpart, rz) elif z_pos == "Uniform along length": # Randomly distributed z-position z = (np.random.random(self._numpart) - 0.5) * rz elif z_pos == "Uniform on ellipse": # Uniformly randomly distributed within an ellipse beta = 2 * np.pi * np.random.random(self._numpart) a = np.ones(self._numpart) rand_phi = np.random.random(self._numpart) a_z = a * np.sqrt(rand_phi) z = a_z * rz * np.cos(beta) elif z_pos == "Gaussian on ellipse": # Gaussian distribution within an ellipse rand = np.random.normal(0, stddev[0], self._numpart) z = rand * rz * .5 elif z_pos == "Waterbag": # Waterbag distribution within an ellipse beta = 2 * np.pi * np.random.random(self._numpart) a = np.sqrt(1.5 * np.sqrt(np.random.random(self._numpart))) rand_phi = np.random.random(self._numpart) a_z = a * np.sqrt(rand_phi) z = a_z * rz * np.cos(beta) elif z_pos == "Parabolic": # Parabolic distribution within an ellipse beta = 2 * np.pi * np.random.random(self._numpart) alpha = np.arccos(1.0 - 2 * np.random.random(self._numpart)) a = np.sqrt(1.0 - 2 * np.cos((alpha - 2.0 * np.pi) / 3)) rand_phi = np.random.random(self._numpart) a_z = a * np.sqrt(rand_phi) z = a_z * rz * np.cos(beta) # Calculate longitudinal momentum distribution zp = np.zeros(self._numpart) if z_mom == "Constant": zp = np.full(self._numpart, rzp) elif z_mom == "Uniform along length": zp = (np.random.random(self._numpart) - 0.5) * rzp elif z_mom == "Uniform on ellipse": beta = 2 * np.pi * np.random.random(self._numpart) a = np.ones(self._numpart) rand_phi = np.random.random(self._numpart) a_z = a * np.sqrt(rand_phi) zp = a_z * (rzp * np.cos(beta) - (ez / rz) * np.sin(beta)) elif z_mom == "Gaussian on ellipse": z_rand = np.random.normal(0, stddev[0], self._numpart) zp_rand = np.random.normal(0, stddev[1], self._numpart) z_temp = z_rand * rz * .5 zp = (rzp / rz) * z_temp + (ez / (2 * rz)) * zp_rand self._z = z self._zp = np.abs(zp) # Functions for generating x-x', y-y' distributions and returning step 0 of the dataset def generate_uniform(self, r, rp, e_normalized): """ Generates a uniform distribution using the beam envelope's angle and radius. :param r: envelope radius in the shape of array [rx, ry] (mm) :param rp: envelope angle in the shape of array [rxp, ryp] (mrad) :param e_normalized: normalized rms emittance in the shape of array [ex, ey](pi-mm-mrad) :return: """ # Initialize parameters rx = float(r[0]) rxp = float(rp[0]) ry = float(r[1]) ryp = float(rp[1]) e_normalized = [float(e_normalized[0]), float(e_normalized[1])] ion = self._species emittance = np.array(e_normalized) / ion.gamma() / ion.beta() # mm-mrad - non-normalized, rms emittance # Initialize random variables a = np.ones(self._numpart) beta_x = 2 * np.pi * np.random.random(self._numpart) beta_y = 2 * np.pi * np.random.random(self._numpart) rand_phi = np.random.random(self._numpart) # Calculate distribution a_x = a * np.sqrt(rand_phi) a_y = a * np.sqrt(1 - rand_phi) x = a_x * rx * np.cos(beta_x) xp = a_x * (rxp * np.cos(beta_x) - (emittance[0] / rx) * np.sin(beta_x)) y = a_y * ry * np.cos(beta_y) yp = a_y * (ryp * np.cos(beta_y) - (emittance[1] / ry) * np.sin(beta_y)) # Correct for z-position x = x + self._z * xp y = y + self._z * yp data = {'Step#0': {'x': ArrayWrapper(0.001 * np.array(x)), 'px': ArrayWrapper(np.array(ion.gamma() * ion.beta() * xp)), 'y': ArrayWrapper(0.001 * np.array(y)), 'py': ArrayWrapper(np.array(ion.gamma() * ion.beta() * yp)), 'z': ArrayWrapper(0.001 * np.array(self._z)), 'pz': ArrayWrapper(np.array(ion.gamma() * ion.beta() * self._zp)), 'id': ArrayWrapper(range(self._numpart + 1)), 'attrs': 0}} return data def generate_gaussian(self, r, rp, e_normalized, stddev): """ Generates a Gaussian distribution using the beam envelope's angle and radius. :param r: envelope radius in the shape of array [rx, ry] (mm) :param rp: envelope angle in the shape of array [rxp, ryp] (mrad) :param e_normalized: normalized rms emittance in the shape of array [ex, ey](pi-mm-mrad) :param stddev: standard deviation for all parameters :return: """ # Initialize parameters r0x = float(r[0]) a0x = float(rp[0]) r0y = float(r[1]) a0y = float(rp[1]) stddev = [float(stddev[0]), float(stddev[1]), float(stddev[2]), float(stddev[3])] e_normalized = [float(e_normalized[0]), float(e_normalized[1])] ion = self._species emittance = np.array(e_normalized) / ion.gamma() / ion.beta() # mm-mrad - non-normalized, rms emittance # Initialize random variables x_rand = np.random.normal(0, stddev[0], self._numpart) y_rand = np.random.normal(0, stddev[2], self._numpart) xp_rand = np.random.normal(0, stddev[1], self._numpart) yp_rand = np.random.normal(0, stddev[3], self._numpart) # Calculate distribution x = x_rand * r0x * .5 xp = (a0x / r0x) * x + (emittance[0] / (2 * r0x)) * xp_rand y = y_rand * r0y * .5 yp = (a0y / r0y) * y + (emittance[1] / (2 * r0y)) * yp_rand # Correct for z-position x = x + self._z * xp y = y + self._z * yp data = {'Step#0': {'x': 0.001 * np.array(x), 'px': np.array(ion.gamma() * ion.beta() * xp), 'y': 0.001 * np.array(y), 'py': np.array(ion.gamma() * ion.beta() * yp), 'z': 0.001 * np.array(self._z), 'pz': np.array(ion.gamma() * ion.beta() * self._zp), 'id': range(self._numpart + 1), 'attrs': 0}} return data def generate_waterbag(self, r, rp, e_normalized): """ Generates a waterbag distribution using the beam envelope's angle and radius. :param r: envelope radius in the shape of array [rx, ry] (mm) :param rp: envelope angle in the shape of array [rxp, ryp] (mrad) :param e_normalized: normalized rms emittance in the shape of array [ex, ey](pi-mm-mrad) :return: """ # Initialize parameters rx = float(r[0]) rxp = float(rp[0]) ry = float(r[1]) ryp = float(rp[1]) e_normalized = [float(e_normalized[0]), float(e_normalized[1])] ion = self._species emittance = np.array(e_normalized) / ion.gamma() / ion.beta() # mm-mrad - non-normalized, rms emittance # Initialize random variables a = np.sqrt(1.5 * np.sqrt(np.random.random(self._numpart))) beta_x = 2 * np.pi * np.random.random(self._numpart) beta_y = 2 * np.pi * np.random.random(self._numpart) rand_phi = np.random.random(self._numpart) # Calculate distribution a_x = a * np.sqrt(rand_phi) a_y = a * np.sqrt(1 - rand_phi) x = a_x * rx * np.cos(beta_x) xp = a_x * (rxp * np.cos(beta_x) - (emittance[0] / rx) * np.sin(beta_x)) y = a_y * ry * np.cos(beta_y) yp = a_y * (ryp * np.cos(beta_y) - (emittance[1] / ry) * np.sin(beta_y)) # Correct for z-position x = x + self._z * xp y = y + self._z * yp data = {'Step#0': {'x': 0.001 * np.array(x), 'px': np.array(ion.gamma() * ion.beta() * xp), 'y': 0.001 * np.array(y), 'py': np.array(ion.gamma() * ion.beta() * yp), 'z': 0.001 * np.array(self._z), 'pz': np.array(ion.gamma() * ion.beta() * self._zp), 'id': range(self._numpart + 1), 'attrs': 0}} return data def generate_parabolic(self, r, rp, e_normalized): """ Generates a parabolic distribution using the beam envelope's angle and radius. :param r: envelope radius in the shape of array [rx, ry] (mm) :param rp: envelope angle in the shape of array [rxp, ryp] (mrad) :param e_normalized: normalized rms emittance in the shape of array [ex, ey](pi-mm-mrad) :return: """ # Initialize parameters rx = float(r[0]) rxp = float(rp[0]) ry = float(r[1]) ryp = float(rp[1]) e_normalized = [float(e_normalized[0]), float(e_normalized[1])] ion = self._species emittance = np.array(e_normalized) / ion.gamma() / ion.beta() # mm-mrad - non-normalized, rms emittance # Initialize random variables alpha = np.arccos(1.0 - 2 * np.random.random(self._numpart)) a = np.sqrt(1.0 - 2 * np.cos((alpha - 2.0 * np.pi) / 3)) beta_x = 2 * np.pi * np.random.random(self._numpart) beta_y = 2 * np.pi * np.random.random(self._numpart) rand_phi = np.random.random(self._numpart) # Calculate distribution a_x = a * np.sqrt(rand_phi) a_y = a * np.sqrt(1 - rand_phi) x = a_x * rx * np.cos(beta_x) xp = a_x * (rxp * np.cos(beta_x) - (emittance[0] / rx) * np.sin(beta_x)) y = a_y * ry * np.cos(beta_y) yp = a_y * (ryp * np.cos(beta_y) - (emittance[1] / ry) * np.sin(beta_y)) # Correct for z-position x = x + self._z * xp y = y + self._z * yp data = {'Step#0': {'x': 0.001 * np.array(x), 'px': np.array(ion.gamma() * ion.beta() * xp), 'y': 0.001 * np.array(y), 'py': np.array(ion.gamma() * ion.beta() * yp), 'z': 0.001 * np.array(self._z), 'pz': np.array(ion.gamma() * ion.beta() * self._zp), 'id': range(self._numpart + 1), 'attrs': 0}} return data # GUI Management class GeneratorGUI(object): def __init__(self, parent): self._parent = parent # Initialize GUI self._generate_main = QMainWindow() self._generate_mainGUI = Ui_Generate_Main() self._generate_mainGUI.setupUi(self._generate_main) self._generate_envelope = QMainWindow() self._generate_envelopeGUI = Ui_Generate_Envelope() self._generate_envelopeGUI.setupUi(self._generate_envelope) self._generate_twiss = QMainWindow() self._generate_twissGUI = Ui_Generate_Twiss() self._generate_twissGUI.setupUi(self._generate_twiss) self._generate_error = QMainWindow() self._generate_errorGUI = Ui_Generate_Error() self._generate_errorGUI.setupUi(self._generate_error) # Connect buttons and signals self._settings = {} self.apply_settings_main() self._generate_mainGUI.buttonBox.accepted.connect(self.callback_ok_main) self._generate_mainGUI.buttonBox.rejected.connect(self._generate_main.close) self._generate_envelopeGUI.buttonBox.accepted.connect(self.callback_ok_envelope) self._generate_envelopeGUI.buttonBox.rejected.connect(self._generate_envelope.close) self._generate_twissGUI.buttonBox.accepted.connect(self.callback_ok_twiss) self._generate_twissGUI.buttonBox.rejected.connect(self._generate_twiss.close) self._generate_errorGUI.buttonBox.accepted.connect(self._generate_error.close) self._generate_envelopeGUI.zpos.currentIndexChanged.connect(self.change_zpos_envelope) self._generate_envelopeGUI.zmom.currentIndexChanged.connect(self.change_zmom_envelope) self._generate_envelopeGUI.xydist.currentIndexChanged.connect(self.change_xy_envelope) self._generate_twissGUI.zpos.currentIndexChanged.connect(self.change_zpos_twiss) self._generate_twissGUI.zmom.currentIndexChanged.connect(self.change_zmom_twiss) self._generate_twissGUI.xydist.currentIndexChanged.connect(self.change_xy_twiss) self._generate_envelopeGUI.checkBox.stateChanged.connect(self.sym_envelope) self._generate_twissGUI.checkBox.stateChanged.connect(self.sym_twiss) self.data = {} def apply_settings_main(self): # Number of particles: self._settings["numpart"] = self._generate_mainGUI.lineEdit.text() # Species: info = str(self._generate_mainGUI.comboBox.currentText()) if info == "Proton": self._settings["species"] = "proton" elif info == "Electron": self._settings["species"] = "electron" elif info == "Dihydrogen cation": self._settings["species"] = "H2_1+" elif info == "Alpha particle": self._settings["species"] = "4He_2+" # Energy: self._settings["energy"] = self._generate_mainGUI.energy.text() # Input parameter type: self._settings["type"] = str(self._generate_mainGUI.comboBox_2.currentText()) def apply_settings_envelope(self): # Longitudinal parameters self._settings["zpos"] = str(self._generate_envelopeGUI.zpos.currentText()) self._settings["zmom"] = str(self._generate_envelopeGUI.zmom.currentText()) self._settings["ze"] = self._generate_envelopeGUI.ze.text() self._settings["zr"] = self._generate_envelopeGUI.zr.text() self._settings["zstddev"] = [self._generate_envelopeGUI.zpstddev.text(), self._generate_envelopeGUI.zmstddev.text()] # Transverse parameters self._settings["xydist"] = str(self._generate_envelopeGUI.xydist.currentText()) self._settings["eps"] = [self._generate_envelopeGUI.xe.text(), self._generate_envelopeGUI.ye.text()] self._settings["r"] = [self._generate_envelopeGUI.xr.text(), self._generate_envelopeGUI.yr.text()] self._settings["rp"] = [self._generate_envelopeGUI.xrp.text(), self._generate_envelopeGUI.yrp.text()] self._settings["xystddev"] = [self._generate_envelopeGUI.xstddev.text(), self._generate_envelopeGUI.xpstddev.text(), self._generate_envelopeGUI.ystddev.text(), self._generate_envelopeGUI.ypstddev.text()] def apply_settings_twiss(self): # Convert from Twiss to envelope zp_beta = self._generate_twissGUI.zpb.text() ze = self._generate_twissGUI.ze.text() if zp_beta != "" and ze != "": zp_beta = float(zp_beta) ze = float(ze) rz = np.sqrt(zp_beta * ze) else: rz = float(self._generate_twissGUI.length.text()) xa = float(self._generate_twissGUI.xa.text()) xb = float(self._generate_twissGUI.xb.text()) xe = float(self._generate_twissGUI.xe.text()) rx = np.sqrt(xb * xe) rxp = -xa * rx / xb ya = float(self._generate_twissGUI.ya.text()) yb = float(self._generate_twissGUI.yb.text()) ye = float(self._generate_twissGUI.ye.text()) ry = np.sqrt(yb * ye) ryp = -ya * ry / yb # Longitudinal parameters self._settings["zpos"] = str(self._generate_twissGUI.zpos.currentText()) self._settings["zmom"] = str(self._generate_twissGUI.zmom.currentText()) self._settings["ze"] = ze self._settings["zr"] = rz self._settings["zstddev"] = [self._generate_envelopeGUI.zpstddev.text(), self._generate_envelopeGUI.zmstddev.text()] # Transverse parameters self._settings["xydist"] = str(self._generate_twissGUI.xydist.currentText()) self._settings["eps"] = [xe, ye] self._settings["r"] = [rx, ry] self._settings["rp"] = [rxp, ryp] if self._generate_twissGUI.xydist.currentText() == "Gaussian": self._settings["xystddev"] = [self._generate_twissGUI.xstddev.text(), self._generate_twissGUI.xpstddev.text(), self._generate_twissGUI.ystddev.text(), self._generate_twissGUI.ypstddev.text()] def callback_ok_main(self): self.apply_settings_main() if self._settings["numpart"] == "" or self._settings["energy"] == "": self.run_error() else: # Open either Twiss or Envelope menu if self._settings["type"] == "Envelope": self.run_envelope() elif self._settings["type"] == "Twiss": self.run_twiss() self._generate_main.close() def callback_ok_envelope(self): self.apply_settings_envelope() if self._settings["eps"] == ["", ""] or self._settings["r"] == ["", ""] or self._settings["rp"] == ["", ""]: self.run_error() else: if self._settings["zpos"] == "Constant" and self._settings["zmom"] == "Constant": g = GenerateDistribution(self._settings["numpart"], self._settings["species"], self._settings["energy"], self._settings["zpos"], self._settings["zmom"], self._settings["zr"]) elif self._settings["zpos"] == "Gaussian on ellipse" or self._settings["zmom"] == "Gaussian on ellipse": g = GenerateDistribution(self._settings["numpart"], self._settings["species"], self._settings["energy"], self._settings["zpos"], self._settings["zmom"], self._settings["zr"], self._settings["ze"], self._settings["zstddev"]) else: g = GenerateDistribution(self._settings["numpart"], self._settings["species"], self._settings["energy"], self._settings["zpos"], self._settings["zmom"], self._settings["zr"], self._settings["ze"]) if self._settings["xydist"] == "Uniform": self.data = g.generate_uniform(self._settings["r"], self._settings["rp"], self._settings["eps"]) elif self._settings["xydist"] == "Gaussian": self.data = g.generate_gaussian(self._settings["r"], self._settings["rp"], self._settings["eps"], self._settings["xystddev"]) elif self._settings["xydist"] == "Waterbag": self.data = g.generate_waterbag(self._settings["r"], self._settings["rp"], self._settings["eps"]) elif self._settings["xydist"] == "Parabolic": self.data = g.generate_parabolic(self._settings["r"], self._settings["rp"], self._settings["eps"]) self._generate_envelope.close() self._parent.add_generated_dataset(data=self.data, settings=self._settings) def callback_ok_twiss(self): self.apply_settings_twiss() if self._settings["eps"] == ["", ""] or self._settings["r"] == ["", ""] or self._settings["rp"] == ["", ""]: self.run_error() else: if self._settings["zpos"] == "Constant" and self._settings["zmom"] == "Constant": g = GenerateDistribution(self._settings["numpart"], self._settings["species"], self._settings["energy"], self._settings["zpos"], self._settings["zmom"], self._settings["zr"]) elif self._settings["zpos"] == "Gaussian on ellipse" or self._settings["zmom"] == "Gaussian on ellipse": g = GenerateDistribution(self._settings["numpart"], self._settings["species"], self._settings["energy"], self._settings["zpos"], self._settings["zmom"], self._settings["zr"], self._settings["ze"], self._settings["zstddev"]) else: g = GenerateDistribution(self._settings["numpart"], self._settings["species"], self._settings["energy"], self._settings["zpos"], self._settings["zmom"], self._settings["zr"], self._settings["ze"]) if self._settings["xydist"] == "Uniform": self.data = g.generate_uniform(self._settings["r"], self._settings["rp"], self._settings["eps"]) elif self._settings["xydist"] == "Gaussian": self.data = g.generate_gaussian(self._settings["r"], self._settings["rp"], self._settings["eps"], self._settings["xystddev"]) elif self._settings["xydist"] == "Waterbag": self.data = g.generate_waterbag(self._settings["r"], self._settings["rp"], self._settings["eps"]) elif self._settings["xydist"] == "Parabolic": self.data = g.generate_parabolic(self._settings["r"], self._settings["rp"], self._settings["eps"]) self._generate_twiss.close() self._parent.add_generated_dataset(data=self.data, settings=self._settings) def change_zpos_envelope(self): info = str(self._generate_envelopeGUI.zpos.currentText()) if info != "Constant" and info != "Uniform along length": self._generate_envelopeGUI.ze.setEnabled(True) if info == "Gaussian on ellipse": self._generate_envelopeGUI.zpstddev.setEnabled(True) else: self._generate_envelopeGUI.zpstddev.setDisabled(True) else: self._generate_envelopeGUI.ze.setDisabled(True) self._generate_envelopeGUI.zpstddev.setDisabled(True) def change_zmom_envelope(self): info = str(self._generate_envelopeGUI.zmom.currentText()) if info != "Constant" and info != "Uniform along length": self._generate_envelopeGUI.ze.setEnabled(True) if info == "Gaussian on ellipse": self._generate_envelopeGUI.zmstddev.setEnabled(True) else: self._generate_envelopeGUI.zmstddev.setDisabled(True) else: self._generate_envelopeGUI.ze.setDisabled(True) self._generate_envelopeGUI.zmstddev.setDisabled(True) def change_xy_envelope(self): info = str(self._generate_envelopeGUI.xydist.currentText()) if info == "Gaussian": self._generate_envelopeGUI.xstddev.setEnabled(True) self._generate_envelopeGUI.xpstddev.setEnabled(True) self._generate_envelopeGUI.ystddev.setEnabled(True) self._generate_envelopeGUI.ypstddev.setEnabled(True) else: self._generate_envelopeGUI.xstddev.setDisabled(True) self._generate_envelopeGUI.xpstddev.setDisabled(True) self._generate_envelopeGUI.ystddev.setDisabled(True) self._generate_envelopeGUI.ypstddev.setDisabled(True) def change_zpos_twiss(self): info = str(self._generate_twissGUI.zpos.currentText()) if info != "Constant" and info != "Uniform along length": self._generate_twissGUI.ze.setEnabled(True) self._generate_twissGUI.zpa.setEnabled(True) self._generate_twissGUI.zpb.setEnabled(True) self._generate_twissGUI.length.setDisabled(True) if info == "Gaussian on ellipse": self._generate_twissGUI.zpstddev.setEnabled(True) else: self._generate_twissGUI.zpstddev.setDisabled(True) else: self._generate_twissGUI.ze.setDisabled(True) self._generate_twissGUI.zpa.setDisabled(True) self._generate_twissGUI.zpb.setDisabled(True) self._generate_twissGUI.length.setEnabled(True) self._generate_twissGUI.zpstddev.setDisabled(True) def change_zmom_twiss(self): info = str(self._generate_twissGUI.zmom.currentText()) if info != "Constant" and info != "Uniform along length": self._generate_twissGUI.ze.setEnabled(True) if info == "Gaussian on ellipse": self._generate_twissGUI.zmstddev.setEnabled(True) else: self._generate_twissGUI.zmstddev.setDisabled(True) else: self._generate_twissGUI.ze.setDisabled(True) self._generate_twissGUI.zmstddev.setDisabled(True) def change_xy_twiss(self): info = str(self._generate_twissGUI.xydist.currentText()) if info == "Gaussian": self._generate_twissGUI.xstddev.setEnabled(True) self._generate_twissGUI.xpstddev.setEnabled(True) self._generate_twissGUI.ystddev.setEnabled(True) self._generate_twissGUI.ypstddev.setEnabled(True) else: self._generate_twissGUI.xstddev.setDisabled(True) self._generate_twissGUI.xpstddev.setDisabled(True) self._generate_twissGUI.ystddev.setDisabled(True) self._generate_twissGUI.ypstddev.setDisabled(True) def sym_envelope(self): info = self._generate_envelopeGUI.checkBox.isChecked() if info: self.apply_settings_envelope() self._generate_envelopeGUI.yr.setText(self._settings["r"][0]) self._generate_envelopeGUI.yrp.setText(self._settings["rp"][0]) self._generate_envelopeGUI.ye.setText(self._settings["eps"][0]) else: self._generate_envelopeGUI.yr.setText("") self._generate_envelopeGUI.yrp.setText("") self._generate_envelopeGUI.ye.setText("") def sym_twiss(self): info = self._generate_twissGUI.checkBox.isChecked() if info: xa = self._generate_twissGUI.xa.text() self._generate_twissGUI.ya.setText(xa) xb = self._generate_twissGUI.xb.text() self._generate_twissGUI.yb.setText(xb) xe = self._generate_twissGUI.xe.text() self._generate_twissGUI.ye.setText(xe) else: self._generate_twissGUI.ya.setText("") self._generate_twissGUI.yb.setText("") self._generate_twissGUI.ye.setText("") def run(self): # --- Calculate the positions to center the window --- # screen_size = self._parent.screen_size() _x = 0.5 * (screen_size.width() - self._generate_main.width()) _y = 0.5 * (screen_size.height() - self._generate_main.height()) # --- Show the GUI --- # self._generate_main.show() self._generate_main.move(_x, _y) def run_error(self): # --- Calculate the positions to center the window --- # screen_size = self._parent.screen_size() _x = 0.5 * (screen_size.width() - self._generate_error.width()) _y = 0.5 * (screen_size.height() - self._generate_error.height()) # --- Show the GUI --- # self._generate_error.show() self._generate_error.move(_x, _y) def run_envelope(self): # --- Calculate the positions to center the window --- # screen_size = self._parent.screen_size() _x = 0.5 * (screen_size.width() - self._generate_envelope.width()) _y = 0.5 * (screen_size.height() - self._generate_envelope.height()) # --- Show the GUI --- # self._generate_envelope.show() self._generate_envelope.move(_x, _y) def run_twiss(self): # --- Calculate the positions to center the window --- # screen_size = self._parent.screen_size() _x = 0.5 * (screen_size.width() - self._generate_twiss.width()) _y = 0.5 * (screen_size.height() - self._generate_twiss.height()) # --- Show the GUI --- # self._generate_twiss.show() self._generate_twiss.move(_x, _y)
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,352
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/drivers/OPALDriver/__init__.py
from py_particle_processor_qt.drivers.OPALDriver.OPALDriver import *
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,353
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/tools/BeamChar/BeamChar.py
from ..abstract_tool import AbstractTool from PyQt5.QtWidgets import QFileDialog, QMainWindow from .beamchargui import Ui_BeamChar from matplotlib.ticker import LinearLocator, LogLocator from matplotlib.ticker import FormatStrFormatter import matplotlib.pyplot as plt import numpy as np import os import re """" A tool for plotting beam characteristics. """ class BeamChar(AbstractTool): def __init__(self, parent): super(BeamChar, self).__init__(parent) self._name = "Beam Characteristics" self._parent = parent self._filename = "" self._settings = {} # --- Initialize the GUI --- # self._beamCharWindow = QMainWindow() self._beamCharGUI = Ui_BeamChar() self._beamCharGUI.setupUi(self._beamCharWindow) self._beamCharGUI.buttonBox.accepted.connect(self.callback_apply) self._beamCharGUI.buttonBox.rejected.connect(self._beamCharWindow.close) self._has_gui = True self._need_selection = True self._min_selections = 1 self._max_selections = None self._redraw_on_exit = False def apply_settings(self): self._settings["rms"] = self._beamCharGUI.rms.isChecked() self._settings["halo"] = self._beamCharGUI.halo.isChecked() self._settings["centroid"] = self._beamCharGUI.centroid.isChecked() self._settings["turnsep"] = self._beamCharGUI.turnsep.isChecked() self._settings["energyHist"] = self._beamCharGUI.ehist.isChecked() self._settings["intensity"] = self._beamCharGUI.intens.isChecked() self._settings["xz"] = self._beamCharGUI.xz.isChecked() def callback_apply(self): self.apply_settings() self._beamCharWindow.close() self._parent.send_status("Creating plot(s)...") plots = {} num = 0 largepos = 1.0e36 for dataset in self._selections: corrected = {} name = dataset.get_name() nsteps, npart = dataset.get_nsteps(), dataset.get_npart() plot_data = {"name": name, "xRMS": np.array([]), "yRMS": np.array([]), "zRMS": np.array([]), "xHalo": np.array([]), "yHalo": np.array([]), "zHalo": np.array([]), "xCentroid": np.ones(nsteps) * largepos, "yCentroid": np.ones(nsteps) * largepos, "turnSep": np.array([]), "R": np.array([]), "energy": np.array([]), "power": np.array([]), "coords": []} azimuths = np.ones(nsteps) * largepos r_temps = np.ones(nsteps) * largepos datasource = dataset.get_datasource() index = 0 save_r = True r_tsep = [] # --- Try to find the .o file corresponding to the dataset # Hardcoded defaults q_macro = 1.353 * 1.0e-15 # fC --> C (1e5 particles @ 6.65 mA and f_cyclo below) f_cyclo = 49.16 * 1.0e6 # MHz --> Hz duty_factor = 0.9 # assumed IsoDAR has 90% duty factor self._parent.send_status("Attempting to read frequency and macro-charge from .o file...") _fn = dataset.get_filename() path = os.path.split(_fn)[0] # Let's be lazy and find the .o file automatically using regex template = re.compile('[.]o[0-9]{8}') _fns = [f for f in os.listdir(path) if os.path.isfile(os.path.join(path, f)) and template.search(f)] if len(_fns) > 0: _fn = _fns[0] with open(os.path.join(path, _fn), 'r') as infile: lines = infile.readlines() have_charge = False have_freq = False for line in lines: if "Qi" in line: _, _, _, _, _, _, _, _, qi, unit = line.strip().split() q_macro = float(qi) * 1.0e-15 # fC --> C # TODO Check for unit, if exception is thrown, need to allow for different units -DW assert unit == "[fC]", "Expected units of fC, got {}. Aborting!".format(unit) have_charge = True if "FREQUENCY" in line: _, _, _, freq, unit = line.strip().split() f_cyclo = float(freq) * 1.0e6 # MHz --> Hz # TODO Check for unit, if exception is thrown, need to allow for different units -DW assert unit == "MHz", "Expected units of MHz, got {}. Aborting!".format(unit) have_freq = True if have_charge and have_freq: break assert have_charge and have_freq, "Found .o file, but couldn't determine frequency and/or macrocharge!" self._parent.send_status("Found f = {:.4f} MHz and Qi = {:.4f} fC in file {}".format(f_cyclo * 1e-6, q_macro * 1e15, _fn)) print("Found f = {:.4f} MHz and Qi = {:.4f} fC in file {}".format(f_cyclo * 1e-6, q_macro * 1e15, _fn)) else: self._parent.send_status("Couldn't find .o file in dataset folder! Falling back to hardcoded values.") print("Couldn't find .o file in dataset folder! Falling back to hardcoded values.") spt = 1 for step in range(int(nsteps / spt)): step *= spt m_amu = 2.01510 # Rest mass of individual H2+, in amu m_mev = 1876.9729554 # Rest mass of individual H2+, in MeV/c^2 if self._settings["rms"] or self._settings["halo"]: px_val = np.array(datasource["Step#{}".format(step)]["px"]) py_val = np.array(datasource["Step#{}".format(step)]["py"]) pz_val = np.array(datasource["Step#{}".format(step)]["pz"]) betagamma = np.sqrt(np.square(px_val) + np.square(py_val) + np.square(pz_val)) energy = np.mean((np.sqrt(np.square(betagamma * m_mev) + np.square(m_mev)) - m_mev) / m_amu) plot_data["energy"] = np.append(plot_data["energy"], energy) if nsteps > 1: completed = int(100*(step/(nsteps-1))) self._parent.send_status("Plotting progress: {}% complete".format(completed)) corrected["Step#{}".format(step)] = {} x_val = np.array(datasource["Step#{}".format(step)]["x"]) y_val = np.array(datasource["Step#{}".format(step)]["y"]) z_val = np.array(datasource["Step#{}".format(step)]["z"]) if self._settings["xz"]: r = np.sqrt(np.square(x_val) + np.square(y_val)) plot_data["coords"] = np.append(plot_data["coords"], z_val) plot_data["R"] = np.append(plot_data["R"], r) px_mean = np.mean(np.array(datasource["Step#{}".format(step)]["px"])) py_mean = np.mean(np.array(datasource["Step#{}".format(step)]["py"])) theta = np.arccos(py_mean/np.linalg.norm([px_mean, py_mean])) if px_mean < 0: theta = -theta # Center the beam corrected["Step#{}".format(step)]["x"] = x_val - np.mean(x_val) corrected["Step#{}".format(step)]["y"] = y_val - np.mean(y_val) corrected["Step#{}".format(step)]["z"] = z_val - np.mean(z_val) # Rotate the beam temp_x = corrected["Step#{}".format(step)]["x"] temp_y = corrected["Step#{}".format(step)]["y"] corrected["Step#{}".format(step)]["x"] = temp_x*np.cos(theta) - temp_y*np.sin(theta) corrected["Step#{}".format(step)]["y"] = temp_x*np.sin(theta) + temp_y*np.cos(theta) # Calculate RMS if self._settings["rms"]: plot_data["xRMS"] = np.append(plot_data["xRMS"], 1000.0 * self.rms(corrected["Step#{}".format(step)]["x"])) plot_data["yRMS"] = np.append(plot_data["yRMS"], 1000.0 * self.rms(corrected["Step#{}".format(step)]["y"])) plot_data["zRMS"] = np.append(plot_data["zRMS"], 1000.0 * self.rms(corrected["Step#{}".format(step)]["z"])) # Calculate halo parameter if self._settings["halo"]: plot_data["xHalo"] = np.append(plot_data["xHalo"], self.halo(corrected["Step#{}".format(step)]["x"])) plot_data["yHalo"] = np.append(plot_data["yHalo"], self.halo(corrected["Step#{}".format(step)]["y"])) plot_data["zHalo"] = np.append(plot_data["zHalo"], self.halo(corrected["Step#{}".format(step)]["z"])) # Calculate energy if self._settings["energyHist"] or self._settings["intensity"]: m_amu = 2.01510 # Rest mass of individual H2+, in amu m_mev = 1876.9729554 # Rest mass of individual H2+, in MeV/c^2 px_val = np.array(datasource["Step#{}".format(step)]["px"]) py_val = np.array(datasource["Step#{}".format(step)]["py"]) pz_val = np.array(datasource["Step#{}".format(step)]["pz"]) betagamma = np.sqrt(np.square(px_val) + np.square(py_val) + np.square(pz_val)) energy = (np.sqrt(np.square(betagamma * m_mev) + np.square(m_mev)) - m_mev) / m_amu # MeV/amu plot_data["energy"] = np.append(plot_data["energy"], energy) if self._settings["intensity"]: # Power deposition of a single h2+ particle (need to use full energy here!) (W) power = q_macro * f_cyclo * energy * 1e6 * m_amu * duty_factor plot_data["power"] = np.append(plot_data["power"], power) # Radii (m) r = np.sqrt(np.square(x_val) + np.square(y_val)) plot_data["R"] = np.append(plot_data["R"], r) # Add centroid coordinates if self._settings["centroid"] or self._settings["turnsep"]: plot_data["xCentroid"][step] = np.mean(x_val) plot_data["yCentroid"][step] = np.mean(y_val) # Calculate turn separation (as close as possible to pos x-axis for now, arbitrary angle later? -DW) if self._settings["turnsep"]: azimuth = np.rad2deg(np.arctan2(plot_data["yCentroid"][step], plot_data["xCentroid"][step])) azimuths[step] = azimuth r_temp = np.sqrt(np.square(plot_data["xCentroid"][step]) + np.square(plot_data["yCentroid"][step])) r_temps[step] = r_temp if azimuth > 0 and save_r: save_r = False r_tsep.append(r_temp) if azimuth < 0: save_r = True # if step >= (16 * 95) + 6 and step % 16 == 6 and self._settings["turnsep"]: # r = np.sqrt(np.square(np.mean(x_val)) + np.square(np.mean(y_val))) # plot_data["R"] = np.append(plot_data["R"], r) # if step > (16 * 95) + 6 and step % 16 == 6 and self._settings["turnsep"]: # index += 1 # difference = np.abs(plot_data["R"][index-1] - plot_data["R"][index]) # plot_data["turnSep"] = np.append(plot_data["turnSep"], difference) plots["plot_data{}".format(num)] = plot_data num += 1 self._parent.send_status("Saving plot(s)...") # Save plots as separate images, with appropriate titles if self._settings["rms"]: _xlim = 62.2 _ylim = 6.0 _figsize = (7, 5) _fs = 12 fig = plt.figure(figsize=_figsize) plt.rc('font', **{'family': 'serif', 'serif': ['Computer Modern'], 'weight': 100, 'size': _fs}) plt.rc('text', usetex=True) plt.rc('grid', linestyle=':') plt.rc('ytick', labelsize=_fs) plt.rc('xtick', labelsize=_fs) ax1 = plt.subplot(311) plt.title("RMS Beam Size (mm)") for n in range(num): plt.plot(plots["plot_data{}".format(n)]["energy"], plots["plot_data{}".format(n)]["xRMS"], lw=0.8, label=plots["plot_data{}".format(n)]["name"]) # print("Mean x RMS: {}".format(np.mean(plots["plot_data{}".format(n)]["xRMS"][40:]))) ax1.get_yaxis().set_major_locator(LinearLocator(numticks=5)) ax1.get_yaxis().set_major_formatter(FormatStrFormatter('%.1f')) ax1.tick_params(labelbottom=False) ax1.set_xlim([0, _xlim]) # ax1.set_ylim([0, _ylim]) ax1.set_ylim([0, 4.0]) plt.grid() plt.ylabel("Transversal") ax2 = plt.subplot(312, sharex=ax1) for n in range(num): plt.plot(plots["plot_data{}".format(n)]["energy"], plots["plot_data{}".format(n)]["yRMS"], lw=0.8, label=plots["plot_data{}".format(n)]["name"]) # print("Mean y RMS: {}".format(np.mean(plots["plot_data{}".format(n)]["yRMS"][40:]))) plt.legend(loc=9) ax2.get_yaxis().set_major_locator(LinearLocator(numticks=5)) ax2.get_yaxis().set_major_formatter(FormatStrFormatter('%.1f')) ax2.tick_params(labelbottom=False) ax2.set_xlim([0, _xlim]) ax2.set_ylim([0, _ylim]) plt.grid() plt.ylabel("Longitudinal") ax3 = plt.subplot(313, sharex=ax1) for n in range(num): plt.plot(plots["plot_data{}".format(n)]["energy"], plots["plot_data{}".format(n)]["zRMS"], lw=0.8, label=plots["plot_data{}".format(n)]["name"]) # print("Mean z RMS: {}".format(np.mean(plots["plot_data{}".format(n)]["zRMS"][40:]))) ax3.get_yaxis().set_major_locator(LinearLocator(numticks=5)) ax3.get_yaxis().set_major_formatter(FormatStrFormatter('%.1f')) ax3.set_xlim([0, _xlim]) ax3.set_ylim([0, _ylim]) plt.grid() plt.xlabel("Energy (MeV/amu)") plt.ylabel("Vertical") # fig.tight_layout() fig.savefig(self._filename[0] + '_rmsBeamSize.png', dpi=1200, bbox_inches='tight') if self._settings["halo"]: _xlim = 62.2 _ylim = 7.0 _figsize = (7, 5) _fs = 12 fig = plt.figure(figsize=_figsize) plt.rc('font', **{'family': 'serif', 'serif': ['Computer Modern'], 'weight': 100, 'size': _fs}) plt.rc('text', usetex=True) plt.rc('grid', linestyle=':') plt.rc('ytick', labelsize=_fs) plt.rc('xtick', labelsize=_fs) ax1 = plt.subplot(311) plt.title("Halo Parameter") for n in range(num): plt.plot(plots["plot_data{}".format(n)]["energy"], plots["plot_data{}".format(n)]["xHalo"], lw=0.8, label=plots["plot_data{}".format(n)]["name"]) ax1.get_yaxis().set_major_locator(LinearLocator(numticks=5)) ax1.tick_params(labelbottom=False) ax1.set_ylim([0, _ylim]) ax1.set_xlim([0, _xlim]) plt.grid() plt.ylabel("Transversal") ax2 = plt.subplot(312, sharex=ax1) for n in range(num): plt.plot(plots["plot_data{}".format(n)]["energy"], plots["plot_data{}".format(n)]["yHalo"], lw=0.8, label=plots["plot_data{}".format(n)]["name"]) plt.legend(loc=9) ax2.get_yaxis().set_major_locator(LinearLocator(numticks=5)) ax2.tick_params(labelbottom=False) ax2.set_ylim([0, _ylim]) ax2.set_xlim([0, _xlim]) plt.grid() plt.ylabel("Longitudinal") ax3 = plt.subplot(313, sharex=ax1) for n in range(num): plt.plot(plots["plot_data{}".format(n)]["energy"], plots["plot_data{}".format(n)]["zHalo"], lw=0.8, label=plots["plot_data{}".format(n)]["name"]) ax3.get_yaxis().set_major_locator(LinearLocator(numticks=5)) ax3.set_ylim([0, _ylim]) ax3.set_xlim([0, _xlim]) plt.grid() plt.xlabel("Energy (MeV/amu)") plt.ylabel("Vertical") # fig.tight_layout() fig.savefig(self._filename[0] + '_haloParameter.png', bbox_inches='tight', dpi=1200) if self._settings["centroid"]: fig = plt.figure() plt.rc('font', **{'family': 'serif', 'serif': ['Computer Modern']}) plt.rc('text', usetex=True) plt.rc('grid', linestyle=':') plt.title("Top-down view of Centroid Position") for n in range(num): plt.plot(plots["plot_data{}".format(n)]["xCentroid"], plots["plot_data{}".format(n)]["yCentroid"], 'o', ms=0.5, label=plots["plot_data{}".format(n)]["name"]) plt.legend() ax = plt.gca() ax.set_aspect('equal') plt.grid() plt.xlabel("Horizontal (m)") plt.ylabel("Longitudinal (m)") fig.tight_layout() fig.savefig(self._filename[0] + '_centroidPosition.png', bbox_inches='tight', dpi=1200) # TODO: Fix turn separation to allow any number of steps if self._settings["turnsep"]: fig = plt.figure() plt.rc('font', **{'family': 'serif', 'serif': ['Computer Modern']}) plt.rc('text', usetex=True) plt.rc('grid', linestyle=':') plt.title("Turn Separation") plt.plot(1000.0 * np.diff(r_tsep)) # plt.plot(range(96, 105), 1000.0 * plot_data["turnSep"], 'k', lw=0.8) plt.grid() plt.xlabel("Turn Number") plt.ylabel("Separation (mm)") fig.savefig(self._filename[0] + '_turnSeparation.png', bbox_inches='tight', dpi=1200) if self._settings["energyHist"]: fig = plt.figure() plt.rc('font', **{'family': 'serif', 'serif': ['Computer Modern']}) plt.rc('text', usetex=True) plt.rc('grid', linestyle=':') plt.title("Particle Energy") for n in range(num): plt.hist(plots["plot_data{}".format(n)]["energy"], bins=100, histtype='step', # weights=np.full_like(plots["plot_data{}".format(n)]["energy"], 6348), label="{}, total particles = {}".format(plots["plot_data{}".format(n)]["name"], len(plots["plot_data{}".format(n)]["energy"]))) plt.legend() plt.grid() plt.xlabel("Energy (MeV/amu)") plt.ylabel(r"Particle Density (a.u.)") fig.tight_layout() fig.savefig(self._filename[0] + '_energy.png', bbox_inches='tight', dpi=1200) if self._settings["intensity"]: fig = plt.figure() plt.rc('font', **{'family': 'serif', 'serif': ['Computer Modern']}) plt.rc('text', usetex=True) plt.rc('grid', linestyle=':') plt.title("Histogram of the Beam Power (0.5 mm Bins)") bin_width = 0.5 # mm for n in range(num): radii = plots["plot_data{}".format(n)]["R"] * 1.0e3 # m --> mm r_len = radii.max() - radii.min() n_bins = int(np.round(r_len / bin_width, 0)) print("Numerical bin width = {:.4f} mm".format(r_len/n_bins)) power, bins = np.histogram(radii, bins=n_bins, weights=plots["plot_data{}".format(n)]["power"]) # temp_bins = bins[200:-1] # temp_power = power[200:] # # idx = np.where(temp_bins <= 1935) # 1940 for Probe25 # # temp_bins = temp_bins[idx] # temp_power = temp_power[idx] # # print("Min R =", temp_bins[np.where(temp_power == np.min(temp_power))], "mm\n") # print("Min P =", temp_power[np.where(temp_power == np.min(temp_power))], "W\n") plt.hist(bins[:-1], bins, weights=power, label=plots["plot_data{}".format(n)]["name"], alpha=0.3, log=True) plt.gca().axhline(200.0, linestyle="--", color="black", linewidth=1.0, label="200 W Limit") plt.legend(loc=2) plt.grid() plt.xlabel("Radius (mm)") plt.ylabel("Beam Power (W)") fig.tight_layout() fig.savefig(self._filename[0] + '_power.png', bbox_inches='tight', dpi=1200) if self._settings["xz"]: fig = plt.figure() plt.rc('font', **{'family': 'serif', 'serif': ['Computer Modern']}) plt.rc('text', usetex=True) plt.rc('grid', linestyle=':') plt.title("Probe Scatter Plot") ax = plt.gca() for n in range(num): plt.plot(plots["plot_data{}".format(n)]["R"] * 1000.0, # m --> mm plots["plot_data{}".format(n)]["coords"] * 1000.0, # m --> mm 'o', alpha=0.6, markersize=0.005, label=plots["plot_data{}".format(n)]["name"]) plt.grid() ax.set_aspect('equal') plt.xlabel("Radius (mm)") plt.ylabel("Vertical (mm)") fig.tight_layout() fig.savefig(self._filename[0] + '_RZ.png', bbox_inches='tight', dpi=1200) self._parent.send_status("Plot(s) saved successfully!") @staticmethod def rms(nparray): mean_sqrd = np.mean(np.square(nparray)) return np.sqrt(mean_sqrd) @staticmethod def halo(nparray): mean_sqrd = np.mean(np.square(nparray)) mean_frth = np.mean(np.square(np.square(nparray))) return mean_frth/(np.square(mean_sqrd)) - 1.0 def run(self): # --- Calculate the positions to center the window --- # screen_size = self._parent.screen_size() _x = 0.5 * (screen_size.width() - self._beamCharWindow.width()) _y = 0.5 * (screen_size.height() - self._beamCharWindow.height()) # --- Show the GUI --- # self._beamCharWindow.show() self._beamCharWindow.move(_x, _y) def open_gui(self): options = QFileDialog.Options() options |= QFileDialog.DontUseNativeDialog self._filename = QFileDialog.getSaveFileName(caption="Saving plots...", options=options, filter="Image (*.png)") self.run()
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,354
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/tools/AnimateXY/__init__.py
from py_particle_processor_qt.tools.AnimateXY.AnimateXY import *
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,355
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/drivers/arraywrapper.py
import numpy as np class ArrayWrapper(object): def __init__(self, array_like): if type(array_like) is not np.array: self._array = np.array(array_like) else: self._array = array_like def __get__(self): return self def __getitem__(self, key): return self._array[key] def __setitem__(self, key, item): self._array[key] = item def __len__(self): return len(self._array) @property def value(self): return self._array def append(self, value): self._array = np.append(self._array, value)
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,356
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/tools/RotateTool/__init__.py
from py_particle_processor_qt.tools.RotateTool.RotateTool import *
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,357
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/tools/__init__.py
from py_particle_processor_qt.tools.ScaleTool import * from py_particle_processor_qt.tools.TranslateTool import * from py_particle_processor_qt.tools.AnimateXY import * from py_particle_processor_qt.tools.BeamChar import * from py_particle_processor_qt.tools.CollimOPAL import * from py_particle_processor_qt.tools.OrbitTool import * # from py_particle_processor_qt.tools.SpiralGeometry import * from py_particle_processor_qt.tools.RotateTool import * """ Format: {"Object_Name": ("Display Name", object)} """ tool_mapping = {"Scale_Tool": ("Scale", ScaleTool), "Translate_Tool": ("Translate", TranslateTool), "Animate_XY": ("Animate X-Y", AnimateXY), "Beam_Characteristics": ("Beam Characteristics", BeamChar), "Collim_OPAL": ("Generate Collimator", CollimOPAL), "Orbit_Tool": ("Orbit Tool", OrbitTool), # "Spiral_Geometry": ("Spiral Geometry", SpiralGeometry), "Rotate_Tool": ("Rotate", RotateTool)}
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,358
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/gui/generate_main.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'generate_main.ui' # # Created by: PyQt5 UI code generator 5.6 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Generate_Main(object): def setupUi(self, Generate_Main): Generate_Main.setObjectName("Generate_Main") Generate_Main.resize(419, 252) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(Generate_Main.sizePolicy().hasHeightForWidth()) Generate_Main.setSizePolicy(sizePolicy) self.centralwidget = QtWidgets.QWidget(Generate_Main) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.centralwidget.sizePolicy().hasHeightForWidth()) self.centralwidget.setSizePolicy(sizePolicy) self.centralwidget.setObjectName("centralwidget") self.verticalLayoutWidget = QtWidgets.QWidget(self.centralwidget) self.verticalLayoutWidget.setGeometry(QtCore.QRect(10, 10, 401, 232)) self.verticalLayoutWidget.setObjectName("verticalLayoutWidget") self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.verticalLayoutWidget) self.verticalLayout_3.setContentsMargins(0, 0, 0, 0) self.verticalLayout_3.setSpacing(0) self.verticalLayout_3.setObjectName("verticalLayout_3") self.gridLayout = QtWidgets.QGridLayout() self.gridLayout.setObjectName("gridLayout") self.tr_label = QtWidgets.QLabel(self.verticalLayoutWidget) self.tr_label.setObjectName("tr_label") self.gridLayout.addWidget(self.tr_label, 2, 0, 1, 1, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter) spacerItem = QtWidgets.QSpacerItem(20, 10, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.gridLayout.addItem(spacerItem, 5, 0, 1, 1) self.lineEdit = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.lineEdit.setMaximumSize(QtCore.QSize(164, 16777215)) self.lineEdit.setObjectName("lineEdit") self.gridLayout.addWidget(self.lineEdit, 0, 2, 1, 1, QtCore.Qt.AlignHCenter) self.tl_label = QtWidgets.QLabel(self.verticalLayoutWidget) self.tl_label.setObjectName("tl_label") self.gridLayout.addWidget(self.tl_label, 0, 0, 1, 1, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter) self.bl_label = QtWidgets.QLabel(self.verticalLayoutWidget) self.bl_label.setObjectName("bl_label") self.gridLayout.addWidget(self.bl_label, 6, 0, 1, 1, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter) self.comboBox_2 = QtWidgets.QComboBox(self.verticalLayoutWidget) self.comboBox_2.setMinimumSize(QtCore.QSize(164, 0)) self.comboBox_2.setObjectName("comboBox_2") self.comboBox_2.addItem("") self.comboBox_2.addItem("") self.gridLayout.addWidget(self.comboBox_2, 6, 2, 1, 1, QtCore.Qt.AlignHCenter) self.comboBox = QtWidgets.QComboBox(self.verticalLayoutWidget) self.comboBox.setObjectName("comboBox") self.comboBox.addItem("") self.comboBox.addItem("") self.comboBox.addItem("") self.comboBox.addItem("") self.gridLayout.addWidget(self.comboBox, 2, 2, 1, 1, QtCore.Qt.AlignHCenter) self.energy = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.energy.setMaximumSize(QtCore.QSize(164, 16777215)) self.energy.setObjectName("energy") self.gridLayout.addWidget(self.energy, 4, 2, 1, 1, QtCore.Qt.AlignHCenter) self.label = QtWidgets.QLabel(self.verticalLayoutWidget) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 4, 0, 1, 1, QtCore.Qt.AlignHCenter) spacerItem1 = QtWidgets.QSpacerItem(20, 10, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.gridLayout.addItem(spacerItem1, 3, 0, 1, 1) spacerItem2 = QtWidgets.QSpacerItem(20, 10, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.gridLayout.addItem(spacerItem2, 1, 0, 1, 1) self.verticalLayout_3.addLayout(self.gridLayout) spacerItem3 = QtWidgets.QSpacerItem(20, 10, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.verticalLayout_3.addItem(spacerItem3) self.buttonBox = QtWidgets.QDialogButtonBox(self.verticalLayoutWidget) self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) self.buttonBox.setObjectName("buttonBox") self.verticalLayout_3.addWidget(self.buttonBox) Generate_Main.setCentralWidget(self.centralwidget) self.retranslateUi(Generate_Main) QtCore.QMetaObject.connectSlotsByName(Generate_Main) def retranslateUi(self, Generate_Main): _translate = QtCore.QCoreApplication.translate Generate_Main.setWindowTitle(_translate("Generate_Main", "Generate Distribution")) self.tr_label.setText(_translate("Generate_Main", "Species:")) self.tl_label.setText(_translate("Generate_Main", "Number of Particles:")) self.bl_label.setText(_translate("Generate_Main", "Input Parameter Type:")) self.comboBox_2.setItemText(0, _translate("Generate_Main", "Envelope")) self.comboBox_2.setItemText(1, _translate("Generate_Main", "Twiss")) self.comboBox.setItemText(0, _translate("Generate_Main", "Proton")) self.comboBox.setItemText(1, _translate("Generate_Main", "Electron")) self.comboBox.setItemText(2, _translate("Generate_Main", "Dihydrogen cation")) self.comboBox.setItemText(3, _translate("Generate_Main", "Alpha particle")) self.label.setText(_translate("Generate_Main", "Energy (MeV):"))
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,359
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/tools/BeamChar/__init__.py
from py_particle_processor_qt.tools.BeamChar.BeamChar import *
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,360
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/drivers/TrackDriver/__init__.py
from py_particle_processor_qt.drivers.TrackDriver.TrackDriver import *
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,361
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'tools/ScaleTool/scaletoolgui.ui' # # Created by: PyQt5 UI code generator 5.5.1 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_ScaleToolGUI(object): def setupUi(self, ScaleToolGUI): ScaleToolGUI.setObjectName("ScaleToolGUI") ScaleToolGUI.resize(257, 125) self.centralwidget = QtWidgets.QWidget(ScaleToolGUI) self.centralwidget.setObjectName("centralwidget") self.verticalLayoutWidget = QtWidgets.QWidget(self.centralwidget) self.verticalLayoutWidget.setGeometry(QtCore.QRect(0, 0, 254, 122)) self.verticalLayoutWidget.setObjectName("verticalLayoutWidget") self.verticalLayout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget) self.verticalLayout.setObjectName("verticalLayout") self.label = QtWidgets.QLabel(self.verticalLayoutWidget) self.label.setObjectName("label") self.verticalLayout.addWidget(self.label, 0, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter) self.gridLayout = QtWidgets.QGridLayout() self.gridLayout.setObjectName("gridLayout") self.parameter_label = QtWidgets.QLabel(self.verticalLayoutWidget) self.parameter_label.setObjectName("parameter_label") self.gridLayout.addWidget(self.parameter_label, 0, 0, 1, 1) self.scaling_factor_label = QtWidgets.QLabel(self.verticalLayoutWidget) self.scaling_factor_label.setObjectName("scaling_factor_label") self.gridLayout.addWidget(self.scaling_factor_label, 1, 0, 1, 1) self.parameter_combo = QtWidgets.QComboBox(self.verticalLayoutWidget) self.parameter_combo.setObjectName("parameter_combo") self.parameter_combo.addItem("") self.parameter_combo.addItem("") self.parameter_combo.addItem("") self.parameter_combo.addItem("") self.parameter_combo.addItem("") self.parameter_combo.addItem("") self.parameter_combo.addItem("") self.parameter_combo.addItem("") self.parameter_combo.addItem("") self.parameter_combo.addItem("") self.gridLayout.addWidget(self.parameter_combo, 0, 1, 1, 1) self.scaling_factor = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.scaling_factor.setText("") self.scaling_factor.setObjectName("scaling_factor") self.gridLayout.addWidget(self.scaling_factor, 1, 1, 1, 1) self.verticalLayout.addLayout(self.gridLayout) self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.cancel_button = QtWidgets.QPushButton(self.verticalLayoutWidget) self.cancel_button.setObjectName("cancel_button") self.horizontalLayout.addWidget(self.cancel_button) self.apply_button = QtWidgets.QPushButton(self.verticalLayoutWidget) self.apply_button.setDefault(True) self.apply_button.setObjectName("apply_button") self.horizontalLayout.addWidget(self.apply_button) self.verticalLayout.addLayout(self.horizontalLayout) ScaleToolGUI.setCentralWidget(self.centralwidget) self.retranslateUi(ScaleToolGUI) QtCore.QMetaObject.connectSlotsByName(ScaleToolGUI) def retranslateUi(self, ScaleToolGUI): _translate = QtCore.QCoreApplication.translate ScaleToolGUI.setWindowTitle(_translate("ScaleToolGUI", "Scale Tool")) self.label.setText(_translate("ScaleToolGUI", "Scale Tool")) self.parameter_label.setText(_translate("ScaleToolGUI", "Parameter(s):")) self.scaling_factor_label.setText(_translate("ScaleToolGUI", "Scaling Factor:")) self.parameter_combo.setItemText(0, _translate("ScaleToolGUI", "X, Y, Z")) self.parameter_combo.setItemText(1, _translate("ScaleToolGUI", "X, Y")) self.parameter_combo.setItemText(2, _translate("ScaleToolGUI", "X")) self.parameter_combo.setItemText(3, _translate("ScaleToolGUI", "Y")) self.parameter_combo.setItemText(4, _translate("ScaleToolGUI", "Z")) self.parameter_combo.setItemText(5, _translate("ScaleToolGUI", "PX, PY, PZ")) self.parameter_combo.setItemText(6, _translate("ScaleToolGUI", "PX, PY")) self.parameter_combo.setItemText(7, _translate("ScaleToolGUI", "PX")) self.parameter_combo.setItemText(8, _translate("ScaleToolGUI", "PY")) self.parameter_combo.setItemText(9, _translate("ScaleToolGUI", "PZ")) self.scaling_factor.setPlaceholderText(_translate("ScaleToolGUI", "1.0")) self.cancel_button.setText(_translate("ScaleToolGUI", "Cancel")) self.apply_button.setText(_translate("ScaleToolGUI", "Apply"))
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,362
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/gui/species_prompt.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'gui/species_prompt.ui' # # Created by: PyQt5 UI code generator 5.5.1 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_SpeciesPrompt(object): def setupUi(self, SpeciesPrompt): SpeciesPrompt.setObjectName("SpeciesPrompt") SpeciesPrompt.resize(325, 132) SpeciesPrompt.setFocusPolicy(QtCore.Qt.StrongFocus) self.centralwidget = QtWidgets.QWidget(SpeciesPrompt) self.centralwidget.setObjectName("centralwidget") self.verticalLayoutWidget = QtWidgets.QWidget(self.centralwidget) self.verticalLayoutWidget.setGeometry(QtCore.QRect(0, 0, 321, 122)) self.verticalLayoutWidget.setObjectName("verticalLayoutWidget") self.verticalLayout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget) self.verticalLayout.setObjectName("verticalLayout") self.gridLayout = QtWidgets.QGridLayout() self.gridLayout.setObjectName("gridLayout") self.label = QtWidgets.QLabel(self.verticalLayoutWidget) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 3, 0, 1, 1) self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.species_label = QtWidgets.QLabel(self.verticalLayoutWidget) self.species_label.setObjectName("species_label") self.horizontalLayout.addWidget(self.species_label) self.gridLayout.addLayout(self.horizontalLayout, 2, 0, 1, 1) self.dataset_name = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.dataset_name.setObjectName("dataset_name") self.gridLayout.addWidget(self.dataset_name, 3, 1, 1, 1, QtCore.Qt.AlignHCenter) self.species_selection = QtWidgets.QComboBox(self.verticalLayoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.species_selection.sizePolicy().hasHeightForWidth()) self.species_selection.setSizePolicy(sizePolicy) self.species_selection.setObjectName("species_selection") self.gridLayout.addWidget(self.species_selection, 2, 1, 1, 1, QtCore.Qt.AlignHCenter) self.verticalLayout.addLayout(self.gridLayout) self.horizontalLayout_9 = QtWidgets.QHBoxLayout() self.horizontalLayout_9.setObjectName("horizontalLayout_9") spacerItem = QtWidgets.QSpacerItem(40, 10, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_9.addItem(spacerItem) self.apply_button = QtWidgets.QPushButton(self.verticalLayoutWidget) self.apply_button.setDefault(True) self.apply_button.setObjectName("apply_button") self.horizontalLayout_9.addWidget(self.apply_button) self.verticalLayout.addLayout(self.horizontalLayout_9) SpeciesPrompt.setCentralWidget(self.centralwidget) self.retranslateUi(SpeciesPrompt) QtCore.QMetaObject.connectSlotsByName(SpeciesPrompt) def retranslateUi(self, SpeciesPrompt): _translate = QtCore.QCoreApplication.translate SpeciesPrompt.setWindowTitle(_translate("SpeciesPrompt", "Species Prompt")) self.label.setText(_translate("SpeciesPrompt", "Dataset Name:")) self.species_label.setText(_translate("SpeciesPrompt", "Ion Species:")) self.apply_button.setText(_translate("SpeciesPrompt", "Apply"))
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,363
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor/drivers/__init__.py
from OPALDriver import * from TraceWinDriver import * """ The driver mapping contains the information needed for the ImportExportDriver class to wrap around the drivers """ driver_mapping = {'OPAL': {'driver': OPALDriver, 'extensions': ['.h5']}, 'TraceWin': {'driver': TraceWinDriver, 'extensions': ['.txt']} }
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,364
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/gui/generate_envelope.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'generate_envelope.ui' # # Created by: PyQt5 UI code generator 5.6 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Generate_Envelope(object): def setupUi(self, Generate_Envelope): Generate_Envelope.setObjectName("Generate_Envelope") Generate_Envelope.resize(488, 648) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(Generate_Envelope.sizePolicy().hasHeightForWidth()) Generate_Envelope.setSizePolicy(sizePolicy) self.centralwidget = QtWidgets.QWidget(Generate_Envelope) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.centralwidget.sizePolicy().hasHeightForWidth()) self.centralwidget.setSizePolicy(sizePolicy) self.centralwidget.setObjectName("centralwidget") self.verticalLayoutWidget = QtWidgets.QWidget(self.centralwidget) self.verticalLayoutWidget.setGeometry(QtCore.QRect(10, 10, 451, 607)) self.verticalLayoutWidget.setObjectName("verticalLayoutWidget") self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.verticalLayoutWidget) self.verticalLayout_3.setContentsMargins(0, 0, 0, 0) self.verticalLayout_3.setSpacing(0) self.verticalLayout_3.setObjectName("verticalLayout_3") self.label = QtWidgets.QLabel(self.verticalLayoutWidget) self.label.setMaximumSize(QtCore.QSize(500, 25)) self.label.setObjectName("label") self.verticalLayout_3.addWidget(self.label) self.gridLayout = QtWidgets.QGridLayout() self.gridLayout.setSizeConstraint(QtWidgets.QLayout.SetMaximumSize) self.gridLayout.setObjectName("gridLayout") self.tr_label = QtWidgets.QLabel(self.verticalLayoutWidget) self.tr_label.setObjectName("tr_label") self.gridLayout.addWidget(self.tr_label, 1, 1, 1, 1, QtCore.Qt.AlignHCenter) self.tl_label = QtWidgets.QLabel(self.verticalLayoutWidget) self.tl_label.setObjectName("tl_label") self.gridLayout.addWidget(self.tl_label, 0, 1, 1, 1, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter) self.label_2 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_2.setObjectName("label_2") self.gridLayout.addWidget(self.label_2, 4, 1, 1, 1, QtCore.Qt.AlignHCenter) self.zr = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.zr.setObjectName("zr") self.gridLayout.addWidget(self.zr, 2, 2, 1, 1, QtCore.Qt.AlignHCenter) self.zpos = QtWidgets.QComboBox(self.verticalLayoutWidget) self.zpos.setMinimumSize(QtCore.QSize(142, 0)) self.zpos.setMaximumSize(QtCore.QSize(176, 16777215)) self.zpos.setObjectName("zpos") self.zpos.addItem("") self.zpos.addItem("") self.zpos.addItem("") self.zpos.addItem("") self.zpos.addItem("") self.zpos.addItem("") self.gridLayout.addWidget(self.zpos, 0, 2, 1, 1, QtCore.Qt.AlignHCenter) self.ze = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.ze.setEnabled(False) self.ze.setObjectName("ze") self.gridLayout.addWidget(self.ze, 4, 2, 1, 1, QtCore.Qt.AlignHCenter) self.label_3 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_3.setObjectName("label_3") self.gridLayout.addWidget(self.label_3, 5, 1, 1, 1, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter) self.bl_label = QtWidgets.QLabel(self.verticalLayoutWidget) self.bl_label.setObjectName("bl_label") self.gridLayout.addWidget(self.bl_label, 2, 1, 1, 1, QtCore.Qt.AlignHCenter) spacerItem = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.gridLayout.addItem(spacerItem, 1, 0, 1, 1) self.zmom = QtWidgets.QComboBox(self.verticalLayoutWidget) self.zmom.setEnabled(True) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.zmom.sizePolicy().hasHeightForWidth()) self.zmom.setSizePolicy(sizePolicy) self.zmom.setMinimumSize(QtCore.QSize(142, 0)) self.zmom.setMaximumSize(QtCore.QSize(176, 16777215)) self.zmom.setObjectName("zmom") self.zmom.addItem("") self.zmom.addItem("") self.zmom.addItem("") self.zmom.addItem("") self.gridLayout.addWidget(self.zmom, 1, 2, 1, 1, QtCore.Qt.AlignHCenter) self.gridLayout_3 = QtWidgets.QGridLayout() self.gridLayout_3.setObjectName("gridLayout_3") self.label_8 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_8.setObjectName("label_8") self.gridLayout_3.addWidget(self.label_8, 0, 0, 1, 1, QtCore.Qt.AlignHCenter) self.label_9 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_9.setObjectName("label_9") self.gridLayout_3.addWidget(self.label_9, 1, 0, 1, 1, QtCore.Qt.AlignHCenter) self.zpstddev = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.zpstddev.setEnabled(False) self.zpstddev.setMinimumSize(QtCore.QSize(100, 0)) self.zpstddev.setMaximumSize(QtCore.QSize(134, 16777215)) self.zpstddev.setObjectName("zpstddev") self.gridLayout_3.addWidget(self.zpstddev, 0, 1, 1, 1, QtCore.Qt.AlignRight) self.zmstddev = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.zmstddev.setEnabled(False) self.zmstddev.setMinimumSize(QtCore.QSize(100, 0)) self.zmstddev.setMaximumSize(QtCore.QSize(134, 16777215)) self.zmstddev.setObjectName("zmstddev") self.gridLayout_3.addWidget(self.zmstddev, 1, 1, 1, 1, QtCore.Qt.AlignRight) self.gridLayout.addLayout(self.gridLayout_3, 5, 2, 1, 1) self.gridLayout.setRowMinimumHeight(0, 20) self.verticalLayout_3.addLayout(self.gridLayout) spacerItem1 = QtWidgets.QSpacerItem(20, 5, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.verticalLayout_3.addItem(spacerItem1) self.label_4 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_4.setMaximumSize(QtCore.QSize(16777215, 25)) self.label_4.setObjectName("label_4") self.verticalLayout_3.addWidget(self.label_4) self.verticalLayout_2 = QtWidgets.QVBoxLayout() self.verticalLayout_2.setObjectName("verticalLayout_2") self.xydist = QtWidgets.QComboBox(self.verticalLayoutWidget) self.xydist.setMinimumSize(QtCore.QSize(142, 0)) self.xydist.setMaximumSize(QtCore.QSize(176, 16777215)) self.xydist.setObjectName("xydist") self.xydist.addItem("") self.xydist.addItem("") self.xydist.addItem("") self.xydist.addItem("") self.verticalLayout_2.addWidget(self.xydist, 0, QtCore.Qt.AlignHCenter) self.gridLayout_2 = QtWidgets.QGridLayout() self.gridLayout_2.setSizeConstraint(QtWidgets.QLayout.SetMinimumSize) self.gridLayout_2.setObjectName("gridLayout_2") self.yrp = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.yrp.setObjectName("yrp") self.gridLayout_2.addWidget(self.yrp, 7, 2, 1, 1, QtCore.Qt.AlignHCenter) self.bl_label_6 = QtWidgets.QLabel(self.verticalLayoutWidget) self.bl_label_6.setObjectName("bl_label_6") self.gridLayout_2.addWidget(self.bl_label_6, 2, 1, 1, 1, QtCore.Qt.AlignRight) self.bl_label_3 = QtWidgets.QLabel(self.verticalLayoutWidget) self.bl_label_3.setObjectName("bl_label_3") self.gridLayout_2.addWidget(self.bl_label_3, 7, 1, 1, 1, QtCore.Qt.AlignRight) self.tl_label_2 = QtWidgets.QLabel(self.verticalLayoutWidget) self.tl_label_2.setObjectName("tl_label_2") self.gridLayout_2.addWidget(self.tl_label_2, 0, 1, 1, 1, QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) self.ye = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.ye.setObjectName("ye") self.gridLayout_2.addWidget(self.ye, 8, 2, 1, 1, QtCore.Qt.AlignHCenter) spacerItem2 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.gridLayout_2.addItem(spacerItem2, 6, 0, 2, 1) self.label_5 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_5.setObjectName("label_5") self.gridLayout_2.addWidget(self.label_5, 8, 1, 1, 1, QtCore.Qt.AlignRight) self.label_6 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_6.setObjectName("label_6") self.gridLayout_2.addWidget(self.label_6, 9, 1, 1, 1, QtCore.Qt.AlignRight|QtCore.Qt.AlignVCenter) self.yr = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.yr.setEnabled(True) self.yr.setObjectName("yr") self.gridLayout_2.addWidget(self.yr, 6, 2, 1, 1, QtCore.Qt.AlignHCenter) self.bl_label_4 = QtWidgets.QLabel(self.verticalLayoutWidget) self.bl_label_4.setObjectName("bl_label_4") self.gridLayout_2.addWidget(self.bl_label_4, 6, 1, 1, 1, QtCore.Qt.AlignRight) self.tr_label_2 = QtWidgets.QLabel(self.verticalLayoutWidget) self.tr_label_2.setObjectName("tr_label_2") self.gridLayout_2.addWidget(self.tr_label_2, 5, 1, 1, 1, QtCore.Qt.AlignLeft) self.xe = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.xe.setEnabled(True) self.xe.setObjectName("xe") self.gridLayout_2.addWidget(self.xe, 3, 2, 1, 1, QtCore.Qt.AlignHCenter) self.bl_label_5 = QtWidgets.QLabel(self.verticalLayoutWidget) self.bl_label_5.setObjectName("bl_label_5") self.gridLayout_2.addWidget(self.bl_label_5, 1, 1, 1, 1, QtCore.Qt.AlignRight) self.xr = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.xr.setEnabled(True) self.xr.setObjectName("xr") self.gridLayout_2.addWidget(self.xr, 1, 2, 1, 1, QtCore.Qt.AlignHCenter) self.label_7 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_7.setObjectName("label_7") self.gridLayout_2.addWidget(self.label_7, 3, 1, 1, 1, QtCore.Qt.AlignRight) self.xrp = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.xrp.setEnabled(True) self.xrp.setObjectName("xrp") self.gridLayout_2.addWidget(self.xrp, 2, 2, 1, 1, QtCore.Qt.AlignHCenter) self.label_10 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_10.setObjectName("label_10") self.gridLayout_2.addWidget(self.label_10, 4, 1, 1, 1, QtCore.Qt.AlignRight) self.gridLayout_4 = QtWidgets.QGridLayout() self.gridLayout_4.setObjectName("gridLayout_4") self.label_11 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_11.setObjectName("label_11") self.gridLayout_4.addWidget(self.label_11, 0, 0, 1, 1, QtCore.Qt.AlignHCenter) self.label_12 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_12.setObjectName("label_12") self.gridLayout_4.addWidget(self.label_12, 1, 0, 1, 1, QtCore.Qt.AlignHCenter) self.xstddev = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.xstddev.setEnabled(False) self.xstddev.setMinimumSize(QtCore.QSize(100, 0)) self.xstddev.setMaximumSize(QtCore.QSize(134, 16777215)) self.xstddev.setObjectName("xstddev") self.gridLayout_4.addWidget(self.xstddev, 0, 1, 1, 1, QtCore.Qt.AlignRight) self.xpstddev = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.xpstddev.setEnabled(False) self.xpstddev.setMinimumSize(QtCore.QSize(100, 0)) self.xpstddev.setMaximumSize(QtCore.QSize(134, 16777215)) self.xpstddev.setObjectName("xpstddev") self.gridLayout_4.addWidget(self.xpstddev, 1, 1, 1, 1, QtCore.Qt.AlignRight) self.gridLayout_2.addLayout(self.gridLayout_4, 4, 2, 1, 1) self.gridLayout_5 = QtWidgets.QGridLayout() self.gridLayout_5.setObjectName("gridLayout_5") self.label_13 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_13.setObjectName("label_13") self.gridLayout_5.addWidget(self.label_13, 0, 0, 1, 1, QtCore.Qt.AlignHCenter) self.label_14 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_14.setObjectName("label_14") self.gridLayout_5.addWidget(self.label_14, 1, 0, 1, 1, QtCore.Qt.AlignHCenter) self.ystddev = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.ystddev.setEnabled(False) self.ystddev.setMinimumSize(QtCore.QSize(100, 0)) self.ystddev.setMaximumSize(QtCore.QSize(134, 16777215)) self.ystddev.setObjectName("ystddev") self.gridLayout_5.addWidget(self.ystddev, 0, 1, 1, 1, QtCore.Qt.AlignRight) self.ypstddev = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.ypstddev.setEnabled(False) self.ypstddev.setMinimumSize(QtCore.QSize(100, 0)) self.ypstddev.setMaximumSize(QtCore.QSize(134, 16777215)) self.ypstddev.setObjectName("ypstddev") self.gridLayout_5.addWidget(self.ypstddev, 1, 1, 1, 1, QtCore.Qt.AlignRight) self.gridLayout_2.addLayout(self.gridLayout_5, 9, 2, 1, 1) self.checkBox = QtWidgets.QCheckBox(self.verticalLayoutWidget) self.checkBox.setAcceptDrops(False) self.checkBox.setChecked(False) self.checkBox.setTristate(False) self.checkBox.setObjectName("checkBox") self.gridLayout_2.addWidget(self.checkBox, 5, 2, 1, 1, QtCore.Qt.AlignHCenter) self.verticalLayout_2.addLayout(self.gridLayout_2) self.verticalLayout_3.addLayout(self.verticalLayout_2) self.buttonBox = QtWidgets.QDialogButtonBox(self.verticalLayoutWidget) self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) self.buttonBox.setObjectName("buttonBox") self.verticalLayout_3.addWidget(self.buttonBox) Generate_Envelope.setCentralWidget(self.centralwidget) self.retranslateUi(Generate_Envelope) QtCore.QMetaObject.connectSlotsByName(Generate_Envelope) def retranslateUi(self, Generate_Envelope): _translate = QtCore.QCoreApplication.translate Generate_Envelope.setWindowTitle(_translate("Generate_Envelope", "Generate Distribution: Enter Parameters")) self.label.setText(_translate("Generate_Envelope", "Longitudinal Distribution")) self.tr_label.setText(_translate("Generate_Envelope", "Momentum:")) self.tl_label.setText(_translate("Generate_Envelope", "Position:")) self.label_2.setText(_translate("Generate_Envelope", "Normalized Emittance (pi-mm-mrad):")) self.zpos.setItemText(0, _translate("Generate_Envelope", "Constant")) self.zpos.setItemText(1, _translate("Generate_Envelope", "Uniform along length")) self.zpos.setItemText(2, _translate("Generate_Envelope", "Uniform on ellipse")) self.zpos.setItemText(3, _translate("Generate_Envelope", "Gaussian on ellipse")) self.zpos.setItemText(4, _translate("Generate_Envelope", "Waterbag")) self.zpos.setItemText(5, _translate("Generate_Envelope", "Parabolic")) self.label_3.setText(_translate("Generate_Envelope", "Standard Deviation:")) self.bl_label.setText(_translate("Generate_Envelope", "Length/Envelope Radius (mm):")) self.zmom.setItemText(0, _translate("Generate_Envelope", "Constant")) self.zmom.setItemText(1, _translate("Generate_Envelope", "Uniform along length")) self.zmom.setItemText(2, _translate("Generate_Envelope", "Uniform on ellipse")) self.zmom.setItemText(3, _translate("Generate_Envelope", "Gaussian on ellipse")) self.label_8.setText(_translate("Generate_Envelope", "Position (mm):")) self.label_9.setText(_translate("Generate_Envelope", "Momentum (mrad):")) self.label_4.setText(_translate("Generate_Envelope", "Transverse Distribution")) self.xydist.setItemText(0, _translate("Generate_Envelope", "Uniform")) self.xydist.setItemText(1, _translate("Generate_Envelope", "Gaussian")) self.xydist.setItemText(2, _translate("Generate_Envelope", "Waterbag")) self.xydist.setItemText(3, _translate("Generate_Envelope", "Parabolic")) self.bl_label_6.setText(_translate("Generate_Envelope", "Envelope Angle (mrad):")) self.bl_label_3.setText(_translate("Generate_Envelope", "Envelope Angle (mrad):")) self.tl_label_2.setText(_translate("Generate_Envelope", "X Phase Space Ellipse:")) self.label_5.setText(_translate("Generate_Envelope", "Normalized Emittance (pi-mm-mrad):")) self.label_6.setText(_translate("Generate_Envelope", "Standard Deviation:")) self.bl_label_4.setText(_translate("Generate_Envelope", "Envelope Radius (mm):")) self.tr_label_2.setText(_translate("Generate_Envelope", "Y Phase Space Ellipse:")) self.bl_label_5.setText(_translate("Generate_Envelope", "Envelope Radius (mm):")) self.label_7.setText(_translate("Generate_Envelope", "Normalized Emittance (pi-mm-mrad):")) self.label_10.setText(_translate("Generate_Envelope", "Standard Deviation:")) self.label_11.setText(_translate("Generate_Envelope", "Radius (mm):")) self.label_12.setText(_translate("Generate_Envelope", "Angle (mrad):")) self.label_13.setText(_translate("Generate_Envelope", "Radius (mm):")) self.label_14.setText(_translate("Generate_Envelope", "Angle (mrad):")) self.checkBox.setText(_translate("Generate_Envelope", "Symmetric?"))
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,365
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor/dataset.py
from dans_pymodules import * # import h5py from drivers import * __author__ = "Daniel Winklehner" __doc__ = """A container that holds a single dataset with multiple time steps and multiple particles per time step. If the data is too large for memory, it is automatically transferred into a h5 file on disk to be operated on. """ # Initialize some global constants amu = const.value("atomic mass constant energy equivalent in MeV") echarge = const.value("elementary charge") clight = const.value("speed of light in vacuum") class ImportExportDriver(object): """ A thin wrapper around the drivers for importing and exporting particle data """ def __init__(self, driver_name=None, debug=False): self._driver_name = driver_name self._driver = None self._debug = debug self.load_driver() def load_driver(self): self._driver = driver_mapping[self._driver_name]['driver'](debug=self._debug) def get_driver_name(self): return self._driver_name def import_data(self, filename): return self._driver.import_data(filename) def export_data(self, data): return self._driver.export_data(data) class Dataset(object): def __init__(self, debug=False): self._datasource = None self._filename = None self._driver = None self._ion = None self._nsteps = 0 self._multispecies = False self._debug = debug self._data = None self._current = 0.0 self._npart = 0 # TODO: For now this is the number of particles at step 0. -DW def close(self): """ Close the dataset's source and return :return: """ if self._datasource is not None: try: self._datasource.close() except Exception as e: if self._debug: print("Exception occured during closing of datafile: {}".format(e)) return 1 return 0 def get(self, key): """ Returns the values for the currently set step and given key ("x", "y", "z", "px", "py", "pz") :return: """ if key not in ["x", "y", "z", "px", "py", "pz"]: if self._debug: print("get(key): Key was not one of 'x', 'y', 'z', 'px', 'py', 'pz'") return 1 if self._data is None: if self._debug: print("get(key): No data loaded yet!") return 1 return self._data.get(key).value def get_a(self): return self._ion.a() def get_filename(self): return self._filename def get_i(self): return self._current def get_npart(self): return self._npart def get_q(self): return self._ion.q() def load_from_file(self, filename, driver=None): """ Load a dataset from file. If the file is h5 already, don't load into memory. Users can write their own drivers but they have to be compliant with the internal structure of datasets. :param filename: :param driver: :return: """ self._driver = driver self._filename = filename if driver is not None: new_ied = ImportExportDriver(driver_name=driver) _data = new_ied.import_data(self._filename) if _data is not None: self._datasource = _data["datasource"] self._ion = _data["ion"] self._nsteps = _data["nsteps"] self._current = _data["current"] self._npart = _data["npart"] self.set_step_view(0) return 0 return 1 def set_step_view(self, step): if step > self._nsteps: if self._debug: print("set_step_view: Requested step {} exceeded max steps of {}!".format(step, self._nsteps)) return 1 self._data = self._datasource.get("Step#{}".format(step)) return 0
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,366
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/__init__.py
from py_particle_processor_qt.py_particle_processor_qt import *
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,367
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/gui/default_plot_settings.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'gui/default_plot_settings.ui' # # Created by: PyQt5 UI code generator 5.5.1 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_DefaultPlotSettingsWindow(object): def setupUi(self, DefaultPlotSettingsWindow): DefaultPlotSettingsWindow.setObjectName("DefaultPlotSettingsWindow") DefaultPlotSettingsWindow.resize(377, 251) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(DefaultPlotSettingsWindow.sizePolicy().hasHeightForWidth()) DefaultPlotSettingsWindow.setSizePolicy(sizePolicy) self.centralwidget = QtWidgets.QWidget(DefaultPlotSettingsWindow) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.centralwidget.sizePolicy().hasHeightForWidth()) self.centralwidget.setSizePolicy(sizePolicy) self.centralwidget.setObjectName("centralwidget") self.verticalLayoutWidget = QtWidgets.QWidget(self.centralwidget) self.verticalLayoutWidget.setGeometry(QtCore.QRect(0, 0, 374, 247)) self.verticalLayoutWidget.setObjectName("verticalLayoutWidget") self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.verticalLayoutWidget) self.verticalLayout_3.setSpacing(0) self.verticalLayout_3.setObjectName("verticalLayout_3") self.main_label = QtWidgets.QLabel(self.verticalLayoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.main_label.sizePolicy().hasHeightForWidth()) self.main_label.setSizePolicy(sizePolicy) self.main_label.setObjectName("main_label") self.verticalLayout_3.addWidget(self.main_label, 0, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter) spacerItem = QtWidgets.QSpacerItem(20, 5, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.verticalLayout_3.addItem(spacerItem) self.gridLayout = QtWidgets.QGridLayout() self.gridLayout.setObjectName("gridLayout") self.bl_enabled = QtWidgets.QCheckBox(self.verticalLayoutWidget) self.bl_enabled.setFocusPolicy(QtCore.Qt.NoFocus) self.bl_enabled.setCheckable(True) self.bl_enabled.setChecked(True) self.bl_enabled.setObjectName("bl_enabled") self.gridLayout.addWidget(self.bl_enabled, 3, 1, 1, 1, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter) self.tl_combo_a = QtWidgets.QComboBox(self.verticalLayoutWidget) self.tl_combo_a.setObjectName("tl_combo_a") self.tl_combo_a.addItem("") self.tl_combo_a.addItem("") self.tl_combo_a.addItem("") self.tl_combo_a.addItem("") self.tl_combo_a.addItem("") self.tl_combo_a.addItem("") self.gridLayout.addWidget(self.tl_combo_a, 1, 2, 1, 1, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter) self.bl_combo_a = QtWidgets.QComboBox(self.verticalLayoutWidget) self.bl_combo_a.setObjectName("bl_combo_a") self.bl_combo_a.addItem("") self.bl_combo_a.addItem("") self.bl_combo_a.addItem("") self.bl_combo_a.addItem("") self.bl_combo_a.addItem("") self.bl_combo_a.addItem("") self.gridLayout.addWidget(self.bl_combo_a, 3, 2, 1, 1, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter) self.tl_enabled = QtWidgets.QCheckBox(self.verticalLayoutWidget) self.tl_enabled.setEnabled(True) self.tl_enabled.setFocusPolicy(QtCore.Qt.NoFocus) self.tl_enabled.setCheckable(True) self.tl_enabled.setChecked(True) self.tl_enabled.setObjectName("tl_enabled") self.gridLayout.addWidget(self.tl_enabled, 1, 1, 1, 1, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter) self.tl_label = QtWidgets.QLabel(self.verticalLayoutWidget) self.tl_label.setObjectName("tl_label") self.gridLayout.addWidget(self.tl_label, 1, 0, 1, 1, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter) self.tr_label = QtWidgets.QLabel(self.verticalLayoutWidget) self.tr_label.setObjectName("tr_label") self.gridLayout.addWidget(self.tr_label, 2, 0, 1, 1, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter) self.step_label = QtWidgets.QLabel(self.verticalLayoutWidget) self.step_label.setObjectName("step_label") self.gridLayout.addWidget(self.step_label, 0, 0, 1, 1, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter) self.tr_combo_b = QtWidgets.QComboBox(self.verticalLayoutWidget) self.tr_combo_b.setObjectName("tr_combo_b") self.tr_combo_b.addItem("") self.tr_combo_b.addItem("") self.tr_combo_b.addItem("") self.tr_combo_b.addItem("") self.tr_combo_b.addItem("") self.tr_combo_b.addItem("") self.gridLayout.addWidget(self.tr_combo_b, 2, 3, 1, 1, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter) self.bl_combo_b = QtWidgets.QComboBox(self.verticalLayoutWidget) self.bl_combo_b.setObjectName("bl_combo_b") self.bl_combo_b.addItem("") self.bl_combo_b.addItem("") self.bl_combo_b.addItem("") self.bl_combo_b.addItem("") self.bl_combo_b.addItem("") self.bl_combo_b.addItem("") self.gridLayout.addWidget(self.bl_combo_b, 3, 3, 1, 1, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter) self.three_d_enabled = QtWidgets.QCheckBox(self.verticalLayoutWidget) self.three_d_enabled.setFocusPolicy(QtCore.Qt.NoFocus) self.three_d_enabled.setCheckable(True) self.three_d_enabled.setObjectName("three_d_enabled") self.gridLayout.addWidget(self.three_d_enabled, 4, 1, 1, 1, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter) self.tr_combo_a = QtWidgets.QComboBox(self.verticalLayoutWidget) self.tr_combo_a.setObjectName("tr_combo_a") self.tr_combo_a.addItem("") self.tr_combo_a.addItem("") self.tr_combo_a.addItem("") self.tr_combo_a.addItem("") self.tr_combo_a.addItem("") self.tr_combo_a.addItem("") self.gridLayout.addWidget(self.tr_combo_a, 2, 2, 1, 1, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter) self.tl_combo_b = QtWidgets.QComboBox(self.verticalLayoutWidget) self.tl_combo_b.setObjectName("tl_combo_b") self.tl_combo_b.addItem("") self.tl_combo_b.addItem("") self.tl_combo_b.addItem("") self.tl_combo_b.addItem("") self.tl_combo_b.addItem("") self.tl_combo_b.addItem("") self.gridLayout.addWidget(self.tl_combo_b, 1, 3, 1, 1, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter) self.bl_label = QtWidgets.QLabel(self.verticalLayoutWidget) self.bl_label.setObjectName("bl_label") self.gridLayout.addWidget(self.bl_label, 3, 0, 1, 1, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter) self.step_input = QtWidgets.QSpinBox(self.verticalLayoutWidget) self.step_input.setMinimum(0) self.step_input.setMaximum(999999999) self.step_input.setObjectName("step_input") self.gridLayout.addWidget(self.step_input, 0, 1, 1, 1) self.three_d_label = QtWidgets.QLabel(self.verticalLayoutWidget) self.three_d_label.setObjectName("three_d_label") self.gridLayout.addWidget(self.three_d_label, 4, 0, 1, 1, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter) self.tr_enabled = QtWidgets.QCheckBox(self.verticalLayoutWidget) self.tr_enabled.setFocusPolicy(QtCore.Qt.NoFocus) self.tr_enabled.setCheckable(True) self.tr_enabled.setChecked(True) self.tr_enabled.setObjectName("tr_enabled") self.gridLayout.addWidget(self.tr_enabled, 2, 1, 1, 1, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter) self.redraw_label = QtWidgets.QLabel(self.verticalLayoutWidget) self.redraw_label.setObjectName("redraw_label") self.gridLayout.addWidget(self.redraw_label, 5, 0, 1, 1, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter) self.redraw_enabled = QtWidgets.QCheckBox(self.verticalLayoutWidget) self.redraw_enabled.setChecked(True) self.redraw_enabled.setObjectName("redraw_enabled") self.gridLayout.addWidget(self.redraw_enabled, 5, 1, 1, 1, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter) self.verticalLayout_3.addLayout(self.gridLayout) spacerItem1 = QtWidgets.QSpacerItem(20, 10, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.verticalLayout_3.addItem(spacerItem1) self.horizontalLayout_9 = QtWidgets.QHBoxLayout() self.horizontalLayout_9.setObjectName("horizontalLayout_9") self.redraw_button = QtWidgets.QPushButton(self.verticalLayoutWidget) self.redraw_button.setObjectName("redraw_button") self.horizontalLayout_9.addWidget(self.redraw_button) spacerItem2 = QtWidgets.QSpacerItem(40, 10, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_9.addItem(spacerItem2) self.cancel_button = QtWidgets.QPushButton(self.verticalLayoutWidget) self.cancel_button.setObjectName("cancel_button") self.horizontalLayout_9.addWidget(self.cancel_button) self.apply_button = QtWidgets.QPushButton(self.verticalLayoutWidget) self.apply_button.setDefault(True) self.apply_button.setObjectName("apply_button") self.horizontalLayout_9.addWidget(self.apply_button) self.verticalLayout_3.addLayout(self.horizontalLayout_9) DefaultPlotSettingsWindow.setCentralWidget(self.centralwidget) self.retranslateUi(DefaultPlotSettingsWindow) self.bl_combo_a.setCurrentIndex(1) self.tr_combo_b.setCurrentIndex(3) self.bl_combo_b.setCurrentIndex(4) self.tl_combo_b.setCurrentIndex(1) QtCore.QMetaObject.connectSlotsByName(DefaultPlotSettingsWindow) def retranslateUi(self, DefaultPlotSettingsWindow): _translate = QtCore.QCoreApplication.translate DefaultPlotSettingsWindow.setWindowTitle(_translate("DefaultPlotSettingsWindow", "Properties")) self.main_label.setText(_translate("DefaultPlotSettingsWindow", "DEFAULT PLOT SETTINGS")) self.bl_enabled.setText(_translate("DefaultPlotSettingsWindow", "Enabled")) self.tl_combo_a.setItemText(0, _translate("DefaultPlotSettingsWindow", "X")) self.tl_combo_a.setItemText(1, _translate("DefaultPlotSettingsWindow", "Y")) self.tl_combo_a.setItemText(2, _translate("DefaultPlotSettingsWindow", "Z")) self.tl_combo_a.setItemText(3, _translate("DefaultPlotSettingsWindow", "PX")) self.tl_combo_a.setItemText(4, _translate("DefaultPlotSettingsWindow", "PY")) self.tl_combo_a.setItemText(5, _translate("DefaultPlotSettingsWindow", "PZ")) self.bl_combo_a.setItemText(0, _translate("DefaultPlotSettingsWindow", "X")) self.bl_combo_a.setItemText(1, _translate("DefaultPlotSettingsWindow", "Y")) self.bl_combo_a.setItemText(2, _translate("DefaultPlotSettingsWindow", "Z")) self.bl_combo_a.setItemText(3, _translate("DefaultPlotSettingsWindow", "PX")) self.bl_combo_a.setItemText(4, _translate("DefaultPlotSettingsWindow", "PY")) self.bl_combo_a.setItemText(5, _translate("DefaultPlotSettingsWindow", "PZ")) self.tl_enabled.setText(_translate("DefaultPlotSettingsWindow", "Enabled")) self.tl_label.setText(_translate("DefaultPlotSettingsWindow", "Top Left:")) self.tr_label.setText(_translate("DefaultPlotSettingsWindow", "Top Right:")) self.step_label.setText(_translate("DefaultPlotSettingsWindow", "Step #:")) self.tr_combo_b.setItemText(0, _translate("DefaultPlotSettingsWindow", "X")) self.tr_combo_b.setItemText(1, _translate("DefaultPlotSettingsWindow", "Y")) self.tr_combo_b.setItemText(2, _translate("DefaultPlotSettingsWindow", "Z")) self.tr_combo_b.setItemText(3, _translate("DefaultPlotSettingsWindow", "PX")) self.tr_combo_b.setItemText(4, _translate("DefaultPlotSettingsWindow", "PY")) self.tr_combo_b.setItemText(5, _translate("DefaultPlotSettingsWindow", "PZ")) self.bl_combo_b.setItemText(0, _translate("DefaultPlotSettingsWindow", "X")) self.bl_combo_b.setItemText(1, _translate("DefaultPlotSettingsWindow", "Y")) self.bl_combo_b.setItemText(2, _translate("DefaultPlotSettingsWindow", "Z")) self.bl_combo_b.setItemText(3, _translate("DefaultPlotSettingsWindow", "PX")) self.bl_combo_b.setItemText(4, _translate("DefaultPlotSettingsWindow", "PY")) self.bl_combo_b.setItemText(5, _translate("DefaultPlotSettingsWindow", "PZ")) self.three_d_enabled.setText(_translate("DefaultPlotSettingsWindow", "Enabled")) self.tr_combo_a.setItemText(0, _translate("DefaultPlotSettingsWindow", "X")) self.tr_combo_a.setItemText(1, _translate("DefaultPlotSettingsWindow", "Y")) self.tr_combo_a.setItemText(2, _translate("DefaultPlotSettingsWindow", "Z")) self.tr_combo_a.setItemText(3, _translate("DefaultPlotSettingsWindow", "PX")) self.tr_combo_a.setItemText(4, _translate("DefaultPlotSettingsWindow", "PY")) self.tr_combo_a.setItemText(5, _translate("DefaultPlotSettingsWindow", "PZ")) self.tl_combo_b.setItemText(0, _translate("DefaultPlotSettingsWindow", "X")) self.tl_combo_b.setItemText(1, _translate("DefaultPlotSettingsWindow", "Y")) self.tl_combo_b.setItemText(2, _translate("DefaultPlotSettingsWindow", "Z")) self.tl_combo_b.setItemText(3, _translate("DefaultPlotSettingsWindow", "PX")) self.tl_combo_b.setItemText(4, _translate("DefaultPlotSettingsWindow", "PY")) self.tl_combo_b.setItemText(5, _translate("DefaultPlotSettingsWindow", "PZ")) self.bl_label.setText(_translate("DefaultPlotSettingsWindow", "Bottom Left:")) self.three_d_label.setText(_translate("DefaultPlotSettingsWindow", "3D Plot:")) self.tr_enabled.setText(_translate("DefaultPlotSettingsWindow", "Enabled")) self.redraw_label.setText(_translate("DefaultPlotSettingsWindow", "Redraw On Selection: ")) self.redraw_enabled.setText(_translate("DefaultPlotSettingsWindow", "Enabled")) self.redraw_button.setText(_translate("DefaultPlotSettingsWindow", "Redraw")) self.cancel_button.setText(_translate("DefaultPlotSettingsWindow", "Cancel")) self.apply_button.setText(_translate("DefaultPlotSettingsWindow", "Apply"))
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,368
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/gui/plot_settings.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'gui/plot_settings.ui' # # Created by: PyQt5 UI code generator 5.5.1 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_PlotSettingsWindow(object): def setupUi(self, PlotSettingsWindow): PlotSettingsWindow.setObjectName("PlotSettingsWindow") PlotSettingsWindow.resize(317, 186) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(PlotSettingsWindow.sizePolicy().hasHeightForWidth()) PlotSettingsWindow.setSizePolicy(sizePolicy) self.centralwidget = QtWidgets.QWidget(PlotSettingsWindow) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.centralwidget.sizePolicy().hasHeightForWidth()) self.centralwidget.setSizePolicy(sizePolicy) self.centralwidget.setObjectName("centralwidget") self.verticalLayoutWidget = QtWidgets.QWidget(self.centralwidget) self.verticalLayoutWidget.setGeometry(QtCore.QRect(0, 0, 317, 183)) self.verticalLayoutWidget.setObjectName("verticalLayoutWidget") self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.verticalLayoutWidget) self.verticalLayout_3.setSpacing(0) self.verticalLayout_3.setObjectName("verticalLayout_3") self.main_label = QtWidgets.QLabel(self.verticalLayoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.main_label.sizePolicy().hasHeightForWidth()) self.main_label.setSizePolicy(sizePolicy) self.main_label.setObjectName("main_label") self.verticalLayout_3.addWidget(self.main_label, 0, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter) spacerItem = QtWidgets.QSpacerItem(20, 5, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.verticalLayout_3.addItem(spacerItem) self.gridLayout = QtWidgets.QGridLayout() self.gridLayout.setObjectName("gridLayout") self.three_d_enabled = QtWidgets.QCheckBox(self.verticalLayoutWidget) self.three_d_enabled.setFocusPolicy(QtCore.Qt.NoFocus) self.three_d_enabled.setCheckable(True) self.three_d_enabled.setObjectName("three_d_enabled") self.gridLayout.addWidget(self.three_d_enabled, 1, 1, 1, 1, QtCore.Qt.AlignLeft) self.three_d_label = QtWidgets.QLabel(self.verticalLayoutWidget) self.three_d_label.setObjectName("three_d_label") self.gridLayout.addWidget(self.three_d_label, 1, 0, 1, 1, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter) self.step_label = QtWidgets.QLabel(self.verticalLayoutWidget) self.step_label.setObjectName("step_label") self.gridLayout.addWidget(self.step_label, 0, 0, 1, 1, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter) self.step_input = QtWidgets.QSpinBox(self.verticalLayoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.step_input.sizePolicy().hasHeightForWidth()) self.step_input.setSizePolicy(sizePolicy) self.step_input.setMinimum(0) self.step_input.setMaximum(999999999) self.step_input.setObjectName("step_input") self.gridLayout.addWidget(self.step_input, 0, 1, 1, 1, QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) self.param_label = QtWidgets.QLabel(self.verticalLayoutWidget) self.param_label.setObjectName("param_label") self.gridLayout.addWidget(self.param_label, 2, 0, 1, 1, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter) self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.param_combo_a = QtWidgets.QComboBox(self.verticalLayoutWidget) self.param_combo_a.setObjectName("param_combo_a") self.param_combo_a.addItem("") self.param_combo_a.addItem("") self.param_combo_a.addItem("") self.param_combo_a.addItem("") self.param_combo_a.addItem("") self.param_combo_a.addItem("") self.horizontalLayout.addWidget(self.param_combo_a) self.param_combo_b = QtWidgets.QComboBox(self.verticalLayoutWidget) self.param_combo_b.setObjectName("param_combo_b") self.param_combo_b.addItem("") self.param_combo_b.addItem("") self.param_combo_b.addItem("") self.param_combo_b.addItem("") self.param_combo_b.addItem("") self.param_combo_b.addItem("") self.horizontalLayout.addWidget(self.param_combo_b) self.param_combo_c = QtWidgets.QComboBox(self.verticalLayoutWidget) self.param_combo_c.setEnabled(False) self.param_combo_c.setObjectName("param_combo_c") self.param_combo_c.addItem("") self.param_combo_c.addItem("") self.param_combo_c.addItem("") self.param_combo_c.addItem("") self.param_combo_c.addItem("") self.param_combo_c.addItem("") self.horizontalLayout.addWidget(self.param_combo_c) self.gridLayout.addLayout(self.horizontalLayout, 2, 1, 1, 1) self.param_enabled = QtWidgets.QCheckBox(self.verticalLayoutWidget) self.param_enabled.setChecked(True) self.param_enabled.setObjectName("param_enabled") self.gridLayout.addWidget(self.param_enabled, 3, 1, 1, 1, QtCore.Qt.AlignLeft) self.en_label = QtWidgets.QLabel(self.verticalLayoutWidget) self.en_label.setText("") self.en_label.setObjectName("en_label") self.gridLayout.addWidget(self.en_label, 3, 0, 1, 1, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter) self.verticalLayout_3.addLayout(self.gridLayout) spacerItem1 = QtWidgets.QSpacerItem(20, 10, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.verticalLayout_3.addItem(spacerItem1) self.horizontalLayout_9 = QtWidgets.QHBoxLayout() self.horizontalLayout_9.setObjectName("horizontalLayout_9") self.redraw_button = QtWidgets.QPushButton(self.verticalLayoutWidget) self.redraw_button.setObjectName("redraw_button") self.horizontalLayout_9.addWidget(self.redraw_button) spacerItem2 = QtWidgets.QSpacerItem(40, 10, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_9.addItem(spacerItem2) self.cancel_button = QtWidgets.QPushButton(self.verticalLayoutWidget) self.cancel_button.setObjectName("cancel_button") self.horizontalLayout_9.addWidget(self.cancel_button) self.apply_button = QtWidgets.QPushButton(self.verticalLayoutWidget) self.apply_button.setDefault(True) self.apply_button.setObjectName("apply_button") self.horizontalLayout_9.addWidget(self.apply_button) self.verticalLayout_3.addLayout(self.horizontalLayout_9) PlotSettingsWindow.setCentralWidget(self.centralwidget) self.retranslateUi(PlotSettingsWindow) self.param_combo_b.setCurrentIndex(1) self.param_combo_c.setCurrentIndex(2) QtCore.QMetaObject.connectSlotsByName(PlotSettingsWindow) def retranslateUi(self, PlotSettingsWindow): _translate = QtCore.QCoreApplication.translate PlotSettingsWindow.setWindowTitle(_translate("PlotSettingsWindow", "Properties")) self.main_label.setText(_translate("PlotSettingsWindow", "PLOT SETTINGS")) self.three_d_enabled.setText(_translate("PlotSettingsWindow", "Enabled")) self.three_d_label.setText(_translate("PlotSettingsWindow", "3D")) self.step_label.setText(_translate("PlotSettingsWindow", "Step #:")) self.param_label.setText(_translate("PlotSettingsWindow", "Parameters")) self.param_combo_a.setItemText(0, _translate("PlotSettingsWindow", "X")) self.param_combo_a.setItemText(1, _translate("PlotSettingsWindow", "Y")) self.param_combo_a.setItemText(2, _translate("PlotSettingsWindow", "Z")) self.param_combo_a.setItemText(3, _translate("PlotSettingsWindow", "PX")) self.param_combo_a.setItemText(4, _translate("PlotSettingsWindow", "PY")) self.param_combo_a.setItemText(5, _translate("PlotSettingsWindow", "PZ")) self.param_combo_b.setItemText(0, _translate("PlotSettingsWindow", "X")) self.param_combo_b.setItemText(1, _translate("PlotSettingsWindow", "Y")) self.param_combo_b.setItemText(2, _translate("PlotSettingsWindow", "Z")) self.param_combo_b.setItemText(3, _translate("PlotSettingsWindow", "PX")) self.param_combo_b.setItemText(4, _translate("PlotSettingsWindow", "PY")) self.param_combo_b.setItemText(5, _translate("PlotSettingsWindow", "PZ")) self.param_combo_c.setItemText(0, _translate("PlotSettingsWindow", "X")) self.param_combo_c.setItemText(1, _translate("PlotSettingsWindow", "Y")) self.param_combo_c.setItemText(2, _translate("PlotSettingsWindow", "Z")) self.param_combo_c.setItemText(3, _translate("PlotSettingsWindow", "PX")) self.param_combo_c.setItemText(4, _translate("PlotSettingsWindow", "PY")) self.param_combo_c.setItemText(5, _translate("PlotSettingsWindow", "PZ")) self.param_enabled.setText(_translate("PlotSettingsWindow", "Enabled")) self.redraw_button.setText(_translate("PlotSettingsWindow", "Redraw")) self.cancel_button.setText(_translate("PlotSettingsWindow", "Cancel")) self.apply_button.setText(_translate("PlotSettingsWindow", "Apply"))
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,369
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor/drivers/OPALDriver/OPALDriver.py
import h5py from dans_pymodules import IonSpecies class OPALDriver: def __init__(self, debug=False): self._debug = debug self._program_name = "OPAL" def get_program_name(self): return self._program_name def import_data(self, filename): if self._debug: print("Importing data from program: {}".format(self._program_name)) if h5py.is_hdf5(filename): if self._debug: print("Opening h5 file..."), _datasource = h5py.File(filename) if self._debug: print("Done!") if "OPAL_version" in _datasource.attrs.keys(): data = {"datasource": _datasource} if self._debug: print("Loading dataset from h5 file in OPAL format.") data["nsteps"] = len(_datasource.items()) if self._debug: print("Found {} steps in the file.".format(data["nsteps"])) _data = _datasource.get("Step#0") # TODO: OPAL apparently doesn't save the charge per particle, but per macroparticle without frequency, # TODO: we have no way of telling what the species is! Add manual input. And maybe fix OPAL... -DW data["ion"] = IonSpecies("proton", _data.attrs["ENERGY"]) data["current"] = 0.0 # TODO: Get actual current! -DW data["npart"] = len(_data.get("x").value) return data return None def export_data(self, data): if self._debug: print("Exporting data for program: {}".format(self._program_name)) print("Export not yet implemented :(") return data
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,370
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/gui/__init__.py
from py_particle_processor_qt.gui import *
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,371
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py
from py_particle_processor_qt.drivers.COMSOLDriver.COMSOLDriver import *
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,372
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/tools/RotateTool/RotateTool.py
from ..abstract_tool import AbstractTool from .rotatetoolgui import Ui_RotateToolGUI from PyQt5 import QtGui import numpy as np class RotateTool(AbstractTool): def __init__(self, parent): super(RotateTool, self).__init__(parent) self._name = "Rotate Tool" self._parent = parent # --- Initialize the GUI --- # self._rotateToolWindow = QtGui.QMainWindow() self._rotateToolGUI = Ui_RotateToolGUI() self._rotateToolGUI.setupUi(self._rotateToolWindow) self._rotateToolGUI.apply_button.clicked.connect(self.callback_apply) self._rotateToolGUI.cancel_button.clicked.connect(self.callback_cancel) self._has_gui = True self._need_selection = True self._min_selections = 1 self._max_selections = None self._redraw_on_exit = True self._angle = 0.0 # --- Required Functions --- # def run(self): # --- Calculate the positions to center the window --- # screen_size = self._parent.screen_size() _x = 0.5 * (screen_size.width() - self._rotateToolWindow.width()) _y = 0.5 * (screen_size.height() - self._rotateToolWindow.height()) # --- Show the GUI --- # self._rotateToolWindow.show() self._rotateToolWindow.move(_x, _y) # --- GUI-related Functions --- # def open_gui(self): self.run() def close_gui(self): self._rotateToolWindow.close() def callback_apply(self): if self.apply() == 0: self._redraw() self.close_gui() def callback_cancel(self): self.close_gui() # --- Tool-related Functions --- # def check(self): value = self._rotateToolGUI.value v_txt = value.text() if len(v_txt) == 0: value.setStyleSheet("color: #000000") try: self._angle = float(v_txt) value.setStyleSheet("color: #000000") except ValueError: # Set the text color to red value.setStyleSheet("color: #FF0000") def apply(self): self.check() # TODO: Radians? self._angle = np.deg2rad(self._angle) rotation_matrix = np.array([[np.cos(self._angle), -np.sin(self._angle), 0.0], [np.sin(self._angle), np.cos(self._angle), 0.0], [0.0, 0.0, 1.0]]) for dataset in self._selections: datasource = dataset.get_datasource() nsteps, npart = dataset.get_nsteps(), dataset.get_npart() for step in range(nsteps): for part in range(npart): position, momentum = np.array([0.0, 0.0, 0.0]), np.array([0.0, 0.0, 0.0]) for i, v in enumerate(["x", "y", "z"]): position[i] = datasource["Step#{}".format(step)][v][part] for i, v in enumerate(["px", "py", "pz"]): momentum[i] = datasource["Step#{}".format(step)][v][part] rot_position = np.matmul(rotation_matrix, position) rot_momentum = np.matmul(rotation_matrix, momentum) for i, v in enumerate(["x", "y", "z"]): datasource["Step#{}".format(step)][v][part] = float(rot_position[i]) for i, v in enumerate(["px", "py", "pz"]): datasource["Step#{}".format(step)][v][part] = float(rot_momentum[i]) return 0
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,373
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py
from ..abstract_tool import AbstractTool from .scaletoolgui import Ui_ScaleToolGUI from PyQt5 import QtGui class ScaleTool(AbstractTool): def __init__(self, parent): super(ScaleTool, self).__init__(parent) self._name = "Scale Tool" self._parent = parent # --- Initialize the GUI --- # self._scaleToolWindow = QtGui.QMainWindow() self._scaleToolGUI = Ui_ScaleToolGUI() self._scaleToolGUI.setupUi(self._scaleToolWindow) self._scaleToolGUI.apply_button.clicked.connect(self.callback_apply) self._scaleToolGUI.cancel_button.clicked.connect(self.callback_cancel) self._scaleToolGUI.scaling_factor.textChanged.connect(self.check_scaling_factor) self._has_gui = True self._need_selection = True self._min_selections = 1 self._max_selections = None self._redraw_on_exit = True # --- Required Functions --- # def run(self): # --- Calculate the positions to center the window --- # screen_size = self._parent.screen_size() _x = 0.5 * (screen_size.width() - self._scaleToolWindow.width()) _y = 0.5 * (screen_size.height() - self._scaleToolWindow.height()) # --- Show the GUI --- # self._scaleToolWindow.show() self._scaleToolWindow.move(_x, _y) # --- GUI-related Functions --- # def open_gui(self): self.run() def close_gui(self): self._scaleToolWindow.close() def callback_apply(self): if self.apply() == 0: self._redraw() self.close_gui() def callback_cancel(self): self.close_gui() # --- Tool-related Functions --- # def check_scaling_factor(self): scale_txt = self._scaleToolGUI.scaling_factor.text() if len(scale_txt) == 0: self._scaleToolGUI.scaling_factor.setStyleSheet("color: #000000") return None try: value = float(scale_txt) # Try to convert the input to a float self._scaleToolGUI.scaling_factor.setStyleSheet("color: #000000") return value except ValueError: # Set the text color to red self._scaleToolGUI.scaling_factor.setStyleSheet("color: #FF0000") return None def apply(self): prop_txt = self._scaleToolGUI.parameter_combo.currentText() scaling_factor = self.check_scaling_factor() if scaling_factor is None: return 1 # Let's do this on a text basis instead of inferring from the indices properties = [t.rstrip(",").lower() for t in prop_txt.split(" ") if "(" not in t] for dataset in self._selections: datasource = dataset.get_datasource() nsteps, npart = dataset.get_nsteps(), dataset.get_npart() for step in range(nsteps): for part in range(npart): for prop in properties: datasource["Step#{}".format(step)][prop][part] *= scaling_factor return 0
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,374
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'rotatetoolgui.ui' # # Created by: PyQt5 UI code generator 5.5.1 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_RotateToolGUI(object): def setupUi(self, RotateToolGUI): RotateToolGUI.setObjectName("RotateToolGUI") RotateToolGUI.resize(257, 125) self.centralwidget = QtWidgets.QWidget(RotateToolGUI) self.centralwidget.setObjectName("centralwidget") self.verticalLayoutWidget = QtWidgets.QWidget(self.centralwidget) self.verticalLayoutWidget.setGeometry(QtCore.QRect(0, 0, 254, 122)) self.verticalLayoutWidget.setObjectName("verticalLayoutWidget") self.verticalLayout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget) self.verticalLayout.setObjectName("verticalLayout") self.label = QtWidgets.QLabel(self.verticalLayoutWidget) self.label.setObjectName("label") self.verticalLayout.addWidget(self.label, 0, QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter) self.gridLayout = QtWidgets.QGridLayout() self.gridLayout.setObjectName("gridLayout") self.type_label = QtWidgets.QLabel(self.verticalLayoutWidget) self.type_label.setObjectName("type_label") self.gridLayout.addWidget(self.type_label, 0, 0, 1, 1) self.value_label = QtWidgets.QLabel(self.verticalLayoutWidget) self.value_label.setObjectName("value_label") self.gridLayout.addWidget(self.value_label, 1, 0, 1, 1) self.type_combo = QtWidgets.QComboBox(self.verticalLayoutWidget) self.type_combo.setObjectName("type_combo") self.type_combo.addItem("") self.gridLayout.addWidget(self.type_combo, 0, 1, 1, 1) self.value = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.value.setText("") self.value.setObjectName("value") self.gridLayout.addWidget(self.value, 1, 1, 1, 1) self.verticalLayout.addLayout(self.gridLayout) self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.cancel_button = QtWidgets.QPushButton(self.verticalLayoutWidget) self.cancel_button.setObjectName("cancel_button") self.horizontalLayout.addWidget(self.cancel_button) self.apply_button = QtWidgets.QPushButton(self.verticalLayoutWidget) self.apply_button.setDefault(True) self.apply_button.setObjectName("apply_button") self.horizontalLayout.addWidget(self.apply_button) self.verticalLayout.addLayout(self.horizontalLayout) RotateToolGUI.setCentralWidget(self.centralwidget) self.retranslateUi(RotateToolGUI) QtCore.QMetaObject.connectSlotsByName(RotateToolGUI) def retranslateUi(self, RotateToolGUI): _translate = QtCore.QCoreApplication.translate RotateToolGUI.setWindowTitle(_translate("RotateToolGUI", "Scale Tool")) self.label.setText(_translate("RotateToolGUI", "Rotate Tool")) self.type_label.setText(_translate("RotateToolGUI", "Type:")) self.value_label.setText(_translate("RotateToolGUI", "Value")) self.type_combo.setItemText(0, _translate("RotateToolGUI", "Degrees")) self.value.setPlaceholderText(_translate("RotateToolGUI", "1.0")) self.cancel_button.setText(_translate("RotateToolGUI", "Cancel")) self.apply_button.setText(_translate("RotateToolGUI", "Apply"))
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,375
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/tools/ScaleTool/__init__.py
from py_particle_processor_qt.tools.ScaleTool.ScaleTool import *
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,376
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor/drivers/TraceWinDriver/__init__.py
from TraceWinDriver import *
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,377
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/py_particle_processor_qt.py
from py_particle_processor_qt.dataset import * from py_particle_processor_qt.gui.main_window import * from py_particle_processor_qt.gui.species_prompt import * from py_particle_processor_qt.plotting import * from py_particle_processor_qt.generator import * from py_particle_processor_qt.tools import * from PyQt5.QtWidgets import qApp, QFileDialog # from dans_pymodules import MyColors __author__ = "Philip Weigel, Daniel Winklehner" __doc__ = """A QT5 based GUI that allows loading particle data from various simulation codes and exporting them for various other simulation codes. """ class ParticleFile(object): """ This object will contain a list of datasets and some attributes for easier handling. """ # __slots__ = ("_filename", "_driver", "_debug", "_datasets", "_selected", "_index", "_parent") def __init__(self, filename, driver, index, load_type, debug=False, **kwargs): self._filename = filename self._driver = driver self._debug = debug self._datasets = [] self._index = index self._load_type = load_type self._parent = kwargs.get("parent") self._c_i = kwargs.get("color_index") self._name = "" self._datasets_to_load = 1 # TODO: Multispecies self._prompt = None def add_dataset(self, dataset): self._datasets.append(dataset) def dataset_count(self): return len(self._datasets) def datasets(self): return self._datasets def filename(self): return self._filename def get_dataset(self, index): return self._datasets[index] def index(self): return self._index def load(self, load_index=0, species=None, name=None): # datasets_to_load = 1 # for i in range(datasets_to_load): # _ds = Dataset(indices=(self._index, i), debug=self._debug) # _ds.load_from_file(filename=self._filename, driver=self._driver) # _ds.assign_color(c_i) # c_i += 1 # self._datasets.append(_ds) if load_index == self._datasets_to_load: # self._prompt = None if self._load_type == "add": self._parent.loaded_add_df(self) elif self._load_type == "new": self._parent.loaded_new_df(self) return 0 elif load_index < self._datasets_to_load: if species is None: self._prompt = SpeciesPrompt(parent=self) self._prompt.run() else: self.species_callback(None, species, name) return 0 else: return 1 def species_callback(self, prompt, species, name="batch"): if prompt is not None: prompt.close() _ds = Dataset(indices=(self._index, len(self._datasets)), debug=self._debug, species=species) _ds.load_from_file(filename=self._filename, driver=self._driver, name=name) _ds.assign_color(self._c_i) self._c_i += 1 self._datasets.append(_ds) self.load(load_index=len(self._datasets)) def remove_dataset(self, selection): # if type(selection) is int: if isinstance(selection, int): del self._datasets[selection] # elif type(selection) is Dataset: elif isinstance(selection, Dataset): self._datasets.remove(selection) return 0 def screen_size(self): return self._parent.screen_size() def set_dataset(self, index, dataset): self._datasets[index] = dataset def set_index(self, index): self._index = index # TODO class FieldFile(object): def __init__(self, filename, driver, index, debug=False): self._filename = filename self._driver = driver self._index = index self._debug = debug def filename(self): return self._filename def index(self): return self._index def load(self): pass def save(self): pass class SpeciesPrompt(object): def __init__(self, parent): self._parent = parent self._window = QtGui.QMainWindow() self._windowGUI = Ui_SpeciesPrompt() self._windowGUI.setupUi(self._window) self._windowGUI.apply_button.clicked.connect(self.apply) for preset_name in sorted(presets.keys()): self._windowGUI.species_selection.addItem(preset_name) def apply(self): preset_name = self._windowGUI.species_selection.currentText() name = self._windowGUI.dataset_name.text() print("SpeciesPrompt.apply: name = {}".format(name)) species = IonSpecies(preset_name, energy_mev=1.0) # TODO: Energy? -PW self._parent.species_callback(self, species=species, name=name) def close(self): self._window.close() return 0 def run(self): # --- Calculate the positions to center the window --- # screen_size = self._parent.screen_size() _x = 0.5 * (screen_size.width() - self._window.width()) _y = 0.5 * (screen_size.height() - self._window.height()) # --- Show the GUI --- # self._window.show() self._window.move(_x, _y) class PyParticleProcessor(object): def __init__(self, debug=False): """ Initialize the GUI """ self._app = QtGui.QApplication([]) # Initialize the application self._app.setStyle('Fusion') # Apply a GUI style self._debug = debug self._ci = 0 # A color index for datasets self._datafiles = [] # Container for holding the datasets self._datafile_buffer = [] # Buffer used to hold datafiles in memory while loading self._selections = [] # Temporary dataset selections self._last_path = "" # Stores the last path from loading/saving files # --- Load the GUI from XML file and initialize connections --- # self._mainWindow = QtGui.QMainWindow() self._mainWindowGUI = Ui_MainWindow() self._mainWindowGUI.setupUi(self._mainWindow) # --- Get some widgets from the builder --- # self._tabs = self._mainWindowGUI.tabWidget self._tabs.currentChanged.connect(self.callback_tab_change) self._status_bar = self._mainWindowGUI.statusBar self._treewidget = self._mainWindowGUI.treeWidget self._treewidget.itemClicked.connect(self.treewidget_clicked) self._properties_select = self._mainWindowGUI.properties_combo self._properties_select.__setattr__("data_objects", []) self._properties_table = self._mainWindowGUI.properties_table self._properties_label = self._mainWindowGUI.properties_label self._properties_table.setHorizontalHeaderLabels(["Property", "Value"]) self._properties_table.__setattr__("data", None) # The currently selected data self._properties_label.setText("Properties") self._menubar = self._mainWindowGUI.menuBar self._menubar.setNativeMenuBar(False) # This is needed to make the menu bar actually appear -PW # --- Connections --- # self._mainWindowGUI.actionQuit.triggered.connect(self.main_quit) self._mainWindowGUI.actionImport_New.triggered.connect(self.callback_load_new_ds) self._mainWindowGUI.actionImport_Add.triggered.connect(self.callback_load_add_ds) self._mainWindowGUI.actionRemove.triggered.connect(self.callback_delete_ds) self._mainWindowGUI.actionAnalyze.triggered.connect(self.callback_analyze) # self._mainWindowGUI.actionPlot.triggered.connect(self.callback_plot) self._mainWindowGUI.actionGenerate.triggered.connect(self.callback_generate) self._mainWindowGUI.actionExport_For.triggered.connect(self.callback_export) self._properties_table.cellChanged.connect(self.callback_table_item_changed) self._properties_select.currentIndexChanged.connect(self.callback_properties_select) # --- Populate the Tools Menu --- # self._tools_menu = self._mainWindowGUI.menuTools self._current_tool = None for tool_name, tool_object in sorted(tool_mapping.items()): action = QtWidgets.QAction(self._mainWindow) action.setText(tool_object[0]) action.setObjectName(tool_name) # noinspection PyUnresolvedReferences action.triggered.connect(self.callback_tool_action) self._tools_menu.addAction(action) # --- Resize the columns in the treewidget --- # for i in range(self._treewidget.columnCount()): self._treewidget.resizeColumnToContents(i) # --- Initial population of the properties table --- # self._property_list = ["name", "steps", "particles", "mass", "energy", "charge", "current"] self._units_list = [None, None, None, "amu", "MeV", "e", "A"] self._properties_table.setRowCount(len(self._property_list)) # --- Do some plot manager stuff --- # self._plot_manager = PlotManager(self) self._mainWindowGUI.actionRedraw.triggered.connect(self._plot_manager.redraw_plot) self._mainWindowGUI.actionNew_Plot.triggered.connect(self._plot_manager.new_plot) self._mainWindowGUI.actionModify_Plot.triggered.connect(self._plot_manager.modify_plot) self._mainWindowGUI.actionRemove_Plot.triggered.connect(self._plot_manager.remove_plot) # Store generator information self._gen = GeneratorGUI(self) self._gen_data = {} # Go through each property in the list for idx, item in enumerate(self._property_list): p_string = item.title() # Create a string from the property name if self._units_list[idx] is not None: # Check if the unit is not None p_string += " (" + self._units_list[idx] + ")" # Add the unit to the property string p = QtGui.QTableWidgetItem(p_string) # Create a new item with the property string p.setFlags(QtCore.Qt.NoItemFlags) # Disable all item flags self._properties_table.setItem(idx, 0, p) # Set the item to the corresponding row (first column) v = QtGui.QTableWidgetItem("") # Create a blank item to be a value placeholder v.setFlags(QtCore.Qt.NoItemFlags) # Disable all item flags self._properties_table.setItem(idx, 1, v) # Set the item to the corresponding row (second column) def add_generated_dataset(self, data, settings): filename, driver = self.get_filename(action='save') # Get a filename and driver df_i = len(self._datafiles) new_df = ParticleFile(filename=filename, driver=driver, index=df_i, load_type="add", parent=self) dataset = Dataset(indices=(df_i, 0), data=data, species=IonSpecies(name=settings["species"], energy_mev=float(settings["energy"]))) # We need a better way to do this -PW dataset.set_property("name", "Generated Dataset") # dataset.set_property("ion", IonSpecies(name=settings["species"], energy_mev=float(settings["energy"]))) dataset.set_property("steps", 1) dataset.set_property("particles", int(settings["numpart"])) dataset.set_property("curstep", 0) dataset.assign_color(1) dataset.export_to_file(filename=filename, driver=driver) new_df.add_dataset(dataset=dataset) self._datafiles.append(new_df) top_level_item = QtGui.QTreeWidgetItem(self._treewidget) # Create the top level item for the datafile top_level_item.setText(0, "") # Selection box top_level_item.setText(1, "{}".format(df_i)) # Display the id of the datafile top_level_item.setText(2, self._datafiles[-1].filename()) # Display the filename top_level_item.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsUserCheckable) # Set item flags top_level_item.setCheckState(0, QtCore.Qt.Unchecked) # Set the datafile to be unchecked by default self._properties_select.addItem("Datafile {}".format(df_i)) # Add an item to the property selection number_of_datasets = new_df.dataset_count() # For now, assume there exists only one dataset for ds_i in range(number_of_datasets): # Loop through each dataset child_item = QtGui.QTreeWidgetItem(top_level_item) # Create a child item for the dataset child_item.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsUserCheckable) # Set item flags child_item.setCheckState(0, QtCore.Qt.Unchecked) # Set the dataset to be unchecked by default self.add_tree_item(df_i, ds_i) # Update the tree item with those indices # Add an item to the property selection self._properties_select.addItem("Datafile {}, Dataset {}".format(df_i, ds_i)) # Conditional to check if there's only one dataset if number_of_datasets == 1: if not self._plot_manager.has_default_plot_settings(): # If the default plot settings aren't set... self._plot_manager.default_plot_settings() # Open the default plot settings GUI # If you want the dataset to automatically be unselected child_item.setCheckState(0, QtCore.Qt.Unchecked) # If you want the dataset to automatically be selected # child_item.setCheckState(0, QtCore.Qt.Checked) # self._selections.append("{}-{}".format(df_i, ds_i)) top_level_item.setExpanded(True) # Expand the tree widget for i in range(self._treewidget.columnCount()): # Resize the columns of the tree self._treewidget.resizeColumnToContents(i) def add_to_properties_selection(self, datafile): self._properties_select.addItem("Datafile {}".format(datafile.index())) self._properties_select.data_objects.append(datafile) for index, dataset in enumerate(datafile.datasets()): self._properties_select.addItem("Datafile {}, Dataset {}".format(datafile.index(), index)) self._properties_select.data_objects.append(dataset) def callback_about_program(self, menu_item): """ :param menu_item: :return: """ if self._debug: print("DEBUG: About Dialog called by {}".format(menu_item)) return 0 def callback_analyze(self): print("Not implemented yet!") for dataset in self._selections: for i in range(dataset.get_npart()): print(dataset.get("x")[i]) print(dataset.get("y")[i]) print(dataset.get("r")[i]) print(dataset.get("px")[i]) print(dataset.get("py")[i]) return 0 def callback_delete_ds(self): """ Callback for Delete Dataset... button :return: """ if self._debug: print("DEBUG: delete_ds_callback was called") if len(self._selections) < 1: # Check to make sure something was selected to remove msg = "You must select something to remove." print(msg) self.send_status(msg) redraw_flag = False # Set a redraw flag to False root = self._treewidget.invisibleRootItem() # Find the root item for selection in self._selections: redraw_flag = True if selection in self._properties_select.data_objects: index = self._properties_select.data_objects.index(selection) self._properties_select.removeItem(index) self._properties_select.data_objects.remove(selection) # if type(selection) is ParticleFile or type(selection) is FieldFile: if isinstance(selection, (ParticleFile, FieldFile)): del self._datafiles[selection.index()] item = self._treewidget.topLevelItem(selection.index()) (item.parent() or root).removeChild(item) if len(self._properties_select.data_objects[index:]) > 0: # while type(self._properties_select.data_objects[index]) is Dataset: while isinstance(self._properties_select.data_objects[index], Dataset): print(self._properties_select.data_objects[index].indices()) self._properties_select.removeItem(index) del self._properties_select.data_objects[index] if index == len(self._properties_select.data_objects): break # elif type(selection) is Dataset: elif isinstance(selection, Dataset): self._plot_manager.remove_dataset(selection) parent_index = selection.indices()[0] child_index = selection.indices()[1] self._datafiles[parent_index].remove_dataset(selection) item = self._treewidget.topLevelItem(parent_index).child(child_index) (item.parent() or root).removeChild(item) self._selections = [] if redraw_flag: # If the redraw flag was set, redraw the plot self.refresh_data() self.clear_properties_table() self._plot_manager.redraw_plot() return 0 def callback_export(self): if self._debug: "DEBUG: export_callback called" # TODO: This should make sure we're selecting a dataset vs. datafile if len(self._selections) == 0: # Check to see if no datasets were selected msg = "No dataset was selected!" print(msg) self.send_status(msg) return 1 elif len(self._selections) > 1: # Check to see if too many datasets were selected msg = "You cannot select more than one dataset!" print(msg) self.send_status(msg) return 1 filename, driver = self.get_filename(action='save') # Get a filename and driver if (filename, driver) == (None, None): return 0 selection = self._selections[0] selection.export_to_file(filename=filename, driver=driver) print("Export complete!") self.send_status("Export complete!") return 0 def callback_load_add_ds(self, widget): """ Callback for Add Dataset... button :return: """ batch = False if self._debug: print("DEBUG: load_add_ds_callback was called with widget {}".format(widget)) filenames, driver = self.get_filename(action="open") # Get a filename and driver if filenames is None: # Return if no file was selected return 1 if len(filenames) > 1: batch = True self.send_status("Loading file with driver: {}".format(driver)) # Create a new datafile with the supplied parameters for filename in filenames: # Create a new datafile with the supplied parameters new_df = ParticleFile(filename=filename, driver=driver, index=0, load_type="add", debug=self._debug, parent=self, color_index=self._ci) if not batch: new_df.load() else: species = self._datafiles[0].datasets()[0].get_property("ion") name = os.path.splitext(os.path.split(filename)[1])[0] new_df.load(species=species, name=name) self._datafile_buffer.append(new_df) return 0 def loaded_add_df(self, new_df): # If the loading of the datafile is successful... self._datafiles.append(new_df) # Add the datafile to the list self._datafile_buffer.remove(new_df) # Remove the datafile from the buffer df_i = len(self._datafiles) - 1 # Since it's the latest datafile, it's the last index self._ci += new_df.dataset_count() # TODO: Is this right? top_level_item = QtGui.QTreeWidgetItem(self._treewidget) # Create the top level item for the datafile top_level_item.setText(0, "") # Selection box top_level_item.setText(1, "{}".format(df_i)) # Display the id of the datafile top_level_item.setText(2, self._datafiles[-1].filename()) # Display the filename top_level_item.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsUserCheckable) # Set item flags top_level_item.setCheckState(0, QtCore.Qt.Unchecked) # Set the datafile to be unchecked by default # self._properties_select.addItem("Datafile {}".format(df_i)) # Add an item to the property selection for ds_i in range(new_df.dataset_count()): # Loop through each dataset child_item = QtGui.QTreeWidgetItem(top_level_item) # Create a child item for the dataset child_item.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsUserCheckable) # Set item flags child_item.setCheckState(0, QtCore.Qt.Unchecked) # Set the dataset to be unchecked by default self.add_tree_item(df_i, ds_i) # Update the tree item with those indices # Add an item to the property selection # self._properties_select.addItem("Datafile {}, Dataset {}".format(df_i, ds_i)) # Conditional to check if there's only one dataset if new_df.dataset_count() == 1: if not self._plot_manager.has_default_plot_settings(): # If the default plot settings aren't set... self._plot_manager.default_plot_settings() # Open the default plot settings GUI # If you want the dataset to automatically be unselected child_item.setCheckState(0, QtCore.Qt.Unchecked) # If you want the dataset to automatically be selected # child_item.setCheckState(0, QtCore.Qt.Checked) # self._selections.append("{}-{}".format(df_i, ds_i)) self.add_to_properties_selection(new_df) top_level_item.setExpanded(True) # Expand the tree widget for i in range(self._treewidget.columnCount()): # Resize the columns of the tree self._treewidget.resizeColumnToContents(i) self.send_status("File loaded successfully!") return 0 def callback_load_new_ds(self): """ Callback for Load Dataset... button :return: """ if self._debug: print("DEBUG: load_new_ds_callback was called.") filenames, driver = self.get_filename(action="open") # Get a filename and driver if filenames is None: # Return if no file was selected return 1 self.send_status("Loading file with driver: {}".format(driver)) # Create a new datafile with the supplied parameters new_df = ParticleFile(filename=filenames[0], driver=driver, index=0, load_type="new", debug=self._debug, parent=self, color_index=self._ci) new_df.load() self._datafile_buffer.append(new_df) return 0 def loaded_new_df(self, new_df): # If the loading of the datafile is successful... self._datafiles = [new_df] # Set the list of datafiles to just this one self._datafile_buffer.remove(new_df) # Remove the datafile from the buffer df_i = 0 # Since it's the only datafile, it's the zeroth index self._ci += new_df.dataset_count() # TODO: Is this right? top_level_item = QtGui.QTreeWidgetItem(self._treewidget) # Create the top level item for the datafile top_level_item.setText(0, "") # Selection box top_level_item.setText(1, "{}".format(df_i)) # Display the id of the datafile top_level_item.setText(2, self._datafiles[-1].filename()) # Display the filename top_level_item.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsUserCheckable) # Set item flags top_level_item.setCheckState(0, QtCore.Qt.Unchecked) # Set the datafile to be unchecked by default # self._properties_select.addItem("Datafile {}".format(df_i)) # Add an item to the property selection number_of_datasets = 1 # For now, assume there exists only one dataset for ds_i in range(number_of_datasets): # Loop through each dataset child_item = QtGui.QTreeWidgetItem(top_level_item) # Create a child item for the dataset child_item.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsUserCheckable) # Set item flags child_item.setCheckState(0, QtCore.Qt.Unchecked) # Set the dataset to be unchecked by default self.add_tree_item(df_i, ds_i) # Update the tree item with those indices # Add an item to the property selection # self._properties_select.addItem("Datafile {}, Dataset {}".format(df_i, ds_i)) # Conditional to check if there's only one dataset if number_of_datasets == 1: if not self._plot_manager.has_default_plot_settings(): # If the default plot settings aren't set... self._plot_manager.default_plot_settings() # Open the default plot settings GUI # If you want the dataset to automatically be unselected child_item.setCheckState(0, QtCore.Qt.Unchecked) # If you want the dataset to automatically be selected # child_item.setCheckState(0, QtCore.Qt.Checked) # self._selections.append("{}-{}".format(df_i, ds_i)) self.add_to_properties_selection(new_df) top_level_item.setExpanded(True) # Expand the tree widget for i in range(self._treewidget.columnCount()): # Resize the columns of the tree self._treewidget.resizeColumnToContents(i) self.send_status("File loaded successfully!") # def callback_plot(self): # # Called when the "Plot..." Button is pressed # # if self._debug: # "DEBUG: callback_plot called" # # if self._tabs.currentIndex() == 0: # Check to see if it's the default plot tab # self._plot_manager.default_plot_settings(redraw=True) # Open the default plot settings # elif self._tabs.currentIndex() > 1: # Check to see if it's after the text tab # self._plot_manager.plot_settings() # Open the plot settings # # return 0 def callback_generate(self): # Called when the "Generate..." button is pressed self._gen.run() # self._gen_data = self._gen.data # self.add_generated_data_set(self._gen.data) def callback_properties_select(self, index): # Get the text from the selected item in the properties selection txt = [item.rstrip(",") for item in self._properties_select.itemText(index).split()] # Format: "Datafile {}, Dataset {}" or "Datafile {}" if len(txt) == 4: # If there are 4 items, it's a dataset df_i, ds_i = int(txt[1]), int(txt[3]) # Get the corresponding indices dataset = self.find_dataset(df_i, ds_i) # Get the dataset self._properties_table.data = dataset # Set the table's data property self.populate_properties_table(dataset) # Populate the properties table with the dataset info return 0 elif len(txt) == 2: # If there are two items, it's a datafile df_i, ds_i = int(txt[1]), None # Get the datafile index datafile = self._datafiles[df_i] # Get the datafile object self._properties_table.data = datafile self.populate_properties_table(datafile) # Populate the properties table with datafile info return 0 elif index == -1: # Check if the index is -1 # This happens when there are no more datasets return 0 else: # This can only happen when something on the backend isn't working right print("Something went wrong!") return 1 def callback_tab_change(self): current_index = self._tabs.currentIndex() current_plot_objects = self._plot_manager.get_plot_object(current_index) redraw = False for plot_object in current_plot_objects: for selection in self._selections: # if type(selection) is Dataset: if isinstance(selection, Dataset): if selection not in plot_object.datasets(): plot_object.add_dataset(selection) redraw = True if redraw: self._plot_manager.redraw_plot() return 0 def callback_table_item_changed(self): v = self._properties_table.currentItem() # Find the current item that was changed # Filter out some meaningless things that could call this function if v is None or v.text == "": return 0 data = self._properties_table.data # Get the datafile and dataset ids from the table # Filter out the condition that the program is just starting and populating the table if data is None: return 0 # TODO: This might trigger a problem if a datafile is selected idx = self._properties_table.currentRow() # Find the row of the value that was changed try: if idx != 0: value = float(v.text()) # Try to convert the input to a float v.setText(str(value)) # Reset the text of the table item to what was just set data.set_property(self._property_list[idx], value) # Set the property of the dataset else: if self._debug: print("Changing dataset name") value = v.text() data.set_property(self._property_list[idx], value) # Set the name of the dataset self.refresh_data(properties=False) v.setForeground(QtGui.QBrush(QtGui.QColor("#FFFFFF"))) # If all this worked, then set the text color return 0 except ValueError: # ds.set_property(self._property_list[idx], None) # Set the dataset property to None v.setForeground(QtGui.QBrush(QtGui.QColor("#FF0000"))) # Set the text color to red return 1 def callback_tool_action(self): sender = self._mainWindow.sender() name = sender.objectName() datasets = [] for selection in self._selections: # if type(selection) is Dataset: if isinstance(selection, Dataset): datasets.append(selection) tool_object = tool_mapping[name][1] self._current_tool = tool_object(parent=self) self._current_tool.set_selections(datasets) if self._current_tool.redraw_on_exit(): self._current_tool.set_plot_manager(self._plot_manager) if self._current_tool.check_requirements() == 0: self._current_tool.open_gui() def clear_properties_table(self): self._properties_table.setCurrentItem(None) # Set the current item to None self._properties_table.data = None # Clear the data property self._properties_label.setText("Properties") # Set the label for idx in range(len(self._property_list)): # Loop through each row v = QtGui.QTableWidgetItem("") # Create a placeholder item v.setFlags(QtCore.Qt.NoItemFlags) # Disable item flags self._properties_table.setItem(idx, 1, v) # Add the item to the table return 0 def find_dataset(self, datafile_id, dataset_id): return self._datafiles[datafile_id].get_dataset(dataset_id) # Return the dataset object given the indices def get_default_graphics_views(self): # Return a tuple of the graphics views from the default plots tab default_gv = (self._mainWindowGUI.graphicsView_1, self._mainWindowGUI.graphicsView_2, self._mainWindowGUI.graphicsView_3, self._mainWindowGUI.graphicsView_4) return default_gv def get_filename(self, action="open"): filename, filetype = "", "" # Format the filetypes selection first_flag1 = True filetypes_text = "" for key in sorted(driver_mapping.keys()): if len(driver_mapping[key]["extensions"]) > 0: if first_flag1: filetypes_text += "{} Files (".format(key) first_flag1 = False else: filetypes_text += ";;{} Files (".format(key) first_flag2 = True for extension in driver_mapping[key]["extensions"]: if first_flag2: filetypes_text += "*{}".format(extension) first_flag2 = False else: filetypes_text += " *{}".format(extension) filetypes_text += ")" # Create the file dialog options options = QFileDialog.Options() options |= QFileDialog.DontUseNativeDialog if action == "open": # For opening a file filenames, filetype = QFileDialog.getOpenFileNames(self._mainWindow, caption="Import dataset...", directory=self._last_path, filter=filetypes_text, options=options) if len(filenames) == 0 or filetype == "": filenames, driver = None, None return filenames, driver assert len(np.unique(np.array([os.path.splitext(_fn)[1] for _fn in filenames]))) == 1, \ "For batch selection, all filenames have to have the same extension!" driver = filetype.split("Files")[0].strip() # Get the driver from the filetype return filenames, driver elif action == "save": # For saving a file filename, filetype = QFileDialog.getSaveFileName(self._mainWindow, caption="Export dataset...", directory=self._last_path, filter=filetypes_text, options=options) if filename == "" or filetype == "": filename, driver = None, None return filename, driver driver = filetype.split("Files")[0].strip() # Get the driver from the filetype return filename, driver @staticmethod def get_selection(selection_string): if "-" in selection_string: # If there's a hyphen, it's a dataset indices = selection_string.split("-") datafile_index, dataset_index = int(indices[0]), int(indices[1]) # Convert the strings to ints return datafile_index, dataset_index else: # Or else it's a datafile datafile_index = int(selection_string) # Convert the string into an int return datafile_index, None def initialize(self): """ Do all remaining initializations :return: 0 """ if self._debug: print("DEBUG: Called initialize() function.") self._status_bar.showMessage("Program Initialized.") return 0 def main_quit(self): """ Shuts down the program (and threads) gracefully. :return: """ if self._debug: print("DEBUG: Called main_quit") self._mainWindow.destroy() # Close the window qApp.quit() # Quit the application return 0 def populate_properties_table(self, data_object): self.clear_properties_table() # if type(data_object) is ParticleFile: if isinstance(data_object, (ParticleFile, FieldFile)): # If the object passed is a datafile... # df = data_object print("Datafile properties are not implemented yet!") return 1 # elif type(data_object) is Dataset: elif isinstance(data_object, Dataset): # If the object passed is a dataset... ds = data_object self._properties_table.data = ds # self._properties_label.setText("Properties (Datafile #{}, Dataset #{})".format(df_i, ds_i)) for idx, item in enumerate(self._property_list): # Enumerate through the properties list if ds.get_property(item) is not None: # If the property is not None v = QtWidgets.QTableWidgetItem(str(ds.get_property(item))) # Set the value item if ds.is_native_property(item): # If it's a native property to the set, it's not editable v.setFlags(QtCore.Qt.ItemIsEnabled) else: # If it is not a native property, it may be edited v.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsEditable) else: # IF the property wasn't found v = QtWidgets.QTableWidgetItem("Property not found") # Create a placeholder v.setForeground(QtGui.QBrush(QtGui.QColor("#FF0000"))) # Set the text color to red v.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsEditable) # Make it editable self._properties_table.setItem(idx, 1, v) # Put the item in the table return 0 def refresh_data(self, properties=True): self._treewidget.clear() if properties: self._properties_select.clear() self._properties_select.data_objects = [] for parent_index, datafile in enumerate(self._datafiles): datafile.set_index(parent_index) # --- Refresh Tree Widget for the Datafile --- # top_level_item = QtGui.QTreeWidgetItem(self._treewidget) top_level_item.setText(0, "") top_level_item.setText(1, "{}".format(parent_index)) top_level_item.setText(2, datafile.filename()) top_level_item.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsUserCheckable) top_level_item.setCheckState(0, QtCore.Qt.Unchecked) for child_index, dataset in enumerate(datafile.datasets()): # --- Refresh Tree Widget for the Dataset --- # dataset.set_indices(parent_index, child_index) child_item = QtGui.QTreeWidgetItem(top_level_item) child_item.setText(0, "") # Selection box child_item.setText(1, "{}-{}".format(parent_index, child_index)) child_item.setText(2, "{}".format(dataset.get_name())) child_item.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsUserCheckable) child_item.setCheckState(0, QtCore.Qt.Unchecked) pass top_level_item.setExpanded(True) # Expand the tree widget # --- Refresh the Properties Selection for the Datafile --- # if properties: self.add_to_properties_selection(datafile) for i in range(self._treewidget.columnCount()): # Resize the columns of the tree self._treewidget.resizeColumnToContents(i) def run(self): """ Run the GUI :return: """ self.initialize() # --- Calculate the positions to center the window --- # screen_size = self.screen_size() _x = 0.5 * (screen_size.width() - self._mainWindow.width()) _y = 0.5 * (screen_size.height() - self._mainWindow.height()) # --- Show the GUI --- # self._mainWindow.show() self._mainWindow.move(_x, _y) self._app.exec_() return 0 def screen_size(self): return self._app.desktop().availableGeometry() # Return the size of the screen def send_status(self, message): if isinstance(message, str): # Make sure we're sending a string to the status bar self._status_bar.showMessage(message) else: print("Status message is not a string!") return 1 return 0 def tabs(self): return self._tabs # Return the tab widget def treewidget_clicked(self, item, column): if self._debug: print("treewidget_data_changed callback called with item {} and column {}".format(item, column)) if column == 0: # If the first column was clicked checkstate = (item.checkState(0) == QtCore.Qt.Checked) # Get a True or False value for selection index = self._treewidget.indexFromItem(item).row() # Get the row index if item.parent() is None: # If the item does not have a parent, it's a datafile selection = self._datafiles[index] else: # If it does, it's a dataset parent_index = self._treewidget.indexFromItem(item.parent()).row() selection = self._datafiles[parent_index].get_dataset(index) if checkstate is True and selection not in self._selections: self._selections.append(selection) # Add the string to the selections # if type(selection) is Dataset: if isinstance(selection, Dataset): self._plot_manager.add_to_current_plot(selection) # Add to plot if not self._plot_manager.has_default_plot_settings(): # Check for default plot settings self._plot_manager.default_plot_settings() # Open the default plot settings self._plot_manager.redraw_plot() # Redraw the plot elif checkstate is False and selection in self._selections: self._selections.remove(selection) # Remove the string from the selections # if type(selection) is Dataset: if isinstance(selection, Dataset): self._plot_manager.remove_dataset(selection) # Remove the dataset self._plot_manager.redraw_plot() # Redraw the plot return 0 def add_tree_item(self, datafile_id, dataset_id): dataset = self._datafiles[datafile_id].get_dataset(dataset_id) # Get the dataset object from the indices child_item = self._treewidget.topLevelItem(datafile_id).child(dataset_id) # Create a child item child_item.setText(0, "") # Selection box child_item.setText(1, "{}-{}".format(datafile_id, dataset_id)) # Set the object id # child_item.setText(2, "{}".format(dataset.get_ion().name())) # Set the dataset name (for now, the ion name) child_item.setText(2, "{}".format(dataset.get_name())) # Set the dataset name child_item.setFlags(child_item.flags() | QtCore.Qt.ItemIsUserCheckable) # Set item flags
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,378
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py
from ..arraywrapper import ArrayWrapper from ..abstractdriver import AbstractDriver from dans_pymodules import IonSpecies import numpy as np from scipy import constants as const clight = const.value("speed of light in vacuum") class TrackDriver(AbstractDriver): def __init__(self, debug=False): super(TrackDriver, self).__init__() self._debug = debug self._program_name = "Track" def get_program_name(self): return self._program_name def import_data(self, filename, species=None): if self._debug: print("Importing data from program: {}".format(self._program_name)) try: # TODO: All of this should be part of the particle_processor, not the loading driver! -DW # Except energy, need that to transform into internal units align_bunches = True z_center = -0.25 # user decides centroid position (m) t_cut = 10.0 # Cut everything above 10 ns away (insufficiently accelerated beam) t_split = -10.0 # Split bunches at -10.0 ns and shift leading bunch back e_mean_total = 0.07 # MeV with open(filename, 'rb') as infile: header1 = infile.readline() if self._debug: print(header1) lines = infile.readlines() data = {} emean = e_mean_total/species.a() # MeV/amu (70 keV) # current = 0.01 # mA species.calculate_from_energy_mev(emean) data["steps"] = 1 data["ion"] = species data["mass"] = data["ion"].a() data["charge"] = data["ion"].q() # data["current"] = current # (A) data["energy"] = emean * species.a() data["particles"] = 0 npart = len(lines) dt = np.zeros(npart) dw = np.zeros(npart) x = np.zeros(npart) xp = np.zeros(npart) y = np.zeros(npart) yp = np.zeros(npart) for i, line in enumerate(lines): # Data: Nseed, iq, dt (ns), dW (MeV/amu), x (cm), x' (mrad), y (cm), y' (mrad) _, _, dt[i], dw[i], x[i], xp[i], y[i], yp[i] = [float(value) for value in line.strip().split()] # Apply cut: indices = np.where(dt <= t_cut) dt = dt[indices] # ns dw = dw[indices] # MeV/amu x = x[indices] * 1.0e-2 # cm --> m xp = xp[indices] * 1.0e-3 # mrad --> rad y = y[indices] * 1.0e-2 # cm --> m yp = yp[indices] * 1.0e-3 # mrad --> rad npart_new = len(x) gammaz = (dw + emean) * species.a() / species.mass_mev() + 1.0 betaz = np.sqrt(1.0 - gammaz**(-2.0)) pz = gammaz * betaz px = pz * np.tan(xp) py = pz * np.tan(yp) vz = clight * betaz # vx = vz * np.tan(xp) # vy = vz * np.tan(xp) print("Cut {} particles out of {}. Remaining particles: {}".format(npart - npart_new, npart, npart_new)) if align_bunches: # Split bunches b1_ind = np.where(dt < t_split) b2_ind = np.where(dt >= t_split) delta_t_theor = 1.0e9 / 32.8e6 # length of one rf period delta_t_sim = np.abs(np.mean(dt[b1_ind]) - np.mean(dt[b2_ind])) print("Splitting bunches at t = {} ns. " "Time difference between bunch centers = {} ns. " "One RF period = {} ns.".format(t_split, delta_t_sim, delta_t_theor)) from matplotlib import pyplot as plt # plt.subplot(231) # plt.scatter(dt[b1_ind], dw[b1_ind], c="red", s=0.5) # plt.scatter(dt[b2_ind], dw[b2_ind], c="blue", s=0.5) # plt.xlabel("dt (ns)") # plt.ylabel("dW (MeV/amu)") # plt.subplot(232) # plt.scatter(x[b1_ind], xp[b1_ind], c="red", s=0.5) # plt.scatter(x[b2_ind], xp[b2_ind], c="blue", s=0.5) # plt.xlabel("x (m)") # plt.ylabel("x' (rad)") # plt.subplot(233) # plt.scatter(y[b1_ind], yp[b1_ind], c="red", s=0.5) # plt.scatter(y[b2_ind], yp[b2_ind], c="blue", s=0.5) # plt.xlabel("y (m)") # plt.ylabel("y' (rad)") # Shift leading bunch dt[b1_ind] += delta_t_theor # x[b1_ind] += vx[b1_ind] * 1.0e-9 * delta_t_theor # y[b1_ind] += vy[b1_ind] * 1.0e-9 * delta_t_theor # plt.subplot(234) # plt.scatter(dt[b1_ind], dw[b1_ind], c="red", s=0.5) # plt.scatter(dt[b2_ind], dw[b2_ind], c="blue", s=0.5) # plt.xlabel("dt (ns)") # plt.ylabel("dW (MeV/amu)") # plt.subplot(235) # plt.scatter(x[b1_ind], xp[b1_ind], c="red", s=0.5) # plt.scatter(x[b2_ind], xp[b2_ind], c="blue", s=0.5) # plt.xlabel("x (m)") # plt.ylabel("x' (rad)") # plt.subplot(236) # plt.scatter(y[b1_ind], yp[b1_ind], c="red", s=0.5) # plt.scatter(y[b2_ind], yp[b2_ind], c="blue", s=0.5) # plt.xlabel("y (m)") # plt.ylabel("y' (rad)") # # plt.tight_layout() # plt.show() z = z_center - dt * 1e-9 * vz distribution = {'x': ArrayWrapper(x), 'px': ArrayWrapper(px), 'y': ArrayWrapper(y), 'py': ArrayWrapper(py), 'z': ArrayWrapper(z), 'pz': ArrayWrapper(pz)} # For a single timestep, we just define a Step#0 entry in a dictionary (supports .get()) data["datasource"] = {"Step#0": distribution} data["particles"] = npart_new return data except Exception as e: print("Exception happened during particle loading with {} " "ImportExportDriver: {}".format(self._program_name, e)) return None def export_data(self, data): # TODO if self._debug: print("Exporting data for program: {}".format(self._program_name)) print("Export not yet implemented :(") return data
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}
42,379
DanielWinklehner/py_particle_processor
refs/heads/master
/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py
from ..abstractdriver import AbstractDriver import numpy as np import os class FreeCADDriver(AbstractDriver): def __init__(self, debug=False): super(FreeCADDriver, self).__init__() self._debug = debug self._program_name = "FreeCAD" def get_program_name(self): return self._program_name def import_data(self, filename, species=None): if self._debug: print("Importing data from program: {}".format(self._program_name)) print("FreeCAD driver is export-only!") return None def export_data(self, dataset, filename): # TODO: Make number of trajectories and time frequency user input -DW ntrj = 1000 # only use 1000 random trajectories freq = 5 # only use every 5th step if self._debug: print("Exporting data for program: {}".format(self._program_name)) datasource = dataset.get_datasource() nsteps = dataset.get_nsteps() maxnumpart = len(datasource.get("Step#0").get("x").value) _chosen = np.random.choice(maxnumpart, ntrj) with open(os.path.splitext(filename)[0] + ".dat", "w") as outfile: outfile.write("step, ID, x (m), y (m), z (m)\n") for step in range(nsteps): if step % freq == 0: _stepdata = datasource.get("Step#{}".format(step)) _ids = _stepdata.get("id").value # npart = len(_ids) indices = np.nonzero(np.isin(_ids, _chosen))[0] if self._debug: print("Saving step {} of {}, found {} matching ID's".format(step, nsteps, len(indices))) for i in indices: # if datasource.get("Step#{}".format(step)).get("id")[i] in _chosen: outstring = "{} {} ".format(step, datasource.get("Step#{}".format(step)).get("id")[i]) outstring += "{} {} {}\n".format(datasource.get("Step#{}".format(step)).get("x")[i], datasource.get("Step#{}".format(step)).get("y")[i], datasource.get("Step#{}".format(step)).get("z")[i]) outfile.write(outstring) return 0
{"/py_particle_processor_qt/plotting.py": ["/py_particle_processor_qt/gui/plot_settings.py", "/py_particle_processor_qt/gui/default_plot_settings.py"], "/py_particle_processor_qt/test/__main__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/OrbitTool/orbittoolgui.py"], "/examples/gui_example.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py": ["/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py"], "/py_particle_processor_qt/tools/TranslateTool/__init__.py": ["/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py"], "/py_particle_processor_qt/tools/TranslateTool/TranslateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/TranslateTool/translatetoolgui.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py": ["/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py"], "/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/AnimateXY/animateXYgui.py"], "/py_particle_processor_qt/dataset.py": ["/py_particle_processor_qt/drivers/__init__.py"], "/py_particle_processor_qt/tools/OrbitTool/__init__.py": ["/py_particle_processor_qt/tools/OrbitTool/OrbitTool.py"], "/py_particle_processor_qt/generator.py": ["/py_particle_processor_qt/gui/generate_main.py", "/py_particle_processor_qt/gui/generate_error.py", "/py_particle_processor_qt/gui/generate_envelope.py", "/py_particle_processor_qt/gui/generate_twiss.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py"], "/py_particle_processor_qt/drivers/OPALDriver/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/OPALDriver.py"], "/py_particle_processor_qt/tools/BeamChar/BeamChar.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/BeamChar/beamchargui.py"], "/py_particle_processor_qt/tools/AnimateXY/__init__.py": ["/py_particle_processor_qt/tools/AnimateXY/AnimateXY.py"], "/py_particle_processor_qt/tools/RotateTool/__init__.py": ["/py_particle_processor_qt/tools/RotateTool/RotateTool.py"], "/py_particle_processor_qt/tools/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/__init__.py", "/py_particle_processor_qt/tools/TranslateTool/__init__.py", "/py_particle_processor_qt/tools/AnimateXY/__init__.py", "/py_particle_processor_qt/tools/BeamChar/__init__.py", "/py_particle_processor_qt/tools/CollimOPAL/__init__.py", "/py_particle_processor_qt/tools/OrbitTool/__init__.py", "/py_particle_processor_qt/tools/RotateTool/__init__.py"], "/py_particle_processor_qt/tools/BeamChar/__init__.py": ["/py_particle_processor_qt/tools/BeamChar/BeamChar.py"], "/py_particle_processor_qt/drivers/TrackDriver/__init__.py": ["/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py"], "/py_particle_processor_qt/__init__.py": ["/py_particle_processor_qt/py_particle_processor_qt.py"], "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py": ["/py_particle_processor_qt/drivers/COMSOLDriver/COMSOLDriver.py"], "/py_particle_processor_qt/tools/RotateTool/RotateTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/RotateTool/rotatetoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/ScaleTool/scaletoolgui.py"], "/py_particle_processor_qt/tools/ScaleTool/__init__.py": ["/py_particle_processor_qt/tools/ScaleTool/ScaleTool.py"], "/py_particle_processor_qt/py_particle_processor_qt.py": ["/py_particle_processor_qt/dataset.py", "/py_particle_processor_qt/gui/main_window.py", "/py_particle_processor_qt/gui/species_prompt.py", "/py_particle_processor_qt/plotting.py", "/py_particle_processor_qt/generator.py", "/py_particle_processor_qt/tools/__init__.py"], "/py_particle_processor_qt/drivers/TrackDriver/TrackDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/drivers/FreeCADDriver/FreeCADDriver.py": ["/py_particle_processor_qt/drivers/abstractdriver.py"], "/py_particle_processor_qt/tools/CollimOPAL/__init__.py": ["/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py"], "/py_particle_processor_qt/tools/CollimOPAL/CollimOPAL.py": ["/py_particle_processor_qt/tools/abstract_tool.py", "/py_particle_processor_qt/tools/CollimOPAL/collimOPALgui.py"], "/py_particle_processor_qt/drivers/__init__.py": ["/py_particle_processor_qt/drivers/OPALDriver/__init__.py", "/py_particle_processor_qt/drivers/TraceWinDriver/__init__.py", "/py_particle_processor_qt/drivers/COMSOLDriver/__init__.py", "/py_particle_processor_qt/drivers/IBSimuDriver/__init__.py", "/py_particle_processor_qt/drivers/TrackDriver/__init__.py", "/py_particle_processor_qt/drivers/FreeCADDriver/__init__.py"], "/py_particle_processor_qt/drivers/IBSimuDriver/IBSimuDriver.py": ["/py_particle_processor_qt/drivers/arraywrapper.py", "/py_particle_processor_qt/drivers/abstractdriver.py"]}