Compare commits
3 Commits
dev
...
306-sigmoi
Author | SHA1 | Date | |
---|---|---|---|
66b56c9be6 | |||
f33643955b | |||
41353b9a54 |
@ -133,7 +133,7 @@ class QAsciiReader(QtWidgets.QDialog, Ui_ascii_reader):
|
|||||||
if self.column_checkBox.isChecked() and self.line_spinBox.isEnabled():
|
if self.column_checkBox.isChecked() and self.line_spinBox.isEnabled():
|
||||||
header_line = self.reader.header[self.line_spinBox.value()-1]
|
header_line = self.reader.header[self.line_spinBox.value()-1]
|
||||||
header_line = header_line.strip('\n\t\r, ')
|
header_line = header_line.strip('\n\t\r, ')
|
||||||
header_line = re.sub(r'[\t ;,]+', ';', header_line)
|
header_line = re.sub(r'[\t, ;]+(?!\w*})', ';', header_line)
|
||||||
|
|
||||||
self.ascii_table.setHorizontalHeaderLabels(header_line.split(';'))
|
self.ascii_table.setHorizontalHeaderLabels(header_line.split(';'))
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ class AsciiReader:
|
|||||||
with self.fname.open('r') as f:
|
with self.fname.open('r') as f:
|
||||||
for i, line in enumerate(islice(f, len(self.header)+len(self.lines), num_lines)):
|
for i, line in enumerate(islice(f, len(self.header)+len(self.lines), num_lines)):
|
||||||
line = line.strip('\n\t\r, ')
|
line = line.strip('\n\t\r, ')
|
||||||
line = re.sub(r'[\t ;,]+', ';', line)
|
line = re.sub(r'[\t, ;]+(?!\w*})', ';', line)
|
||||||
line = line.split(';')
|
line = line.split(';')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -146,10 +146,11 @@ class AsciiReader:
|
|||||||
raw_data = raw_data.reshape((1, *raw_data.shape))
|
raw_data = raw_data.reshape((1, *raw_data.shape))
|
||||||
|
|
||||||
if len(x) == 0 or raw_data.shape[2] == 1:
|
if len(x) == 0 or raw_data.shape[2] == 1:
|
||||||
_temp = np.zeros((raw_data.shape[0], raw_data.shape[1], raw_data.shape[2]+1))
|
raw_data = raw_data.reshape(raw_data.shape[0], raw_data.shape[2], raw_data.shape[1])
|
||||||
_temp[:, :, 0] = np.arange(raw_data.shape[1])
|
# _temp = np.zeros((raw_data.shape[0], raw_data.shape[2], raw_data.shape[1]))
|
||||||
_temp[:, :, 1:] = raw_data
|
# _temp[:, :, 0] = np.arange(raw_data.shape[1])
|
||||||
raw_data = _temp
|
# _temp[:, :, 1:] = raw_data
|
||||||
|
# raw_data = _temp
|
||||||
|
|
||||||
if y:
|
if y:
|
||||||
y = [i+1 for i in y]
|
y = [i+1 for i in y]
|
||||||
|
@ -203,6 +203,31 @@ class Sinc:
|
|||||||
return c * np.sinc(((x-x0)/w)/np.pi)
|
return c * np.sinc(((x-x0)/w)/np.pi)
|
||||||
|
|
||||||
|
|
||||||
|
class Sigmoid:
|
||||||
|
type = 'Basic'
|
||||||
|
name = 'Sigmoid'
|
||||||
|
equation = 'C / [1 + exp(-a * (x - x_{0})] + y_{0}'
|
||||||
|
params = ['C', 'a', 'x_{0}', 'y_{0}']
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def func(x, c, a, x0, y0):
|
||||||
|
"""
|
||||||
|
Sigmoid function
|
||||||
|
|
||||||
|
.. math::
|
||||||
|
y = C / [1 + exp(-a * (x - x_0))] + y_0
|
||||||
|
|
||||||
|
Args:
|
||||||
|
x (array_like): Input values
|
||||||
|
c (float): Prefactor
|
||||||
|
a (float): Steepness of the sigmoid
|
||||||
|
x0 (float): x position of the sigmoid's midpoint
|
||||||
|
y0 (float): y position of the sigmoid's midpoint
|
||||||
|
|
||||||
|
"""
|
||||||
|
return c / (1 + np.exp(-a * (x - x0))) + y0
|
||||||
|
|
||||||
|
|
||||||
class Sine:
|
class Sine:
|
||||||
"""
|
"""
|
||||||
Wavy sine function
|
Wavy sine function
|
||||||
|
@ -116,7 +116,7 @@ class Peschier:
|
|||||||
name = 'Diffusion + Cross-Relaxation'
|
name = 'Diffusion + Cross-Relaxation'
|
||||||
type = 'Diffusion'
|
type = 'Diffusion'
|
||||||
equation = r'Diffusion with cross-relax f(ast) \rightarrow s(low)'
|
equation = r'Diffusion with cross-relax f(ast) \rightarrow s(low)'
|
||||||
params = ['M_{0}', 'D', 'T_{1,f}', 'T_{1,s}', 'k', 'p_{f}', 't_{ev}', 'g']
|
params = ['M_{0}', 'D', 'T_{1f}', 'T_{1s}', 'k', 'p_{f}', 't_{ev}', 'g']
|
||||||
bounds = [(0, None), (0, None), (0, None), (0, None), (0, None), (0, None)]
|
bounds = [(0, None), (0, None), (0, None), (0, None), (0, None), (0, None)]
|
||||||
choices = [(r'\gamma', 'nucleus', gamma)]
|
choices = [(r'\gamma', 'nucleus', gamma)]
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ class TwoSatRecAbsolute:
|
|||||||
type = 'Relaxation'
|
type = 'Relaxation'
|
||||||
name = 'Two-step relaxation (abs. int)'
|
name = 'Two-step relaxation (abs. int)'
|
||||||
equation = r'M_{0} + \Sigma \DeltaM_{i}(1-exp(-(x/T_{1,i})^{\beta_{i}}))'
|
equation = r'M_{0} + \Sigma \DeltaM_{i}(1-exp(-(x/T_{1,i})^{\beta_{i}}))'
|
||||||
params = [r'\DeltaM_{1}', 'T_{1,1}', r'\beta_{1}', r'\DeltaM_{2}', 'T_{1,2}', r'\beta_{2}', 'M_{0}']
|
params = [r'\DeltaM_{1}', 'T_{11}', r'\beta_{1}', r'\DeltaM_{2}', 'T_{12}', r'\beta_{2}', 'M_{0}']
|
||||||
choices = [('Type', 'is_inv', {'Saturation': False, 'Inversion': True})]
|
choices = [('Type', 'is_inv', {'Saturation': False, 'Inversion': True})]
|
||||||
bounds = [(0, None), (0, None), (0, 1), (0, None), (0, None), (0, 1), (None, None)]
|
bounds = [(0, None), (0, None), (0, 1), (0, None), (0, None), (0, 1), (None, None)]
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ class TwoSatRecRelative:
|
|||||||
name = 'Two-step relaxation (rel. int)'
|
name = 'Two-step relaxation (rel. int)'
|
||||||
equation = r'M_{0} + \DeltaM[R(1-exp(-(x/T_{1,1})^{\beta_{1}})) + \n'\
|
equation = r'M_{0} + \DeltaM[R(1-exp(-(x/T_{1,1})^{\beta_{1}})) + \n'\
|
||||||
r'(1-R)(1-exp(-(x/T_{1,2})^{\beta_{2}}))]'
|
r'(1-R)(1-exp(-(x/T_{1,2})^{\beta_{2}}))]'
|
||||||
params = [r'\DeltaM', 'M_{0}', 'T_{1,1}', r'\beta_{1}', 'T_{1,2}', r'\beta_{2}', 'R']
|
params = [r'\DeltaM', 'M_{0}', 'T_{11}', r'\beta_{1}', 'T_{12}', r'\beta_{2}', 'R']
|
||||||
choices = [('Type', 'kind', {'Saturation': 'sat', 'Inversion': 'inv'})]
|
choices = [('Type', 'kind', {'Saturation': 'sat', 'Inversion': 'inv'})]
|
||||||
bounds = [(0, None), (None, None), (0, None), (0, 1), (0, None), (0, 1), (0, 1)]
|
bounds = [(0, None), (None, None), (0, None), (0, 1), (0, None), (0, 1), (0, 1)]
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user