Commit 77c4738a authored by Julia Garriga Ferrer's avatar Julia Garriga Ferrer
Browse files

[gui][grainplot] Add case for one dimension datasets

parent 760f1d7c
Pipeline #52156 passed with stage
in 3 minutes and 16 seconds
...@@ -92,7 +92,7 @@ class GrainPlotWidget(qt.QMainWindow): ...@@ -92,7 +92,7 @@ class GrainPlotWidget(qt.QMainWindow):
self._levelsWidget.setLayout(levelsLayout) self._levelsWidget.setLayout(levelsLayout)
self._mosaicityPlot = Plot2D(parent=self) self._mosaicityPlot = Plot2D(parent=self)
self._exportButton = qt.QPushButton("Export") self._exportButton = qt.QPushButton("Export")
self._exportButton.clicked.connect(self._saveMaps) self._exportButton.clicked.connect(self.exportMaps)
layout.addWidget(self._methodCB) layout.addWidget(self._methodCB)
layout.addWidget(self._levelsWidget) layout.addWidget(self._levelsWidget)
layout.addWidget(self._plotWidget) layout.addWidget(self._plotWidget)
...@@ -280,12 +280,12 @@ class GrainPlotWidget(qt.QMainWindow): ...@@ -280,12 +280,12 @@ class GrainPlotWidget(qt.QMainWindow):
return medfilt2d(img) return medfilt2d(img)
def _saveMaps(self): def exportMaps(self):
""" """
Loads the file from a FileDialog. Loads the file from a FileDialog.
""" """
if self.dataset.dims.ndim > 1: if self.dataset and self.dataset.dims.ndim > 1:
nx = { nx = {
"entry": { "entry": {
"data": { "data": {
...@@ -316,6 +316,28 @@ class GrainPlotWidget(qt.QMainWindow): ...@@ -316,6 +316,28 @@ class GrainPlotWidget(qt.QMainWindow):
} }
) )
else:
nx = {
"entry": {
"data": {
">" + Method.COM.name: "../maps/" + Method.COM.name,
"@signal": Method.COM.name,
"@NX_class": "NXdata"
},
"maps": {
Method.COM.name: self._moments[0][0],
Method.FWHM.name: self._moments[0][1],
Method.SKEWNESS.name: self._moments[0][2],
Method.KURTOSIS.name: self._moments[0][3],
"@NX_class": "NXcollection"
},
"@NX_class": "NXentry",
"@default": "data",
},
"@NX_class": "NXroot",
"@default": "entry"
}
fileDialog = qt.QFileDialog() fileDialog = qt.QFileDialog()
fileDialog.setFileMode(fileDialog.AnyFile) fileDialog.setFileMode(fileDialog.AnyFile)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment