194-fitrange #219
@ -22,51 +22,59 @@ class Namespace:
|
||||
|
||||
if basic:
|
||||
self.add_namespace(
|
||||
{'x': (None, 'x values'),
|
||||
'y': (None, 'x values'),
|
||||
'y_err': (None, 'y error values'),
|
||||
'fit': (None, 'dictionary of fit parameter', 'fit["PIKA"]'),
|
||||
'np': (np, 'numpy module'),
|
||||
{
|
||||
'x': (None, 'x values'),
|
||||
'y': (None, 'x values'),
|
||||
'y_err': (None, 'y error values'),
|
||||
'fit': (None, 'dictionary of fit parameter', 'fit["PIKA"]'),
|
||||
'np': (np, 'numpy module'),
|
||||
},
|
||||
parents=('Basic', 'General'),
|
||||
)
|
||||
|
||||
self.add_namespace(
|
||||
{'sin': (np.sin, 'Sine', 'sin(PIKA)'),
|
||||
'cos': (np.cos, 'Cosine', 'cos(PIKA)'),
|
||||
'tan': (np.tan, 'Tangens', 'tan(PIKA)'),
|
||||
'ln': (np.log, 'Natural Logarithm', 'ln(PIKA)'),
|
||||
'log': (np.log10, 'Logarithm (base 10)', 'log(PIKA)'),
|
||||
'exp': (np.exp, 'Exponential', 'exp(PIKA)'),
|
||||
'sqrt': (np.sqrt, 'Root', 'sqrt(PIKA)'),
|
||||
'lin_range': (np.linspace, 'N evenly spaced over interval [start, stop]', 'lin_range(start, stop, N)'),
|
||||
'log_range': (np.geomspace, 'N evenly spaced (log-scale) over interval [start, stop]', 'lin_range(start, stop, N)'),
|
||||
},
|
||||
{
|
||||
'sin': (np.sin, 'Sine', 'sin(PIKA)'),
|
||||
'cos': (np.cos, 'Cosine', 'cos(PIKA)'),
|
||||
'tan': (np.tan, 'Tangens', 'tan(PIKA)'),
|
||||
'ln': (np.log, 'Natural Logarithm', 'ln(PIKA)'),
|
||||
'log': (np.log10, 'Logarithm (base 10)', 'log(PIKA)'),
|
||||
'exp': (np.exp, 'Exponential', 'exp(PIKA)'),
|
||||
'sqrt': (np.sqrt, 'Root', 'sqrt(PIKA)'),
|
||||
'lin_range': (np.linspace, 'N evenly spaced over interval [start, stop]', 'lin_range(start, stop, N)'),
|
||||
'log_range': (np.geomspace, 'N evenly spaced (log-scale) over interval [start, stop]', 'lin_range(start, stop, N)'),
|
||||
},
|
||||
parents=('Basic', 'Functions'))
|
||||
|
||||
self.add_namespace(
|
||||
{'max': (np.max, 'Maximum value', 'max(PIKA)'),
|
||||
'min': (np.min, 'Minimum value', 'min(PIKA)'),
|
||||
'argmax': (np.argmax, 'Index of maximum value', 'argmax(PIKA)'),
|
||||
'argmin': (np.argmax, 'Index of minimum value', 'argmin(PIKA)'),
|
||||
},
|
||||
{
|
||||
'max': (np.max, 'Maximum value', 'max(PIKA)'),
|
||||
'min': (np.min, 'Minimum value', 'min(PIKA)'),
|
||||
'argmax': (np.argmax, 'Index of maximum value', 'argmax(PIKA)'),
|
||||
'argmin': (np.argmax, 'Index of minimum value', 'argmin(PIKA)'),
|
||||
},
|
||||
parents=('Basic', 'Values')),
|
||||
|
||||
if const:
|
||||
self.add_namespace(
|
||||
{'e': (constants.e, 'e / As'),
|
||||
'eps0': (constants.epsilon0, 'epsilon0 / As/Vm'),
|
||||
'Eu': (constants.Eu,), 'h': (constants.h, 'h / eVs'),
|
||||
'hbar': (constants.hbar, 'hbar / eVs'), 'kB': (constants.kB, 'kB / eV/K'),
|
||||
'mu0': (constants.mu0, 'mu0 / Vs/Am'), 'NA': (constants.NA, 'NA / 1/mol'),
|
||||
'pi': (constants.pi,), 'R': (constants.R, 'R / eV'),
|
||||
},
|
||||
{
|
||||
'e': (constants.e, 'e / As'),
|
||||
'eps0': (constants.epsilon0, 'epsilon0 / As/Vm'),
|
||||
'Eu': (constants.Eu,),
|
||||
'h': (constants.h, 'h / eVs'),
|
||||
'hbar': (constants.hbar, 'hbar / eVs'),
|
||||
'kB': (constants.kB, 'kB / eV/K'),
|
||||
'mu0': (constants.mu0, 'mu0 / Vs/Am'),
|
||||
'NA': (constants.NA, 'NA / 1/mol'),
|
||||
'pi': (constants.pi,),
|
||||
'R': (constants.R, 'R / eV'),
|
||||
},
|
||||
parents=('Constants', 'Maybe useful'),
|
||||
)
|
||||
|
||||
self.add_namespace(
|
||||
{f'gamma["{k}"]': (v, k, f'gamma["{k}"]') for k, v in constants.gamma.items()},
|
||||
parents=('Constants', 'Magnetogyric ratios (in 1/(sT))')
|
||||
parents=('Constants', 'Gyromagnetic ratios (in 1/(sT))')
|
||||
)
|
||||
|
||||
if fitfuncs:
|
||||
@ -199,7 +207,7 @@ class QNamespaceWidget(QtWidgets.QWidget, Ui_Form):
|
||||
|
||||
for entry in subspace:
|
||||
key_item = QtWidgets.QTableWidgetItem(entry)
|
||||
key_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
|
||||
key_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled)
|
||||
|
||||
vals = self.namespace.namespace[entry]
|
||||
|
||||
@ -214,12 +222,12 @@ class QNamespaceWidget(QtWidgets.QWidget, Ui_Form):
|
||||
display = vals[1]
|
||||
|
||||
value_item = QtWidgets.QTableWidgetItem(display)
|
||||
value_item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
|
||||
value_item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled)
|
||||
|
||||
key_item.setData(QtCore.Qt.UserRole, alias)
|
||||
key_item.setData(QtCore.Qt.UserRole+1, entry)
|
||||
value_item.setData(QtCore.Qt.UserRole, alias)
|
||||
value_item.setData(QtCore.Qt.UserRole+1, entry)
|
||||
key_item.setData(QtCore.Qt.ItemDataRole.UserRole, alias)
|
||||
key_item.setData(QtCore.Qt.ItemDataRole.UserRole+1, entry)
|
||||
value_item.setData(QtCore.Qt.ItemDataRole.UserRole, alias)
|
||||
value_item.setData(QtCore.Qt.ItemDataRole.UserRole+1, entry)
|
||||
|
||||
row = self.namespace_table.rowCount()
|
||||
self.namespace_table.setRowCount(row+1)
|
||||
@ -241,5 +249,5 @@ class QNamespaceWidget(QtWidgets.QWidget, Ui_Form):
|
||||
|
||||
@QtCore.pyqtSlot(QtWidgets.QTableWidgetItem, name='on_namespace_table_itemDoubleClicked')
|
||||
def item_selected(self, item: QtWidgets.QTableWidgetItem):
|
||||
self.selected.emit(item.data(QtCore.Qt.UserRole))
|
||||
self.sendKey.emit(item.data(QtCore.Qt.UserRole+1))
|
||||
self.selected.emit(item.data(QtCore.Qt.ItemDataRole.UserRole))
|
||||
self.sendKey.emit(item.data(QtCore.Qt.ItemDataRole.UserRole+1))
|
||||
|
Loading…
Reference in New Issue
Block a user