Skip to content
Merged
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
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[features] # defines the plugin features contained into this plugin
instruments = true # true if plugin contains instrument classes (else false, notice the lowercase for toml files)
extensions = true # true if plugins contains dashboard extensions
models = false # true if plugins contains pid models
models = true # true if plugins contains models
h5exporters = false # true if plugin contains custom h5 file exporters
scanners = false # true if plugin contains custom scan layout (daq_scan extensions)

Expand All @@ -23,7 +23,7 @@ authors = [
{name='Sebastien J. Weber', email='sebastien.weber@cnrs.fr'}
]
dependencies = [
"pymodaq>5.0"
"pymodaq>5.0.0"
]
classifiers = [
"Development Status :: 5 - Production/Stable",
Expand Down
1 change: 0 additions & 1 deletion src/pymodaq_plugins_datamixer/extensions/data_mixer.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ def snap(self):
self.modules_manager.grab_data()

def create_computed_detectors(self):
# Now that we have the module manager, load PID if it is checked in managers
try:
self.dashboard.add_det_from_extension('DataMixer', 'DAQ0D', 'DataMixer', self)
self.set_action_enabled('create_computed_detectors', False)
Expand Down
79 changes: 79 additions & 0 deletions src/pymodaq_plugins_datamixer/models/harmonics_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import numpy as np

from pymodaq_plugins_datamixer.extensions.utils.model import DataMixerModel, np # np will be used in method eval of the formula

from pymodaq_utils.math_utils import gauss1D, my_moment

from pymodaq_data.data import DataToExport, DataWithAxes
from pymodaq_gui.parameter import Parameter

from pymodaq_plugins_datamixer.extensions.utils.parser import (
extract_data_names, split_formulae, replace_names_in_formula)


from scipy.signal import find_peaks



class DataMixerModelFit(DataMixerModel):
params = [
{'title': 'Find Peaks', 'name': 'find_peaks', 'type': 'group', 'children': [
{'title': 'Highest Peak', 'name': 'highest_peak', 'type': 'float', 'value': 0, 'readonly': True},
{'title': 'Options', 'name': 'options', 'type': 'bool', 'value': False, 'children': [
{'title': 'Height', 'name': 'height', 'type': 'float', 'value': 0},
{'title': 'Distance', 'name': 'distance', 'type': 'int', 'value': 1, 'max': 1},
]},
]},
{'title': 'Cropping', 'name': 'cropping', 'type': 'group', 'children': [
{'title': 'Index min from peak', 'name': 'ind_min', 'type': 'int', 'value': 0},
{'title': 'Index max from peak', 'name': 'ind_max', 'type': 'int', 'value': 100},

]},
]

def ini_model(self):
pass

def update_settings(self, param: Parameter):
pass

def process_dte(self, dte: DataToExport):
dte_processed = DataToExport('computed')
dwa = dte[0].deepcopy()

options = {}
if self.settings['find_peaks', 'options']:
for param in self.settings.child('find_peaks', 'options'):
options[param.name()] = param.value()

peaks_indices, _ = find_peaks(dwa[0], **options)

heights = [float(dwa.isig[index][0][0]) for index in peaks_indices]
ind_max = peaks_indices[np.argmax(heights)]
self.settings.child('find_peaks', 'highest_peak').setValue(dwa.axes[0].get_data()[ind_max])

dwa_indexed = dwa.isig[ind_max + self.settings['cropping', 'ind_min']:
ind_max + self.settings['cropping', 'ind_max']]
dwa_indexed.axes = []
dwa_indexed.create_missing_axes()

dte_processed.append(dwa_indexed)

return dte_processed


def main():
from pymodaq_gui.utils.utils import mkQApp
from pymodaq.utils.gui_utils.loader_utils import load_dashboard_with_preset

app = mkQApp('DataMixer')

preset_file_name = 'harmonics'
dashboard, extension, win = load_dashboard_with_preset(preset_file_name, 'Data Mixer')
app.exec()

return dashboard, extension, win


if __name__ == '__main__':
main()
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
title = 'this is the configuration file of the plugin XXX'
title = 'this is the configuration file of the plugin DataMixer'

preset = ''