def run_log(path): """Function to pass to the process pool executor to process machine logs.""" try: log = load_log(path) if not log.treatment_type == IMAGING: log.fluence.gamma.calc_map() if log.fluence.gamma.pass_prcnt < 90: raise Exception("Gamma pass % < 90") ret = "Success" except Exception as e: ret = 'Failure: {} @ {}'.format(e, path) return ret
def process(self): """Process the file; includes analysis, saving results to file, and sending emails.""" logger.info(self.local_path + " will be analyzed...") self.instance = load_log(self.full_path, **self.constructor_kwargs) if self.instance.treatment_type == IMAGING: logger.info(self.local_path + " is an imaging log...") else: self.analyze() self.publish_pdf() self.save_zip() if self.config['email']['enable-all']: self.send_email() elif self.config['email']['enable-failure'] and self.should_send_failure_email(): self.send_email() logger.info("Finished analysis on " + self.local_path) return True
def process(self): """Process the file; includes analysis, saving results to file, and sending emails.""" logger.info(self.local_path + " will be analyzed...") self.instance = load_log(self.full_path, **self.constructor_kwargs) if self.instance.treatment_type == IMAGING: logger.info(self.local_path + " is an imaging log...") SKIP_LIST.append(self.full_path) else: self.analyze() self.save_zip() if self.config['email']['enable-all']: self.send_email() elif self.config['email'][ 'enable-failure'] and self.should_send_failure_email(): self.send_email() logger.info("Finished analysis on " + self.local_path)
def process(self): """Process the file; includes analysis, saving results to file, and sending emails.""" logger.info(self.local_path + " will be analyzed...") self.instance = load_log(self.full_path, **self.constructor_kwargs) if self.instance.treatment_type == IMAGING: logger.info(self.local_path + " is an imaging log...") else: self.analyze() s=self.base_name file = open(self.local_path+".txt", "w") file.write(str("name: ") + str(self.base_name.split('_')[2]+"\n")) file.write(str("gama: ")+str(self.instance.fluence.gamma.pass_prcnt)) file.close() self.publish_pdf() self.save_zip() if self.config['email']['enable-all']: self.send_email() elif self.config['email']['enable-failure'] and self.should_send_failure_email(): self.send_email() logger.info("Finished analysis on " + self.local_path) return True
from pylinac import load_log, MachineLogs #import matplotlib import matplotlib.pyplot as plt #import numpy as np path_to_folder = "/tmp/tlogs/" #logs = MachineLogs(path_to_folder) logs = load_log(path_to_folder) i = 0 for log in logs: #log.axis_data.mu.plot_actual() plotbase = '/tmp/tlogs/plot_' + str(i) i = i + 1 print("Making plot now...") # Produce a quick, generic summary (note: doesn't seem to work well, but might as well produce it anyway). log.publish_pdf(filename=(plotbase + '_report.pdf'), metadata={'Number of beam holds': log.num_beamholds}) # Produce specific plots. log.axis_data.beam_hold.save_plot_actual(filename=(plotbase + '_beam_holds.pdf')) log.axis_data.mu.save_plot_actual(filename=(plotbase + '_MU.pdf')) log.axis_data.gantry.save_plot_actual(filename=(plotbase + '_gantry.pdf')) #log.axis_data.gantry.save_plot_difference(filename=(plotbase + '_gantry.pdf')) # Produce a custom plot. plt.close('all') # Reset
from pylinac import load_log from pylinac import log_analyzer #logs_path = "/tmp/A20191202084129_1937015.dlg" dlogs_path = "/tmp/" dlogs = load_log(dlogs_path) #dlogs.report_basic_parameters() for dlog in dlogs: #dlog.report_basic_parameters() #dlog.plot_summary() #log_analyzer.Axis( dlog.axis_data.gantry.actual, dlog.axis_data.beam_hold.actual).save_plot_difference(filename='diff.png') plotname = dlog.a_logfile + '.png' log_analyzer.Axis( dlog.axis_data.beam_hold.actual).save_plot_actual(filename=plotname) #dlog.axis_data.gantry.actual #dlog.axis_data.beam_hold.actual #dlog.axis_data.gantry.actual #dlog.publish_pdf("/tmp/LogAnalysisReport.pdf") #dlog.axis_data.mu.plot_actual() #dlogs.axis_data.gantry.plot_actual() # plot the gantry position throughout treatment #dlogs.fluence.gamma.calc_map(doseTA=1, distTA=1, threshold=10, resolution=0.1) #dlogs.fluence.gamma.plot_map() # show the gamma map as a matplotlib figure #dlogs.publish_pdf() # publish a PDF report
from PyQt5 import QtCore from pylinac import TrajectoryLog from pylinac import load_log from pylinac import log_analyzer from pylinac import MachineLogs import csv from pylinac import process file = open("configQAwatchdir.txt", "r") a = file.readline() file = open("configPathSRS.txt", "r") yamlanalise = file.readline() win_directory = QtCore.QDir.toNativeSeparators(a) yamlanalisePath = QtCore.QDir.toNativeSeparators(yamlanalise) asr = load_log(win_directory) log = TrajectoryLog("Arck_PFRAHDD1_T1.1_PF_RA_20181228080911.bin") # a = log.axis_data.mlc.create_RMS_array(log.axis_data.mlc.get_leaves()) # print(a) #b = log_analyzer.JawStruct(log.axis_data.jaws.x1, log.axis_data.jaws.y1, log.axis_data.jaws.x2, log.axis_data.jaws.y2) # print(b.y1.plot_actual()) a1 = log.subbeams s = log.axis_data.mlc.leaf_axes[30] print(s.difference[1]) with open('filename.txt', 'w') as f: for i in range(71): f.write('%.6f' % s.difference[i] + '\n')