vdat.gui.utils – PyQt related utilities¶
Utilities for qt/gui stuff
-
vdat.gui.utils.THUMB_DIR= 'thumbs'¶ Name of the directory containing thumbnails
-
vdat.gui.utils.THUMB_PREFIX= 'thmb_'¶ Prefix of the thumbnail images
-
vdat.gui.utils.RECON_PREFIX= 'rec_'¶ Prefix of the reconstructed images
-
vdat.gui.utils.static_directory()[source]¶ Return the absolute path of the static directory. Construct it from the location of vdat.gui
Returns: - string
name of the directory
-
vdat.gui.utils.help_collection()[source]¶ Return the absolute path of the collection file. If no or more than one files are found return None.
Returns: - string
name of the file
-
vdat.gui.utils.wait_cursor()[source]¶ Context manager that replaces the default cursor with a WaitCursor and then reset it upon exiting
-
class
vdat.gui.utils.FuncQThread(func, *args, **kwargs)[source]¶ Bases:
PyQt5.QtCore.QThreadQThread that accepts a function and its arguments in the constructor and execute it in the
runmethodParameters: - func : callable
function to execute
- args : arguments of the function
- kwargs[‘parent’] :
PyQt5.QtWidgets.QWidgetor derivate parent object of the tree view model
- kwargs : keyword arguments of the function
-
vdat.gui.utils.delete_files(paths, matches)[source]¶ Loop through all the path and the matches and remove all the files matching each match in each path.
Parameters: - paths : list of strings
paths containing the files to remove
- matches : list of string
file names or wildcards pattern for removal
-
vdat.gui.utils.run_wait_func_qthread(func, *args, **kwargs)[source]¶ Start a thread and wait for it to finish. The cursor is set to
wait_cursor()and the thread is marked for deletion before returningParameters: - msecs : int, optional
if given and not
Noneforce the application to process events every ``msecs` milliseconds; otherwise wait until the thread is done- all :
see
FuncQThread
-
vdat.gui.utils.get_reconstructed()[source]¶ Get a
pyhetdex.het.reconstruct_ifu.QuickReconstructedIFUobject. If the reconstruction fails,Nonewill be returned.The object is created the first time the function is called and then cached. Subsequent calls will return always the same object.
Returns: - reconstructed :
pyhetdex.het.reconstruct_ifu.QuickReconstructedIFU a newly created or cached reconstructed object
- reconstructed :
-
vdat.gui.utils.rebin_fits(infile, outfile=None, rebin=20, z_indx=None, ext=0)[source]¶ Create a thumbnail of the fits
infile, save and return it.If it is a datacube, flatten the third axis using a nan-sensitive median before rebinning.
Parameters: - infile : string
name of the fits file to use to create the thumbnail
- outfile : string, optional
if not
Nonesave the thumbnail as a fits file- rebin : integer, optional
reduce the number of bins by
rebin, if smaller or equal to 1, no rebinning happens- z_indx : tuple of two integers, optional
if the input file is a cube, flatten only [z_indx[0], z_indx[1])
- ext : int or string, optional
extension number or name to use
Returns: - data : numpy.ndarray
rebinned data