Skip to content

Commit c81d7fb

Browse files
Merge new dataset backend into master for v0.5.0
2 parents 56e6317 + 5953781 commit c81d7fb

12 files changed

Lines changed: 736 additions & 510 deletions

File tree

.github/CONTRIBUTING.md

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,40 @@
11
# Contributing
22

33
When contributing to this repository, please first discuss the change you wish to make via issue,
4-
email, or any other method with the owners of this repository before making a change.
4+
email, or any other method with the owners of this repository before making a change.
55

66
Please note we have a code of conduct, please follow it in all your interactions with the project.
77

8-
## Pull Request Process
8+
## Committing
9+
10+
1. *Need* to contain reference to any of the issues that it resolved.
11+
2. Should contain a description about what was accomplished in the change. If an issue is
12+
tied to the given commit, then a longer description can be given in the corresponding issue's comments.
13+
14+
## Issues
15+
16+
1. Complete overview of what needs to be accomplished in order to resolve this issue, or what occurs
17+
when this issue takes place.
18+
2. *Blocked* and/or *Blocking* labels must be applied if an issue interrupts the progress of another. The
19+
issues that are *Blocking*/*Blocked* should then be stated in the issue description like so:
20+
21+
> ***Blocking/Blocked Example***:
22+
> ---------------------------
23+
> **Blocked by:** #0, ...
24+
>
25+
> **Blocking:** #0, ...
26+
27+
3. Priority labels that correspond to this issue (please contact code owners with any questions regarding
28+
priority labels).
29+
4. Any other labelling that corresponds to this issue should be applied.
30+
5. Once an issue is being worked on, the *In Progress* label must be applied, as well as assigned to the
31+
user working on this issue.
32+
6. An issue will be marked as *Closed* once it is merged successfully into *main* or approved to be closed by
33+
any code owners.
34+
7. Don't forget to comment on the issue with any updates regarding your progress, questions/concerns, as well as
35+
requesting help from any other contributors.
36+
37+
## Pull Requests
938

1039
1. Ensure any install or build dependencies are removed before the end of the layer when doing a
1140
build.

build_config.spec

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# -*- mode: python ; coding: utf-8 -*-
2+
3+
block_cipher = None
4+
5+
a = Analysis(['src\\multi_stat_analysis\\__main__.py'],
6+
pathex=['src\\multi_stat_analysis'],
7+
binaries=[],
8+
datas=[('C:/workspace/Multiscale-Statistical-Analysis/resources/*', 'resources')],
9+
hiddenimports=['scipy.special.cython_special',
10+
'pkg_resources.py2_warn',
11+
'pyimod03_importers',
12+
'pyi_rth_pkgres'],
13+
hookspath=[],
14+
runtime_hooks=[],
15+
excludes=[],
16+
win_no_prefer_redirects=False,
17+
win_private_assemblies=False,
18+
cipher=block_cipher,
19+
noarchive=False)
20+
21+
pyz = PYZ(a.pure, a.zipped_data,
22+
cipher=block_cipher)
23+
24+
exe = EXE(pyz,
25+
a.scripts,
26+
a.binaries,
27+
a.zipfiles,
28+
a.datas,
29+
[],
30+
name='MultiscaleStatisticalAnalysis',
31+
debug=False,
32+
bootloader_ignore_signals=False,
33+
strip=False,
34+
upx=False,
35+
upx_exclude=[],
36+
runtime_tmpdir=None,
37+
console=False )

src/multi_stat_analysis/CanvasPanel.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ def pick_point(event):
9898
pos = self.get_scatter_plot().get_offsets()[ind["ind"][0]]
9999
scale = pos[0]
100100

101-
index = self.get_data().get_results_scale().index(scale)
101+
index = self.data.get_results_scale().index(scale)
102102
xregress = self.get_save_xr()
103-
yregress = self.get_data().get_regress_sets()[index]
103+
yregress = self.data.get_regress_sets()[index]
104104
# checks the given id to perform the correct regression using the data determined above
105105
# this needs error exceptions still
106106
regression_choices = \
@@ -285,7 +285,7 @@ def __init__(self, parent, x, xr, y, swb, tree):
285285
wx.Panel.__init__(self, parent, size=wx.Size(640, 480), style=wx.SIMPLE_BORDER)
286286

287287
self.tree_menu = tree
288-
self.workbook = self.tree_menu.GetItemData(swb).get_wb()
288+
self.workbook = self.tree_menu.GetItemData(swb)
289289
self.swb = swb
290290
self.figure = figure()
291291
# defines the plot
@@ -540,6 +540,8 @@ def set_popt(self, popt): self.popt = popt
540540
# TODO: rename the class name
541541
class SclbyAreaPlot(wx.Panel):
542542

543+
_X_AXIS_LABEL = "Scale-sensitive multiscale analysis"
544+
543545
def __init__(self, parent, x, y, data):
544546
# gets the Panel properties
545547
wx.Panel.__init__(self, parent, size=wx.Size(640, 530), style=wx.SIMPLE_BORDER)
@@ -642,8 +644,8 @@ def draw_plot(self):
642644

643645
self.set_y(newy)
644646
self.get_axes().set_title('')
645-
self.get_axes().set_xlabel(self.data.get_strings()[3][0] + ' ' + self.data.get_strings()[4][0])
646-
self.get_axes().set_ylabel(self.data.get_strings()[3][1])
647+
self.get_axes().set_xlabel(SclbyAreaPlot._X_AXIS_LABEL)
648+
self.get_axes().set_ylabel(self.data.get_row_labels()[0][0])
647649
self.set_scatter_plot(scatterList)
648650
# set the x-scale to log plot
649651
self.get_axes().set_xscale('log')
@@ -681,8 +683,8 @@ def draw_complexity_plot(self):
681683
scatterList.append(self.get_axes().scatter(self.get_x(), np.log10(yvals), marker="o", s=8))
682684

683685
self.get_axes().set_title('')
684-
self.get_axes().set_xlabel(self.data.get_strings()[3][0] + ' ' + self.data.get_strings()[4][0])
685-
self.get_axes().set_ylabel(self.data.get_strings()[3][2] + ' log10 scale')
686+
self.get_axes().set_xlabel(SclbyAreaPlot._X_AXIS_LABEL)
687+
self.get_axes().set_ylabel(self.data.get_row_labels()[0][1] + ' log10 scale')
686688
self.set_scatter_plot(scatterList)
687689
# set x-axis to log scale
688690
self.get_axes().set_xscale('log')

src/multi_stat_analysis/Dialogs.py

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,7 +1330,7 @@ def set_saved_legend_text(self, txt): self.legend_text = txt
13301330
# class for the dialog which allows the user to set the x-regression values based on the opened data sets
13311331
class XRValuesDialog(wx.Dialog):
13321332
# Dynamic UI stuff
1333-
def __init__(self, parent, x):
1333+
def __init__(self, parent, regress_vals:list):
13341334
wx.Dialog.__init__(self, parent, wx.ID_ANY, "X-Axis Regression Values", size=(450, 350))
13351335
self.main_panel = wx.Panel(self, wx.ID_ANY)
13361336

@@ -1348,37 +1348,32 @@ def __init__(self, parent, x):
13481348
self.sizer.Add(self.lblxvals, 1, wx.ALL, 5)
13491349

13501350
self.txt_ctrl = []
1351-
# dynamically add a new textbox for each file that is opened
1352-
for value in x:
1353-
# default textbox value is the name of the file
1351+
# dynamically add a new textbox for each value that is given in the list
1352+
for value in regress_vals:
13541353
txt = wx.TextCtrl(self.scroll_panel, value=str(value), pos=(140, 20), size=(250, -1))
13551354
self.txt_ctrl.append(txt)
13561355
self.sizer.Add(txt, 0, wx.ALL, 5)
13571356

13581357
self.ok = wx.Button(self.btn_panel, id=wx.ID_OK, label="OK", pos=(240, 0))
13591358
self.cancel = wx.Button(self.btn_panel, id=wx.ID_CANCEL, label="Cancel", pos=(335, 0))
13601359

1361-
self.xvals_txt = ''
1360+
self.regress_vals = ''
13621361
self.scroll_panel.SetSizer(self.sizer)
13631362
self.scroll_panel.Layout()
13641363
self.scroll_panel.Fit()
1364+
13651365
# function for closing the dialog
13661366
def OnQuit(self, event):
1367-
13681367
self.Destroy()
1368+
13691369
# function to save the user input values
13701370
def SaveString(self):
1371-
1372-
vals = []
1373-
1371+
new_regress_vals = []
13741372
for values in self.get_txtctrl():
1373+
new_regress_vals.append(float(values.GetValue()))
1374+
self.regress_vals = new_regress_vals
13751375

1376-
vals.append(float(values.GetValue()))
1377-
1378-
self.set_xvals(vals)
1379-
1380-
def get_xvals(self): return self.xvals_txt
1381-
def set_xvals(self, x): self.xvals_txt = x
1376+
def get_regress_vals(self): return self.regress_vals
13821377
def get_txtctrl(self): return self.txt_ctrl
13831378

13841379
class HHPlotDialog(wx.Frame):

src/multi_stat_analysis/MountainsImporter/ImportUtils.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44
from typing import Optional
55
from ctypes import wintypes, windll, create_unicode_buffer, pointer
66

7-
_DEFAULT_TIMEOUT = 60.0
8-
_resource_paths = {}
9-
107
class ResourceFiles:
8+
DIRECTORY = "resources"
9+
1110
SSFA_TEMPLATE = "ssfa-template.mnt"
1211

1312
START_MNTS_BTN = "start-mountains.png"
@@ -24,6 +23,15 @@ def append_to_path(end_str, prefix=os.getcwd()):
2423
"""Joins the given end string to the end of the file path prefix."""
2524
return os.path.join(os.sep, prefix, end_str)
2625

26+
_DEFAULT_TIMEOUT = 60.0
27+
_resource_paths = {}
28+
# Find base path for resources
29+
try:
30+
# PyInstaller creates a temp folder and stores path in _MEIPASS
31+
_resource_base_path = append_to_path(ResourceFiles.DIRECTORY, sys._MEIPASS)
32+
except Exception:
33+
_resource_base_path = append_to_path(ResourceFiles.DIRECTORY)
34+
2735
def resource_abs_path(relative_path):
2836
"""Get absolute path to resources, works for normal file handling and for PyInstaller.
2937
Based on answer from stackoverflow page:
@@ -34,13 +42,8 @@ def resource_abs_path(relative_path):
3442
if relative_path in _resource_paths:
3543
return _resource_paths[relative_path]
3644

37-
try:
38-
# PyInstaller creates a temp folder and stores path in _MEIPASS
39-
base_path = sys._MEIPASS
40-
except Exception:
41-
base_path = append_to_path("resources")
42-
43-
path = append_to_path(relative_path, base_path)
45+
global _resource_base_path
46+
path = append_to_path(relative_path, _resource_base_path)
4447
if not os.path.exists(path):
4548
raise FileNotFoundError("Could not find resource " + path)
4649
_resource_paths[relative_path] = path

src/multi_stat_analysis/MountainsImporter/Importer.py

Lines changed: 11 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -111,20 +111,17 @@ class MntsImporter:
111111
@param result_file_path
112112
@param file_dir
113113
@param file_name
114-
@param sensitivity_func
115114
@param analysis_func_wrapper
116115
117116
@return If an exception is thrown, it can be recieved using the excep_queue queue.
118117
This queue outputs a tuple with data:
119118
[0] - Exception to re-raise
120119
[1] - Traceback to print out"""
121-
def __init__(self, is_init, result_file_path, file_dir, file_name,
122-
sensitivity_func, analysis_func_wrapper):
120+
def __init__(self, is_init, result_file_path, file_dir, file_name, analysis_func_wrapper):
123121
self.is_init = is_init
124122
self.result_file_path = result_file_path
125123
self.file_dir = file_dir
126124
self.file_name = file_name
127-
self.sensitivity_func = sensitivity_func
128125
self.analysis_func_wrapper = analysis_func_wrapper
129126
if __debug__:
130127
print("Mountains Import Process Initialized.")
@@ -141,7 +138,7 @@ def start(self):
141138
if self.is_init:
142139
self.init_mnts()
143140

144-
# Generate results file from scale-sensitive fractal analysis
141+
# Generate results file from scale-sensitive multiscale analysis
145142
self.option_select_export_func()
146143
# Throw exception if the results file was not correctly generated
147144
if not os.path.exists(self.result_file_path):
@@ -199,11 +196,7 @@ def option_select_export_func(self):
199196
if __debug__:
200197
print("Selected graph")
201198

202-
# Select sensitivity and analysis options
203-
self.sensitivity_func()
204-
if __debug__:
205-
time.sleep(_DELAY)
206-
print("Ran sensitivity selection")
199+
# Select analysis options
207200
self.analysis_func_wrapper.call()
208201
if __debug__:
209202
time.sleep(_DELAY)
@@ -243,7 +236,7 @@ def option_select_export_func(self):
243236
if __debug__:
244237
print("Closed file editor")
245238

246-
def get_results_data(file_paths, results_dir, sensitive_func, analysis_func_wrapper):
239+
def get_results_data(file_paths, results_dir, analysis_func_wrapper):
247240
"""Given the list of surface files and a results directory,
248241
generate the corresponding list of new file names and paths.
249242
Also generates mountains interaction process calls."""
@@ -261,31 +254,10 @@ def get_results_data(file_paths, results_dir, sensitive_func, analysis_func_wrap
261254
result_temp_paths.append(ImportUtils.append_to_path(surf_full_name, TEMP_PATH))
262255
# Add to function list
263256
mountains_processes.append(
264-
MntsImporter(i==0, result_temp_paths[i], TEMP_PATH, surfName, sensitive_func, analysis_func_wrapper))
257+
MntsImporter(i==0, result_temp_paths[i], TEMP_PATH, surfName, analysis_func_wrapper))
265258
# Output generated paths and functions
266259
return result_paths, result_temp_paths, mountains_processes
267260

268-
def select_scale_sensitivity():
269-
"""Select scale-sensitivity option"""
270-
ImportUtils.click_resource(ResourceFiles.SCALE_SENSITIVE_BTN)
271-
272-
def select_complexity():
273-
"""Select scale-sensitivity option"""
274-
ImportUtils.click_resource(ResourceFiles.COMPLEXITY_BTN)
275-
276-
_sensitivity_option_map = {}
277-
class SensitivityOption(Enum):
278-
"""Used by ImportOptionsDialog to specify options for sensitivity combo box."""
279-
Scale = ("Scale-sensitive Analysis", select_scale_sensitivity)
280-
Complexity = ("Complexity Analysis", select_complexity)
281-
282-
def __init__(self, label, func):
283-
self.label = label
284-
self.func = func
285-
# Assign label to function map
286-
global _sensitivity_option_map
287-
_sensitivity_option_map[label] = func
288-
289261
def select_analysis_option(pos):
290262
"""Click on the analysis menu button to prepare for selecting the option"""
291263
ImportUtils.click_resource(ResourceFiles.ANALYSIS_OPTION_BTN)
@@ -315,10 +287,10 @@ def __init__(self, label, blank):
315287
_analysis_option_map[label] = AnalysisOptionFuncWrapper(len(_analysis_option_map) + 1)
316288

317289
class ImportOptionsDialog(wx.Dialog):
318-
"""Create surface import options selection. This includes specifying scale/complexity sensitivity,
319-
the type of surface analysis being done, as well as the directory for saving the analysis data.
320-
It can then be used to return these selected options wrapped within interactive functions designed
321-
for Digital Surf's MountainsMap application."""
290+
"""Create surface import options selection. This includes specifying the type of surface analysis
291+
being done, as well as the directory for saving the analysis data. It can then be used to return
292+
these selected options wrapped within interactive functions designed for Digital Surf's MountainsMap
293+
application."""
322294

323295
def __init__(self, parent, file_paths):
324296
"""@param file_paths - List of surface file paths that will be analyzed into result files."""
@@ -339,30 +311,18 @@ def __init__(self, parent, file_paths):
339311
analysis_label = wx.StaticText(self.options_panel, wx.ID_ANY, label="Analysis Type:")
340312
self.analysis_combo = self.getTypeCombo(AnalysisOption)
341313

342-
# Sensitivity Type Selection
343-
sensitivity_label = wx.StaticText(self.options_panel, wx.ID_ANY, label="Sensitivity Type:")
344-
self.sensitivity_combo = self.getTypeCombo(SensitivityOption)
345-
346314
# Initialize sizer for both combo boxes
347315
combo_sizer = wx.BoxSizer(wx.HORIZONTAL)
348316
analysis_sizer = wx.BoxSizer(wx.VERTICAL)
349-
sensitivity_sizer = wx.BoxSizer(wx.VERTICAL)
350317
# Initialize Analyasis sizer
351318
analysis_sizer.AddStretchSpacer()
352319
analysis_sizer.Add(analysis_label, flag=wx.ALIGN_LEFT)
353320
analysis_sizer.Add(self.analysis_combo, flag=wx.ALIGN_LEFT)
354321
analysis_sizer.AddStretchSpacer()
355-
# Initialize Sensitivity sizer
356-
sensitivity_sizer.AddStretchSpacer()
357-
sensitivity_sizer.Add(sensitivity_label, flag=wx.ALIGN_LEFT)
358-
sensitivity_sizer.Add(self.sensitivity_combo, flag=wx.ALIGN_LEFT)
359-
sensitivity_sizer.AddStretchSpacer()
360322
# Layout combo sizers
361323
combo_sizer.AddStretchSpacer()
362324
combo_sizer.Add(analysis_sizer, flag=wx.CENTER)
363325
combo_sizer.AddStretchSpacer()
364-
combo_sizer.Add(sensitivity_sizer, flag=wx.CENTER)
365-
combo_sizer.AddStretchSpacer()
366326

367327
# Results folder selection button handling
368328
results_label = wx.StaticText(self.options_panel, wx.ID_ANY, label="Select Results Folder:")
@@ -416,11 +376,10 @@ def okBtnHandler(self, event):
416376
else: # Create new directory to save files, directory accepted
417377
os.mkdir(selected_results_dir)
418378

419-
sensitive_func = _sensitivity_option_map[self.sensitivity_combo.GetStringSelection()]
420379
analysis_func = _analysis_option_map[self.analysis_combo.GetStringSelection()]
421380
# Build new file path based on given surface files and results dir
422381
new_file_paths, temp_file_paths, new_mountains_processes = \
423-
get_results_data(self.file_paths, selected_results_dir, sensitive_func, analysis_func)
382+
get_results_data(self.file_paths, selected_results_dir, analysis_func)
424383

425384
# Possibly overwrite check was requested
426385
already_exists = []
@@ -471,6 +430,7 @@ class ImportInfoDialog(wx.MessageDialog):
471430
tool_information = \
472431
"Please follow these requirements in order to have the most optimal/functional experience with" \
473432
"the surface import tool:\n\n" \
433+
" - To recieve reliable results, the means of measuring and equipment used should be identical between surfaces\n"\
474434
" - Do not move your mouse or use the keyboard during the import process\n" \
475435
" - Enable the MountainsMap product configuration startup window\n" \
476436
" - Verify that last usage of MountainsMap did not terminate unexpectedly\n" \

0 commit comments

Comments
 (0)