Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Bliss
bliss
Commits
3960e2fd
Commit
3960e2fd
authored
May 18, 2022
by
Valentin Valls
Browse files
Pluginify the filters in the GUI
parent
5eef97a6
Changes
8
Hide whitespace changes
Inline
Side-by-side
bliss/flint/filters/derivative.py
View file @
3960e2fd
...
...
@@ -35,6 +35,9 @@ class DerivativeData(NamedTuple):
class
DerivativeItem
(
ComputedCurveItem
,
plot_model
.
IncrementalComputableMixIn
):
"""This item use the scan data to process result before displaying it."""
NAME
=
"Derivative function"
ICON_NAME
=
"flint:icons/item-func"
EXTRA_POINTS
=
5
"""Extra points needed before and after a single point to compute a result"""
...
...
bliss/flint/filters/gaussian_fit.py
View file @
3960e2fd
...
...
@@ -35,6 +35,9 @@ class GaussianFitData(NamedTuple):
class
GaussianFitItem
(
ComputedCurveItem
,
plot_model
.
ComputableMixIn
):
"""This item use the scan data to process result before displaying it."""
NAME
=
"Gaussian fit"
ICON_NAME
=
"flint:icons/item-func"
def
__getstate__
(
self
):
state
:
Dict
[
str
,
Any
]
=
{}
state
.
update
(
plot_model
.
ChildItem
.
__getstate__
(
self
))
...
...
bliss/flint/filters/max.py
View file @
3960e2fd
...
...
@@ -33,6 +33,9 @@ class MaxData(NamedTuple):
class
MaxCurveItem
(
CurveStatisticItem
,
plot_model
.
IncrementalComputableMixIn
):
"""Statistic identifying the maximum location of a curve."""
NAME
=
"Max marker"
ICON_NAME
=
"flint:icons/item-stats"
def
name
(
self
)
->
str
:
return
"Max"
...
...
bliss/flint/filters/min.py
View file @
3960e2fd
...
...
@@ -33,6 +33,9 @@ class MinData(NamedTuple):
class
MinCurveItem
(
CurveStatisticItem
,
plot_model
.
IncrementalComputableMixIn
):
"""Statistic identifying the minimum location of a curve."""
NAME
=
"Min marker"
ICON_NAME
=
"flint:icons/item-stats"
def
name
(
self
)
->
str
:
return
"Min"
...
...
bliss/flint/filters/negative.py
View file @
3960e2fd
...
...
@@ -34,6 +34,9 @@ class NegativeData(NamedTuple):
class
NegativeItem
(
ComputedCurveItem
,
plot_model
.
IncrementalComputableMixIn
):
"""This item use a curve item to negative it."""
NAME
=
"Negative function"
ICON_NAME
=
"flint:icons/item-func"
def
__init__
(
self
,
parent
=
None
):
ComputedCurveItem
.
__init__
(
self
,
parent
=
parent
)
plot_model
.
IncrementalComputableMixIn
.
__init__
(
self
)
...
...
bliss/flint/filters/normalized.py
View file @
3960e2fd
...
...
@@ -27,6 +27,9 @@ _logger = logging.getLogger(__name__)
class
NormalizedCurveItem
(
plot_model
.
ChildItem
,
plot_item_model
.
CurveMixIn
):
"""Curve based on a source item, normalized by a side channel."""
NAME
=
"Normalized function"
ICON_NAME
=
"flint:icons/item-func"
def
__init__
(
self
,
parent
=
None
):
plot_model
.
ChildItem
.
__init__
(
self
,
parent
)
plot_item_model
.
CurveMixIn
.
__init__
(
self
)
...
...
bliss/flint/filters/normalized_zero_one.py
View file @
3960e2fd
...
...
@@ -62,6 +62,9 @@ class NormalizedZeroOneItem(ComputedCurveItem, plot_model.IncrementalComputableM
and 1.
"""
NAME
=
"Normalized range"
ICON_NAME
=
"flint:icons/item-func"
def
__init__
(
self
,
parent
=
None
):
ComputedCurveItem
.
__init__
(
self
,
parent
=
parent
)
plot_model
.
IncrementalComputableMixIn
.
__init__
(
self
)
...
...
bliss/flint/widgets/curve_plot_property.py
View file @
3960e2fd
...
...
@@ -270,72 +270,34 @@ class _AddItemAction(qt.QWidgetAction):
menu
:
qt
.
QMenu
=
self
.
sender
()
menu
.
clear
()
availableItemFactory
=
{
MaxCurveItem
:
None
,
MinCurveItem
:
None
,
DerivativeItem
:
None
,
NegativeItem
:
None
,
GaussianFitItem
:
None
,
NormalizedCurveItem
:
self
.
__createNormalized
,
NormalizedZeroOneItem
:
None
,
}
item
=
self
.
parent
().
selectedPlotItem
()
if
isinstance
(
item
,
plot_item_model
.
CurveMixIn
):
menu
.
addSection
(
"Statistics"
)
action
=
qt
.
QAction
(
self
)
action
.
setText
(
"Max marker"
)
icon
=
icons
.
getQIcon
(
"flint:icons/item-stats"
)
action
.
setIcon
(
icon
)
action
.
triggered
.
connect
(
functools
.
partial
(
self
.
__createChildItem
,
MaxCurveItem
)
)
menu
.
addAction
(
action
)
action
=
qt
.
QAction
(
self
)
action
.
setText
(
"Min marker"
)
icon
=
icons
.
getQIcon
(
"flint:icons/item-stats"
)
action
.
setIcon
(
icon
)
action
.
triggered
.
connect
(
functools
.
partial
(
self
.
__createChildItem
,
MinCurveItem
)
)
menu
.
addAction
(
action
)
menu
.
addSection
(
"Functions"
)
action
=
qt
.
QAction
(
self
)
action
.
setText
(
"Derivative function"
)
icon
=
icons
.
getQIcon
(
"flint:icons/item-func"
)
action
.
setIcon
(
icon
)
action
.
triggered
.
connect
(
functools
.
partial
(
self
.
__createChildItem
,
DerivativeItem
)
)
menu
.
addAction
(
action
)
action
=
qt
.
QAction
(
self
)
action
.
setText
(
"Negative function"
)
icon
=
icons
.
getQIcon
(
"flint:icons/item-func"
)
action
.
setIcon
(
icon
)
action
.
triggered
.
connect
(
functools
.
partial
(
self
.
__createChildItem
,
NegativeItem
)
)
menu
.
addAction
(
action
)
action
=
qt
.
QAction
(
self
)
action
.
setText
(
"Gaussian fit"
)
icon
=
icons
.
getQIcon
(
"flint:icons/item-func"
)
action
.
setIcon
(
icon
)
action
.
triggered
.
connect
(
functools
.
partial
(
self
.
__createChildItem
,
GaussianFitItem
)
)
menu
.
addAction
(
action
)
action
=
qt
.
QAction
(
self
)
action
.
setText
(
"Normalized function"
)
icon
=
icons
.
getQIcon
(
"flint:icons/item-func"
)
action
.
setIcon
(
icon
)
action
.
triggered
.
connect
(
self
.
__createNormalized
)
menu
.
addAction
(
action
)
action
=
qt
.
QAction
(
self
)
action
.
setText
(
"Normalized range"
)
icon
=
icons
.
getQIcon
(
"flint:icons/item-func"
)
action
.
setIcon
(
icon
)
action
.
triggered
.
connect
(
functools
.
partial
(
self
.
__createChildItem
,
NormalizedZeroOneItem
)
)
menu
.
addAction
(
action
)
for
className
,
chassFactory
in
availableItemFactory
.
items
():
try
:
name
=
className
.
NAME
except
Exception
:
name
=
className
.
__name__
if
chassFactory
is
None
:
chassFactory
=
functools
.
partial
(
self
.
__createChildItem
,
className
)
action
=
qt
.
QAction
(
self
)
action
.
setText
(
name
)
icon
=
icons
.
getQIcon
(
"flint:icons/item-stats"
)
action
.
setIcon
(
icon
)
action
.
triggered
.
connect
(
chassFactory
)
menu
.
addAction
(
action
)
else
:
action
=
qt
.
QAction
(
self
)
action
.
setText
(
"No available items"
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment