Added features increasing user friendliness of the software

This commit is contained in:
Cian Hughes
2022-02-21 17:22:39 +00:00
parent 87af564c9c
commit caae863be5
5 changed files with 562 additions and 218 deletions

81
Data/Calibration.py Normal file
View File

@@ -0,0 +1,81 @@
class CalCurve():
def __init__(self):
self.name = "None"
self.formula = "y=x"
def __call__(self, x):
return x
def __str__(self):
return self.name
class AlSi7Mg(CalCurve):
def __init__(self):
self.name = "AlSi7Mg"
self.formula = "N/A"
def __call__(self, x):
return x
class Al6061(CalCurve):
def __init__(self):
self.name = "Al6061"
self.formula = "T=(V+84.66)/1.45"
def __call__(self, x):
return (x + 84.661) / 1.4516
class _15_5PH(CalCurve):
def __init__(self):
self.name = "15-5PH Stainless Steel"
self.formula = "N/A"
def __call__(self, x):
return x
class H13(CalCurve):
def __init__(self):
self.name = "H13 Tool Steel"
self.formula = "N/A"
def __call__(self, x):
return x
class Inconel625(CalCurve):
def __init__(self):
self.name = "Inconel 625"
self.formula = "N/A"
def __call__(self, x):
return x
class Inconel718(CalCurve):
def __init__(self):
self.name = "Inconel 718"
self.formula = "N/A"
def __call__(self, x):
return x
class Custom(CalCurve):
def __init__(self):
self.name = "Custom"
self.formula = "y=mx+c"
def __call__(self, x):
return x

View File

@@ -0,0 +1,64 @@
import operator as __op
class __Base():
def __init__(self):
self.name = "None"
def __str__(self):
return self.name
class Greater(__Base):
def __init__(self):
self.name = ">"
def __call__(self, *args):
return __op.gt(*args)
class GreaterOrEqual(__Base):
def __init__(self):
self.name = ""
def __call__(self, *args):
return __op.ge(*args)
class Equal(__Base):
def __init__(self):
self.name = "="
def __call__(self, *args):
return __op.eq(*args)
class NotEqual(__Base):
def __init__(self):
self.name = ""
def __call__(self, *args):
return __op.ne(*args)
class LessOrEqual(__Base):
def __init__(self):
self.name = ""
def __call__(self, *args):
return __op.le(*args)
class Less(__Base):
def __init__(self):
self.name = "<"
def __call__(self, *args):
return __op.lt(*args)

View File

@@ -8,9 +8,9 @@ from kivy.uix.screenmanager import Screen
# Other python module imports # Other python module imports
from Common.MTPy_Modified import MT_Modded as MeltpoolTomography from Common.MTPy_Modified import MT_Modded as MeltpoolTomography
from Common.threading_decorators import run_in_thread from Common.threading_decorators import run_in_thread
from Data import Calibration, ThresholdFunctions
from pathlib import Path from pathlib import Path
from types import SimpleNamespace from types import SimpleNamespace, FunctionType
import operator as op
from ast import literal_eval from ast import literal_eval
from contextlib import redirect_stdout from contextlib import redirect_stdout
@@ -32,7 +32,8 @@ class Main(Screen):
shared_io_choosers = ["io_chooser_dataloading", shared_io_choosers = ["io_chooser_dataloading",
"io_chooser_buildplate", "io_chooser_buildplate",
"io_chooser_sampledetection", "io_chooser_sampledetection",
"io_chooser_persample"] "io_chooser_persample",
"io_chooser_datasheet"]
shared_io_choosers = [self.ids[x] for x in shared_io_choosers] shared_io_choosers = [self.ids[x] for x in shared_io_choosers]
# Link progress bars in document to their associated functions # Link progress bars in document to their associated functions
self.mtpy.progress_bars["read_layers"] = self.ids.read_layers_progbar self.mtpy.progress_bars["read_layers"] = self.ids.read_layers_progbar
@@ -48,24 +49,21 @@ class Main(Screen):
# self.mtpy.progress_bars["threshold_all_layers"] = self.ids.avgtemp_threshold_progbar # noqa # self.mtpy.progress_bars["threshold_all_layers"] = self.ids.avgtemp_threshold_progbar # noqa
self.mtpy.progress_bars["temp_data_to_csv"] = self.ids.kmeans_separate_samples_progbar # noqa self.mtpy.progress_bars["temp_data_to_csv"] = self.ids.kmeans_separate_samples_progbar # noqa
# Starting items in cache # Starting items in cache
starting_cache = {"shared_io_choosers": shared_io_choosers, starting_cache = {
# Shared variables
"shared_io_choosers": shared_io_choosers,
"in_path": str(Path("~").expanduser()), # path to input data "in_path": str(Path("~").expanduser()), # path to input data
"out_path": str(Path("~").expanduser()), # path to output data "out_path": str(Path("~").expanduser()), # path to output data
"last_loaded_path": False, # path to last loaded "last_loaded_path": False, # path to last loaded
"calibration_curve": False, # last cal curve used "calibration_curve": False, # last cal curve used
"static_fileformats": # Allowed static formats # Dropdown population lists
("png", "pdf", "ps", "eps", "svg"), "printer_types": ("None", "3D Systems", "Aconity", "GE Additive", "Renishaw", "Stratasys"),
"thresh_functions": # Threshold functions available "calibration_curves": [v() for k, v in Calibration.__dict__.items() if "__" not in k],
{ "static_fileformats": ("png", "pdf", "ps", "eps", "svg"), # Allowed static formats
">": op.gt, "thresh_functions": [v() for k, v in ThresholdFunctions.__dict__.items() if "__" not in k],
"": op.ge, # Progress Bars
"=": op.eq, "progress_bars": self.mtpy.progress_bars
"": op.ne, }
"": op.le,
"<": op.lt,
},
"progress_bars": self.mtpy.progress_bars}
self.cache = SimpleNamespace(**starting_cache) self.cache = SimpleNamespace(**starting_cache)
# Make sure each shared io chooser is aware of others and parent app # Make sure each shared io chooser is aware of others and parent app
for chooser in self.cache.shared_io_choosers: for chooser in self.cache.shared_io_choosers:
@@ -73,11 +71,21 @@ class Main(Screen):
[x for x in self.cache.shared_io_choosers if x != chooser] [x for x in self.cache.shared_io_choosers if x != chooser]
chooser.cache.parent_app = self chooser.cache.parent_app = self
# Next, populate dropdowns # Next, populate dropdowns
# First, the dropdowns for matplotlib filetype options # The dropdown for selecting the printer type
self.ids.layers_to_figures_filetype_dropdown.populate_dropdown( self.ids.printer_type_dropdown.populate_dropdown(self.cache.printer_types)
self.cache.static_fileformats) # The dropdown for calibration curves
self.ids.avgtemp_thresh_function_dropdown.populate_dropdown( self.ids.calibration_curve_dropdown.populate_dropdown(self.cache.calibration_curves)
self.cache.thresh_functions.keys()) # The dropdowns for matplotlib filetype options
static_filetype_dropdowns = (
self.ids.layers_to_figures_filetype_dropdown,
self.ids.layers_to_3dplot_filetype_dropdown,
self.ids.samples_to_figures_filetype_dropdown,
self.ids.samples_to_3dplot_filetype_dropdown,
)
for dropdown in static_filetype_dropdowns:
dropdown.populate_dropdown(self.cache.static_fileformats)
# The dropdowns for the thresholding functions
self.ids.avgtemp_thresh_function_dropdown.populate_dropdown(self.cache.thresh_functions)
# Property returns a string summarising the status of data processing # Property returns a string summarising the status of data processing
@property @property
@@ -149,9 +157,9 @@ class Main(Screen):
elif c in ("(", "{", "["): elif c in ("(", "{", "["):
neststring += c neststring += c
elif c in (")", "}", "]"): elif c in (")", "}", "]"):
if (c == ")" and neststring[-1] == "(" or if (c == ")" and neststring[-1] == "("
c == "}" and neststring[-1] == "{" or or c == "}" and neststring[-1] == "{"
c == "]" and neststring[-1] == "["): or c == "]" and neststring[-1] == "["):
neststring = neststring[:-1] neststring = neststring[:-1]
parsed.append(paramstring[prev_split:]) parsed.append(paramstring[prev_split:])
@@ -164,6 +172,18 @@ class Main(Screen):
return parsed return parsed
# Parses layer selection into a layer filter
def parse_filter(self, filterstring: str) -> FunctionType:
filterstring = filterstring.strip()
if filterstring.isdigit():
return lambda x: x == int(filterstring)
elif ":" in filterstring:
return lambda x: x in range(*(int(y) for y in filterstring.split(":")))
elif "," in filterstring:
return lambda x: x in (int(y) for y in filterstring.split(","))
else:
return lambda x: True
# This function loads input data only if not already loaded # This function loads input data only if not already loaded
@run_in_thread @run_in_thread
def load_data(self): def load_data(self):
@@ -177,16 +197,23 @@ class Main(Screen):
# NOTE: relies on eval! Function may be dangerous # NOTE: relies on eval! Function may be dangerous
@run_in_thread @run_in_thread
def apply_calibration_curve(self): def apply_calibration_curve(self):
cal_curve_selection = self.ids.calibration_curve_dropdown.current_selection
if (cal_curve_selection.name == "Custom"):
equation = self.ids.calibration_curve.text equation = self.ids.calibration_curve.text
equation = equation.replace(" ", "") equation = equation.replace(" ", "")
if ((equation != self.cache.calibration_curve) and if ((equation != self.cache.calibration_curve)
(equation != "y=x") and and (equation != "y=x")
(equation[:2] == "y=")): and (equation[:2] == "y=")):
def func(x): def func(x):
return eval(equation[2:]) return eval(equation[2:])
self.mtpy.apply_calibration_curve(func) self.mtpy.apply_calibration_curve(func)
self.cache.calibration_curve = equation self.cache.calibration_curve = equation
self.update_data_status() self.update_data_status()
else:
if cal_curve_selection is not self.cache.calibration_curve:
self.mtpy.apply_calibration_curve(cal_curve_selection)
self.cache.calibration_curve = cal_curve_selection
self.update_data_status()
# A wrapper function translating application state into a call to the # A wrapper function translating application state into a call to the
# mtpy function layers_to_figures # mtpy function layers_to_figures
@@ -200,10 +227,8 @@ class Main(Screen):
plot_w = self.ids.layers_to_figures_plot_w.active plot_w = self.ids.layers_to_figures_plot_w.active
colorbar = self.ids.layers_to_figures_colorbar.active colorbar = self.ids.layers_to_figures_colorbar.active
# then parse kwarg params # then parse kwarg params
figureparams = self.parse_kwargs( figureparams = self.parse_kwargs(self.ids.layers_to_figures_figureparams.text)
self.ids.layers_to_figures_figureparams.text) scatterparams = self.parse_kwargs(self.ids.layers_to_figures_plotparams.text)
scatterparams = self.parse_kwargs(
self.ids.layers_to_figures_plotparams.text)
self.mtpy.layers_to_figures(self.cache.out_path, self.mtpy.layers_to_figures(self.cache.out_path,
filetype=filetype, filetype=filetype,
plot_w=plot_w, plot_w=plot_w,
@@ -382,4 +407,13 @@ class Main(Screen):
# This function generates datasheets # This function generates datasheets
@run_in_thread @run_in_thread
def temp_data_to_csv(self): def temp_data_to_csv(self):
self.mtpy.temp_data_to_csv(f"{self.cache.out_path}") confidence_interval = self.ids.temp_data_to_csv_confinterval
confidence_interval = confidence_interval.strip()
if confidence_interval.isdigit():
confidence_interval = float(confidence_interval)
else:
confidence_interval = 0.95
self.mtpy.temp_data_to_csv(f"{self.cache.out_path}",
layers=self.ids.temp_data_to_csv_layers,
samples=self.ids.temp_data_to_csv_samples,
confidence_interval=confidence_interval)

View File

@@ -7,8 +7,13 @@ from kivy.uix.dropdown import DropDown
class DropdownButton(Button): class DropdownButton(Button):
def __init__(self, option_list=None, **kwargs):
# ensure "text" kwarg isnt present def __init__(self,
option_list=None,
default_selection=None,
bound_textfields={},
**kwargs):
# ensure "test" kwarg isnt present
if "test" in kwargs: if "test" in kwargs:
kwargs.pop("test") kwargs.pop("test")
@@ -21,16 +26,22 @@ class DropdownButton(Button):
if keyword not in kwargs: if keyword not in kwargs:
kwargs[keyword] = arg kwargs[keyword] = arg
# self.bound_textfields is a dict of objects as keys,
# values are either the name of textfield to update or tuple containing
# the textfield name AND a function that maps the selection to a new string
self.bound_textfields = bound_textfields
self.kwargs = kwargs self.kwargs = kwargs
super(DropdownButton, self).__init__(**self.kwargs) super(DropdownButton, self).__init__(**self.kwargs)
# Create lambdas for callbacks
self.__bind_button = lambda btn: self.dropdown_list.select(btn.text)
self.__update_label = lambda instance, x: setattr(self, "text", x)
if option_list is not None: if option_list is not None:
self.populate_dropdown(option_list) self.populate_dropdown(option_list)
if type(default_selection) == str:
self.current_selection = self.objects_dict[default_selection]
else:
self.current_selection = default_selection
# Populates dropdown with contents of list given
def populate_dropdown(self, option_list): def populate_dropdown(self, option_list):
kwargs = self.kwargs.copy() kwargs = self.kwargs.copy()
kwargs["size_hint_y"] = None kwargs["size_hint_y"] = None
@@ -42,11 +53,32 @@ class DropdownButton(Button):
self.dropdown_list = None self.dropdown_list = None
self.dropdown_list = DropDown() self.dropdown_list = DropDown()
for x in option_list: self.objects_dict = {str(x): x for x in option_list}
for x in self.objects_dict.keys():
button = Button(text=x, **kwargs) button = Button(text=x, **kwargs)
# button = Button(text=x, size_hint_y=None, height=50) button.bind(on_release=self._bind_button)
button.bind(on_release=self.__bind_button)
self.dropdown_list.add_widget(button) self.dropdown_list.add_widget(button)
self.bind(on_release=self.dropdown_list.open) self.bind(on_release=self.dropdown_list.open)
self.dropdown_list.bind(on_select=self.__update_label) self.dropdown_list.bind(on_select=self._select_item)
# Function to bind button to dropdown
def _bind_button(self, btn):
self.dropdown_list.select(btn.text)
def _update_label(self, instance, x):
setattr(self, "text", x)
# This function runs whenever an item from the dropdown is selected
def _select_item(self, instance, selection):
self.current_selection = self.objects_dict[selection]
self._update_label(instance, selection)
self.update_bound_textfields(selection)
def update_bound_textfields(self, text):
for object, field in self.bound_textfields.items():
if type(field) == str:
setattr(object, field, text)
elif type(field) == tuple:
setattr(object, field[0], field[1](text))

View File

@@ -42,26 +42,33 @@
size_hint_x: 0.25 size_hint_x: 0.25
text: "Load Pyrometry Data" text: "Load Pyrometry Data"
on_press: root.load_data() on_press: root.load_data()
# A dropdown for selecting printer type
# TODO: make this actually do something
DropdownButton:
text: "None"
size_hint_x: 0.25
id: printer_type_dropdown
ProgressBar: ProgressBar:
id: read_layers_progbar id: read_layers_progbar
size_hint_x: 0.75 size_hint_x: 0.5
value: 0 value: 0
# A button that applies the calibration curve # A button that applies the calibration curve
Button: Button:
text: "Apply Calibration Curve" text: "Apply Calibration Curve"
size_hint_x: 0.25 size_hint_x: 0.25
width: 120 width: 60
on_press: root.apply_calibration_curve() on_press: root.apply_calibration_curve()
StackLayout: StackLayout:
size_hint_x: 0.25 size_hint_x: 0.25
size_hint_y: 0.5 size_hint_y: 0.5
cols: 1 cols: 1
rows: 2 rows: 2
# Containing a description of what the field points to # A dropdown for selecting preprogrammed/custom calibrations
Label: DropdownButton:
halign: "right" text: "None"
text: "Calibration Curve" id: calibration_curve_dropdown
width: 160 width: 80
bound_textfields: {calibration_curve: ("hint_text", lambda _: getattr(self.current_selection, "formula"))}
# A textbox for cal curve equation entry # A textbox for cal curve equation entry
TextInput: TextInput:
halign: "center" halign: "center"
@@ -319,43 +326,58 @@
#:set num_functions 3 #:set num_functions 3
#:set spacer_y_hint ((1-(row_y_hint*num_functions*2))/(num_functions-1)) #:set spacer_y_hint ((1-(row_y_hint*num_functions*2))/(num_functions-1))
# Panel of options for static 2d figures
StackLayout:
orientation: "tb-lr"
size_hint_x: 1.
size_hint_y: row_y_hint
# First function on this panel (layers_to_figures) begins here # First function on this panel (layers_to_figures) begins here
# This button will be a dropdown # This button will be a dropdown
DropdownButton: DropdownButton:
id: layers_to_figures_filetype_dropdown id: layers_to_figures_filetype_dropdown
text: "select file type\n(png)" text: "select file type (png)"
size_hint_x: 0.25 size_hint_x: 0.25
size_hint_y: row_y_hint size_hint_y: 0.5
# Right of the dropdown will be a suite of options GridLayout:
StackLayout: rows: 1
orientation: "tb-lr" size_hint_x: 0.25
size_hint_x: 0.75 size_hint_y: 0.5
size_hint_y: row_y_hint
# Checkboxes for toggling plot colouring and colourbars # Checkboxes for toggling plot colouring and colourbars
CheckBox: CheckBox:
id: layers_to_figures_plot_w id: layers_to_figures_plot_w
active: True active: True
size_hint_x: 0.1 size_hint_x: 0.1
size_hint_y: 0.5 size_hint_y: 0.5
Label:
text: "Heatmap"
size_hint_x: 0.4
size_hint_y: 0.5
text_size: self.size
halign: "left"
valign: "middle"
CheckBox: CheckBox:
id: layers_to_figures_colorbar id: layers_to_figures_colorbar
active: True active: True
size_hint_x: 0.1 size_hint_x: 0.1
size_hint_y: 0.5 size_hint_y: 0.5
Label: Label:
text: "Colour by temperature" text: "Colourbar"
size_hint_x: 0.4 size_hint_x: 0.4
size_hint_y: 0.5 size_hint_y: 0.5
text_size: self.size text_size: self.size
halign: "left" halign: "left"
valign: "middle" valign: "middle"
Label: # Text input for layer/sample filters
text: "Display colourbar" TextInput:
size_hint_x: 0.4 id: layers_to_figures_layerfilter
size_hint_x: 0.25
size_hint_y: 0.5 size_hint_y: 0.5
text_size: self.size hint_text: "Layer filter..."
halign: "left" TextInput:
valign: "middle" id: layers_to_figures_samplefilter
size_hint_x: 0.25
size_hint_y: 0.5
hint_text: "Sample filter..."
# And text input for other figure parameters # And text input for other figure parameters
TextInput: TextInput:
id: layers_to_figures_figureparams id: layers_to_figures_figureparams
@@ -386,42 +408,56 @@
size_hint_y: spacer_y_hint size_hint_y: spacer_y_hint
# Second function on this panel (layers_to_3dplot) begins here # Second function on this panel (layers_to_3dplot) begins here
StackLayout:
orientation: "tb-lr"
size_hint_x: 1.
size_hint_y: row_y_hint
# This button will be a dropdown # This button will be a dropdown
DropdownButton: DropdownButton:
id: layers_to_3dplot_filetype_dropdown id: layers_to_3dplot_filetype_dropdown
text: "select file type\n(png)" text: "select file type (png)"
size_hint_x: 0.25 size_hint_x: 0.25
size_hint_y: row_y_hint size_hint_y: 0.5
# Right of the dropdown will be a suite of options # Checkboxes for toggling plot colouring and colourbars
StackLayout: GridLayout:
orientation: "tb-lr" rows: 1
size_hint_x: 0.75 size_hint_x: 0.25
size_hint_y: row_y_hint size_hint_y: 0.5
# Checboxes for toggling plot colouring and colourbars
CheckBox: CheckBox:
id: layers_to_3dplot_plot_w id: layers_to_3dplot_plot_w
active: True active: True
size_hint_x: 0.1 size_hint_x: 0.1
size_hint_y: 0.5 size_hint_y: 0.5
Label:
text: "Heatmap"
size_hint_x: 0.4
size_hint_y: 0.5
text_size: self.size
halign: "left"
valign: "middle"
CheckBox: CheckBox:
id: layers_to_3dplot_colorbar id: layers_to_3dplot_colorbar
active: True active: True
size_hint_x: 0.1 size_hint_x: 0.1
size_hint_y: 0.5 size_hint_y: 0.5
Label: Label:
text: "Colour by temperature" text: "Colourbar"
size_hint_x: 0.4 size_hint_x: 0.4
size_hint_y: 0.5 size_hint_y: 0.5
text_size: self.size text_size: self.size
halign: "left" halign: "left"
valign: "middle" valign: "middle"
Label: # Text input for layer/sample filters
text: "Display colourbar" TextInput:
size_hint_x: 0.4 id: layers_to_3dplot_layerfilter
size_hint_x: 0.25
size_hint_y: 0.5 size_hint_y: 0.5
text_size: self.size hint_text: "Layer filter..."
halign: "left" TextInput:
valign: "middle" id: layers_to_3dplot_samplefilter
size_hint_x: 0.25
size_hint_y: 0.5
hint_text: "Sample filter..."
# And text input for other figure parameters # And text input for other figure parameters
TextInput: TextInput:
id: layers_to_3dplot_figureparams id: layers_to_3dplot_figureparams
@@ -451,7 +487,7 @@
size_hint_x: 1.0 size_hint_x: 1.0
size_hint_y: spacer_y_hint size_hint_y: spacer_y_hint
# Second function on this panel (layers_to_3dplot) begins here # Third function on this panel (layers_to_3dplot_interactive) begins here
# First part of this panel will be a suite of options # First part of this panel will be a suite of options
StackLayout: StackLayout:
orientation: "lr-tb" orientation: "lr-tb"
@@ -459,10 +495,9 @@
size_hint_y: row_y_hint size_hint_y: row_y_hint
# Checkboxes for toggling plot colouring and colourbars # Checkboxes for toggling plot colouring and colourbars
# and downsampling factor input # and downsampling factor input
#:set one_third 1/3
Label: Label:
text: "Downsampling:" text: "Downsampling:"
size_hint_x: 0.75 * one_third size_hint_x: 0.167
size_hint_y: 0.5 size_hint_y: 0.5
text_size: self.size text_size: self.size
halign: "right" halign: "right"
@@ -470,16 +505,26 @@
TextInput: TextInput:
id: layers_to_3dplot_interactive_downsampling id: layers_to_3dplot_interactive_downsampling
hint_text: "1" hint_text: "1"
size_hint_x: 0.25 * one_third size_hint_x: 0.083
size_hint_y: 0.5 size_hint_y: 0.5
TextInput:
id: layers_to_3dplot_interactive_layerfilter
size_hint_x: 0.375
size_hint_y: 0.5
hint_text: "Layer Filter..."
TextInput:
id: layers_to_3dplot_interactive_samplefilter
size_hint_x: 0.375
size_hint_y: 0.5
hint_text: "Sample Filter..."
CheckBox: CheckBox:
id: layers_to_3dplot_interactive_plot_w id: layers_to_3dplot_interactive_plot_w
active: True active: True
size_hint_x: 0.25 * one_third size_hint_x: 0.025
size_hint_y: 0.5 size_hint_y: 0.5
Label: Label:
text: "Colour by temperature" text: "Heatmap"
size_hint_x: 0.75 * one_third size_hint_x: 0.1
size_hint_y: 0.5 size_hint_y: 0.5
text_size: self.size text_size: self.size
halign: "left" halign: "left"
@@ -487,18 +532,18 @@
CheckBox: CheckBox:
id: layers_to_3dplot_interactive_sliceable id: layers_to_3dplot_interactive_sliceable
active: True active: True
size_hint_x: 0.25 * one_third size_hint_x: 0.025
size_hint_y: 0.5 size_hint_y: 0.5
Label: Label:
text: "Sliceable model" text: "Sliceable"
size_hint_x: 0.75 * one_third size_hint_x: 0.1
size_hint_y: 0.5 size_hint_y: 0.5
text_size: self.size text_size: self.size
halign: "left" halign: "left"
valign: "middle" valign: "middle"
TextInput: TextInput:
id: layers_to_3dplot_interactive_plotparams id: layers_to_3dplot_interactive_plotparams
size_hint_x: 1. size_hint_x: 0.75
size_hint_y: 0.5 size_hint_y: 0.5
hint_text: "Plot parameters..." hint_text: "Plot parameters..."
# This button is a progress bar trigger that tracks the # This button is a progress bar trigger that tracks the
@@ -539,43 +584,58 @@
#:set num_functions 3 #:set num_functions 3
#:set spacer_y_hint ((1-(row_y_hint*num_functions*2))/(num_functions-1)) #:set spacer_y_hint ((1-(row_y_hint*num_functions*2))/(num_functions-1))
# Panel of options for static 2d figures
StackLayout:
orientation: "tb-lr"
size_hint_x: 1.
size_hint_y: row_y_hint
# First function on this panel (layers_to_figures) begins here # First function on this panel (layers_to_figures) begins here
# This button will be a dropdown # This button will be a dropdown
DropdownButton: DropdownButton:
id: samples_to_figures_filetype_dropdown id: samples_to_figures_filetype_dropdown
text: "select file type\n(png)" text: "select file type (png)"
size_hint_x: 0.25 size_hint_x: 0.25
size_hint_y: row_y_hint size_hint_y: 0.5
# Right of the dropdown will be a suite of options GridLayout:
StackLayout: rows: 1
orientation: "tb-lr" size_hint_x: 0.25
size_hint_x: 0.75 size_hint_y: 0.5
size_hint_y: row_y_hint
# Checkboxes for toggling plot colouring and colourbars # Checkboxes for toggling plot colouring and colourbars
CheckBox: CheckBox:
id: samples_to_figures_plot_w id: samples_to_figures_plot_w
active: True active: True
size_hint_x: 0.1 size_hint_x: 0.1
size_hint_y: 0.5 size_hint_y: 0.5
Label:
text: "Heatmap"
size_hint_x: 0.4
size_hint_y: 0.5
text_size: self.size
halign: "left"
valign: "middle"
CheckBox: CheckBox:
id: samples_to_figures_colorbar id: samples_to_figures_colorbar
active: True active: True
size_hint_x: 0.1 size_hint_x: 0.1
size_hint_y: 0.5 size_hint_y: 0.5
Label: Label:
text: "Colour by temperature" text: "Colourbar"
size_hint_x: 0.4 size_hint_x: 0.4
size_hint_y: 0.5 size_hint_y: 0.5
text_size: self.size text_size: self.size
halign: "left" halign: "left"
valign: "middle" valign: "middle"
Label: # Text input for layer/sample filters
text: "Display colourbar" TextInput:
size_hint_x: 0.4 id: samples_to_figures_layerfilter
size_hint_x: 0.25
size_hint_y: 0.5 size_hint_y: 0.5
text_size: self.size hint_text: "Layer filter..."
halign: "left" TextInput:
valign: "middle" id: samples_to_figures_samplefilter
size_hint_x: 0.25
size_hint_y: 0.5
hint_text: "Sample filter..."
# And text input for other figure parameters # And text input for other figure parameters
TextInput: TextInput:
id: samples_to_figures_figureparams id: samples_to_figures_figureparams
@@ -606,42 +666,56 @@
size_hint_y: spacer_y_hint size_hint_y: spacer_y_hint
# Second function on this panel (layers_to_3dplot) begins here # Second function on this panel (layers_to_3dplot) begins here
StackLayout:
orientation: "tb-lr"
size_hint_x: 1.
size_hint_y: row_y_hint
# This button will be a dropdown # This button will be a dropdown
DropdownButton: DropdownButton:
id: samples_to_3dplot_filetype_dropdown id: samples_to_3dplot_filetype_dropdown
text: "select file type\n(png)" text: "select file type (png)"
size_hint_x: 0.25 size_hint_x: 0.25
size_hint_y: row_y_hint size_hint_y: 0.5
# Right of the dropdown will be a suite of options GridLayout:
StackLayout: rows: 1
orientation: "tb-lr" size_hint_x: 0.25
size_hint_x: 0.75 size_hint_y: 0.5
size_hint_y: row_y_hint # Checkboxes for toggling plot colouring and colourbars
# Checboxes for toggling plot colouring and colourbars
CheckBox: CheckBox:
id: samples_to_3dplot_plot_w id: samples_to_3dplot_plot_w
active: True active: True
size_hint_x: 0.1 size_hint_x: 0.1
size_hint_y: 0.5 size_hint_y: 0.5
Label:
text: "Heatmap"
size_hint_x: 0.4
size_hint_y: 0.5
text_size: self.size
halign: "left"
valign: "middle"
CheckBox: CheckBox:
id: samples_to_3dplot_colorbar id: samples_to_3dplot_colorbar
active: True active: True
size_hint_x: 0.1 size_hint_x: 0.1
size_hint_y: 0.5 size_hint_y: 0.5
Label: Label:
text: "Colour by temperature" text: "Colourbar"
size_hint_x: 0.4 size_hint_x: 0.4
size_hint_y: 0.5 size_hint_y: 0.5
text_size: self.size text_size: self.size
halign: "left" halign: "left"
valign: "middle" valign: "middle"
Label: # Text input for layer/sample filters
text: "Display colourbar" TextInput:
size_hint_x: 0.4 id: samples_to_3dplot_layerfilter
size_hint_x: 0.25
size_hint_y: 0.5 size_hint_y: 0.5
text_size: self.size hint_text: "Layer filter..."
halign: "left" TextInput:
valign: "middle" id: samples_to_3dplot_samplefilter
size_hint_x: 0.25
size_hint_y: 0.5
hint_text: "Sample filter..."
# And text input for other figure parameters # And text input for other figure parameters
TextInput: TextInput:
id: samples_to_3dplot_figureparams id: samples_to_3dplot_figureparams
@@ -671,7 +745,7 @@
size_hint_x: 1.0 size_hint_x: 1.0
size_hint_y: spacer_y_hint size_hint_y: spacer_y_hint
# Second function on this panel (layers_to_3dplot) begins here # Third function on this panel (layers_to_3dplot_interactive) begins here
# First part of this panel will be a suite of options # First part of this panel will be a suite of options
StackLayout: StackLayout:
orientation: "lr-tb" orientation: "lr-tb"
@@ -679,10 +753,9 @@
size_hint_y: row_y_hint size_hint_y: row_y_hint
# Checkboxes for toggling plot colouring and colourbars # Checkboxes for toggling plot colouring and colourbars
# and downsampling factor input # and downsampling factor input
#:set one_third 1/3
Label: Label:
text: "Downsampling:" text: "Downsampling:"
size_hint_x: 0.75 * one_third size_hint_x: 0.167
size_hint_y: 0.5 size_hint_y: 0.5
text_size: self.size text_size: self.size
halign: "right" halign: "right"
@@ -690,16 +763,26 @@
TextInput: TextInput:
id: samples_to_3dplot_interactive_downsampling id: samples_to_3dplot_interactive_downsampling
hint_text: "1" hint_text: "1"
size_hint_x: 0.25 * one_third size_hint_x: 0.083
size_hint_y: 0.5 size_hint_y: 0.5
TextInput:
id: samples_to_3dplot_interactive_layerfilter
size_hint_x: 0.375
size_hint_y: 0.5
hint_text: "Layer Filter..."
TextInput:
id: samples_to_3dplot_interactive_samplefilter
size_hint_x: 0.375
size_hint_y: 0.5
hint_text: "Sample Filter..."
CheckBox: CheckBox:
id: samples_to_3dplot_interactive_plot_w id: samples_to_3dplot_interactive_plot_w
active: True active: True
size_hint_x: 0.25 * one_third size_hint_x: 0.025
size_hint_y: 0.5 size_hint_y: 0.5
Label: Label:
text: "Colour by temperature" text: "Heatmap"
size_hint_x: 0.75 * one_third size_hint_x: 0.1
size_hint_y: 0.5 size_hint_y: 0.5
text_size: self.size text_size: self.size
halign: "left" halign: "left"
@@ -707,18 +790,18 @@
CheckBox: CheckBox:
id: samples_to_3dplot_interactive_sliceable id: samples_to_3dplot_interactive_sliceable
active: True active: True
size_hint_x: 0.25 * one_third size_hint_x: 0.025
size_hint_y: 0.5 size_hint_y: 0.5
Label: Label:
text: "Sliceable model" text: "Sliceable"
size_hint_x: 0.75 * one_third size_hint_x: 0.1
size_hint_y: 0.5 size_hint_y: 0.5
text_size: self.size text_size: self.size
halign: "left" halign: "left"
valign: "middle" valign: "middle"
TextInput: TextInput:
id: samples_to_3dplot_interactive_plotparams id: samples_to_3dplot_interactive_plotparams
size_hint_x: 1. size_hint_x: 0.75
size_hint_y: 0.5 size_hint_y: 0.5
hint_text: "Plot parameters..." hint_text: "Plot parameters..."
# This button is a progress bar trigger that tracks the # This button is a progress bar trigger that tracks the
@@ -744,25 +827,75 @@
# First item is an InputOutputChooser # First item is an InputOutputChooser
InputOutputChooser: InputOutputChooser:
id: io_chooser_persample id: io_chooser_datasheet
size_hint_x: 1.0 size_hint_x: 1.0
pos_hint: {"x": 0., "y": 0.875} pos_hint: {"x": 0., "y": 0.875}
# Button, below, is in a simple grid layout # Button, below, is in a simple grid layout
GridLayout: StackLayout:
orientation: "lr-tb"
size_hint_x: 0.9 size_hint_x: 0.9
size_hint_y: 0.15 size_hint_y: 0.1875
pos_hint: {"x": 0.05, "y": 0.6} pos_hint: {"x": 0.05, "y": 0.5}
rows: 1 # rows: 2
# Checkboxes to turn on/off layer-by-layer and sample-by-sample stats
CheckBox:
id: temp_data_to_csv_layers
active: True
size_hint_x: 0.025
size_hint_y: 0.33
Label:
text: "Layers"
size_hint_x: 0.1
size_hint_y: 0.33
text_size: self.size
halign: "left"
valign: "middle"
CheckBox:
id: temp_data_to_csv_samples
active: True
size_hint_x: 0.025
size_hint_y: 0.33
Label:
text: "Samples"
size_hint_x: 0.1
size_hint_y: 0.33
text_size: self.size
halign: "left"
valign: "middle"
# Text input for setting confidence interval
Label:
text: "Confidence Interval"
size_hint_x: 0.125
size_hint_y: 0.33
text_size: self.size
halign: "right"
valign: "middle"
TextInput:
id: temp_data_to_csv_confinterval
size_hint_x: 0.075
size_hint_y: 0.33
hint_text: "0.95"
# Text input for layer/sample filters
TextInput:
id: temp_data_to_csv_layerfilter
size_hint_x: 0.25
size_hint_y: 0.33
hint_text: "Layer filter..."
TextInput:
id: temp_data_to_csv_samplefilter
size_hint_x: 0.25
size_hint_y: 0.33
hint_text: "Sample filter..."
# This button is a progress bar trigger that tracks the # This button is a progress bar trigger that tracks the
# generation of datasheets # generation of datasheets
Button: Button:
text: "Generate\nDatasheets" text: "Generate\nDatasheets"
size_hint_x: 0.25 size_hint_x: 0.25
size_hint_y: 1 size_hint_y: 0.67
on_press: root.temp_data_to_csv() on_press: root.temp_data_to_csv()
ProgressBar: ProgressBar:
id: temp_data_to_csv_progbar id: temp_data_to_csv_progbar
size_hint_x: 0.75 size_hint_x: 0.75
size_hint_y: 1 size_hint_y: 0.67
value: 0 value: 0