crikit.ui package — CRIKit2 0.4.3 documentation

# crikit.ui package

## Subpackages

- crikit.ui.utils package
  - Submodules
  - crikit.ui.utils.check_requirements module
  - crikit.ui.utils.roi module
    - Visualization General Utilities (crikit.ui.visgentuils)
  - Module contents
    - CRI Spectral Processing Tools (CRIkit)

## 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)

  Bases: `object`

  property grayscaleimage
  property image

    For image from property settings (limits, compression, etc)

  property maxer
  property mean
  property minner
  set_x(value, units=None)
  set_y(value, units=None)
  property std
  property winextent
  property x
  property xlen
  property y
  property ylen

class crikit.ui.classes_ui.CompositeColor(sgl_color_list=None)

  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

  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)

  Bases: `PyQt5.QtWidgets.QDialog`

  SubUiSVD : SVD SubUI

  advance()

    View next set of SVs

  applyCheckBoxes()

    Add checked singular values (and remove un-checked SVs)

  clear()

    Clear selected singular values (i.e., none will be selected)

  combiner(factors=None)
  get_spatial_slice(num)
  get_spectral_slice(num)
  max_factors()
  mean_spatial(cube)
  mean_spectral(cube)
  runScript()

    Run “script” of singular value selection

    Example

    [1,2,3,5:7] = 1,2,3,5,6,7

  setup(parent=None)
  setupData(img_shape)
  ui_changes()

    Any changes to ui labels or otherwise for particular implementation

  property unselected_factors
  updateCurrentRemainder()

    Update image reconstructed (mean over spectral vector) using remaining (unselected) singular values

  updatePlots(startnum=0)

    Update images and spectra of set of singular values starting at SV number startnum

## crikit.ui.dialog_AbstractPlotEffect module

Created on Thu Dec 22 10:04:39 2016

@author: chc

class crikit.ui.dialog_AbstractPlotEffect.AbstractPlotEffectPlugin

  Bases: `PyQt5.QtWidgets.QWidget`

  changed
  fcn(data_in)
  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)

  Bases: `PyQt5.QtWidgets.QDialog`

  References

  static dialogCalcAnscombeParams(parent=None, dark_array=None, rep_array=None, axis=None, rng=None, dark_sub=None)

    Calculate Anscombe Parameters

    Parameters

      None (None) –

  updateInputValues()
  updateOutputValues()

## 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)

  Bases: `crikit.ui.dialog_AbstractFactorization.DialogAbstractFactorization`

  SVD Class

  combiner(selections=None)

    Performs U*S*Vh

  static dialogSVD(data, img_shape, mask=None, use_imag=True, img_all=None, spect_all=None, parent=None)
  get_spatial_slice(num)
  get_spectral_slice(num)
  max_factors()

    Return maximum number of factors. Since DialogAbstractFactorization (parent) is initialized first (before self.s), need to return None at first.

  mean_spatial(cube)
  mean_spectral(cube)
  s_from_selected(selections=None)

    Return SVD S-matrix of SELECTED singular values

## 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)

  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)

    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,

  goInteractive()

## crikit.ui.dialog_model module

Dialog for creating BCARS or Raman numerical phantom

class crikit.ui.dialog_model.DialogModel(cplx=True, parent=None)

  Bases: `PyQt5.QtWidgets.QDialog`

  Dialog for creating BCARS or Raman numerical phantom

  changeSize()
  static dialogModel(cplx=True, parent=None)

## 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)

  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
  static dialogPlotEffect(data, x=None, plugin=None, parent=None)

    Static method that is actually called

  make_affected_plots(data, lw=1, ls='-')
  make_orig_plots(data, lw=1, ls='-')
  make_plots(canvas, data, lw=1, ls='-')
  plot_labels()

    Add axis labels and titles

  widget_changed()

    Plugin widget has changed. Re-submit data to plugin function.

class crikit.ui.dialog_ploteffect.widgetDemoPlotEffectPlugin(offset=0.1, parent=None)

  Bases: `crikit.ui.dialog_AbstractPlotEffect.AbstractPlotEffectPlugin`

  Very simple demo of a plugin

  fcn(data_in)

    If return list, [0] goes to original, [1] goes to affected

  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)

  Bases: `PyQt5.QtWidgets.QDialog`

  DialogDarkOptions : Dark subtraction options dialog

  dialogSave : Used to call UI and retrieve results of dialog
  changeDataset()
  changeFilename()
  changePath()
  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)

    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)

  generateDatasetName()
  generateFilename()
  getFilename()
  getPath()

## 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.

class crikit.ui.dialog_subResidualOptions.DialogSubResidualOptions(parent=None)

  Bases: `PyQt5.QtWidgets.QDialog`

  RESIDUAL_FREQ = [-1500, -400]
  static dialogSubResidualOptions(parent=None, imgloaded=False, nrbloaded=False)

    Retrieve dark subtraction dialog results

    Parameters

      - imgloaded ((bool)) – Is there an HSI image loaded?

      - nrbloaded ((bool)) – Is there an NRB loaded?

    Returns

      out – In order: subtract residual from image, subtract residual from NRB, range to subtract from.

    Return type

      dict{‘submain’ : bool, ‘subnrb’ : bool, ‘subrange’ : list}

## 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)

  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.

  static dialogAnscombeOptions(stddev=12.44, gain=1.4, parent=None)

    Retrieve Anscombe Transform dialog results

    Parameters

      None (None) –

    Returns

      out – Standard deviation of Gaussian noise : (float) Detector gain of Poisson noise : (float)

    Return type

      dict{‘gain’ : float, ‘stddev’ : float}

## 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)

  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']
  getLineStyle(num_current_plots=0)
  property linestyle_str
  property marker_str
  property qcolor

## crikit.ui.helper_roiselect module

class crikit.ui.helper_roiselect.ImageSelection(parent=None)

  Bases: `object`

  append_selection(xpix, ypix, x=None, y=None)
  clear_all()
  property num_selections

## crikit.ui.main_Mosaic module

MainWindow program that allows construction of stitched images from multiple dataset

class crikit.ui.main_Mosaic.DnDReorderListWidget(parent)

  Bases: `PyQt5.QtWidgets.QListWidget`

  List widget with drag-n-drop reordering

  dropEvent(self, QDropEvent)
  reordered

class crikit.ui.main_Mosaic.MainWindowMosaic(parent=None)

  Bases: `PyQt5.QtWidgets.QMainWindow`

  addDataset()
  check_for_spatial_calib(dset)

    See if dataset has spatial calibration meta data

  check_for_spectral_calib(dset)

    See if dataset has spectral calibration meta data

  closeEvent(self, QCloseEvent)
  config = {'allow_duplicates': False}
  deleteDataset()
  frequency_calib = {'Calib_WL': 700.0, 'Center_WL': 700.0, 'Intercept': 832.5510120093941, 'Probe': 771.461, 'Slope': -0.165955456}
  init_internals()

    Initialize internal variables

  is_duplicate_import(to_open)
  lineEditPixChange()

    Frequency manually entered in frequency-slider-display

  list_reordered()
  promote_demote_list_item()
  save()
  setupListWidget()
  updateDatasets()

    Update the listWidget of datasets

  updateFrequency(calib_vec=None)
  updateMosaicImage()
  updateParams()

    Update Mosaic object parameters

  updateSlider()

## 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)

  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

  asym_sub_val_change()

    P Subsections spinbox has changed value

  asymspinboxchanged()

    Asymetry parameter-related values have changed

  fcn(data_in)

    If return list, [0] goes to original, [1] goes to affected

  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'}
  selectFixedEnds()

    Check selection of fixed end-points

  selectWNIncrease()

    Check selection of conjugate

  setup_asym()

    P/asymmetry parameter related

  setup_smoothness()

    Lambda/smoothness parameter rlated

  spinBoxChanged()

    Controller for all spinBoxes

  weight_sub_val_change()

    Weights Subsections spinbox has changed value

  weightspinboxchanged()

    Weight parameter-related values have changed

  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)

  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

  fcn(data_in)

    If return list, [0] goes to original, [1] goes to affected

  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'}
  selectFixedEnds()

    Check selection of fixed end-points

  spinBoxChanged()

    Controller for all spinBoxes

## 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)

  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)

    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)'}
  meas_vs_ideal()
  parameters = {'long_name': 'Spectral Calibration', 'name': 'Calibrate'}
  setup_calib()
  spinBoxChanged()

    Controller for all spinBoxes

## 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)

  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

  comboBoxChanged()

    Action comboBox box changed

  fcn(data_in)

    Return the plot with the appropriate cuts

  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'}
  setupOptions()
  spinBoxChanged()

    Controller for all spinBoxes

## 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)

  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.

  changeWidget(buttonId)

    Change active widget

  widgetOptionsChanged()

    Options within the active widget were changed

## crikit.ui.widget_Jupyter module

Created on Wed Mar 2 17:12:54 2016

@author: chc

class crikit.ui.widget_Jupyter.QJupyterWidget(**kwargs)

  Bases: `qtconsole.rich_jupyter_widget.RichJupyterWidget`

  Convenience class for a live IPython console widget. We can replace the standard banner using the customBanner argument

  clearTerminal()

    Clears the terminal

  executeCommand(command)

    Execute a command in the frame of the console widget

  printText(text)

    Prints some plain text to the console

  pushVariables(variableDict)

    Given a dictionary containing name / value pairs, push those variables to the IPython console widget

## 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)

  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

  changeCheckBoxConjugate()
  changeCheckBoxLockBias()
  changeCheckBoxNRBNorm()
  changeShowReal()
  fcn(data_in)

    If return list, [0] goes to original, [1] goes to affected

  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'}
  setupKK()
  spinBoxChanged()

    Controller for all spinBoxes

## 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)

  Bases: `crikit.ui.dialog_AbstractPlotEffect.AbstractPlotEffectPlugin`

  Widget for PlotEffect that adjusts the parameters appropriate for Savitky-Golay filtering

  Parameters

    - window_length (int) – Window length

    - polyorder (int) – Polynomial order

    - parent (QObject) – Parent

  fcn : Performs the Savitky-Golay
  Signals:

    changed : a value in the UI has changed

  changeOrder()
  changeWinSize()
  fcn(data_in)

    If return list, [0] goes to original, [1] goes to affected

  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)

  Bases: `PyQt5.QtWidgets.QWidget`

  Grayscale image widget

  checkBoxFixed()

    See if the min and max are identified as being fixed by checkbox

  checkBoxRemOutliers()
  comboBoxCompress()

    See if compression is activated via the comboBoxAboveMax

  createImg(img, xunits=None, yunits=None, extent=None, cmap=<matplotlib.colors.LinearSegmentedColormap object>)
  createImg_Ext(img, xunits=None, yunits=None, extent=None, showcbar=True, axison=True, cmap=<matplotlib.colors.LinearSegmentedColormap object>, parent=None)

    Create new figure window and show image of img

  initData()

    (Re)-initialize self.data

  spinBoxMinMaxSet()

class crikit.ui.widget_images.widgetColorMode(parent=None, **kwargs)

  Bases: `PyQt5.QtWidgets.QWidget`

  Color mode selector

class crikit.ui.widget_images.widgetCompositeColor(sgl_color_widget_list=None, parent=None, **kwargs)

  Bases: `PyQt5.QtWidgets.QWidget`

  changeMode()
  createImg(img, xunits=None, yunits=None, extent=None, cmap=<matplotlib.colors.LinearSegmentedColormap object>)
  createImg_Ext(img, xunits=None, yunits=None, extent=None, showcbar=True, axison=True, cmap=<matplotlib.colors.LinearSegmentedColormap object>, parent=None)

    Create new figure window and show image of img

  initData(sgl_color_widget_list)

    (Re)-initialize self.data

class crikit.ui.widget_images.widgetGrayScaleInfoBar(parent=None, **kwargs)

  Bases: `PyQt5.QtWidgets.QWidget`

  Grayscale image info bar

class crikit.ui.widget_images.widgetImageGainMath(parent=None, **kwargs)

  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']
  clear()

    Resets the ui to it’s initial state

  condOpsChange()
  operationchange()

class crikit.ui.widget_images.widgetPopSpectrumGS(parent=None, **kwargs)

  Bases: `PyQt5.QtWidgets.QWidget`

  Panel that let’s user pop the current image, an average spectrum, or a grayscale image to SciPlot

class crikit.ui.widget_images.widgetSglColor(parent=None, **kwargs)

  Bases: `crikit.ui.widget_images.widgetBWImg`

  Single-color widget

  applyGain()
  changeColor()
  disabled()
  gain1()
  initData()

    (Re)-initialize self.data

## 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)

  Bases: `crikit.ui.dialog_AbstractPlotEffect.AbstractPlotEffectPlugin`

  Widget for PlotEffect that adjusts the parameters appropriate for merging 2 NRBs

  fcn(data_in)

    If return list, [0] goes to original, [1] goes to affected

  property fullRange
  kkChanged()
  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'}
  pixChanged()
  rangeChanged()
  scaleChanged()
  wnChanged()

## 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.FloatValidator

  Bases: `PyQt5.QtGui.QValidator`

  fixup(self, str) → str
  validate(self, str, int) → Tuple[QValidator.State, str, int]

class crikit.ui.widget_scientificspin.ScientificDoubleSpinBox(*args, **kwargs)

  Bases: `PyQt5.QtWidgets.QDoubleSpinBox`

  fixup(self, str) → str
  stepBy(self, int)
  textFromValue(self, float) → str
  validate(self, str, int) → Tuple[QValidator.State, str, int]
  valueFromText(self, str) → float

crikit.ui.widget_scientificspin.format_float(value)

  Modified form of the ‘g’ format specifier.

crikit.ui.widget_scientificspin.valid_float_string(string)

## Module contents