Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
814 changes: 383 additions & 431 deletions rsHRF/CLI.py

Large diffs are not rendered by default.

33 changes: 7 additions & 26 deletions rsHRF/rsHRF_GUI/datatypes/misc/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import numpy as np
from copy import deepcopy
from ...misc.status import Status
from ....utils.default_parameters import default_parameters


class Parameters:
Expand All @@ -12,31 +13,11 @@ class Parameters:

def __init__(self):
# initialize default parameters
self.estimation = "canon2dd"
self.passband = [0.01, 0.08]
self.passband_deconvolve = [0.0, sys.float_info.max]
self.TR = 2.0
self.localK = 1
self.T = 3
self.T0 = 1
self.TD_DD = 2
self.AR_lag = 1
self.thr = 1
self.order = 3
self.volterra = 0
self.len = 24
self.temporal_mask = []
self.min_onset_search = 4
self.max_onset_search = 8
self.dt = self.TR / self.T
self.lag = np.arange(
np.fix(self.min_onset_search / self.dt),
np.fix(self.max_onset_search / self.dt) + 1,
dtype="int",
)
for key, value in default_parameters.items():
setattr(self, key, value)

# getters
def get_estimation(self):
def get_estimation(self) -> str:
return self.estimation

def get_passband(self):
Expand Down Expand Up @@ -281,7 +262,7 @@ def set_Volterra(self, volterra):
"""
Sets Volterra if the estimation rule is canon2dd
"""
if self.estimation == "canon":
if "canon" in self.estimation:
try:
volterra = int(volterra)
except:
Expand Down Expand Up @@ -373,8 +354,8 @@ def update_lag(self):
Re-calculating lag
"""
self.lag = np.arange(
np.fix(self.min_onset_search / self.dt),
np.fix(self.max_onset_search / self.dt) + 1,
np.trunc(self.min_onset_search / self.dt),
np.trunc(self.max_onset_search / self.dt) + 1,
dtype="int",
)

Expand Down
10 changes: 2 additions & 8 deletions rsHRF/rsHRF_GUI/gui_windows/inputWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
StringVar,
Label,
)
from ...utils.default_parameters import available_estimations


class InputWindow:
Expand Down Expand Up @@ -146,14 +147,7 @@ def getOutputDir():
maskFileLabel = Label(window, text="")
outputPathLabel = Label(window, text="")
estimationDropDown = OptionMenu(
window,
self.estimationOption,
"canon2dd",
"sFIR",
"FIR",
"gamma",
"fourier",
"fourier w/ hanning",
window, self.estimationOption, *available_estimations
)
# placing widgets
inputFormat.grid(row=0, column=0, padx=(5, 5), pady=(5, 5))
Expand Down
6 changes: 4 additions & 2 deletions rsHRF/rsHRF_GUI/gui_windows/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


class Main:
def __init__(self):
def __init__(self, parameters=None):
# main window
root = Tk()
root.title("rsHRF Toolbox")
Expand Down Expand Up @@ -46,7 +46,9 @@ def __init__(self):
input = () # receives the input from the input window
output = {} # receives the output from the core
# initializing parameter window
parameter_window.setParameters(core.get_parameters())
parameter_window.setParameters(
parameters if parameters is not None else core.get_parameters()
)
parameter_window.display()

""" Gets the input from the input toplevel.
Expand Down
4 changes: 2 additions & 2 deletions rsHRF/rsHRF_GUI/gui_windows/parameterWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ def __init__(self):
self.window = Toplevel()
self.window.title("Parameters")
self.parameters = {}
self.labels = []
self.entries = []
self.labels: list[Label] = []
self.entries: list[Entry] = []
# get screen width and height
screen_width = self.window.winfo_screenwidth()
screen_height = self.window.winfo_screenheight()
Expand Down
4 changes: 2 additions & 2 deletions rsHRF/rsHRF_GUI/run.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .gui_windows.main import Main


def run():
Main()
def run(parameters=None):
Main(parameters)
Loading