crikit.ui package¶
Subpackages¶
Submodules¶
crikit.ui.classes_ui module¶
User Interface and Visualization Classes (crikit.ui.classes_ui)¶
BW : Grayscale images
SingleColor : Single-color images
_ColorMath : Container of math operations
- class crikit.ui.classes_ui.BW(**kwargs)[source]¶
Bases:
object
- property grayscaleimage¶
- property image¶
For image from property settings (limits, compression, etc)
- property maxer¶
- property mean¶
- property minner¶
- property std¶
- property winextent¶
- property x¶
- property xlen¶
- property y¶
- property ylen¶
- class crikit.ui.classes_ui.CompositeColor(sgl_color_list=None)[source]¶
Bases:
crikit.ui.classes_ui.BW
- property image¶
For image from property settings (limits, compression, etc)
- property mode_txt¶
- property xlen¶
- property ylen¶
- class crikit.ui.classes_ui.SingleColor[source]¶
Bases:
crikit.ui.classes_ui.BW
,crikit.ui.classes_ui._ColorMath
- property image¶
For image from property settings (limits, compression, etc)
- property imageGS¶
Returns self.grayscaleimage with limits applied
crikit.ui.dialog_AbstractFactorization module¶
Abstract Factorization Class
Created on Mon Jul 25 10:44:03 2016
@author: chc
- class crikit.ui.dialog_AbstractFactorization.DialogAbstractFactorization(parent=None)[source]¶
Bases:
PyQt5.QtWidgets.QDialog
SubUiSVD : SVD SubUI
- property unselected_factors¶
crikit.ui.dialog_AbstractPlotEffect module¶
Created on Thu Dec 22 10:04:39 2016
@author: chc
- class crikit.ui.dialog_AbstractPlotEffect.AbstractPlotEffectPlugin[source]¶
Bases:
PyQt5.QtWidgets.QWidget
- changed¶
- labels_affected = {'title': 'Affected', 'x_label': 'x', 'y_label': 'y'}¶
- labels_orig = {'title': 'Original', 'x_label': 'x', 'y_label': 'y'}¶
- parameters = {'long_name': 'Longer Name', 'name': 'Name'}¶
crikit.ui.dialog_AnscombeParams module¶
Calculate Anscombe Parameters
- class crikit.ui.dialog_AnscombeParams.DialogCalcAnscombeParams(parent=None, dark_array=None, rep_array=None, axis=None, rng=None, dark_sub=None)[source]¶
Bases:
PyQt5.QtWidgets.QDialog
References
crikit.ui.dialog_SVD module¶
Created on Mon Jul 25 13:57:24 2016
@author: chc
- class crikit.ui.dialog_SVD.DialogSVD(data, img_shape, mask=None, use_imag=True, img_all=None, spect_all=None, parent=None)[source]¶
Bases:
crikit.ui.dialog_AbstractFactorization.DialogAbstractFactorization
SVD Class
- static dialogSVD(data, img_shape, mask=None, use_imag=True, img_all=None, spect_all=None, parent=None)[source]¶
crikit.ui.dialog_kkOptions module¶
Kramers-Kronig phase retrieval
References
[1] C H Camp Jr, Y J Lee, and M T Cicerone, “Quantitative, Comparable Coherent Anti-Stokes Raman Scattering (CARS) Spectroscopy: Correcting Errors in Phase Retrieval,” Journal of Raman Spectroscopy (2016). arXiv:1507.06543.
- class crikit.ui.dialog_kkOptions.DialogKKOptions(parent=None, data=None, conjugate=False)[source]¶
Bases:
PyQt5.QtWidgets.QDialog
DialogKKOptions : Phase-Retrieval (only Kramers-Kronig currently supported) options dialog
- dialogKKOptions : Used to call UI and retrieve results of dialog
References
[1] Y. Liu, Y. J. Lee, and M. T. Cicerone, “Broadband CARS spectral phase retrieval using a time-domain Kramers-Kronig transform,” Opt. Lett. 34, 1363-1365 (2009).
[2] C H Camp Jr, Y J Lee, and M T Cicerone, “Quantitative, Comparable Coherent Anti-Stokes Raman Scattering (CARS) Spectroscopy: Correcting Errors in Phase Retrieval,” Journal of Raman Spectroscopy (2016). arXiv:1507.06543.
- CARS_AMP = 0.0¶
- NORM_TO_NRB = True¶
- NRB_AMP = 0.0¶
- N_EDGE = 30¶
- PAD_FACTOR = 1¶
- PHASE_OFFSET = 0.0¶
- static dialogKKOptions(parent=None, data=None, conjugate=False)[source]¶
Retrieve dark subtraction dialog results
- Parameters
None (None) –
- Returns
- out – ‘phase_offset’float, ‘norm_to_nrb’bool,
’pad_factor’ : int}
- In order: CARS amp offset, NRB amp offset, phase offset, normalize
by NRB, pad factor
- Return type
dict{‘cars_amp’ : float, ‘nrb_amp’ : float,
crikit.ui.dialog_model module¶
Dialog for creating BCARS or Raman numerical phantom
crikit.ui.dialog_ploteffect module¶
Extensible Dialog that shows the effect of a plugin on input data.
Created on Wed Dec 21 21:36:00 2016
@author: chc
- class crikit.ui.dialog_ploteffect.DialogPlotEffect(data, x=None, plugin=None, mpl_kwargs={'height': 2, 'width': 8}, parent=None)[source]¶
Bases:
PyQt5.QtWidgets.QDialog
Extensible Dialog that shows the effect of a plugin on input data.
- Parameters
data (ndarray (ND)) – Input data
x (ndarray (1D)) – Independent variable
plugin (sub-class of AbstractPlotEffectPlugin) – Plugin class instance
parent (QObject) – Parent
- TRANSPOSE_ARR = True¶
- class crikit.ui.dialog_ploteffect.widgetDemoPlotEffectPlugin(offset=0.1, parent=None)[source]¶
Bases:
crikit.ui.dialog_AbstractPlotEffect.AbstractPlotEffectPlugin
Very simple demo of a plugin
- labels_affected = {'title': 'Affected', 'x_label': 'Wavenumber (cm$^{-1}$)', 'y_label': 'Output Int (au)'}¶
- labels_orig = {'title': 'Original', 'x_label': 'Wavenumber (cm$^{-1}$)', 'y_label': 'Input Int (au)'}¶
- parameters = {'long_name': 'Demo of PlotEffectPlugins', 'name': 'DEMO'}¶
crikit.ui.dialog_save module¶
CRIkit Save Dialog (crikit.ui.dialog_save)¶
Classes that present dialog boxes that retrieve options
DialogSave : Save Dialog
- class crikit.ui.dialog_save.DialogSave(current_filename=None, current_path=None, current_dataset_name=None, save_filename=None, save_path=None, save_dataset_name=None, suffix=None, parent=None)[source]¶
Bases:
PyQt5.QtWidgets.QDialog
DialogDarkOptions : Dark subtraction options dialog
- dialogSave : Used to call UI and retrieve results of dialog
- static dialogSave(current_filename=None, current_path=None, current_dataset_name=None, save_filename=None, save_path=None, save_dataset_name=None, suffix=None, parent=None)[source]¶
Retrieve save dialog results
- Parameters
current_filename (str) – Filename of HDF5 file from where current data resided
current_path (str) – Path to HDF5 file from where current data resided
current_dataset_name (str) – Dataset path and name where current data resided
save_filename (str) – Filename of HDF5 file where previously saved (if so)
save_path (str) – Path of HDF5 file where previously saved (if so)
save_dataset_name (str) – Dataset path and name where previously saved (if so)
suffix (str) – Suffix to append to _dataset_name based on processing steps
NOTE (save* parameters supercede current* parameters) –
- Returns
out – Filename : str Path : str Dataset_name_path : str
- Return type
(tuple)
crikit.ui.dialog_subResidualOptions module¶
References
[1] C H Camp Jr, Y J Lee, and M T Cicerone, “Quantitative, Comparable Coherent Anti-Stokes Raman Scattering (CARS) Spectroscopy: Correcting Errors in Phase Retrieval,” Journal of Raman Spectroscopy (2016). arXiv:1507.06543.
crikit.ui.dialog_varstabAnscombeOptions module¶
Created on Sat Jul 23 21:38:08 2016
@author: chc
- class crikit.ui.dialog_varstabAnscombeOptions.DialogAnscombeOptions(stddev=12.44, gain=1.4, parent=None)[source]¶
Bases:
PyQt5.QtWidgets.QDialog
DialogAnscombeOptions : Anscombe Transformation options dialog
- dialogAnscombeOptions : Used to call UI and retrieve results of dialog
References
[1] C H Camp Jr, Y J Lee, and M T Cicerone, “Quantitative, Comparable Coherent Anti-Stokes Raman Scattering (CARS) Spectroscopy: Correcting Errors in Phase Retrieval,” Journal of Raman Spectroscopy (2016). arXiv:1507.06543.
crikit.ui.helper_plotOptions module¶
Created on Sun Oct 4 00:28:16 2015
@author: camp
- class crikit.ui.helper_plotOptions.plotStyle(num_current_plots=0)[source]¶
Bases:
object
- COLOR_DICT = {'Blue': [0, 0, 1], 'Cyan': [0, 0.8, 0.8], 'Green': [0, 0.5, 0], 'Magenta': [1, 0, 1], 'Red': [1, 0, 0], 'Yellow': [0.8, 0.8, 0]}¶
- COLOR_VEC = ['Blue', 'Green', 'Red', 'Magenta', 'Yellow', 'Cyan']¶
- LINESTYLE_VEC = ['-', '--', '-.', ':', 'None']¶
- LINESTYLE_VEC_STR = ['Solid', 'Dashed', 'Dash-Dot', 'Dotted', 'None']¶
- LINEWIDTH = 1.0¶
- MARKERSIZE = 5.0¶
- MARKER_VEC = ['None', '.', ',', 'o', 'v', '^', '<', '>', '8', 's', 'p', '*', 'h', 'H', '+', 'x', 'D', 'd', '|', '_']¶
- MARKER_VEC_STR = ['None', 'Point', 'Pixel', 'Circle', 'Triangle Down', 'Triangle Up', 'Triangle Left', 'Triangle Right', 'Octagon', 'Square', 'Pentagon', 'Star', 'Hexagon 1', 'Hexagon 2', 'Plus', 'X', 'Diamond', 'Thin Diamondd', 'Vert Line', 'Horiz Line']¶
- property linestyle_str¶
- property marker_str¶
- property qcolor¶
crikit.ui.helper_roiselect module¶
crikit.ui.main_Mosaic module¶
MainWindow program that allows construction of stitched images from multiple dataset
- class crikit.ui.main_Mosaic.DnDReorderListWidget(parent)[source]¶
Bases:
PyQt5.QtWidgets.QListWidget
List widget with drag-n-drop reordering
- reordered¶
crikit.ui.widget_ALS module¶
Widget for PlotEffect that adjusts the parameters appropriate for asymmetric least squares (ALS)
Created on Thu Dec 22 01:16:01 2016
@author: chc
- class crikit.ui.widget_ALS.widgetALS(x=None, wavenumber_increasing=True, rng=None, smoothness_param=1, asym_param=0.001, redux=10, order=2, fix_end_points=True, fix_const=1, fix_rng=None, max_iter=100, min_diff=1e-06, verbose=False, sub_asym_list=None, sub_w_list=None, parent=None)[source]¶
Bases:
crikit.ui.dialog_AbstractPlotEffect.AbstractPlotEffectPlugin
Widget for PlotEffect that adjusts the parameters appropriate for asymmetric least squares (ALS)
- Parameters
wavenumber_increasing (bool, optional (default, True)) – If wavenumber is increasing left-to-right. Opposite value as the KK conjugate value
smoothness_param (float, optional (default, 1e3)) – Smoothness parameter
asym_param (float, optional (default, 1e-4)) – Assymetry parameter
redux (int, optional (default, 1)) – Reduction parameter to sub-sample input signal
order (int, optional (default, 2)) – Derivative regularization term. Order=2 for Whittaker-smoother
fix_end_points (bool, optional (default, False)) – Weight the baseline endpoints to approach equally the end-points of the data.
max_iter (int, optional (default, 100)) – Maximum number of least-squares iterations to perform
min_diff (float, optional (default, 1e-5)) – Break iterative calculations if difference is less than min_diff
parent (QObject) – Parent
- fcn : Perform ALS detrending
- Signals:
changed : a value in the UI has changed
- labels_affected = {'title': 'Detrended', 'x_label': 'Wavenumber (cm$^{-1}$)', 'y_label': 'Output Int (au)'}¶
- labels_orig = {'title': 'Original', 'x_label': 'Wavenumber (cm$^{-1}$)', 'y_label': 'Input Int (au)'}¶
- parameters = {'long_name': 'Asymmetric least squares', 'name': 'ALS'}¶
- property x¶
crikit.ui.widget_ArPLS module¶
Widget for PlotEffect that adjusts the parameters appropriate for asymmetrically reweights penalized least squares (arPLS)
Created on Thu Dec 22 01:16:01 2016
@author: chc
- class crikit.ui.widget_ArPLS.widgetArPLS(smoothness_param=1, redux=1, fix_end_points=True, max_iter=100, min_diff=1e-06, parent=None)[source]¶
Bases:
crikit.ui.dialog_AbstractPlotEffect.AbstractPlotEffectPlugin
Widget for PlotEffect that adjusts the parameters appropriate for asymmetrically reweights penalized least squares (arPLS)
- Parameters
smoothness_param (float, optional (default, 1e3)) – Smoothness parameter
redux (int, optional (default, 1)) – Reduction parameter to sub-sample input signal
order (int, optional (default, 2)) – Derivative regularization term. Order=2 for Whittaker-smoother
fix_end_points (bool, optional (default, False)) – Weight the baseline endpoints to approach equally the end-points of the data.
max_iter (int, optional (default, 100)) – Maximum number of least-squares iterations to perform
min_diff (float, optional (default, 1e-5)) – Break iterative calculations if difference is less than min_diff
parent (QObject) – Parent
- fcn : Perform arPLS detrending
- Signals:
changed : a value in the UI has changed
- labels_affected = {'title': 'Detrended', 'x_label': 'Wavenumber (cm$^{-1}$)', 'y_label': 'Output Int (au)'}¶
- labels_orig = {'title': 'Original', 'x_label': 'Wavenumber (cm$^{-1}$)', 'y_label': 'Input Int (au)'}¶
- parameters = {'long_name': 'Asymmetrically reweighted penalized least squares', 'name': 'arPLS'}¶
crikit.ui.widget_Calibrate module¶
Widget for PlotEffect that adjusts the parameters appropriate for calibration
Created on Thu Dec 22 14:27:46 2016
@author: chc
- class crikit.ui.widget_Calibrate.widgetCalibrate(calib_dict, parent=None)[source]¶
Bases:
crikit.ui.dialog_AbstractPlotEffect.AbstractPlotEffectPlugin
Widget for PlotEffect that adjusts the parameters appropriate for calibration
- Parameters
calib_dict (dict) – Calibration dictionary
- fcn : Perform arPLS detrending
- Signals:
changed : a value in the UI has changed
- fcn(data_in)[source]¶
Returns a shifted version of the input spectrum to mimic the effect of calibration. (Real calibration doesn’t shift the spectrum, but rather the independent variable)
- labels_affected = {'title': 'Calibrated', 'x_label': 'Wavenumber (cm$^{-1}$)', 'y_label': 'Output Int (au)'}¶
- labels_orig = {'title': 'Uncalibrated', 'x_label': 'Wavenumber (cm$^{-1}$)', 'y_label': 'Input Int (au)'}¶
- parameters = {'long_name': 'Spectral Calibration', 'name': 'Calibrate'}¶
crikit.ui.widget_Cut_every_n_spectra module¶
Widget for PlotEffect that sets the parameters to cut M spectra of every N spectra
- class crikit.ui.widget_Cut_every_n_spectra.widgetCutEveryNSpectra(offset=0, cut_m=1, every_n=100, action='cut', parent=None)[source]¶
Bases:
crikit.ui.dialog_AbstractPlotEffect.AbstractPlotEffectPlugin
Widget for PlotEffect that adjusts the parameters appropriate for the Cutting Every N Spectra.
- cars_amp_offset¶
DC offset applied to CARS spectrum(a) prior to KK relation.
- Type
float, optional (default=0.0)
- nrb_amp_offset¶
DC offset applied to NRB spectrum(a) prior to KK relation.
- Type
float, optional (default=0.0)
- phase_offset¶
Phase constant or ndarray applied to retrieved phase prior to separating the real and imaginary components.
- Type
float or ndarray, optional (default=0.0)
- norm_to_nrb¶
Normalize the amplitude by sqrt(NRB). This effectively removes several system reponse functions.
- Type
bool, optional (default=True)
- pad_factor¶
Multiple size of spectral-length to pad the ends of each spectra with. Padded with a constant value corresponding to the value at that end of the spectrum.
- Type
int, optional (default=1)
- fcn : Performs the KK
- Signals:
changed : a value in the UI has changed
- labels_affected = {'title': 'Cropped Spectra', 'x_label': 'Repetition Number', 'y_label': 'Intensity (au)'}¶
- labels_orig = {'title': 'Original', 'x_label': 'Repetition Number', 'y_label': 'Intensity (au)'}¶
- parameters = {'long_name': 'Cut M Spectra Every N Spectra', 'name': 'CutEveryNSpectra'}¶
crikit.ui.widget_DeTrending module¶
Widget for PlotEffect that contains and presents different detrending algorithms. Whichever algorithm is plugged in effectively acts as the widget as far as PlotEffect is concerned.
Created on Wed Dec 7 13:36:48 2016
@author: chc
- class crikit.ui.widget_DeTrending.widgetDeTrending(parent=None)[source]¶
Bases:
crikit.ui.dialog_AbstractPlotEffect.AbstractPlotEffectPlugin
Widget for PlotEffect that contains and presents different detrending algorithms. Whichever algorithm is plugged in effectively acts as the widget as far as PlotEffect is concerned.
crikit.ui.widget_Jupyter module¶
Created on Wed Mar 2 17:12:54 2016
@author: chc
crikit.ui.widget_KK module¶
Widget for PlotEffect that adjusts the parameters appropriate for the Kramers-Kronig relation
Created on Thu Dec 22 11:43:42 2016
@author: chc
- class crikit.ui.widget_KK.widgetKK(cars_amp_offset=0.0, nrb_amp_offset=0.0, conjugate=False, phase_offset=0.0, norm_to_nrb=True, pad_factor=1, n_edge=30, parent=None)[source]¶
Bases:
crikit.ui.dialog_AbstractPlotEffect.AbstractPlotEffectPlugin
Widget for PlotEffect that adjusts the parameters appropriate for the Kramers-Kronig (KK) relation phase retrieval.
- cars_amp_offset¶
DC offset applied to CARS spectrum(a) prior to KK relation.
- Type
float, optional (default=0.0)
- nrb_amp_offset¶
DC offset applied to NRB spectrum(a) prior to KK relation.
- Type
float, optional (default=0.0)
- phase_offset¶
Phase constant or ndarray applied to retrieved phase prior to separating the real and imaginary components.
- Type
float or ndarray, optional (default=0.0)
- norm_to_nrb¶
Normalize the amplitude by sqrt(NRB). This effectively removes several system reponse functions.
- Type
bool, optional (default=True)
- pad_factor¶
Multiple size of spectral-length to pad the ends of each spectra with. Padded with a constant value corresponding to the value at that end of the spectrum.
- Type
int, optional (default=1)
- fcn : Performs the KK
- Signals:
changed : a value in the UI has changed
- labels_affected = {'title': 'KK-Raman', 'x_label': 'Wavenumber (cm$^{-1}$)', 'y_label': 'Raman-Like Int (au)'}¶
- labels_orig = {'title': 'Original', 'x_label': 'Wavenumber (cm$^{-1}$)', 'y_label': 'Input Int (au)'}¶
- parameters = {'long_name': 'Kramers-Kronig Relation', 'name': 'KK'}¶
crikit.ui.widget_SG module¶
Widget for PlotEffect that adjusts the parameters appropriate for Savitky-Golay filtering
Created on Thu Dec 22 11:18:36 2016
@author: chc
- class crikit.ui.widget_SG.widgetSG(window_length=601, polyorder=2, parent=None)[source]¶
Bases:
crikit.ui.dialog_AbstractPlotEffect.AbstractPlotEffectPlugin
Widget for PlotEffect that adjusts the parameters appropriate for Savitky-Golay filtering
- Parameters
- fcn : Performs the Savitky-Golay
- Signals:
changed : a value in the UI has changed
- labels_affected = {'title': 'Difference', 'x_label': 'Wavenumber (cm$^{-1}$)', 'y_label': 'Difference (au)'}¶
- labels_orig = {'title': 'Original', 'x_label': 'Wavenumber (cm$^{-1}$)', 'y_label': 'Input Int (au)'}¶
- parameters = {'long_name': 'Savitky-Golay filtering', 'name': 'SG'}¶
crikit.ui.widget_images module¶
Visualization Widgets (crikit.ui.widget_images)¶
widgetColorMath : Mathematical operations on raw data leading to color images
widgetBWImg : Grayscale imagery
widgetSglColor : Single-color imagery
widgetCompositeColor : Composite-color imagery
_mplWin : Matplotlib window container
- class crikit.ui.widget_images.widgetBWImg(parent=None, **kwargs)[source]¶
Bases:
PyQt5.QtWidgets.QWidget
Grayscale image widget
- createImg(img, xunits=None, yunits=None, extent=None, cmap=<matplotlib.colors.LinearSegmentedColormap object>)[source]¶
- class crikit.ui.widget_images.widgetColorMode(parent=None, **kwargs)[source]¶
Bases:
PyQt5.QtWidgets.QWidget
Color mode selector
- class crikit.ui.widget_images.widgetCompositeColor(sgl_color_widget_list=None, parent=None, **kwargs)[source]¶
Bases:
PyQt5.QtWidgets.QWidget
- createImg(img, xunits=None, yunits=None, extent=None, cmap=<matplotlib.colors.LinearSegmentedColormap object>)[source]¶
- class crikit.ui.widget_images.widgetGrayScaleInfoBar(parent=None, **kwargs)[source]¶
Bases:
PyQt5.QtWidgets.QWidget
Grayscale image info bar
- class crikit.ui.widget_images.widgetImageGainMath(parent=None, **kwargs)[source]¶
Bases:
PyQt5.QtWidgets.QWidget
Panel that controle image gain and applies math
- COND_TYPE_STRINGS = ['>', '<', '=', '<=', '>=']¶
- OPERATION_FREQ_COUNT = [1, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2]¶
- OPERATION_STRINGS = ['', '+', '-', '*', '/', 'Peak b/w troughs', 'SUM', 'SUM(ABS(Re) + 1j*ABS(Im))', 'Max', 'Min', 'MaxAbs', 'MinAbs']¶
crikit.ui.widget_mergeNRBs module¶
Widget for PlotEffect that adjusts the parameters appropriate for merging 2 NRBs
Created on Thu Dec 22 22:20:06 2016
@author: chc
- class crikit.ui.widget_mergeNRBs.widgetMergeNRBs(wn_vec, nrb_left, nrb_right, scale_left=False, wn_switchpt=2800.0, parent=None)[source]¶
Bases:
crikit.ui.dialog_AbstractPlotEffect.AbstractPlotEffectPlugin
Widget for PlotEffect that adjusts the parameters appropriate for merging 2 NRBs
- property fullRange¶
- labels_affected = {'title': 'KK-Raman', 'x_label': 'Wavenumber (cm$^{-1}$)', 'y_label': 'Raman-Like Int (au)'}¶
- labels_orig = {'title': 'Original', 'x_label': 'Wavenumber (cm$^{-1}$)', 'y_label': 'Input Int (au)'}¶
- parameters = {'long_name': 'Merge 2 NRBs', 'name': 'mergeNRBs'}¶
crikit.ui.widget_scientificspin module¶
From https://gist.github.com/jdreaver – scientificspin.py
Created on Wed Dec 7 10:39:26 2016
@author: chc
- class crikit.ui.widget_scientificspin.ScientificDoubleSpinBox(*args, **kwargs)[source]¶
Bases:
PyQt5.QtWidgets.QDoubleSpinBox