vdat.gui.tabs.tab_widget
– The tab widgets¶
-
class
vdat.gui.tabs.tab_widget.
UpdateIFUTask
(parent=None)[source]¶ Bases:
PyQt5.QtCore.QThread
PyQt5.QtCore.QThread
that runsifu.prepare_image
on every of the ifus passed to theinit()
method¶ Name Signature Description finished
bool Emitted when the run()
is stopped (True
) or finishes normally (False
)ifu_ready
str after preparing the image(s) to show, emits the signal with the ifu.ifuslot string. The main thread can then retrieve the ifu and display it. ¶ Name Signature Description stop()
stop and exit from run()
before finishing the list of IFUs. If the method is processing one IFU, finishes before exiting.Note
It is not possible to update a pixmap from withing a running
QThread
. Therefore we emit theifu_ready
signal when the image is ready for display. It is responsibility of the process owning the thread to pain the image into the pixmap and display it.Parameters: - parent :
QWidget
or derived instance, optional the parent of the current widget
Attributes: - ifus : list
IFUs to process. Each object must implement the
prepare_image()
-
finished
¶
-
ifu_ready
¶
- parent :
-
class
vdat.gui.tabs.tab_widget.
BaseFplanePanel
(tab_type, parent=None)[source]¶ Bases:
vdat.gui.tabs.interface.FplaneTabTemplate
Implementation of the
FplaneTabTemplate
that creates a working fplane panel using theifu_widget.BaseIFUWidget
. Connect all the relevant slots to be able to select/deselect the IFUs.¶ Name Signature Description sig_thread_stop
Emitted to stop the update_thread
¶ Name Signature Description update_finished bool react to the UpdateIFUTask.finished
signal. The current implementation does nothing.ifuSelected()
,selectAllIFUs()
,deselectAllIFUs()
see interface.FplaneTabTemplate
update_ifus()
If the update_thread
runs, stop it; then pass to it the IFUs list and start the thread.¶ Signal Slot UpdateIFUTask.finished
update_finished()
UpdateIFUTask.ifu_ready
show_ifu_image()
sig_thread_stop
UpdateIFUTask.stop()
ifu_widget.BaseIFUWidget.sig_ifuToggled
sig_ifuToggled
Parameters: - all :
Attributes: - update_thread :
UpdateIFUTask
QThread used to update the images to show in the IFUs
ifu_widget_class
Return the name of the class to use to represent IFUs in the focal plane.
- fplane :
FPlane
instance of the focal plane constructed using the
ifu_widget_class
- main_layout :
PyQt5.QtWidgets.QVBoxLayout
main layout of the widget.
- fplane_layout :
PyQt5.QtWidgets.QGridLayout
layout containing the IFU widgets
- initialized : bool
if
False
, react toshowEvent()
drawing the tab content. It is set toFalse
at build time and incleanup()
- others
-
sig_thread_stop
¶
-
setup_qthread
()[source]¶ Create and setup the
UpdateIFUTask
. Saves it into theupdate_thread
attribute.Overrides this method to use other QThread implementations. The rest of the implementation assumes that
update_thread
has astart()
method and aifus
attibute.This method is called during the initialisation of the object
-
build_gui
()[source]¶ Build the GUI calling
set_main_layout()
and adding to the main layout the fplane layout frombuild_fplane()
-
set_main_layout
()[source]¶ Create and set the default layout. The layout is saved into the
main_layout
.Default to
PyQt5.QtWidgets.QVBoxLayout
. Override to use a different layout.
-
build_fplane
()[source]¶ Create a grid layout, fill it with the IFU widgets returned by
ifu_widget_class
, connect the relevant signals and return the layout.The name of the fplane file is taken from the
fp_filename
option of thefplane
sectoin in the main vdat configuration file.Returns: - fplane_layout :
PyQt5.QtWidgets.QGridLayout
instance layout containing the IFU widgets
- fplane_layout :
-
ifu_widget_class
¶ Return the name of the class to use to represent IFUs in the focal plane.
Override in derived classes to use a different IFU widget.
Returns: - :class:`.ifu_widget.BaseIFUWidget`
-
update_finished
(stopped)[source]¶ Do nothing method. This method is also a pyqt Slot.
Override this method in derived classes to act upon the
UpdateIFUTask.finished
signalParameters: - stopped : bool
True
if the updated has been forcefully stopped,False
if it finished.
-
show_ifu_image
(ifuslot)[source]¶ Call the
show_image()
of the ifu withifuslot
ID.This method is also an pyqt slot.
Parameters: - ifuslot : str
ifuslot ID of the IFU to show
-
ifuSelected
(ifuslot, val)[source]¶ Select or deselect an IFU. This method is also a PyQt slot.
Parameters: - ifuslot : string
SLOTID of the selected IFU
- val : bool
If
True
selected, otherwise deselected
-
selectAllIFUs
()[source]¶ Select all IFU. This method is also a PyQt slot.
It emits the
sig_ifuToggled
signal to make sure that all the ifus are registered as selected.
-
deselectAllIFUs
()[source]¶ Deselect all IFU. This method is also a PyQt slot.
It emits the
sig_ifuToggled
signal to make sure that all the ifus are registered as deselected.
-
showEvent
(e)[source]¶ When the tab becomes visible, this method is triggered by Qt. If
initialized
is False, callsupdate_ifus()
and then set it to True.Parameters: - e :
PyQt5.QtGui.QShowEvent
the tab is show
- e :
-
class
vdat.gui.tabs.tab_widget.
BaseFplanePanelSetup
(tab_type, parent=None)[source]¶ Bases:
vdat.gui.tabs.tab_widget.BaseFplanePanel
Add a default setup implementation that set the title and the tooltip and then call the setup method for the IFUs
-
setup
(target_dir, tab_dict, format_dict)[source]¶ Informations to pass to the tab and to the IFUs.
The method uses directly the following keys of the
tab_dict
argument:- title (mandatory): title of the current widget; the title is
formatted using
format_dict
and saved intitle
. - tool_tip (optional): tool tip to show for the current widget; if
present, the string is formatted using
format_dict
and saved intool_tip
.
Other keys might be used by the ifu widget setup method.
Parameters: - target_dir : string
directory selected by the user
- tab_dict : dictionary
dictionary with the specifications to use to build the tabs
- format_dict : string
dictionary with the fields and values that can be replaced in file names
- title (mandatory): title of the current widget; the title is
formatted using
-
-
class
vdat.gui.tabs.tab_widget.
FitsFplanePanel
(tab_type, parent=None)[source]¶ Bases:
vdat.gui.tabs.tab_widget.BaseFplanePanelSetup
Class that shows fits files in the focal plane. It allows to select the scaling for the IFUs.
Unless documented below, the class inherits signals, slots and connection from
BaseFplanePanel
.¶ Name Signature Description toggle_individual_scale()
bool When the input is true, redraw the IFU with individual scaling enabled toggle_global_scale()
bool When the input is true, redraw the IFU with using a global scaling enabled toggle_custom_scale()
bool, optional When the input is true, redraw the IFU using a custom scaling enabled ¶ Signal Slot toggled
of “Individual” radio buttontoggle_individual_scale()
toggled
of “Global” radio buttontoggle_global_scale()
toggled
of “Custom” radio buttontoggle_custom_scale()
(with bool argument)released
of custom “Rescale” buttontoggle_custom_scale()
(with no argument)Parameters: - all :
see
BaseFplanePanel
Attributes: - scaling_bar :
PyQt5.QtWidgets.QHBoxLayout
layout containing the scaling bar
min_scale_custom
Float value shown in the minimum scale box.
max_scale_custom
Float value shown in the maximum scale box.
- min_scale_global, max_scale_global : int
minimum and maximum global scale used when clicking on the global scale button
radio_individual_scale
Individual scale radio button
radio_global_scale
Global scale radio button
radio_custom_scale
Custom scale radio button
-
ifu_widget_class
¶ Return the name of the class to use to represent IFUs in the focal plane.
Returns: - :class:`.ifu_widget.IFUFitsWidget`
-
add_scaling_bar
()[source]¶ Create a
PyQt5.QtWidgets.QHBoxLayout
, add it to themain_layout
. On this layout add buttons and text boxes to chose the scaling to use for the IFUs. Connect all the relevant signals and slots.
Create a radio button, add it to
layout
and return it. The buttons are not marked by default.Parameters: - label : string
label of the button
- layout :
PyQt5.QtWidgets.QLayout
layout to which the button is added
Returns: - button :
PyQt5.QtWidgets.QRadioButton
-
_scale_box
()[source]¶ Create and return a box where is possible to insert numbers.
Returns: - scale_box :
PyQt5.QtWidgets.QLineEdit
box with width of 80 and a double validator
- scale_box :
-
_custom_scale_setter
(layout)[source]¶ Setup all the parts needed to set the custom scale.
Parameters: - layout :
PyQt5.QtWidgets.QLayout
layout to which the pieces are added
- layout :
-
custom_scale_set_enabled
(enable)[source]¶ Enable/disable the labels, input boxes and button used to set the custom scaling.
Parameters: - enable : bool
whether to enable or disable the widgets.
-
min_scale_custom
¶ Float value shown in the minimum scale box. Clear the text box with
del min_scale_custom
-
max_scale_custom
¶ Float value shown in the maximum scale box. Clear the text box with
del max_scale_custom
-
radio_individual_scale
¶ Individual scale radio button
-
radio_global_scale
¶ Global scale radio button
-
radio_custom_scale
¶ Custom scale radio button
-
toggle_individual_scale
(enabled=True)[source]¶ When
enabled
isTrue
redraw the IFUs using the individual scaling.This method is also a PyQt slot.
Parameters: - enabled : bool
whether the individual scaling is enabled or not
-
toggle_global_scale
(enabled)[source]¶ When
enabled
isTrue
redraw the IFUs using the global scaling, saved inmin_scale_global
andmax_scale_global
.This method is also a PyQt slot.
Parameters: - enabled : bool
whether the global scaling is enabled or not
-
toggle_custom_scale
(enabled=True)[source]¶ When
enabled
isTrue
redraw the IFUs using the minimum and maximum values provided by the user.This method is also a PyQt slot.
Parameters: - enabled : bool
whether the custom scaling is enabled or not
-
_zscale_to_ifus
(zmin, zmax)[source]¶ Loop over all the IFUs setting
ifu.zmin_global
andifu.zmax_global
to the input values.Parameters: - zmin, zmax : float or None
values to set
-
update_finished
(stopped)[source]¶ If the update of the IFUs finished without being stopped, collect all the zmin/zmax from the IFUs and save it for the global scaling. If none of the IFUs has such values disable the global scaling button.
This method is also a pyqt Slot.
Override this method in derived classes to act upon the
UpdateIFUTask.finished
signalParameters: - stopped : bool
True
if the updated has been forcefully stopped,False
if it finished.
-
class
vdat.gui.tabs.tab_widget.
QuickReconFplanePanel
(tab_type, parent=None)[source]¶ Bases:
vdat.gui.tabs.tab_widget.FitsFplanePanel
Do a quick reconstruction with the input files
Unless documented below, the class inherits signals, slots and connection, as well as attributes from
FitsFplanePanel
.Parameters: - all :
see
BaseFplanePanel
Attributes: - enabled : bool
if the reconstruction object exists, is set to True, else to False
-
ifu_widget_class
¶ Return the name of the class to use to represent IFUs in the focal plane.
Returns: - :class:`.ifu_widget.IFUQuickReconWidget`
-
setup
(target_dir, tab_dict, format_dict)[source]¶ Informations to pass to the tab and to the IFUs.
See
FitsFplanePanel.setup()
for the keys oftab_dict
used here.Parameters: - target_dir : string
directory selected by the user
- tab_dict : dictionary
dictionary with the specifications to use to build the tabs
- format_dict : string
dictionary with the fields and values that can be replaced in file names
-
cleanup
()[source]¶ On top of what
FitsFplanePanel.cleanup()
does, resetenabled
to True
-
class
vdat.gui.tabs.tab_widget.
FitsAndReconFplanePanel
(tab_type, parent=None)[source]¶ Bases:
vdat.gui.tabs.interface.FplaneTabTemplate
This class provides a tab grouping a
FitsFplanePanel
and aQuickReconFplanePanel
and providing a button to switch between them.Unless documented below, the class inherits signals, slots and connection from
interface.FplaneTabTemplate
.¶ Name Signature Description next_widget()
go to the next widget ¶ Signal Slot “Reconstructed” checkbox added in the lower right corner of the widgets next_widget()
Parameters: - all :
Attributes: - others
-
_make_widget
(Widget, tab_type, is_checked)[source]¶ Create a
Widget
instance, connect thesig_ifuToggled
, add a check box with “Reconstructed” as text and connect it to anext_widget()
.Parameters: - Widget : class derived from
BaseFplanePanel
the widget to create
- tab_type : string
name of the tab
- is_checked : bool
whether the checkbox needs to be always checked or not
Returns: - w : instance of Widget
- button :
PyQt5.QtWidgets.QPushButton
button added to the Widget
- Widget : class derived from
-
setup
(target_dir, tab_dict, format_dict)[source]¶ Informations to pass to the stacked widgets and to the IFUs.
Make sure that the
FitsFplanePanel
is always shown first. If the reconstruction object does not exist, disable the checkbox to switch to the reconstructed widget. The title and tool tip, if present, are taken from the first widget.Parameters: - target_dir : string
directory selected by the user
- tab_dict : dictionary
dictionary with the specifications to use to build the tabs
- format_dict : string
dictionary with the fields and values that can be replaced in file names
-
ifuSelected
(ifuslot, val)[source]¶ Select or deselect an IFU. This method is also a PyQt slot.
Call the corresponding method in the stacked widgets.
Parameters: - ifuslot : string
SLOTID of the selected IFU
- val : bool
If
True
selected, otherwise deselected
-
class
vdat.gui.tabs.tab_widget.
CubeFplanePanel
(tab_type, parent=None)[source]¶ Bases:
vdat.gui.tabs.tab_widget.FitsFplanePanel
Class that shows data cube fits files in the focal plane.
Unless documented below, the class inherits signals, slots and connection from
FitsFplanePanel
.Parameters: - all :
see
FitsFplanePanel
Attributes: - all :
see
FitsFplanePanel
-
ifu_widget_class
¶ Return the name of the class to use to represent IFUs in the focal plane.
Returns: - :class:`.ifu_widget.IFUCubeWidget`
-
class
vdat.gui.tabs.tab_widget.
MultiExtFplanePanel
(tab_type, parent=None)[source]¶ Bases:
vdat.gui.tabs.tab_widget.FitsFplanePanel
Class that shows one desired extension from fits files in the focal plane.
Unless documented below, the class inherits signals, slots and connection from
FitsFplanePanel
.Parameters: - all :
see
FitsFplanePanel
Attributes: - all :
see
FitsFplanePanel
-
ifu_widget_class
¶ Return the name of the class to use to represent IFUs in the focal plane.
Returns: - :class:`.ifu_widget.IFUMultiExtWidget`
-
class
vdat.gui.tabs.tab_widget.
StaticCheckBox
(text, is_checked, parent=None)[source]¶ Bases:
PyQt5.QtWidgets.QCheckBox
A checkbox always checked or un-checked
¶ Name Signature Description stay_checked()
Keep the “checked” state of the button always the same ¶ Signal Slot clicked
stay_checked()
Parameters: - text : string
text showing in the button
- is_checked : bool
whether the checkbox must stay checked or not
- parent :
QWidget
or derived instance, optional the parent of the current widget
-
class
vdat.gui.tabs.tab_widget.
TextFilesPanel
(tab_type, parent=None)[source]¶ Bases:
vdat.gui.tabs.tab_widget.BaseFplanePanelSetup
Tab to show the content of a text file.
The IFU in the focal plane shows the number of lines in the file. A double click on the widget brings up a window with the content of the file
Unless documented below, the class inherits signals, slots and connection from
BaseFplanePanel
.Parameters: - all :
-
ifu_widget_class
¶ Return the class to use to represent IFUs in the focal plane.
Returns: - :class:`.ifu_widget.TextFileWidget`
-
class
vdat.gui.tabs.tab_widget.
DistPanel
(tab_type, parent=None)[source]¶ Bases:
vdat.gui.tabs.tab_widget.BaseFplanePanelSetup
Show the number of lines in the distortion file in the IFUs. A double click on the widget brings up a window with the content of the file. From the window, it is possible to send a region file computed from the distortion to the
ds9
.Unless documented below, the class inherits signals, slots and connection from
BaseFplanePanel
.Parameters: - all :
-
ifu_widget_class
¶ Return the class to use to represent IFUs in the focal plane.
Returns: - :class:`.ifu_widget.BaseIFUWidget`