Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RadioObservatory
LOFAR
Commits
a7ecc486
Commit
a7ecc486
authored
13 years ago
by
Sven Duscha
Browse files
Options
Downloads
Patches
Plain Diff
task #2699 implemented skeleton common plotexport dialog
parent
ff7eac78
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitattributes
+1
-0
1 addition, 0 deletions
.gitattributes
CEP/Calibration/BBSControl/scripts/plotexport.py
+211
-0
211 additions, 0 deletions
CEP/Calibration/BBSControl/scripts/plotexport.py
with
212 additions
and
0 deletions
.gitattributes
+
1
−
0
View file @
a7ecc486
...
@@ -23,6 +23,7 @@ CEP/Calibration/BBSControl/scripts/casapy2bbs.py -text
...
@@ -23,6 +23,7 @@ CEP/Calibration/BBSControl/scripts/casapy2bbs.py -text
CEP/Calibration/BBSControl/scripts/checkBBSskymodel.py -text
CEP/Calibration/BBSControl/scripts/checkBBSskymodel.py -text
CEP/Calibration/BBSControl/scripts/parmdbplot.py -text
CEP/Calibration/BBSControl/scripts/parmdbplot.py -text
CEP/Calibration/BBSControl/scripts/plotcorrmatrix.py -text
CEP/Calibration/BBSControl/scripts/plotcorrmatrix.py -text
CEP/Calibration/BBSControl/scripts/plotexport.py -text
CEP/Calibration/BBSControl/scripts/plothistogram.py -text
CEP/Calibration/BBSControl/scripts/plothistogram.py -text
CEP/Calibration/BBSControl/scripts/plotwindow.py -text
CEP/Calibration/BBSControl/scripts/plotwindow.py -text
CEP/Calibration/BBSControl/scripts/solverdialog.py -text
CEP/Calibration/BBSControl/scripts/solverdialog.py -text
...
...
This diff is collapsed.
Click to expand it.
CEP/Calibration/BBSControl/scripts/plotexport.py
0 → 100755
+
211
−
0
View file @
a7ecc486
#!/usr/bin/env python
#
# Solver statistics preferences dialog
#
# File: plotpexport.py
# Author: Sven Duscha (duscha@astron.nl)
# Date: 2011-12-20
# Last change; 2012-01-10
#
# This class displays an export dialog for the solver statistics plotter
# to export data in ASCII or Matlab format (using scipy.savemat)
# TODO
from
PyQt4.QtCore
import
*
from
PyQt4.QtGui
import
*
import
os
import
sys
import
numpy
as
np
class
plotexport
(
QDialog
):
def
__init__
(
self
,
parent
):
QDialog
.
__init__
(
self
)
self
.
parent
=
parent
#self.perIteration=self.parent.parent.perIteration
#self.useScipy=self.parent.parent.useScipy
self
.
path
=
""
# path to export data to
self
.
format
=
"
ASCII
"
# format to export to (ASCII or Matlab, default=ASCII)
self
.
parmList
=
[]
# List of parameters (parmdb and solver) to export
# Interval to export data over
self
.
xIntervalMin
=
None
self
.
xIntervalMax
=
None
self
.
createWidgets
()
# Create Widgets
self
.
createLayouts
()
# Create Layouts
self
.
createConnections
()
# create connections between widgets
def
createWidgets
(
self
):
print
"
createWidgets()
"
# DEBUG
# Group boxes to group widgets into logical units
self
.
parmGroup
=
QGroupBox
()
self
.
parmGroup
.
setTitle
(
"
Parameters to export
"
)
self
.
parmGroup
.
setToolTip
(
"
select parameters to export
"
)
self
.
formatGroup
=
QGroupBox
()
self
.
formatGroup
.
setTitle
(
"
Format settings
"
)
self
.
formatGroup
.
setToolTip
(
"
format settings
"
)
self
.
parmComboBox
=
QComboBox
()
self
.
parmComboBox
.
setMaxVisibleItems
(
4
)
self
.
solverComboBox
=
QComboBox
()
self
.
solverComboBox
.
setMaxVisibleItems
(
4
)
self
.
fileDialog
=
QFileDialog
()
self
.
fileDialog
.
setFileMode
(
QFileDialog
.
AnyFile
);
urls
=
[]
urls
.
append
(
QUrl
.
fromLocalFile
(
os
.
environ
[
'
HOME
'
]))
if
os
.
path
.
exists
(
'
/data/scratch/
'
+
os
.
environ
[
'
USER
'
]):
urls
.
append
(
QUrl
.
fromLocalFile
(
'
/data/scratch/
'
+
os
.
environ
[
'
USER
'
]))
self
.
fileDialog
.
setSidebarUrls
(
urls
);
self
.
saveButton
=
QPushButton
(
"
Save as
"
)
self
.
saveButton
.
setMaximumWidth
(
120
)
self
.
filenameLineEdit
=
QLineEdit
()
self
.
filenameLineEdit
.
setReadOnly
(
True
)
self
.
filenameLineEdit
.
setText
(
os
.
environ
[
'
HOME
'
])
self
.
filenameLineEdit
.
setText
(
self
.
path
)
self
.
formatComboBox
=
QComboBox
()
self
.
formatComboBox
.
addItem
(
"
ASCII
"
)
# if self.parent.parent.haveModule('scipy') == True or self.parent.parent.haveModule('scipy.io') == True:
# self.exportComboBox.addItem("Matlab")
self
.
rangeComboBox
=
QComboBox
()
self
.
rangeComboBox
.
addItem
(
"
plotted x_min to x_max
"
)
self
.
rangeComboBox
.
addItem
(
"
complete selection
"
)
self
.
rangeComboBox
.
addItem
(
"
complete set
"
)
self
.
exportButton
=
QPushButton
(
"
Export
"
)
self
.
exportButton
.
setToolTip
(
"
export selected data
"
)
self
.
cancelButton
=
QPushButton
(
"
Cancel
"
)
self
.
cancelButton
.
setToolTip
(
"
Cancel export and close dialog
"
)
# Window settings
self
.
setMinimumWidth
(
400
)
self
.
setMinimumHeight
(
400
)
self
.
setMaximumWidth
(
400
)
self
.
setMaximumHeight
(
400
)
self
.
setWindowTitle
(
"
Export Data
"
)
self
.
updateComboBoxes
()
def
createConnections
(
self
):
print
"
createConnections()
"
# DEBUG
self
.
connect
(
self
.
saveButton
,
SIGNAL
(
'
clicked()
'
),
self
.
saveAs
)
self
.
connect
(
self
.
exportButton
,
SIGNAL
(
'
clicked()
'
),
self
.
exportData
)
self
.
connect
(
self
.
cancelButton
,
SIGNAL
(
'
clicked()
'
),
SLOT
(
'
close()
'
))
def
createLayouts
(
self
):
print
"
createLayouts()
"
# DEBUG
self
.
parametersLayout
=
QVBoxLayout
()
self
.
parmGroup
.
setLayout
(
self
.
parametersLayout
)
self
.
fileNameLayout
=
QHBoxLayout
()
self
.
fileNameLayout
.
addWidget
(
self
.
saveButton
)
self
.
fileNameLayout
.
addWidget
(
self
.
filenameLineEdit
)
self
.
formatLayout
=
QVBoxLayout
()
self
.
formatLayout
.
addWidget
(
self
.
rangeComboBox
)
self
.
formatLayout
.
addWidget
(
self
.
formatComboBox
)
self
.
formatGroup
.
setLayout
(
self
.
formatLayout
)
self
.
buttonLayout
=
QHBoxLayout
()
self
.
buttonLayout
.
addWidget
(
self
.
exportButton
)
self
.
buttonLayout
.
addWidget
(
self
.
cancelButton
)
# Combine all layouts into mainLayout
self
.
mainLayout
=
QVBoxLayout
()
self
.
mainLayout
.
addWidget
(
self
.
parmGroup
)
self
.
mainLayout
.
addWidget
(
self
.
formatGroup
)
self
.
mainLayout
.
addLayout
(
self
.
fileNameLayout
)
self
.
mainLayout
.
addLayout
(
self
.
buttonLayout
)
self
.
setLayout
(
self
.
mainLayout
)
def
updateParmComboBox
(
self
):
print
"
updateComboBox()
"
# DEBUG
self
.
deleteEntriesComboBox
()
# Delete entries in parmComboBox
# Read entries from solverQuery table
#for i in range(0, self.parent.parametersComboBox.count()):
# self.parmComboBox.addItem(self.parent.parametersComboBox.itemText(i))
def
updateComboBoxes
(
self
):
print
"
updateFormatComboBox()
"
# DEBUG
self
.
deleteEntriesComboBox
()
# loop over parms and add them to parmComboBox
self
.
formatComboBox
.
addItem
(
"
ASCII
"
)
# if self.parent.parent.useScipy==True: # Check availability of scipy
# self.formatComboBox.addItem("Matlab")
self
.
addEntriesParmComboBox
()
self
.
addEntriesSolverComboBox
()
def
deleteEntriesComboBox
(
self
):
print
"
deleteEntriesParmComboBox()
"
# DEBUG
# Loop over elements in parmComboBox with parmDB parameters
i
=
self
.
parmComboBox
.
count
()
while
i
>
0
:
# Delete entries in parmComboBox
print
"
removing i =
"
,
i
,
parmComboBox
.
currentText
()
# DEBUG
self
.
parmComboBox
.
removeItem
(
i
-
1
)
i
=
self
.
parmComboBox
.
count
()
i
=
self
.
formatComboBox
.
count
()
while
i
>
0
:
# Delete entries in formatComboBox
print
"
removing i =
"
,
i
,
self
.
formatComboBox
.
currentText
()
# DEBUG
self
.
formatComboBox
.
removeItem
(
i
-
1
)
i
=
self
.
formatComboBox
.
count
()
i
=
self
.
solverComboBox
.
count
()
while
i
>
0
:
# Delete entries in solverComboBox
print
"
removing i =
"
,
i
,
self
.
solverComboBox
.
currentText
()
# DEBUG
self
.
solverComboBox
.
removeItem
(
i
-
1
)
i
=
self
.
solverComboBox
.
count
()
def
addEntriesParmComboBox
(
self
):
print
"
addEntriesParmComboBox()
"
# DEBUG
def
addEntriesSolverComboBox
(
self
):
print
"
addEntriesSolverComboBox()
"
# DEBUG
def
saveAs
(
self
):
print
"
saveAs()
"
# DEBUG
self
.
path
=
unicode
(
self
.
fileDialog
.
getSaveFileName
(
self
,
'
Save file
'
))
self
.
filenameLineEdit
.
setText
(
self
.
path
)
def
exportData
(
self
):
print
"
exportData()
"
# DEBUG
#****************************************
#
# Helper functions
#
#****************************************
# Main function used for debugging
#
def
main
():
print
"
main()
"
# DEBUG
app
=
QApplication
(
sys
.
argv
)
form
=
plotexport
(
app
)
form
.
show
()
app
.
exec_
()
if
__name__
==
"
__main__
"
:
main
()
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment