Browse Source

Added nozzel voltage and pulse to print info

sx_rewrite
Holger Frey 5 years ago
parent
commit
50f9659f8b
  1. 1
      .gitignore
  2. 16
      s3printlog/logparser.py
  3. 5
      s3printlog/main.py
  4. 14
      s3printlog/report.py
  5. 1
      test.py

1
.gitignore vendored

@ -1,6 +1,7 @@
# example data # example data
example 1/ example 1/
example 2/ example 2/
example 3/
example fail 1/ example fail 1/
example fail 2/ example fail 2/
example fail 3/ example fail 3/

16
s3printlog/logparser.py

@ -183,3 +183,19 @@ def parse_print_log(log_files):
) )
environment_df = tmp_df.drop(columns=["garbage 1", "garbage 2"]) environment_df = tmp_df.drop(columns=["garbage 1", "garbage 2"])
return PrintLogResult(environment_df, print_info) return PrintLogResult(environment_df, print_info)
def augment_print_info(print_log_result, drop_log_list, encoding="iso-8859-1"):
""" gets voltage and pulse from a drop log file
Since the voltage and pulse should not change during a print run,
we add this information to the print log info
"""
one_log_file = drop_log_list[0]
with open(one_log_file, "r", encoding=encoding) as file_handle:
for line in file_handle:
if line.startswith("Nozzle Voltage"):
print_log_result.info["voltage"] = parse_log_line(line, str)
elif line.startswith("Nozzle Pulse"):
print_log_result.info["pulse"] = parse_log_line(line, str)
return print_log_result

5
s3printlog/main.py

@ -12,7 +12,7 @@ from .analysis import (
generate_environment_graph, generate_environment_graph,
find_missing_drops, find_missing_drops,
) )
from .logparser import parse_log_files, parse_print_log from .logparser import parse_log_files, parse_print_log, augment_print_info
from .report import generate_report from .report import generate_report
DROP_CHECK_SUFFIX = ".cor" DROP_CHECK_SUFFIX = ".cor"
@ -72,7 +72,8 @@ def process_print_log(log_files):
image_path = log_files.folder / f"{log_files.folder.name}_environment.png" image_path = log_files.folder / f"{log_files.folder.name}_environment.png"
plt.savefig(image_path) plt.savefig(image_path)
return PrintLogResult(ProcessResult(print_log.environment, image_path), print_log.info) tmp_result = PrintLogResult(ProcessResult(print_log.environment, image_path), print_log.info)
return augment_print_info(tmp_result, log_files.drop_check)
def process_log_files(log_files): def process_log_files(log_files):
drop_check_result = process_drop_checks(log_files) drop_check_result = process_drop_checks(log_files)

14
s3printlog/report.py

@ -115,23 +115,23 @@ def failed_drops_flowable(drops, missing, what):
def print_info_flowable(print_info): def print_info_flowable(print_info):
data = [ data = [
("Source Plate:", print_info["source"]), ("Source Plate:", print_info["source"]),
("Print Solutions:", f"{print_info['solutions']} different solutions"), ("Print Solutions:", f"{print_info['solutions']} solutions"),
("Target Substrate:", print_info["target"]), ("Target Substrate:", print_info["target"]),
("Number of Fields:", f"{print_info['fields']} fields printed"), ("Number of Fields:", f"{print_info['fields']} fields printed"),
("Run Method:", print_info["run"]), ("Run Method:", print_info["run"]),
("Voltage:", f"{print_info['voltage']} V"),
("Pulse:", f"{print_info['pulse']} µs"),
( (
"Humidity Setting:", "Humidity Setting:",
f"{print_info['humidity']} (humidifier might be turned off)", f"{print_info['humidity']} (humidifier might be turned off)",
), ),
] ]
# Table(data, colWidths=None, rowHeights=None, style=None, splitByRow=1,
# repeatRows=0, repeatCols=0, rowSplitRange=None, spaceBefore=None,
# spaceAfter=None)
return Table(data, style=[ return Table(data, style=[
('TOPPADDING', (0, 0), (-1, -1), 1), ('TOPPADDING', (0, 0), (-1, -1), 0),
('RIGHTPADDING', (0, 0), (-1, -1), 7), ('RIGHTPADDING', (0, 0), (-1, -1), 7),
('BOTTOMPADDING', (0, 0), (-1, -1), 1), ('BOTTOMPADDING', (0, 0), (-1, -1), 0),
('LEFTPADDING', (0, 0), (-1, -1), 0), ('LEFTPADDING', (0, 0), (-1, -1), 0),
('FONTSIZE', (0, 0), (-1, -1), 8),
],hAlign='LEFT' ],hAlign='LEFT'
) )
@ -158,7 +158,7 @@ def generate_report(log_files, drops, missing, environment, print_info):
if len(story) == 5: if len(story) == 5:
# no failed drop checks where reported # no failed drop checks where reported
story.append(Spacer(width=17 * cm, height=1 * cm)) story.append(Spacer(width=17 * cm, height=0.5 * cm))
story.append(Paragraph("No failed drop checks found.", style_n)) story.append(Paragraph("No failed drop checks found.", style_n))
story.append(PageBreak()) story.append(PageBreak())

1
test.py

@ -5,6 +5,7 @@ from s3printlog import main
folder = 'C:/Users/Holgi/Developer/python-libraries/s3printlog/example 1' folder = 'C:/Users/Holgi/Developer/python-libraries/s3printlog/example 1'
#folder = "example 2" #folder = "example 2"
folder = "example 3"
print("Generating report, PDF should be opened in a couple of seconds") print("Generating report, PDF should be opened in a couple of seconds")
report_file = main.process_log_folder(folder) report_file = main.process_log_folder(folder)

Loading…
Cancel
Save