Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
G
GEPARD
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
GEPARD
GEPARD
Commits
545f462e
Commit
545f462e
authored
Apr 29, 2019
by
Lars Bittrich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfixes
parent
15c7be2e
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
37 additions
and
17 deletions
+37
-17
analysis/analysisview.py
analysis/analysisview.py
+5
-3
analysis/datastats.py
analysis/datastats.py
+5
-5
analysis/loadresults.py
analysis/loadresults.py
+6
-1
analysis/particleeditor.py
analysis/particleeditor.py
+13
-2
dataset.py
dataset.py
+4
-2
viewitems.py
viewitems.py
+4
-4
No files found.
analysis/analysisview.py
View file @
545f462e
...
...
@@ -220,9 +220,11 @@ class ParticleAnalysis(QtWidgets.QMainWindow):
self
.
layout
.
addLayout
(
self
.
menuLayout
)
self
.
layout
.
addLayout
(
viewLayout
)
if
self
.
datastats
.
config
[
'minHQI'
]
is
not
None
:
self
.
hqiSpinBox
.
setValue
(
self
.
datastats
.
config
[
'minHQI'
])
self
.
compHqiSpinBox
.
setValue
(
self
.
datastats
.
config
[
'compHQI'
])
minHQI
=
self
.
datastats
.
dataset
.
resultParams
[
'minHQI'
]
compHQI
=
self
.
datastats
.
dataset
.
resultParams
[
'compHQI'
]
if
minHQI
is
not
None
:
self
.
hqiSpinBox
.
setValue
(
minHQI
)
self
.
compHqiSpinBox
.
setValue
(
compHQI
)
self
.
createActions
()
self
.
createMenus
()
...
...
analysis/datastats.py
View file @
545f462e
...
...
@@ -21,7 +21,7 @@ If not, see <https://www.gnu.org/licenses/>.
import
os
import
numpy
as
np
import
operator
from
dataset
import
loadData
from
dataset
import
loadData
,
recursiveDictCompare
def
readDataStats
(
fname
):
...
...
@@ -38,7 +38,6 @@ def readDataStats(fname):
class
DataStats
(
object
):
def
__init__
(
self
,
dataset
):
self
.
dataset
=
dataset
self
.
config
=
dataset
.
resultParams
self
.
spectraResults
=
None
#entire List of all spectra assignments
self
.
additiveResults
=
None
#entire List of all additives
...
...
@@ -209,11 +208,12 @@ class DataStats(object):
self
.
dataset
.
resultParams
=
{
'minHQI'
:
minHQI
,
'compHQI'
:
compHQI
}
self
.
dataset
.
save
()
print
(
'saved dataset; Valid:'
,
self
.
testRead
())
testresult
=
self
.
testRead
()
print
(
'saved dataset; Valid:'
,
testresult
)
return
testresult
def
testRead
(
self
):
statsread
=
readDataStats
(
self
.
dataset
.
fname
)
return
statsread
.
__dict__
==
self
.
__dict__
return
recursiveDictCompare
(
self
.
__dict__
,
statsread
.
__dict__
)
\ No newline at end of file
analysis/loadresults.py
View file @
545f462e
...
...
@@ -261,7 +261,12 @@ class LoadWITecResults(QtWidgets.QDialog):
self
.
parent
.
updateBtn
.
clicked
.
connect
(
self
.
parent
.
formatResults
)
self
.
parent
.
formatResults
()
self
.
parent
.
show_hide_labels
()
self
.
parent
.
saveAnalysisResults
()
minHQI
=
self
.
parent
.
hqiSpinBox
.
value
()
compHQI
=
self
.
parent
.
compHqiSpinBox
.
value
()
if
not
self
.
parent
.
datastats
.
saveAnalysisResults
(
minHQI
,
compHQI
):
QtWidgets
.
QMessageBox
.
warning
(
self
.
parent
,
'Error!'
,
'Data inconsistency after saving!'
,
QtWidgets
.
QMessageBox
.
Ok
,
QtWidgets
.
QMessageBox
.
Ok
)
self
.
parent
.
setEnabled
(
True
)
event
.
accept
()
...
...
analysis/particleeditor.py
View file @
545f462e
...
...
@@ -24,6 +24,7 @@ You should have received a copy of the GNU General Public License
along with this program, see COPYING.
If not, see <https://www.gnu.org/licenses/>.
"""
import
numpy
as
np
import
cv2
from
PyQt5
import
QtWidgets
...
...
@@ -134,7 +135,12 @@ class ParticleEditor(object):
del
self
.
datastats
.
dataset
.
particles2spectra
[
index
]
#save data
self
.
datastats
.
saveAnalysisResults
()
minHQI
=
self
.
parent
.
hqiSpinBox
.
value
()
compHQI
=
self
.
parent
.
compHqiSpinBox
.
value
()
if
not
self
.
datastats
.
saveAnalysisResults
(
minHQI
,
compHQI
):
QtWidgets
.
QMessageBox
.
warning
(
self
.
parent
,
'Error!'
,
'Data inconsistency after saving!'
,
QtWidgets
.
QMessageBox
.
Ok
,
QtWidgets
.
QMessageBox
.
Ok
)
#update contours in sampleview
self
.
parent
.
parent
.
contouritem
.
resetContours
(
self
.
datastats
.
dataset
.
particlecontours
)
...
...
@@ -156,7 +162,12 @@ class ParticleEditor(object):
self
.
datastats
.
hqis
[
specIndex
]
=
100
#save data
self
.
datastats
.
saveAnalysisResults
()
minHQI
=
self
.
parent
.
hqiSpinBox
.
value
()
compHQI
=
self
.
parent
.
compHqiSpinBox
.
value
()
if
not
self
.
datastats
.
saveAnalysisResults
(
minHQI
,
compHQI
):
QtWidgets
.
QMessageBox
.
warning
(
self
.
parent
,
'Error!'
,
'Data inconsistency after saving!'
,
QtWidgets
.
QMessageBox
.
Ok
,
QtWidgets
.
QMessageBox
.
Ok
)
self
.
parent
.
loadParticleData
()
...
...
dataset.py
View file @
545f462e
...
...
@@ -54,7 +54,6 @@ def saveData(dataset, fname):
dataset
.
zvalimg
=
zvalimg
def
arrayCompare
(
a1
,
a2
):
print
(
"array compare"
)
ind
=
np
.
isnan
(
a1
)
if
not
np
.
any
(
ind
):
return
np
.
all
(
a1
==
a2
)
...
...
@@ -63,7 +62,6 @@ def arrayCompare(a1, a2):
return
np
.
all
(
a1
[
~
ind
]
==
a2
[
~
ind
])
def
listCompare
(
l1
,
l2
):
print
(
"list compare"
)
if
len
(
l1
)
!=
len
(
l2
):
return
False
for
l1i
,
l2i
in
zip
(
l1
,
l2
):
...
...
@@ -86,16 +84,20 @@ def recursiveDictCompare(d1, d2):
print
(
key
,
type
(
a
),
type
(
b
))
if
isinstance
(
a
,
np
.
ndarray
):
if
not
isinstance
(
b
,
np
.
ndarray
)
or
not
arrayCompare
(
a
,
b
):
print
(
"data is different!"
,
a
,
b
)
return
False
elif
isinstance
(
a
,
dict
):
if
not
isinstance
(
b
,
dict
):
print
(
"data is different!"
,
a
,
b
)
return
False
if
not
recursiveDictCompare
(
a
,
b
):
return
False
elif
isinstance
(
a
,
(
list
,
tuple
)):
if
not
isinstance
(
b
,
(
list
,
tuple
))
or
not
listCompare
(
a
,
b
):
print
(
"data is different!"
,
a
,
b
)
return
False
elif
a
!=
b
:
print
(
"data is different!"
,
a
,
b
)
return
False
return
True
...
...
viewitems.py
View file @
545f462e
...
...
@@ -122,14 +122,14 @@ class SegmentationContours(QtWidgets.QGraphicsItem):
for
index
in
self
.
selectedContours
:
# partIndex = int(np.where(self.parent.dataset.ramanscansortindex == index)[0])
partIndex
=
index
assignments
.
append
(
self
.
analysiswidget
.
datastats
.
particleResults
[
partIndex
])
assignments
.
append
(
self
.
parent
.
analysiswidget
.
datastats
.
particleResults
[
partIndex
])
assignments
.
append
(
"other"
)
for
assignment
in
np
.
unique
(
np
.
array
(
assignments
)):
combineActs
.
append
(
combineMenu
.
addAction
(
assignment
))
reassignActs
=
[]
reassignMenu
=
QtWidgets
.
QMenu
(
"Reassign particle(s) into"
)
for
polymer
in
self
.
analysiswidget
.
datastats
.
getUniquePolymers
():
for
polymer
in
self
.
parent
.
analysiswidget
.
datastats
.
getUniquePolymers
():
reassignActs
.
append
(
reassignMenu
.
addAction
(
polymer
))
reassignActs
.
append
(
reassignMenu
.
addAction
(
"other"
))
...
...
@@ -156,7 +156,7 @@ class SegmentationContours(QtWidgets.QGraphicsItem):
# QtWidgets.QMessageBox.about(self.parent, "Not yet implemented", "we are getting there...")
# return
self
.
analysiswidget
.
editor
.
combineParticles
(
self
.
selectedContours
,
newAssignment
)
self
.
parent
.
analysiswidget
.
editor
.
combineParticles
(
self
.
selectedContours
,
newAssignment
)
elif
action
in
reassignActs
:
newAssignment
=
action
.
text
()
...
...
@@ -164,7 +164,7 @@ class SegmentationContours(QtWidgets.QGraphicsItem):
# QtWidgets.QMessageBox.about(self.parent, "Not yet implemented", "we are getting there...")
# return
self
.
analysiswidget
.
editor
.
reassignParticles
(
self
.
selectedContours
,
newAssignment
)
self
.
parent
.
analysiswidget
.
editor
.
reassignParticles
(
self
.
selectedContours
,
newAssignment
)
class
FitPosIndicator
(
QtWidgets
.
QGraphicsItem
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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